@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | $this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url(); |
243 | 243 | $this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url(); |
244 | 244 | $this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url(); |
245 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE ); |
|
245 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE); |
|
246 | 246 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax; |
247 | - $this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
247 | + $this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC')); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | * @return array |
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | - foreach ( $this->reg_status_updated as $reg_status ) { |
|
258 | - if ( $reg_status ) { |
|
257 | + foreach ($this->reg_status_updated as $reg_status) { |
|
258 | + if ($reg_status) { |
|
259 | 259 | return true; |
260 | 260 | } |
261 | 261 | } |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | * @param $REG_ID |
269 | 269 | * @return array |
270 | 270 | */ |
271 | - public function reg_status_updated( $REG_ID ) { |
|
272 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
271 | + public function reg_status_updated($REG_ID) { |
|
272 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | * @param $REG_ID |
279 | 279 | * @param $reg_status |
280 | 280 | */ |
281 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
282 | - $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
|
281 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
282 | + $this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * can ONLY be set by the Finalize_Registration reg step |
301 | 301 | */ |
302 | 302 | public function set_exit_spco() { |
303 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
303 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
304 | 304 | $this->exit_spco = true; |
305 | 305 | } |
306 | 306 | } |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function reset_for_current_request() { |
319 | 319 | $this->process_form_submission = FALSE; |
320 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
320 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
321 | 321 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
322 | 322 | $this->continue_reg = true; |
323 | 323 | $this->redirect = false; |
324 | 324 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
325 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
325 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
326 | 326 | $this->redirect_form = ''; |
327 | 327 | } |
328 | 328 | $this->redirect_url = ''; |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_SPCO_Reg_Step $reg_step_obj |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
343 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
342 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
343 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -356,22 +356,22 @@ discard block |
||
356 | 356 | * @param string $reg_step_slug |
357 | 357 | * @return void |
358 | 358 | */ |
359 | - public function skip_reg_step( $reg_step_slug = '' ) { |
|
360 | - $step_to_skip = $this->find_reg_step( $reg_step_slug ); |
|
361 | - if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) { |
|
362 | - $step_to_skip->set_is_current_step( false ); |
|
359 | + public function skip_reg_step($reg_step_slug = '') { |
|
360 | + $step_to_skip = $this->find_reg_step($reg_step_slug); |
|
361 | + if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) { |
|
362 | + $step_to_skip->set_is_current_step(false); |
|
363 | 363 | $step_to_skip->set_completed(); |
364 | 364 | // advance to the next step |
365 | - $this->set_current_step( $this->next_step->slug() ); |
|
365 | + $this->set_current_step($this->next_step->slug()); |
|
366 | 366 | // also reset the step param in the request in case any other code references that directly |
367 | - EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() ); |
|
367 | + EE_Registry::instance()->REQ->set('step', $this->current_step->slug()); |
|
368 | 368 | // since we are skipping a step and setting the current step to be what was previously the next step, |
369 | 369 | // we need to check that the next step is now correct, and not still set to the current step. |
370 | - if ( $this->current_step->slug() == $this->next_step->slug() ) { |
|
370 | + if ($this->current_step->slug() == $this->next_step->slug()) { |
|
371 | 371 | // correctly setup the next step |
372 | 372 | $this->set_next_step(); |
373 | 373 | } |
374 | - $this->set_reg_step_initiated( $this->current_step ); |
|
374 | + $this->set_reg_step_initiated($this->current_step); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * @param bool $reset whether to reset reg steps after removal |
386 | 386 | * @throws EE_Error |
387 | 387 | */ |
388 | - public function remove_reg_step( $reg_step_slug = '', $reset = true ) { |
|
389 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
390 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
388 | + public function remove_reg_step($reg_step_slug = '', $reset = true) { |
|
389 | + unset($this->reg_steps[$reg_step_slug]); |
|
390 | + if ($this->transaction instanceof EE_Transaction) { |
|
391 | 391 | /** @type EE_Transaction_Processor $transaction_processor */ |
392 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
392 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
393 | 393 | // now remove reg step from TXN and save |
394 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
394 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
395 | 395 | $this->transaction->save(); |
396 | 396 | } |
397 | - if ( $reset ) { |
|
397 | + if ($reset) { |
|
398 | 398 | $this->reset_reg_steps(); |
399 | 399 | } |
400 | 400 | } |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | * @param int $order |
410 | 410 | * @return void |
411 | 411 | */ |
412 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
413 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
414 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
412 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
413 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
414 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | |
@@ -424,25 +424,25 @@ discard block |
||
424 | 424 | * @param string $current_step |
425 | 425 | * @return void |
426 | 426 | */ |
427 | - public function set_current_step( $current_step ) { |
|
427 | + public function set_current_step($current_step) { |
|
428 | 428 | // grab what step we're on |
429 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
429 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
430 | 430 | // verify instance |
431 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
431 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
432 | 432 | // we don't want to repeat completed steps if this is the first time through SPCO |
433 | - if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) { |
|
433 | + if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) { |
|
434 | 434 | // so advance to the next step |
435 | 435 | $this->set_next_step(); |
436 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
436 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
437 | 437 | // and attempt to set it as the current step |
438 | - $this->set_current_step( $this->next_step->slug() ); |
|
438 | + $this->set_current_step($this->next_step->slug()); |
|
439 | 439 | } |
440 | 440 | return; |
441 | 441 | } |
442 | - $this->current_step->set_is_current_step( TRUE ); |
|
442 | + $this->current_step->set_is_current_step(TRUE); |
|
443 | 443 | } else { |
444 | 444 | EE_Error::add_error( |
445 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
445 | + __('The current step could not be set.', 'event_espresso'), |
|
446 | 446 | __FILE__, __FUNCTION__, __LINE__ |
447 | 447 | ); |
448 | 448 | } |
@@ -459,20 +459,20 @@ discard block |
||
459 | 459 | */ |
460 | 460 | public function set_next_step() { |
461 | 461 | // set pointer to start of array |
462 | - reset( $this->reg_steps ); |
|
462 | + reset($this->reg_steps); |
|
463 | 463 | // if there is more than one step |
464 | - if ( count( $this->reg_steps ) > 1 ) { |
|
464 | + if (count($this->reg_steps) > 1) { |
|
465 | 465 | // advance to the current step and set pointer |
466 | - while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) { |
|
467 | - next( $this->reg_steps ); |
|
466 | + while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') { |
|
467 | + next($this->reg_steps); |
|
468 | 468 | } |
469 | 469 | } |
470 | 470 | // advance one more spot ( if it exists ) |
471 | - $this->next_step = next( $this->reg_steps ); |
|
471 | + $this->next_step = next($this->reg_steps); |
|
472 | 472 | // verify instance |
473 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
473 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
474 | 474 | // then back to current step to reset |
475 | - prev( $this->reg_steps ); |
|
475 | + prev($this->reg_steps); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | * @return EE_SPCO_Reg_Step | null |
487 | 487 | */ |
488 | 488 | public function get_next_reg_step() { |
489 | - $next = next( $this->reg_steps ); |
|
490 | - prev( $this->reg_steps ); |
|
489 | + $next = next($this->reg_steps); |
|
490 | + prev($this->reg_steps); |
|
491 | 491 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
492 | 492 | } |
493 | 493 | |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | * @return EE_SPCO_Reg_Step | null |
503 | 503 | */ |
504 | 504 | public function get_prev_reg_step() { |
505 | - $prev = prev( $this->reg_steps ); |
|
506 | - next( $this->reg_steps ); |
|
505 | + $prev = prev($this->reg_steps); |
|
506 | + next($this->reg_steps); |
|
507 | 507 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
508 | 508 | } |
509 | 509 | |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | * @return void |
517 | 517 | */ |
518 | 518 | public function sort_reg_steps() { |
519 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
520 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
519 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
520 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -530,19 +530,19 @@ discard block |
||
530 | 530 | * @param string $reg_step_slug |
531 | 531 | * @return EE_SPCO_Reg_Step|null |
532 | 532 | */ |
533 | - public function find_reg_step( $reg_step_slug = '' ) { |
|
534 | - if ( ! empty( $reg_step_slug ) ) { |
|
533 | + public function find_reg_step($reg_step_slug = '') { |
|
534 | + if ( ! empty($reg_step_slug)) { |
|
535 | 535 | // copy reg step array |
536 | 536 | $reg_steps = $this->reg_steps; |
537 | 537 | // set pointer to start of array |
538 | - reset( $reg_steps ); |
|
538 | + reset($reg_steps); |
|
539 | 539 | // if there is more than one step |
540 | - if ( count( $reg_steps ) > 1 ) { |
|
540 | + if (count($reg_steps) > 1) { |
|
541 | 541 | // advance to the current step and set pointer |
542 | - while ( key( $reg_steps ) != $reg_step_slug && key( $reg_steps ) != '' ) { |
|
543 | - next( $reg_steps ); |
|
542 | + while (key($reg_steps) != $reg_step_slug && key($reg_steps) != '') { |
|
543 | + next($reg_steps); |
|
544 | 544 | } |
545 | - return current( $reg_steps ); |
|
545 | + return current($reg_steps); |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | return null; |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | * @param EE_SPCO_Reg_Step $reg_step_B |
559 | 559 | * @return array() |
560 | 560 | */ |
561 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
561 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
562 | 562 | // send finalize_registration step to the end of the array |
563 | - if ( $reg_step_A->slug() == 'finalize_registration' ) { |
|
563 | + if ($reg_step_A->slug() == 'finalize_registration') { |
|
564 | 564 | return 1; |
565 | - } else if ( $reg_step_B->slug() == 'finalize_registration' ) { |
|
565 | + } else if ($reg_step_B->slug() == 'finalize_registration') { |
|
566 | 566 | return -1; |
567 | 567 | } |
568 | - if ( $reg_step_A->order() == $reg_step_B->order() ) { |
|
568 | + if ($reg_step_A->order() == $reg_step_B->order()) { |
|
569 | 569 | return 0; |
570 | 570 | } |
571 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
571 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | * @access public |
580 | 580 | * @param EE_SPCO_Reg_Step $reg_step |
581 | 581 | */ |
582 | - public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) { |
|
582 | + public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) { |
|
583 | 583 | // call set_reg_step_initiated ??? |
584 | 584 | if ( |
585 | 585 | // first time visiting SPCO ? |
@@ -592,13 +592,13 @@ discard block |
||
592 | 592 | ) |
593 | 593 | ) { |
594 | 594 | /** @type EE_Transaction_Processor $transaction_processor */ |
595 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
595 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
596 | 596 | // set the start time for this reg step |
597 | - if ( ! $transaction_processor->set_reg_step_initiated( $this->transaction, $reg_step->slug() ) ) { |
|
598 | - if ( WP_DEBUG ) { |
|
597 | + if ( ! $transaction_processor->set_reg_step_initiated($this->transaction, $reg_step->slug())) { |
|
598 | + if (WP_DEBUG) { |
|
599 | 599 | EE_Error::add_error( |
600 | 600 | sprintf( |
601 | - __( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), |
|
601 | + __('The "%1$s" registration step was not initialized properly.', 'event_espresso'), |
|
602 | 602 | $reg_step->name() |
603 | 603 | ), |
604 | 604 | __FILE__, __FUNCTION__, __LINE__ |
@@ -617,10 +617,10 @@ discard block |
||
617 | 617 | * @return void |
618 | 618 | */ |
619 | 619 | public function set_reg_step_JSON_info() { |
620 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
620 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
621 | 621 | // pass basic reg step data to JS |
622 | - foreach ( $this->reg_steps as $reg_step ) { |
|
623 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
622 | + foreach ($this->reg_steps as $reg_step) { |
|
623 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
624 | 624 | } |
625 | 625 | // reset reg step html |
626 | 626 | // $this->json_response->set_reg_step_html( '' ); |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | */ |
637 | 637 | public function reset_reg_steps() { |
638 | 638 | $this->sort_reg_steps(); |
639 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
639 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
640 | 640 | $this->set_next_step(); |
641 | 641 | // the text that appears on the reg step form submit button |
642 | 642 | $this->current_step->set_submit_button_text(); |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | */ |
654 | 654 | public function get_registration_time_limit() { |
655 | 655 | |
656 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
656 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
657 | 657 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
658 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
658 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
659 | 659 | return apply_filters( |
660 | 660 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
661 | 661 | $registration_time_limit |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | // overpaid TXN |
676 | 676 | // free TXN ( total = 0.00 ) |
677 | 677 | // then payment required is TRUE |
678 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
678 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | |
@@ -688,8 +688,8 @@ discard block |
||
688 | 688 | */ |
689 | 689 | public function initialize_txn_reg_steps_array() { |
690 | 690 | $txn_reg_steps_array = array(); |
691 | - foreach ( $this->reg_steps as $reg_step ) { |
|
692 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
691 | + foreach ($this->reg_steps as $reg_step) { |
|
692 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
693 | 693 | } |
694 | 694 | return $txn_reg_steps_array; |
695 | 695 | } |
@@ -705,13 +705,13 @@ discard block |
||
705 | 705 | public function update_txn_reg_steps_array() { |
706 | 706 | $updated = FALSE; |
707 | 707 | /** @type EE_Transaction_Processor $transaction_processor */ |
708 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
709 | - foreach ( $this->reg_steps as $reg_step ) { |
|
710 | - if ( $reg_step->completed() ) { |
|
711 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated; |
|
708 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
709 | + foreach ($this->reg_steps as $reg_step) { |
|
710 | + if ($reg_step->completed()) { |
|
711 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated; |
|
712 | 712 | } |
713 | 713 | } |
714 | - if ( $updated ) { |
|
714 | + if ($updated) { |
|
715 | 715 | $this->transaction->save(); |
716 | 716 | } |
717 | 717 | return $updated; |
@@ -726,14 +726,14 @@ discard block |
||
726 | 726 | * @return void |
727 | 727 | */ |
728 | 728 | public function stash_transaction_and_checkout() { |
729 | - if ( ! $this->revisit ) { |
|
729 | + if ( ! $this->revisit) { |
|
730 | 730 | $this->update_txn_reg_steps_array(); |
731 | 731 | } |
732 | 732 | $this->track_transaction_and_registration_status_updates(); |
733 | 733 | // save all data to the db, but suppress errors |
734 | 734 | //$this->save_all_data( FALSE ); |
735 | 735 | // cache the checkout in the session |
736 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
736 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | |
@@ -749,21 +749,21 @@ discard block |
||
749 | 749 | */ |
750 | 750 | public function track_transaction_and_registration_status_updates() { |
751 | 751 | // verify the transaction |
752 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
752 | + if ($this->transaction instanceof EE_Transaction) { |
|
753 | 753 | /** @type EE_Transaction_Payments $transaction_payments */ |
754 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
754 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
755 | 755 | /** @type EE_Transaction_Processor $transaction_processor */ |
756 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
756 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
757 | 757 | // has there been a TXN status change during this checkout? |
758 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
758 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
759 | 759 | $this->txn_status_updated = true; |
760 | 760 | } |
761 | 761 | /** @type EE_Registration_Processor $registration_processor */ |
762 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
762 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
763 | 763 | // grab the saved registrations from the transaction |
764 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
765 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
766 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
764 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
765 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
766 | + $this->set_reg_status_updated($registration->ID(), true); |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | } |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | * @param EE_Registration $registration |
786 | 786 | * @return bool |
787 | 787 | */ |
788 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
789 | - return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE; |
|
788 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
789 | + return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | |
@@ -811,18 +811,18 @@ discard block |
||
811 | 811 | * @param bool $show_errors |
812 | 812 | * @return bool |
813 | 813 | */ |
814 | - public function save_all_data( $show_errors = TRUE ) { |
|
814 | + public function save_all_data($show_errors = TRUE) { |
|
815 | 815 | // verify the transaction |
816 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
816 | + if ($this->transaction instanceof EE_Transaction) { |
|
817 | 817 | // save to ensure that TXN has ID |
818 | 818 | $this->transaction->save(); |
819 | 819 | // grab the saved registrations from the transaction |
820 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
821 | - $this->_save_registration( $registration, $show_errors ); |
|
820 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
821 | + $this->_save_registration($registration, $show_errors); |
|
822 | 822 | } |
823 | 823 | } else { |
824 | - if ( $show_errors ) { |
|
825 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
824 | + if ($show_errors) { |
|
825 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
826 | 826 | } |
827 | 827 | return FALSE; |
828 | 828 | } |
@@ -837,32 +837,32 @@ discard block |
||
837 | 837 | * @param bool $show_errors |
838 | 838 | * @return void |
839 | 839 | */ |
840 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
840 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
841 | 841 | // verify object |
842 | - if ( $registration instanceof EE_Registration ) { |
|
842 | + if ($registration instanceof EE_Registration) { |
|
843 | 843 | // should this registration be processed during this visit ? |
844 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
844 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
845 | 845 | //set TXN ID |
846 | - if ( ! $registration->transaction_ID() ) { |
|
847 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
846 | + if ( ! $registration->transaction_ID()) { |
|
847 | + $registration->set_transaction_id($this->transaction->ID()); |
|
848 | 848 | } |
849 | 849 | // verify and save the attendee |
850 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
850 | + $this->_save_registration_attendee($registration, $show_errors); |
|
851 | 851 | // save answers to reg form questions |
852 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
852 | + $this->_save_registration_answers($registration, $show_errors); |
|
853 | 853 | // save changes |
854 | 854 | $registration->save(); |
855 | 855 | // update txn cache |
856 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
857 | - if ( $show_errors ) { |
|
858 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
856 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
857 | + if ($show_errors) { |
|
858 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
859 | 859 | } |
860 | 860 | } |
861 | 861 | } |
862 | 862 | } else { |
863 | - if ( $show_errors ) { |
|
863 | + if ($show_errors) { |
|
864 | 864 | EE_Error::add_error( |
865 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
865 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
866 | 866 | __FILE__, __FUNCTION__, __LINE__ |
867 | 867 | ); |
868 | 868 | } |
@@ -878,26 +878,26 @@ discard block |
||
878 | 878 | * @param bool $show_errors |
879 | 879 | * @return void |
880 | 880 | */ |
881 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
882 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
881 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
882 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
883 | 883 | // save so that ATT has ID |
884 | 884 | $registration->attendee()->save(); |
885 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) { |
|
886 | - if ( $show_errors ) { |
|
885 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
886 | + if ($show_errors) { |
|
887 | 887 | EE_Error::add_error( |
888 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
888 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
889 | 889 | __FILE__, __FUNCTION__, __LINE__ |
890 | 890 | ); |
891 | 891 | } |
892 | 892 | } |
893 | 893 | } else { |
894 | - if ( $show_errors ) { |
|
894 | + if ($show_errors) { |
|
895 | 895 | ob_start(); |
896 | - var_dump( $registration->attendee() ); |
|
896 | + var_dump($registration->attendee()); |
|
897 | 897 | EE_Error::add_error( |
898 | 898 | sprintf( |
899 | 899 | '%1$s||%1$s $attendee = %2$s', |
900 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
900 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
901 | 901 | ob_get_clean() |
902 | 902 | ), |
903 | 903 | __FILE__, __FUNCTION__, __LINE__ |
@@ -915,25 +915,25 @@ discard block |
||
915 | 915 | * @param bool $show_errors |
916 | 916 | * @return void |
917 | 917 | */ |
918 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
918 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
919 | 919 | // now save the answers |
920 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
920 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
921 | 921 | // verify object |
922 | - if ( $answer instanceof EE_Answer ) { |
|
923 | - $answer->set_registration( $registration->ID() ); |
|
922 | + if ($answer instanceof EE_Answer) { |
|
923 | + $answer->set_registration($registration->ID()); |
|
924 | 924 | $answer->save(); |
925 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
926 | - if ( $show_errors ) { |
|
925 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
926 | + if ($show_errors) { |
|
927 | 927 | EE_Error::add_error( |
928 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
928 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
929 | 929 | __FILE__, __FUNCTION__, __LINE__ |
930 | 930 | ); |
931 | 931 | } |
932 | 932 | } |
933 | 933 | } else { |
934 | - if ( $show_errors ) { |
|
934 | + if ($show_errors) { |
|
935 | 935 | EE_Error::add_error( |
936 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
936 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
937 | 937 | __FILE__, __FUNCTION__, __LINE__ |
938 | 938 | ); |
939 | 939 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | * @param bool $from_db |
952 | 952 | * @return bool |
953 | 953 | */ |
954 | - public function refresh_all_entities( $from_db = false ) { |
|
954 | + public function refresh_all_entities($from_db = false) { |
|
955 | 955 | $from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db; |
956 | 956 | //$this->log( |
957 | 957 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -972,11 +972,11 @@ discard block |
||
972 | 972 | */ |
973 | 973 | protected function refresh_from_db() { |
974 | 974 | // verify the transaction |
975 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
975 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
976 | 976 | // pull fresh TXN data from the db |
977 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
977 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
978 | 978 | // update EE_Checkout's cached primary_attendee object |
979 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
979 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
980 | 980 | // update EE_Checkout's cached payment object |
981 | 981 | $payment = $this->transaction->last_payment(); |
982 | 982 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -984,15 +984,15 @@ discard block |
||
984 | 984 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
985 | 985 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
986 | 986 | //now refresh the cart, based on the TXN |
987 | - $this->cart = EE_Cart::get_cart_from_txn( $this->transaction ); |
|
987 | + $this->cart = EE_Cart::get_cart_from_txn($this->transaction); |
|
988 | 988 | // verify and update the cart because inaccurate totals are not so much fun |
989 | - if ( $this->cart instanceof EE_Cart ) { |
|
989 | + if ($this->cart instanceof EE_Cart) { |
|
990 | 990 | $this->cart->get_grand_total()->recalculate_total_including_taxes(); |
991 | 991 | } else { |
992 | - $this->cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
992 | + $this->cart = EE_Registry::instance()->load_core('Cart'); |
|
993 | 993 | } |
994 | 994 | } else { |
995 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
995 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
996 | 996 | return FALSE; |
997 | 997 | } |
998 | 998 | return TRUE; |
@@ -1006,24 +1006,24 @@ discard block |
||
1006 | 1006 | * @param EE_Transaction $transaction |
1007 | 1007 | * @return EE_Attendee | null |
1008 | 1008 | */ |
1009 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
1009 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
1010 | 1010 | |
1011 | 1011 | $primary_attendee_obj = null; |
1012 | 1012 | // grab the saved registrations from the transaction |
1013 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
1013 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
1014 | 1014 | // verify object |
1015 | - if ( $registration instanceof EE_Registration ) { |
|
1015 | + if ($registration instanceof EE_Registration) { |
|
1016 | 1016 | $attendee = $registration->attendee(); |
1017 | 1017 | // verify object |
1018 | - if ( $attendee instanceof EE_Attendee ) { |
|
1018 | + if ($attendee instanceof EE_Attendee) { |
|
1019 | 1019 | // maybe cache primary_attendee_obj ? |
1020 | - if ( $registration->is_primary_registrant() ) { |
|
1020 | + if ($registration->is_primary_registrant()) { |
|
1021 | 1021 | $primary_attendee_obj = $attendee; |
1022 | 1022 | } |
1023 | 1023 | } |
1024 | 1024 | } else { |
1025 | 1025 | EE_Error::add_error( |
1026 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1026 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1027 | 1027 | __FILE__, __FUNCTION__, __LINE__ |
1028 | 1028 | ); |
1029 | 1029 | } |
@@ -1043,43 +1043,43 @@ discard block |
||
1043 | 1043 | */ |
1044 | 1044 | protected function refresh_entity_map() { |
1045 | 1045 | // verify the transaction |
1046 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1046 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1047 | 1047 | // never cache payment info |
1048 | - $this->transaction->clear_cache( 'Payment' ); |
|
1048 | + $this->transaction->clear_cache('Payment'); |
|
1049 | 1049 | /** @type EE_Transaction_Processor $transaction_processor */ |
1050 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1050 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1051 | 1051 | // is the Payment Options Reg Step completed ? |
1052 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
1052 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
1053 | 1053 | // then check for payments and update TXN accordingly |
1054 | 1054 | /** @type EE_Transaction_Payments $transaction_payments */ |
1055 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1056 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
1055 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1056 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
1057 | 1057 | } |
1058 | 1058 | // grab the saved registrations from the transaction |
1059 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) { |
|
1060 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
1059 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) { |
|
1060 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
1061 | 1061 | } |
1062 | 1062 | // make sure our cached TXN is added to the model entity mapper |
1063 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
1063 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
1064 | 1064 | |
1065 | 1065 | } else { |
1066 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1066 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1067 | 1067 | return FALSE; |
1068 | 1068 | } |
1069 | 1069 | // verify and update the cart because inaccurate totals are not so much fun |
1070 | - if ( $this->cart instanceof EE_Cart ) { |
|
1070 | + if ($this->cart instanceof EE_Cart) { |
|
1071 | 1071 | $grand_total = $this->cart->get_grand_total(); |
1072 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
1072 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
1073 | 1073 | $grand_total->recalculate_total_including_taxes(); |
1074 | 1074 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
1075 | 1075 | $this->cart->get_grand_total()->ID(), |
1076 | 1076 | $this->cart->get_grand_total() |
1077 | 1077 | ); |
1078 | 1078 | } |
1079 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
1080 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
1079 | + if ($grand_total instanceof EE_Line_Item) { |
|
1080 | + $this->cart = EE_Cart::instance($grand_total); |
|
1081 | 1081 | } else { |
1082 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1082 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1083 | 1083 | return false; |
1084 | 1084 | } |
1085 | 1085 | } |
@@ -1095,19 +1095,19 @@ discard block |
||
1095 | 1095 | * @param EE_Registration $registration |
1096 | 1096 | * @return void |
1097 | 1097 | */ |
1098 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
1098 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
1099 | 1099 | |
1100 | 1100 | // verify object |
1101 | - if ( $registration instanceof EE_Registration ) { |
|
1101 | + if ($registration instanceof EE_Registration) { |
|
1102 | 1102 | // update the entity mapper attendee |
1103 | - $this->_refresh_registration_attendee( $registration ); |
|
1103 | + $this->_refresh_registration_attendee($registration); |
|
1104 | 1104 | // update the entity mapper answers for reg form questions |
1105 | - $this->_refresh_registration_answers( $registration ); |
|
1105 | + $this->_refresh_registration_answers($registration); |
|
1106 | 1106 | // make sure the cached registration is added to the model entity mapper |
1107 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1107 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1108 | 1108 | } else { |
1109 | 1109 | EE_Error::add_error( |
1110 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1110 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1111 | 1111 | __FILE__, __FUNCTION__, __LINE__ |
1112 | 1112 | ); |
1113 | 1113 | } |
@@ -1121,15 +1121,15 @@ discard block |
||
1121 | 1121 | * @param EE_Registration $registration |
1122 | 1122 | * @return void |
1123 | 1123 | */ |
1124 | - protected function _refresh_registration_attendee( $registration ) { |
|
1124 | + protected function _refresh_registration_attendee($registration) { |
|
1125 | 1125 | |
1126 | 1126 | $attendee = $registration->attendee(); |
1127 | 1127 | // verify object |
1128 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1128 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1129 | 1129 | // make sure the cached attendee is added to the model entity mapper |
1130 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1130 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1131 | 1131 | // maybe cache primary_attendee_obj ? |
1132 | - if ( $registration->is_primary_registrant() ) { |
|
1132 | + if ($registration->is_primary_registrant()) { |
|
1133 | 1133 | $this->primary_attendee_obj = $attendee; |
1134 | 1134 | } |
1135 | 1135 | } |
@@ -1143,19 +1143,19 @@ discard block |
||
1143 | 1143 | * @param EE_Registration $registration |
1144 | 1144 | * @return void |
1145 | 1145 | */ |
1146 | - protected function _refresh_registration_answers( $registration ) { |
|
1146 | + protected function _refresh_registration_answers($registration) { |
|
1147 | 1147 | |
1148 | 1148 | // now update the answers |
1149 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1149 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1150 | 1150 | // verify object |
1151 | - if ( $answer instanceof EE_Answer ) { |
|
1152 | - if ( $answer->ID() ) { |
|
1151 | + if ($answer instanceof EE_Answer) { |
|
1152 | + if ($answer->ID()) { |
|
1153 | 1153 | // make sure the cached answer is added to the model entity mapper |
1154 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1154 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1155 | 1155 | } |
1156 | 1156 | } else { |
1157 | 1157 | EE_Error::add_error( |
1158 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1158 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1159 | 1159 | __FILE__, __FUNCTION__, __LINE__ |
1160 | 1160 | ); |
1161 | 1161 | } |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1171 | 1171 | */ |
1172 | 1172 | function __wakeup() { |
1173 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1173 | + foreach ($this->reg_steps as $reg_step) { |
|
1174 | 1174 | $reg_step->checkout = $this; |
1175 | 1175 | } |
1176 | 1176 | } |
@@ -1186,11 +1186,11 @@ discard block |
||
1186 | 1186 | * @param array $info |
1187 | 1187 | * @param bool $display_request |
1188 | 1188 | */ |
1189 | - function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1190 | - if ( WP_DEBUG && false ) { |
|
1191 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1189 | + function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1190 | + if (WP_DEBUG && false) { |
|
1191 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1192 | 1192 | $default_data = array( |
1193 | - $class => $func . '() : ' . $line, |
|
1193 | + $class => $func.'() : '.$line, |
|
1194 | 1194 | 'request->step' => $this->step, |
1195 | 1195 | 'request->action' => $this->action, |
1196 | 1196 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1202,24 +1202,24 @@ discard block |
||
1202 | 1202 | 'reg_url_link' => $this->reg_url_link, |
1203 | 1203 | 'REQ' => $display_request ? $_REQUEST : '', |
1204 | 1204 | ); |
1205 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1206 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1207 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1208 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1209 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1205 | + if ($this->transaction instanceof EE_Transaction) { |
|
1206 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1207 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1208 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1209 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1210 | 1210 | } |
1211 | - if ( $this->transaction->ID() ) { |
|
1212 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1211 | + if ($this->transaction->ID()) { |
|
1212 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1213 | 1213 | // don't serialize objects |
1214 | - $info = $this->_strip_objects( $info ); |
|
1215 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1216 | - $debug_data[ $TXN_ID ] = array(); |
|
1214 | + $info = $this->_strip_objects($info); |
|
1215 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1216 | + $debug_data[$TXN_ID] = array(); |
|
1217 | 1217 | } |
1218 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1218 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1219 | 1219 | $default_data, |
1220 | 1220 | $info |
1221 | 1221 | ); |
1222 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1222 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | } |
@@ -1232,23 +1232,23 @@ discard block |
||
1232 | 1232 | * @param array $info |
1233 | 1233 | * @return array |
1234 | 1234 | */ |
1235 | - function _strip_objects( $info = array() ) { |
|
1236 | - foreach ( $info as $key => $value ) { |
|
1237 | - if ( is_array( $value )) { |
|
1238 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1239 | - } else if ( is_object( $value ) ) { |
|
1240 | - $object_class = get_class( $value ); |
|
1241 | - $info[ $object_class ] = array(); |
|
1242 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1243 | - if ( method_exists( $value, 'status' ) ) { |
|
1244 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1245 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1246 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1235 | + function _strip_objects($info = array()) { |
|
1236 | + foreach ($info as $key => $value) { |
|
1237 | + if (is_array($value)) { |
|
1238 | + $info[$key] = $this->_strip_objects($value); |
|
1239 | + } else if (is_object($value)) { |
|
1240 | + $object_class = get_class($value); |
|
1241 | + $info[$object_class] = array(); |
|
1242 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1243 | + if (method_exists($value, 'status')) { |
|
1244 | + $info[$object_class]['status'] = $value->status(); |
|
1245 | + } else if (method_exists($value, 'status_ID')) { |
|
1246 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1247 | 1247 | } |
1248 | - unset( $info[ $key ] ); |
|
1248 | + unset($info[$key]); |
|
1249 | 1249 | } |
1250 | 1250 | } |
1251 | - return (array)$info; |
|
1251 | + return (array) $info; |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param bool $preview indicate whether a preview is being generated or not. |
272 | 272 | * @return void |
273 | 273 | */ |
274 | - public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE ) { |
|
274 | + public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE) { |
|
275 | 275 | |
276 | 276 | $this->_active_messenger = $active_messenger; |
277 | 277 | |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | |
281 | 281 | //this is a special method that allows child message types to trigger an exit from generating messages early (in cases where there may be a delay on send). |
282 | 282 | $exit = $this->_trigger_exit(); |
283 | - if ( $exit && ! $this->_preview ) return FALSE; |
|
283 | + if ($exit && ! $this->_preview) return FALSE; |
|
284 | 284 | |
285 | 285 | //todo: need to move require into registration hook but for now we'll require here. |
286 | - EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ); |
|
286 | + EE_Registry::instance()->load_helper('Parse_Shortcodes'); |
|
287 | 287 | //get shortcode_replace instance- set when _get_messages is called in child... |
288 | 288 | $this->_shortcode_replace = new EEH_Parse_Shortcodes(); |
289 | 289 | |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | $this->_data_handler = ! $this->_preview ? $this->_data_handler : 'Preview'; |
295 | 295 | |
296 | 296 | //if there is an incoming context then this is a preview so let's ONLY show the given context! |
297 | - if ( !empty( $context ) ) { |
|
298 | - $cntxt = ! empty( $this->_contexts[$context] ) ? $this->_contexts[$context] : ''; |
|
299 | - if ( ! empty( $cntxt ) ) { |
|
297 | + if ( ! empty($context)) { |
|
298 | + $cntxt = ! empty($this->_contexts[$context]) ? $this->_contexts[$context] : ''; |
|
299 | + if ( ! empty($cntxt)) { |
|
300 | 300 | $this->_contexts = array(); |
301 | 301 | $this->_contexts[$context] = $cntxt; |
302 | 302 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $exit = $this->_init_data(); |
306 | 306 | |
307 | 307 | //final check for if we exit or not cause child objects may have run conditionals that cleared out data so no addresees generated. |
308 | - if ( $exit ) return FALSE; |
|
308 | + if ($exit) return FALSE; |
|
309 | 309 | |
310 | 310 | $this->_get_templates(); //get the templates that have been set with this type and for the given messenger that have been saved in the database. |
311 | 311 | $this->_assemble_messages(); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * @param int $id Optional. Integer corresponding to the value for the primary key of a EE_Base_Class_Object |
342 | 342 | * @return mixed ( EE_Base_Class||EE_Base_Class[] ) |
343 | 343 | */ |
344 | - abstract protected function _get_data_for_context( $context, EE_Registration $registration, $id ); |
|
344 | + abstract protected function _get_data_for_context($context, EE_Registration $registration, $id); |
|
345 | 345 | |
346 | 346 | |
347 | 347 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @return int |
375 | 375 | */ |
376 | - protected function _get_id_for_msg_url( $context, EE_Registration $registration ) { |
|
376 | + protected function _get_id_for_msg_url($context, EE_Registration $registration) { |
|
377 | 377 | return 0; |
378 | 378 | } |
379 | 379 | |
@@ -406,28 +406,28 @@ discard block |
||
406 | 406 | * |
407 | 407 | * @return string generated url |
408 | 408 | */ |
409 | - public function get_url_trigger( $context, $sending_messenger, EE_Registration $registration ) { |
|
409 | + public function get_url_trigger($context, $sending_messenger, EE_Registration $registration) { |
|
410 | 410 | |
411 | 411 | //validate context |
412 | 412 | //valid context? |
413 | - if ( !isset( $this->_contexts[$context] ) ) { |
|
414 | - throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) ); |
|
413 | + if ( ! isset($this->_contexts[$context])) { |
|
414 | + throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this))); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | //valid sending_messenger? |
418 | 418 | $not_valid_msgr = FALSE; |
419 | - foreach ( $this->_with_messengers as $generating => $sendings ) { |
|
420 | - if ( empty( $sendings ) || array_search( $sending_messenger, $sendings ) === FALSE ) { |
|
419 | + foreach ($this->_with_messengers as $generating => $sendings) { |
|
420 | + if (empty($sendings) || array_search($sending_messenger, $sendings) === FALSE) { |
|
421 | 421 | $not_valid_msgr = TRUE; |
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
425 | - if ( $not_valid_msgr ) { |
|
426 | - throw new EE_Error( sprintf( __('The given sending messenger string (%s) does not match a valid sending messenger with the %s. If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class( $this ) ) ); |
|
425 | + if ($not_valid_msgr) { |
|
426 | + throw new EE_Error(sprintf(__('The given sending messenger string (%s) does not match a valid sending messenger with the %s. If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class($this))); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | EE_Registry::instance()->load_helper('MSG_Template'); |
430 | - return EEH_MSG_Template::generate_url_trigger( $sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url( $context, $registration ) ); |
|
430 | + return EEH_MSG_Template::generate_url_trigger($sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url($context, $registration)); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -448,19 +448,19 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return mixed (EE_Base_Class||EE_Base_Class[]) |
450 | 450 | */ |
451 | - public function get_data_for_context( $context, EE_Registration $registration, $id = 0 ) { |
|
451 | + public function get_data_for_context($context, EE_Registration $registration, $id = 0) { |
|
452 | 452 | //valid context? |
453 | - if ( !isset( $this->_contexts[$context] ) ) { |
|
454 | - throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) ); |
|
453 | + if ( ! isset($this->_contexts[$context])) { |
|
454 | + throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this))); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | //get data and apply global and class specific filters on it. |
458 | - $data = apply_filters( 'FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context( $context, $registration, $id ), $this ); |
|
459 | - $data = apply_filters( 'FHEE__' . get_class( $this ) . '__get_data_for_context__data', $data, $this ); |
|
458 | + $data = apply_filters('FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context($context, $registration, $id), $this); |
|
459 | + $data = apply_filters('FHEE__'.get_class($this).'__get_data_for_context__data', $data, $this); |
|
460 | 460 | |
461 | 461 | //if empty then something went wrong! |
462 | - if ( empty( $data ) ) { |
|
463 | - throw new EE_Error( sprintf( __('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name ) ); |
|
462 | + if (empty($data)) { |
|
463 | + throw new EE_Error(sprintf(__('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name)); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | return $data; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | */ |
496 | 496 | public function with_messengers() { |
497 | 497 | |
498 | - return apply_filters( 'FHEE__EE_message_type__get_with_messengers__with_messengers__' . get_class( $this ), $this->_with_messengers); |
|
498 | + return apply_filters('FHEE__EE_message_type__get_with_messengers__with_messengers__'.get_class($this), $this->_with_messengers); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | * @access public |
514 | 514 | * @return void |
515 | 515 | */ |
516 | - public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array() ) { |
|
516 | + public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array()) { |
|
517 | 517 | //we can also further refine the context by action (if present). |
518 | - return $this->_get_admin_page_content( $page, $action, $extra, $messengers ); |
|
518 | + return $this->_get_admin_page_content($page, $action, $extra, $messengers); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | */ |
560 | 560 | public function get_master_templates() { |
561 | 561 | //first class specific filter then filter that by the global filter. |
562 | - $master_templates = apply_filters( 'FHEE__' . get_class( $this ) . '__get_master_templates', $this->_master_templates ); |
|
563 | - return apply_filters( 'FHEE__EE_message_type__get_master_templates', $master_templates, $this ); |
|
562 | + $master_templates = apply_filters('FHEE__'.get_class($this).'__get_master_templates', $this->_master_templates); |
|
563 | + return apply_filters('FHEE__EE_message_type__get_master_templates', $master_templates, $this); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -579,31 +579,31 @@ discard block |
||
579 | 579 | /** |
580 | 580 | * first let's make sure that incoming data isn't empty! |
581 | 581 | */ |
582 | - if ( is_array($this->_data) && empty($this->_data) && !$this->_preview ) { |
|
583 | - $msg = sprintf( __( '"%s" message type incoming data is empty. There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular'] ); |
|
584 | - throw new EE_Error( $msg ); |
|
582 | + if (is_array($this->_data) && empty($this->_data) && ! $this->_preview) { |
|
583 | + $msg = sprintf(__('"%s" message type incoming data is empty. There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular']); |
|
584 | + throw new EE_Error($msg); |
|
585 | 585 | } |
586 | 586 | |
587 | - if ( empty( $this->_data_handler) ) { |
|
588 | - $msg = sprintf( __('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__ ); |
|
589 | - throw new EE_Error( $msg ); |
|
587 | + if (empty($this->_data_handler)) { |
|
588 | + $msg = sprintf(__('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__); |
|
589 | + throw new EE_Error($msg); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
593 | 593 | //setup class name for the data handler |
594 | - $classname = 'EE_Messages_' . $this->_data_handler . '_incoming_data'; |
|
594 | + $classname = 'EE_Messages_'.$this->_data_handler.'_incoming_data'; |
|
595 | 595 | |
596 | 596 | //check that the class exists |
597 | - if ( !class_exists( $classname ) ) { |
|
597 | + if ( ! class_exists($classname)) { |
|
598 | 598 | |
599 | 599 | $msg[] = __('uhoh, Something went wrong and no data handler is found', 'event_espresso'); |
600 | - $msg[] = sprintf( __('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class"). Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname ); |
|
601 | - throw new EE_error( implode('||', $msg) ); |
|
600 | + $msg[] = sprintf(__('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class"). Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname); |
|
601 | + throw new EE_error(implode('||', $msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | //k lets get the prepared data object and replace existing data property with it. |
605 | - $a = new ReflectionClass( $classname ); |
|
606 | - $this->_data = $a->newInstance( $this->_data ); |
|
605 | + $a = new ReflectionClass($classname); |
|
606 | + $this->_data = $a->newInstance($this->_data); |
|
607 | 607 | |
608 | 608 | $this->_set_default_addressee_data(); |
609 | 609 | return $this->_process_data(); |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | protected function _process_data() { |
620 | 620 | //at a minimum, we NEED EE_Attendee objects. |
621 | 621 | |
622 | - if ( empty( $this->_data->attendees ) ) |
|
623 | - return TRUE; //EXIT! |
|
622 | + if (empty($this->_data->attendees)) |
|
623 | + return TRUE; //EXIT! |
|
624 | 624 | |
625 | 625 | //process addressees for each context. Child classes will have to have methods for each context defined to handle the processing of the data object within them |
626 | - foreach ( $this->_contexts as $context => $details ) { |
|
627 | - $xpctd_method = '_' . $context . '_addressees'; |
|
628 | - if ( !method_exists( $this, $xpctd_method ) ) |
|
629 | - throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) ); |
|
630 | - $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) ); |
|
626 | + foreach ($this->_contexts as $context => $details) { |
|
627 | + $xpctd_method = '_'.$context.'_addressees'; |
|
628 | + if ( ! method_exists($this, $xpctd_method)) |
|
629 | + throw new EE_Error(sprintf(__('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method)); |
|
630 | + $this->_addressees[$context] = call_user_func(array($this, $xpctd_method)); |
|
631 | 631 | } |
632 | 632 | return FALSE; //DON'T EXIT |
633 | 633 | } |
@@ -662,8 +662,8 @@ discard block |
||
662 | 662 | 'total_ticket_count' => $this->_data->total_ticket_count |
663 | 663 | ); |
664 | 664 | |
665 | - if ( is_array( $this->_data->primary_attendee_data ) ) { |
|
666 | - $this->_default_addressee_data = array_merge( $this->_default_addressee_data, $this->_data->primary_attendee_data ); |
|
665 | + if (is_array($this->_data->primary_attendee_data)) { |
|
666 | + $this->_default_addressee_data = array_merge($this->_default_addressee_data, $this->_data->primary_attendee_data); |
|
667 | 667 | $this->_default_addressee_data['primary_att_obj'] = $this->_data->primary_attendee_data['att_obj']; |
668 | 668 | $this->_default_addressee_data['primary_reg_obj'] = $this->_data->primary_attendee_data['reg_obj']; |
669 | 669 | } |
@@ -681,26 +681,26 @@ discard block |
||
681 | 681 | * see abstract declaration in parent class for details, children message types can override these valid shortcodes if desired (we include all for all contexts by default). |
682 | 682 | */ |
683 | 683 | protected function _set_valid_shortcodes() { |
684 | - $all_shortcodes = array( 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger' ); |
|
684 | + $all_shortcodes = array('attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger'); |
|
685 | 685 | $contexts = $this->get_contexts(); |
686 | - foreach ( $contexts as $context => $details ) { |
|
686 | + foreach ($contexts as $context => $details) { |
|
687 | 687 | $this->_valid_shortcodes[$context] = $all_shortcodes; |
688 | 688 | |
689 | 689 | //make sure non admin context does not include the event_author shortcodes |
690 | - if ( $context != 'admin' ) { |
|
691 | - if( ($key = array_search('event_author', $this->_valid_shortcodes[$context] ) ) !== false) { |
|
690 | + if ($context != 'admin') { |
|
691 | + if (($key = array_search('event_author', $this->_valid_shortcodes[$context])) !== false) { |
|
692 | 692 | unset($this->_valid_shortcodes[$context][$key]); |
693 | 693 | } |
694 | 694 | } |
695 | 695 | } |
696 | 696 | |
697 | 697 | //make sure admin context does not include the recipient_details shortcodes IF we have admin context hooked in message types might not have that context. |
698 | - if ( !empty( $this->_valid_shortcodes['admin'] ) ) { |
|
699 | - if( ($key = array_search('recipient_details', $this->_valid_shortcodes['admin'] ) ) !== false) { |
|
698 | + if ( ! empty($this->_valid_shortcodes['admin'])) { |
|
699 | + if (($key = array_search('recipient_details', $this->_valid_shortcodes['admin'])) !== false) { |
|
700 | 700 | unset($this->_valid_shortcodes['admin'][$key]); |
701 | 701 | } |
702 | 702 | //make sure admin context does not include the recipient_details shortcodes |
703 | - if( ($key = array_search('recipient_list', $this->_valid_shortcodes['admin'] ) ) !== false) { |
|
703 | + if (($key = array_search('recipient_list', $this->_valid_shortcodes['admin'])) !== false) { |
|
704 | 704 | unset($this->_valid_shortcodes['admin'][$key]); |
705 | 705 | } |
706 | 706 | } |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | * @param array $new_config array of valid shortcodes (by context) |
714 | 714 | * @return void sets valid_shortcodes property |
715 | 715 | */ |
716 | - public function reset_valid_shortcodes_config( $new_config ) { |
|
717 | - foreach ( $new_config as $context => $shortcodes ) { |
|
716 | + public function reset_valid_shortcodes_config($new_config) { |
|
717 | + foreach ($new_config as $context => $shortcodes) { |
|
718 | 718 | $this->_valid_shortcodes[$context] = $shortcodes; |
719 | 719 | } |
720 | 720 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | $addressees = array(); |
735 | 735 | |
736 | 736 | //first we need to get the event admin user id for all the events and setup an addressee object for each unique admin user. |
737 | - foreach ( $this->_data->events as $line_ref => $event ) { |
|
737 | + foreach ($this->_data->events as $line_ref => $event) { |
|
738 | 738 | $admin_id = $this->_get_event_admin_id($event['ID']); |
739 | 739 | //get the user_id for the event |
740 | 740 | $admin_ids[] = $admin_id; |
@@ -746,14 +746,14 @@ discard block |
||
746 | 746 | $admin_ids = array_unique($admin_ids); |
747 | 747 | |
748 | 748 | //k now we can loop through the event_admins and setup the addressee data. |
749 | - foreach ( $admin_ids as $event_admin ) { |
|
749 | + foreach ($admin_ids as $event_admin) { |
|
750 | 750 | $aee = array( |
751 | 751 | 'user_id' => $event_admin, |
752 | 752 | 'events' => $admin_events[$event_admin], |
753 | 753 | 'attendees' => $this->_data->attendees |
754 | 754 | ); |
755 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
756 | - $addressees[] = new EE_Messages_Addressee( $aee ); |
|
755 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
756 | + $addressees[] = new EE_Messages_Addressee($aee); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | return $addressees; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $aee['attendees'] = $this->_data->attendees; |
774 | 774 | |
775 | 775 | //great now we can instantiate the $addressee object and return (as an array); |
776 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
776 | + $add[] = new EE_Messages_Addressee($aee); |
|
777 | 777 | return $add; |
778 | 778 | } |
779 | 779 | |
@@ -792,34 +792,34 @@ discard block |
||
792 | 792 | //use to verify unique attendee emails... we don't want to sent multiple copies to the same attendee do we? |
793 | 793 | $already_processed = array(); |
794 | 794 | |
795 | - foreach ( $this->_data->attendees as $att_id => $details ) { |
|
795 | + foreach ($this->_data->attendees as $att_id => $details) { |
|
796 | 796 | //set the attendee array to blank on each loop; |
797 | 797 | $aee = array(); |
798 | 798 | |
799 | - if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue; |
|
799 | + if (isset($this->_data->reg_obj) && ($this->_data->reg_obj->attendee_ID() != $att_id) && $this->_single_message) continue; |
|
800 | 800 | |
801 | 801 | //is $this->_regs_for_sending present? If so, let's make sure we ONLY generate addressee for registrations in that array. |
802 | - if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) { |
|
803 | - $regs_allowed = array_intersect_key( array_flip( $this->_regs_for_sending ), $details['reg_objs'] ); |
|
804 | - if ( empty( $regs_allowed ) ) { |
|
802 | + if ( ! empty($this->_regs_for_sending) && is_array($this->_regs_for_sending)) { |
|
803 | + $regs_allowed = array_intersect_key(array_flip($this->_regs_for_sending), $details['reg_objs']); |
|
804 | + if (empty($regs_allowed)) { |
|
805 | 805 | continue; |
806 | 806 | } |
807 | 807 | } |
808 | 808 | |
809 | - if ( in_array( $details['attendee_email'], $already_processed ) ) |
|
809 | + if (in_array($details['attendee_email'], $already_processed)) |
|
810 | 810 | continue; |
811 | 811 | |
812 | 812 | $already_processed[] = $details['attendee_email']; |
813 | 813 | |
814 | - foreach ( $details as $item => $value ) { |
|
814 | + foreach ($details as $item => $value) { |
|
815 | 815 | $aee[$item] = $value; |
816 | - if ( $item == 'line_ref' ) { |
|
817 | - foreach ( $value as $event_id ) { |
|
816 | + if ($item == 'line_ref') { |
|
817 | + foreach ($value as $event_id) { |
|
818 | 818 | $aee['events'][$event_id] = $this->_data->events[$event_id]; |
819 | 819 | } |
820 | 820 | } |
821 | 821 | |
822 | - if ( $item == 'attendee_email' ) { |
|
822 | + if ($item == 'attendee_email') { |
|
823 | 823 | $aee['attendee_email'] = $value; |
824 | 824 | } |
825 | 825 | |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | $aee['attendees'] = $this->_data->attendees; |
835 | 835 | |
836 | 836 | //merge in the primary attendee data |
837 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
838 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
837 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
838 | + $add[] = new EE_Messages_Addressee($aee); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | return $add; |
@@ -860,46 +860,46 @@ discard block |
||
860 | 860 | ); |
861 | 861 | |
862 | 862 | //in vanilla EE we're assuming there's only one event. However, if there are multiple events then we'll just use the default templates instead of different templates per event (which could create problems). |
863 | - if ( count($this->_data->events) === 1 ) { |
|
864 | - foreach ( $this->_data->events as $event ) { |
|
863 | + if (count($this->_data->events) === 1) { |
|
864 | + foreach ($this->_data->events as $event) { |
|
865 | 865 | $EVT_ID = $event['ID']; |
866 | 866 | } |
867 | 867 | } |
868 | 868 | // is there a Group ID in the incoming request? |
869 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
869 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
870 | 870 | // if not, set a default value of false |
871 | - $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID', false ); |
|
871 | + $GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID', false); |
|
872 | 872 | //if this is a preview then we just get whatever message group is for the preview and skip this part! |
873 | - if ( $this->_preview && $GRP_ID ) { |
|
874 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
873 | + if ($this->_preview && $GRP_ID) { |
|
874 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
875 | 875 | } else { |
876 | 876 | //not a preview or test send so lets continue on our way! |
877 | 877 | //is there an evt_id? If so let's get that. template. |
878 | - if ( !empty( $EVT_ID ) ) { |
|
878 | + if ( ! empty($EVT_ID)) { |
|
879 | 879 | $evt_qa = array( |
880 | 880 | 'Event.EVT_ID' => $EVT_ID |
881 | 881 | ); |
882 | - $qa = array_merge( $template_qa, $evt_qa ); |
|
883 | - $mtpg = EEM_Message_Template_Group::instance()->get_one( array( $qa ) ); |
|
882 | + $qa = array_merge($template_qa, $evt_qa); |
|
883 | + $mtpg = EEM_Message_Template_Group::instance()->get_one(array($qa)); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | //is there a 'GRP_ID' ? if so let's get that. |
887 | 887 | |
888 | 888 | //if global template is NOT an override, and there is a 'GRP_ID' in the request, then we'll assume a specific template has ben requested. |
889 | - if ( $GRP_ID ) { |
|
890 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
889 | + if ($GRP_ID) { |
|
890 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | |
894 | 894 | $template_qa['MTP_is_global'] = TRUE; |
895 | 895 | |
896 | 896 | //this gets the current global template (message template group) for the active messenger and message type. |
897 | - $global_mtpg = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) ); |
|
897 | + $global_mtpg = EEM_Message_Template_Group::instance()->get_one(array($template_qa)); |
|
898 | 898 | |
899 | - $mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get( 'MTP_is_override' ) ? $mtpg : $global_mtpg; |
|
899 | + $mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get('MTP_is_override') ? $mtpg : $global_mtpg; |
|
900 | 900 | } |
901 | 901 | |
902 | - if ( ! $mtpg instanceof EE_Message_Template_Group ) { |
|
902 | + if ( ! $mtpg instanceof EE_Message_Template_Group) { |
|
903 | 903 | //get out because we can't process anything, there are no message template groups |
904 | 904 | // and thus some sort of bad setup issues. |
905 | 905 | return false; |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | |
916 | 916 | |
917 | 917 | |
918 | - foreach ( $templates as $context => $template_fields ) { |
|
919 | - foreach( $template_fields as $template_field=> $template_obj ) { |
|
918 | + foreach ($templates as $context => $template_fields) { |
|
919 | + foreach ($template_fields as $template_field=> $template_obj) { |
|
920 | 920 | $this->_templates[$template_field][$context] = $template_obj->get('MTP_content'); |
921 | 921 | } |
922 | 922 | } |
@@ -931,11 +931,11 @@ discard block |
||
931 | 931 | protected function _assemble_messages() { |
932 | 932 | //make sure any set messages object is cleared |
933 | 933 | $this->messages = array(); |
934 | - foreach ( $this->_addressees as $context => $addressees ) { |
|
935 | - foreach ( $addressees as $addressee ) { |
|
934 | + foreach ($this->_addressees as $context => $addressees) { |
|
935 | + foreach ($addressees as $addressee) { |
|
936 | 936 | $message = $this->_setup_message_object($context, $addressee); |
937 | 937 | //only assign message if everything went okay |
938 | - if ( $message ) { |
|
938 | + if ($message) { |
|
939 | 939 | $message->template_pack = $this->_template_pack; |
940 | 940 | $message->variation = $this->_variation; |
941 | 941 | $this->messages[] = $message; |
@@ -959,22 +959,22 @@ discard block |
||
959 | 959 | $m_shortcodes = $this->_active_messenger->get_valid_shortcodes(); |
960 | 960 | |
961 | 961 | //if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because this context is turned off) EXCEPT if we're previewing |
962 | - if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview ) |
|
962 | + if ((isset($this->_templates['to'][$context]) && empty($this->_templates['to'][$context])) && ! $this->_preview) |
|
963 | 963 | return false; |
964 | 964 | |
965 | - if ( empty( $this->_templates ) ) { |
|
965 | + if (empty($this->_templates)) { |
|
966 | 966 | //unable to setup any messages because there are no templates. Some sort of catastrophic setup |
967 | 967 | //issue exists |
968 | 968 | return false; |
969 | 969 | } |
970 | 970 | |
971 | - foreach ( $this->_templates as $field => $ctxt ) { |
|
971 | + foreach ($this->_templates as $field => $ctxt) { |
|
972 | 972 | //let's setup the valid shortcodes for the incoming context. |
973 | 973 | $valid_shortcodes = $mt_shortcodes[$context]; |
974 | 974 | //merge in valid shortcodes for the field. |
975 | 975 | $shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes; |
976 | - if ( isset( $this->_templates[$field][$context] ) ) { |
|
977 | - $message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID ); |
|
976 | + if (isset($this->_templates[$field][$context])) { |
|
977 | + $message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID); |
|
978 | 978 | } |
979 | 979 | } |
980 | 980 | return $message; |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | * @param bool $routing |
50 | 50 | * @return Registrations_Admin_Page |
51 | 51 | */ |
52 | - public function __construct( $routing = TRUE ) { |
|
53 | - parent::__construct( $routing ); |
|
52 | + public function __construct($routing = TRUE) { |
|
53 | + parent::__construct($routing); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | 'trash' => 'post.php' |
83 | 83 | ); |
84 | 84 | |
85 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
85 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
86 | 86 | //add filters so that the comment urls don't take users to a confusing 404 page |
87 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
87 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | - public function clear_comment_link( $link, $comment, $args ) { |
|
91 | + public function clear_comment_link($link, $comment, $args) { |
|
92 | 92 | //gotta make sure this only happens on this route |
93 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
94 | - if ( $post_type == 'espresso_attendees' ) |
|
93 | + $post_type = get_post_type($comment->comment_post_ID); |
|
94 | + if ($post_type == 'espresso_attendees') |
|
95 | 95 | return '#commentsdiv'; |
96 | 96 | return $link; |
97 | 97 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | protected function _ajax_hooks() { |
101 | 101 | //todo: all hooks for registrations ajax goes in here |
102 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
102 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
115 | 115 | 'edit' => __('Edit Contact', 'event_espresso'), |
116 | 116 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
117 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
118 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
117 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
118 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
119 | 119 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
120 | 120 | ), |
121 | 121 | 'publishbox' => array( |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | |
144 | 144 | $this->_get_registration_status_array(); |
145 | 145 | |
146 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
147 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
148 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
146 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
147 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
148 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
149 | 149 | |
150 | 150 | $this->_page_routes = array( |
151 | 151 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | 'restore_registrations' => array( |
180 | 180 | 'func' => '_trash_or_restore_registrations', |
181 | - 'args' => array( 'trash' => FALSE ), |
|
181 | + 'args' => array('trash' => FALSE), |
|
182 | 182 | 'noheader' => TRUE, |
183 | 183 | 'capability' => 'ee_delete_registrations' |
184 | 184 | ), |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | 'filename' => 'registrations_overview_other' |
406 | 406 | ) |
407 | 407 | ), |
408 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
408 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
409 | 409 | 'qtips' => array('Registration_List_Table_Tips'), |
410 | 410 | 'list_table' => 'EE_Registrations_List_Table', |
411 | 411 | 'require_nonce' => FALSE |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | 'nav' => array( |
416 | 416 | 'label' => __('REG Details', 'event_espresso'), |
417 | 417 | 'order' => 15, |
418 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
418 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
419 | 419 | 'persistent' => FALSE |
420 | 420 | ), |
421 | 421 | 'help_tabs' => array( |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | 'filename' => 'registrations_details_registrant_details' |
437 | 437 | ) |
438 | 438 | ), |
439 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
440 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
439 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
440 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
441 | 441 | 'require_nonce' => FALSE |
442 | 442 | ), |
443 | 443 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | 'order' => 15, |
462 | 462 | 'persistent' => FALSE |
463 | 463 | ), |
464 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
464 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
465 | 465 | 'require_nonce' => FALSE |
466 | 466 | ), |
467 | 467 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | 'label' => __('Edit Contact', 'event_espresso'), |
471 | 471 | 'order' => 15, |
472 | 472 | 'persistent' => FALSE, |
473 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
473 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
474 | 474 | ), |
475 | 475 | 'metaboxes' => array('attendee_editor_metaboxes'), |
476 | 476 | 'require_nonce' => FALSE |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | 'filename' => 'registrations_contact_list_other' |
501 | 501 | ) |
502 | 502 | ), |
503 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
503 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
504 | 504 | 'metaboxes' => array(), |
505 | 505 | 'require_nonce' => FALSE |
506 | 506 | ), |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | protected function _add_screen_options() {} |
520 | 520 | protected function _add_feature_pointers() {} |
521 | 521 | public function admin_init() { |
522 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
522 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
523 | 523 | } |
524 | 524 | public function admin_notices() {} |
525 | 525 | public function admin_footer_scripts() {} |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @return void |
538 | 538 | */ |
539 | 539 | private function _get_registration_status_array() { |
540 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
540 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -560,11 +560,11 @@ discard block |
||
560 | 560 | public function load_scripts_styles() { |
561 | 561 | //style |
562 | 562 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
563 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
563 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
564 | 564 | wp_enqueue_style('espresso_reg'); |
565 | 565 | |
566 | 566 | //script |
567 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
567 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
568 | 568 | wp_enqueue_script('espresso_reg'); |
569 | 569 | } |
570 | 570 | |
@@ -573,9 +573,9 @@ discard block |
||
573 | 573 | public function load_scripts_styles_edit_attendee() { |
574 | 574 | //stuff to only show up on our attendee edit details page. |
575 | 575 | $attendee_details_translations = array( |
576 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
576 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
577 | 577 | ); |
578 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
578 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
579 | 579 | wp_enqueue_script('jquery-validate'); |
580 | 580 | } |
581 | 581 | |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | //styles |
585 | 585 | wp_enqueue_style('espresso-ui-theme'); |
586 | 586 | //scripts |
587 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
588 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
587 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
588 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | |
596 | 596 | public function load_scripts_styles_contact_list() { |
597 | 597 | wp_deregister_style('espresso_reg'); |
598 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
598 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
599 | 599 | wp_enqueue_style('espresso_att'); |
600 | 600 | } |
601 | 601 | |
@@ -604,9 +604,9 @@ discard block |
||
604 | 604 | |
605 | 605 | |
606 | 606 | public function load_scripts_styles_new_registration() { |
607 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
607 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
608 | 608 | wp_enqueue_script('ee-spco-for-admin'); |
609 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
609 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
610 | 610 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
611 | 611 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
612 | 612 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -645,23 +645,23 @@ discard block |
||
645 | 645 | |
646 | 646 | /** setup reg status bulk actions **/ |
647 | 647 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
648 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
648 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
649 | 649 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
650 | 650 | } |
651 | 651 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
652 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
652 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
653 | 653 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
654 | 654 | } |
655 | 655 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
656 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
656 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
657 | 657 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
658 | 658 | } |
659 | 659 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
660 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
660 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
661 | 661 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
662 | 662 | } |
663 | 663 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
664 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
664 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
665 | 665 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
666 | 666 | } |
667 | 667 | |
@@ -670,29 +670,29 @@ discard block |
||
670 | 670 | 'slug' => 'all', |
671 | 671 | 'label' => __('View All Registrations', 'event_espresso'), |
672 | 672 | 'count' => 0, |
673 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
673 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
674 | 674 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
675 | - ) ) |
|
675 | + )) |
|
676 | 676 | ), |
677 | 677 | 'month' => array( |
678 | 678 | 'slug' => 'month', |
679 | 679 | 'label' => __('This Month', 'event_espresso'), |
680 | 680 | 'count' => 0, |
681 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
681 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
682 | 682 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
683 | 683 | )) |
684 | 684 | ), |
685 | 685 | 'today' => array( |
686 | 686 | 'slug' => 'today', |
687 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
687 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
688 | 688 | 'count' => 0, |
689 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
689 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
690 | 690 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
691 | 691 | )) |
692 | 692 | ) |
693 | 693 | ); |
694 | 694 | |
695 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
695 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
696 | 696 | $this->_views['incomplete'] = array( |
697 | 697 | 'slug' => 'incomplete', |
698 | 698 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | ) |
729 | 729 | ); |
730 | 730 | |
731 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
731 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
732 | 732 | $this->_views['trash'] = array( |
733 | 733 | 'slug' => 'trash', |
734 | 734 | 'label' => __('Trash', 'event_espresso'), |
@@ -767,42 +767,42 @@ discard block |
||
767 | 767 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
768 | 768 | ), |
769 | 769 | ); |
770 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
770 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
771 | 771 | $fc_items['resend_registration'] = array( |
772 | 772 | 'class' => 'dashicons dashicons-email-alt', |
773 | 773 | 'desc' => __('Resend Registration Details', 'event_espresso') |
774 | 774 | ); |
775 | 775 | } else { |
776 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
776 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
777 | 777 | } |
778 | 778 | |
779 | 779 | $sc_items = array( |
780 | 780 | 'approved_status' => array( |
781 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
782 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
781 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
782 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
783 | 783 | ), |
784 | 784 | 'pending_status' => array( |
785 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
786 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
785 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
786 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
787 | 787 | ), |
788 | 788 | 'incomplete_status' => array( |
789 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
790 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
789 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
790 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
791 | 791 | ), |
792 | 792 | 'not_approved' => array( |
793 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
794 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
793 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
794 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
795 | 795 | ), |
796 | 796 | 'declined_status' => array( |
797 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
798 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
797 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
798 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
799 | 799 | ), |
800 | 800 | 'cancelled_status' => array( |
801 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
802 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
801 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
802 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
803 | 803 | ) |
804 | 804 | ); |
805 | - return array_merge( $fc_items, $sc_items ); |
|
805 | + return array_merge($fc_items, $sc_items); |
|
806 | 806 | } |
807 | 807 | |
808 | 808 | |
@@ -815,15 +815,15 @@ discard block |
||
815 | 815 | |
816 | 816 | |
817 | 817 | protected function _registrations_overview_list_table() { |
818 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
819 | - if ( $EVT_ID ) { |
|
820 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
821 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
818 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
819 | + if ($EVT_ID) { |
|
820 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
821 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
822 | 822 | } |
823 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
824 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
823 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
824 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
825 | 825 | } |
826 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
826 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
827 | 827 | $this->display_admin_list_table_page_with_no_sidebar(); |
828 | 828 | } |
829 | 829 | |
@@ -838,19 +838,19 @@ discard block |
||
838 | 838 | */ |
839 | 839 | private function _set_registration_object() { |
840 | 840 | //get out if we've already set the object |
841 | - if ( is_object( $this->_registration )) { |
|
841 | + if (is_object($this->_registration)) { |
|
842 | 842 | return TRUE; |
843 | 843 | } |
844 | 844 | |
845 | 845 | $REG = EEM_Registration::instance(); |
846 | 846 | |
847 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
847 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
848 | 848 | |
849 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
849 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
850 | 850 | return TRUE; |
851 | 851 | else { |
852 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
853 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
852 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
853 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
854 | 854 | $this->_registration = NULL; |
855 | 855 | return FALSE; |
856 | 856 | } |
@@ -869,25 +869,25 @@ discard block |
||
869 | 869 | * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set) |
870 | 870 | * @return mixed (int|array) int = count || array of registration objects |
871 | 871 | */ |
872 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
873 | - |
|
874 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
875 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
876 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
877 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
878 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
879 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
872 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
873 | + |
|
874 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
875 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
876 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
877 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
878 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
879 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
880 | 880 | $start_date = FALSE; |
881 | 881 | $end_date = FALSE; |
882 | 882 | $_where = array(); |
883 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
884 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
883 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
884 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
885 | 885 | |
886 | 886 | //set orderby |
887 | 887 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
888 | 888 | |
889 | 889 | |
890 | - switch ( $this->_req_data['orderby'] ) { |
|
890 | + switch ($this->_req_data['orderby']) { |
|
891 | 891 | case '_REG_ID': |
892 | 892 | $orderby = 'REG_ID'; |
893 | 893 | break; |
@@ -907,26 +907,26 @@ discard block |
||
907 | 907 | $orderby = 'REG_date'; |
908 | 908 | } |
909 | 909 | |
910 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
911 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
912 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
910 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
911 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
912 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
913 | 913 | |
914 | 914 | |
915 | - $offset = ($current_page-1)*$per_page; |
|
916 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
915 | + $offset = ($current_page - 1) * $per_page; |
|
916 | + $limit = $count ? NULL : array($offset, $per_page); |
|
917 | 917 | |
918 | - if($EVT_ID){ |
|
919 | - $_where['EVT_ID']=$EVT_ID; |
|
918 | + if ($EVT_ID) { |
|
919 | + $_where['EVT_ID'] = $EVT_ID; |
|
920 | 920 | } |
921 | - if($CAT_ID){ |
|
921 | + if ($CAT_ID) { |
|
922 | 922 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
923 | 923 | } |
924 | - if ( $incomplete ) { |
|
924 | + if ($incomplete) { |
|
925 | 925 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
926 | 926 | } else if ( ! $trash) { |
927 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
927 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
928 | 928 | } |
929 | - if($reg_status){ |
|
929 | + if ($reg_status) { |
|
930 | 930 | $_where['STS_ID'] = $reg_status; |
931 | 931 | } |
932 | 932 | |
@@ -938,105 +938,105 @@ discard block |
||
938 | 938 | $time_start = ' 00:00:00'; |
939 | 939 | $time_end = ' 23:59:59'; |
940 | 940 | |
941 | - if($today_a || $today ){ |
|
941 | + if ($today_a || $today) { |
|
942 | 942 | $curdate = date('Y-m-d', current_time('timestamp')); |
943 | - $_where['REG_date']= array('BETWEEN', |
|
943 | + $_where['REG_date'] = array('BETWEEN', |
|
944 | 944 | array( |
945 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
946 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
945 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
946 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
947 | 947 | )); |
948 | - }elseif($this_month_a || $this_month){ |
|
948 | + }elseif ($this_month_a || $this_month) { |
|
949 | 949 | $this_month_r = date('m', current_time('timestamp')); |
950 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
951 | - $_where['REG_date']= array('BETWEEN', |
|
950 | + $days_this_month = date('t', current_time('timestamp')); |
|
951 | + $_where['REG_date'] = array('BETWEEN', |
|
952 | 952 | array( |
953 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
954 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
953 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
954 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
955 | 955 | )); |
956 | - }elseif($month_range){ |
|
956 | + }elseif ($month_range) { |
|
957 | 957 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
958 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
959 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
960 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
961 | - $_where['REG_date']= array('BETWEEN', |
|
962 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
963 | - }elseif($start_date && $end_date){ |
|
958 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
959 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
960 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
961 | + $_where['REG_date'] = array('BETWEEN', |
|
962 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
963 | + }elseif ($start_date && $end_date) { |
|
964 | 964 | throw new EE_Error("not yet supported"); |
965 | - }elseif($start_date){ |
|
965 | + }elseif ($start_date) { |
|
966 | 966 | throw new EE_Error("not yet supported"); |
967 | - }elseif($end_date){ |
|
967 | + }elseif ($end_date) { |
|
968 | 968 | throw new EE_Error("not yet supported"); |
969 | 969 | } |
970 | 970 | |
971 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
972 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
971 | + if ( ! empty($this->_req_data['s'])) { |
|
972 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
973 | 973 | $_where['OR'] = array( |
974 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
975 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
976 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
977 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
978 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
979 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
980 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
981 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
982 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
983 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
984 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
985 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
986 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
987 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
988 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
989 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
990 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
991 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
974 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
975 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
976 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
977 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
978 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
979 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
980 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
981 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
982 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
983 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
984 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
985 | + 'REG_final_price' => array('LIKE', $sstr), |
|
986 | + 'REG_code' => array('LIKE', $sstr), |
|
987 | + 'REG_count' => array('LIKE', $sstr), |
|
988 | + 'REG_group_size' => array('LIKE', $sstr), |
|
989 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
990 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
991 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
992 | 992 | ); |
993 | 993 | } |
994 | 994 | |
995 | 995 | //capability checks |
996 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
996 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
997 | 997 | $_where['AND'] = array( |
998 | 998 | 'Event.EVT_wp_user' => get_current_user_id() |
999 | 999 | ); |
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | |
1003 | - if( $count ){ |
|
1004 | - if ( $trash ) { |
|
1005 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1006 | - } else if ( $incomplete ) { |
|
1007 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1003 | + if ($count) { |
|
1004 | + if ($trash) { |
|
1005 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1006 | + } else if ($incomplete) { |
|
1007 | + return EEM_Registration::instance()->count(array($_where)); |
|
1008 | 1008 | } else { |
1009 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1009 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1010 | 1010 | } |
1011 | 1011 | } else { |
1012 | 1012 | //make sure we remove default where conditions cause all registrations matching query are returned |
1013 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1014 | - if ( $per_page !== -1 ) { |
|
1013 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1014 | + if ($per_page !== -1) { |
|
1015 | 1015 | $query_params['limit'] = $limit; |
1016 | 1016 | } |
1017 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1017 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1018 | 1018 | |
1019 | 1019 | |
1020 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1020 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1021 | 1021 | $first_registration = $registrations[0]; |
1022 | 1022 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1023 | 1023 | $event_name = $first_registration->event_obj()->name(); |
1024 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1024 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1025 | 1025 | // edit event link |
1026 | - if ( $event_name != '' ) { |
|
1027 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1028 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1029 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1026 | + if ($event_name != '') { |
|
1027 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1028 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1029 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1033 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1032 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1033 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1034 | 1034 | |
1035 | 1035 | $this->_template_args['before_admin_page_content'] = ' |
1036 | 1036 | <div id="admin-page-header"> |
1037 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1038 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1039 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1037 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1038 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1039 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1040 | 1040 | </div> |
1041 | 1041 | '; |
1042 | 1042 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | |
1075 | 1075 | $this->_set_registration_object(); |
1076 | 1076 | |
1077 | - if ( is_object( $this->_registration )) { |
|
1077 | + if (is_object($this->_registration)) { |
|
1078 | 1078 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1079 | 1079 | $this->_session = $transaction->session_data(); |
1080 | 1080 | |
@@ -1082,10 +1082,10 @@ discard block |
||
1082 | 1082 | |
1083 | 1083 | |
1084 | 1084 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1085 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1085 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1086 | 1086 | |
1087 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y','g:i:s a') ; |
|
1088 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1087 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); |
|
1088 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1089 | 1089 | |
1090 | 1090 | $this->_template_args['grand_total'] = $transaction->total(); |
1091 | 1091 | |
@@ -1093,19 +1093,19 @@ discard block |
||
1093 | 1093 | // link back to overview |
1094 | 1094 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1095 | 1095 | $this->_template_args['registration'] = $this->_registration; |
1096 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1097 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1098 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1096 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1097 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1098 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1099 | 1099 | |
1100 | 1100 | //next and previous links |
1101 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1102 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1103 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1104 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1101 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1102 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1103 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1104 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1105 | 1105 | |
1106 | 1106 | // grab header |
1107 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1108 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1107 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1108 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1109 | 1109 | |
1110 | 1110 | } else { |
1111 | 1111 | |
@@ -1124,17 +1124,17 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | |
1126 | 1126 | protected function _registration_details_metaboxes() { |
1127 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1127 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1128 | 1128 | $this->_set_registration_object(); |
1129 | 1129 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1130 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1131 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1132 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1133 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1130 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1131 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1132 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1133 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1134 | 1134 | } |
1135 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1136 | - if ( $this->_registration->group_size() > 1 ) { |
|
1137 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1135 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1136 | + if ($this->_registration->group_size() > 1) { |
|
1137 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1138 | 1138 | } |
1139 | 1139 | } |
1140 | 1140 | |
@@ -1155,23 +1155,23 @@ discard block |
||
1155 | 1155 | |
1156 | 1156 | //let's get an array of all possible buttons that we can just reference |
1157 | 1157 | $status_buttons = $this->_get_reg_status_buttons(); |
1158 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1159 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1158 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1159 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1160 | 1160 | $template_args['attendee'] = $this->_registration->attendee(); |
1161 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1162 | - if ( $this->_set_registration_object() ) { |
|
1161 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1162 | + if ($this->_set_registration_object()) { |
|
1163 | 1163 | $current_status = $this->_registration->status_ID(); |
1164 | - unset( $status_buttons[$current_status] ); |
|
1165 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1166 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1164 | + unset($status_buttons[$current_status]); |
|
1165 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1166 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1167 | 1167 | } |
1168 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1168 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1169 | 1169 | } |
1170 | 1170 | $template_args['form_url'] = REG_ADMIN_URL; |
1171 | 1171 | $template_args['REG_ID'] = $this->_registration->ID(); |
1172 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1172 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1173 | 1173 | |
1174 | - EEH_Template::display_template( $template, $template_args ); |
|
1174 | + EEH_Template::display_template($template, $template_args); |
|
1175 | 1175 | |
1176 | 1176 | } |
1177 | 1177 | |
@@ -1185,11 +1185,11 @@ discard block |
||
1185 | 1185 | private function _get_reg_status_buttons() { |
1186 | 1186 | |
1187 | 1187 | $buttons = array( |
1188 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1189 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1190 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1191 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1192 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1188 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1189 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1190 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1191 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1192 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1193 | 1193 | ); |
1194 | 1194 | return $buttons; |
1195 | 1195 | } |
@@ -1203,13 +1203,13 @@ discard block |
||
1203 | 1203 | * |
1204 | 1204 | * @return array (array with reg_id(s) updated and whether update was successful. |
1205 | 1205 | */ |
1206 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1207 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1206 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1207 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1208 | 1208 | |
1209 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1209 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1210 | 1210 | |
1211 | 1211 | //notify? |
1212 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1212 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1213 | 1213 | $this->_process_resend_registration(); |
1214 | 1214 | } |
1215 | 1215 | |
@@ -1227,19 +1227,19 @@ discard block |
||
1227 | 1227 | * @param bool $status |
1228 | 1228 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1229 | 1229 | */ |
1230 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1230 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1231 | 1231 | $success = true; |
1232 | 1232 | // set default status if none is passed |
1233 | 1233 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1234 | 1234 | |
1235 | 1235 | //typecast and sanitize reg_id |
1236 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1236 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1237 | 1237 | |
1238 | 1238 | //loop through REG_ID's and change status |
1239 | - foreach ( $reg_ids as $r_id ) { |
|
1240 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1241 | - if ( $registration instanceof EE_Registration ) { |
|
1242 | - $registration->set_status( $status ); |
|
1239 | + foreach ($reg_ids as $r_id) { |
|
1240 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1241 | + if ($registration instanceof EE_Registration) { |
|
1242 | + $registration->set_status($status); |
|
1243 | 1243 | $result = $registration->save(); |
1244 | 1244 | |
1245 | 1245 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | $this->_req_data['_REG_ID'] = $reg_ids; |
1252 | 1252 | |
1253 | 1253 | //return $success and processed registrations |
1254 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1254 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
@@ -1263,37 +1263,37 @@ discard block |
||
1263 | 1263 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1264 | 1264 | * @return void |
1265 | 1265 | */ |
1266 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1266 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1267 | 1267 | |
1268 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1268 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1269 | 1269 | |
1270 | 1270 | |
1271 | - $success = isset( $result['success'] ) && $result['success']; |
|
1271 | + $success = isset($result['success']) && $result['success']; |
|
1272 | 1272 | |
1273 | 1273 | //setup success message |
1274 | - if ( $success ) { |
|
1275 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1276 | - EE_Error::add_success( $msg ); |
|
1274 | + if ($success) { |
|
1275 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1276 | + EE_Error::add_success($msg); |
|
1277 | 1277 | } else { |
1278 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1278 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1279 | 1279 | } |
1280 | 1280 | |
1281 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1281 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1282 | 1282 | //unset nonces |
1283 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1284 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1285 | - unset( $this->_req_data[$ref] ); |
|
1283 | + foreach ($this->_req_data as $ref => $value) { |
|
1284 | + if (strpos($ref, 'nonce') !== false) { |
|
1285 | + unset($this->_req_data[$ref]); |
|
1286 | 1286 | continue; |
1287 | 1287 | } |
1288 | 1288 | |
1289 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1289 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1290 | 1290 | $this->_req_data[$ref] = $value; |
1291 | 1291 | } |
1292 | 1292 | |
1293 | 1293 | //merge request vars so that the reloaded list table contains any existing filter query params |
1294 | - $route = array_merge( $this->_req_data, $route ); |
|
1294 | + $route = array_merge($this->_req_data, $route); |
|
1295 | 1295 | |
1296 | - $this->_redirect_after_action( $success, '', '', $route, true ); |
|
1296 | + $this->_redirect_after_action($success, '', '', $route, true); |
|
1297 | 1297 | |
1298 | 1298 | } |
1299 | 1299 | |
@@ -1306,29 +1306,29 @@ discard block |
||
1306 | 1306 | protected function _change_reg_status() { |
1307 | 1307 | $this->_req_data['return'] = 'view_registration'; |
1308 | 1308 | //set notify based on whether the send notifications toggle is set or not |
1309 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1310 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1309 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1310 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1311 | 1311 | |
1312 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1313 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1314 | - $this->approve_registration( $notify ); |
|
1312 | + switch ($this->_req_data['_reg_status_id']) { |
|
1313 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1314 | + $this->approve_registration($notify); |
|
1315 | 1315 | break; |
1316 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1317 | - $this->pending_registration( $notify ); |
|
1316 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1317 | + $this->pending_registration($notify); |
|
1318 | 1318 | break; |
1319 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1320 | - $this->not_approve_registration( $notify ); |
|
1319 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1320 | + $this->not_approve_registration($notify); |
|
1321 | 1321 | break; |
1322 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1323 | - $this->decline_registration( $notify ); |
|
1322 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1323 | + $this->decline_registration($notify); |
|
1324 | 1324 | break; |
1325 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1326 | - $this->cancel_registration( $notify ); |
|
1325 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1326 | + $this->cancel_registration($notify); |
|
1327 | 1327 | break; |
1328 | 1328 | default : |
1329 | 1329 | $result['success'] = false; |
1330 | - unset( $this->_req_data['return'] ); |
|
1331 | - $this->_reg_status_change_return( '', false ); |
|
1330 | + unset($this->_req_data['return']); |
|
1331 | + $this->_reg_status_change_return('', false); |
|
1332 | 1332 | break; |
1333 | 1333 | } |
1334 | 1334 | } |
@@ -1341,8 +1341,8 @@ discard block |
||
1341 | 1341 | * @param bool $notify whether or not to notify the registrant about their approval. |
1342 | 1342 | * @return void |
1343 | 1343 | */ |
1344 | - protected function approve_registration( $notify = false ) { |
|
1345 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1344 | + protected function approve_registration($notify = false) { |
|
1345 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | |
@@ -1354,8 +1354,8 @@ discard block |
||
1354 | 1354 | * @param bool $notify whether or not to notify the registrant about their approval. |
1355 | 1355 | * @return void |
1356 | 1356 | */ |
1357 | - protected function decline_registration( $notify = false ) { |
|
1358 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1357 | + protected function decline_registration($notify = false) { |
|
1358 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1359 | 1359 | } |
1360 | 1360 | |
1361 | 1361 | |
@@ -1367,8 +1367,8 @@ discard block |
||
1367 | 1367 | * @param bool $notify whether or not to notify the registrant about their approval. |
1368 | 1368 | * @return void |
1369 | 1369 | */ |
1370 | - protected function cancel_registration( $notify = false ) { |
|
1371 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1370 | + protected function cancel_registration($notify = false) { |
|
1371 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | |
@@ -1381,8 +1381,8 @@ discard block |
||
1381 | 1381 | * @param bool $notify whether or not to notify the registrant about their approval. |
1382 | 1382 | * @return void |
1383 | 1383 | */ |
1384 | - protected function not_approve_registration( $notify = false ) { |
|
1385 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1384 | + protected function not_approve_registration($notify = false) { |
|
1385 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | |
@@ -1393,8 +1393,8 @@ discard block |
||
1393 | 1393 | * @param bool $notify whether or not to notify the registrant about their approval. |
1394 | 1394 | * @return void |
1395 | 1395 | */ |
1396 | - protected function pending_registration( $notify = false ) { |
|
1397 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1396 | + protected function pending_registration($notify = false) { |
|
1397 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1398 | 1398 | } |
1399 | 1399 | |
1400 | 1400 | |
@@ -1408,75 +1408,75 @@ discard block |
||
1408 | 1408 | public function _reg_details_meta_box() { |
1409 | 1409 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1410 | 1410 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1411 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1411 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1412 | 1412 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1413 | 1413 | $this->_session = $transaction->session_data(); |
1414 | 1414 | |
1415 | 1415 | $filters = new EE_Line_Item_Filter_Collection(); |
1416 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1417 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1418 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1416 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1417 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1418 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1419 | 1419 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1420 | 1420 | |
1421 | 1421 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1422 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1423 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1422 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1423 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1424 | 1424 | |
1425 | 1425 | |
1426 | 1426 | $attendee = $this->_registration->attendee(); |
1427 | 1427 | |
1428 | 1428 | |
1429 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1430 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1429 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1430 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1431 | 1431 | |
1432 | 1432 | |
1433 | 1433 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1434 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1434 | + $payment = $transaction->get_first_related('Payment'); |
|
1435 | 1435 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1436 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1436 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1437 | 1437 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1438 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1438 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1439 | 1439 | $reg_details = array( |
1440 | 1440 | 'payment_method' => $payment_method->name(), |
1441 | 1441 | 'response_msg' => $payment->gateway_response(), |
1442 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1442 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1443 | 1443 | 'registration_session' => $this->_registration->session_ID(), |
1444 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1445 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1444 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1445 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1446 | 1446 | ); |
1447 | 1447 | |
1448 | 1448 | |
1449 | - if ( isset( $reg_details['registration_id'] )) { |
|
1449 | + if (isset($reg_details['registration_id'])) { |
|
1450 | 1450 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1451 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1451 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1452 | 1452 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1453 | 1453 | } |
1454 | 1454 | |
1455 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1455 | + if (isset($reg_details['payment_method'])) { |
|
1456 | 1456 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1457 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1457 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1458 | 1458 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1459 | 1459 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1460 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1460 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1461 | 1461 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1465 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1465 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1466 | 1466 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1467 | 1467 | |
1468 | 1468 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1469 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1469 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1470 | 1470 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1471 | 1471 | |
1472 | 1472 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1473 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1473 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1474 | 1474 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1475 | 1475 | |
1476 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1476 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1477 | 1477 | |
1478 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1479 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1478 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1479 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1480 | 1480 | |
1481 | 1481 | } |
1482 | 1482 | |
@@ -1490,14 +1490,14 @@ discard block |
||
1490 | 1490 | */ |
1491 | 1491 | public function _reg_questions_meta_box() { |
1492 | 1492 | //allow someone to override this method entirely |
1493 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1494 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1495 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1493 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1494 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1495 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1496 | 1496 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1497 | 1497 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1498 | 1498 | |
1499 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1500 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1499 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1500 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1501 | 1501 | } |
1502 | 1502 | } |
1503 | 1503 | |
@@ -1511,12 +1511,12 @@ discard block |
||
1511 | 1511 | * @param string $output |
1512 | 1512 | * @return string |
1513 | 1513 | */ |
1514 | - public function form_before_question_group( $output ) { |
|
1514 | + public function form_before_question_group($output) { |
|
1515 | 1515 | EE_Error::doing_it_wrong( |
1516 | - __CLASS__ . '::' . __FUNCTION__, |
|
1517 | - __( 'This method would have been protected but was used on a filter callback' |
|
1516 | + __CLASS__.'::'.__FUNCTION__, |
|
1517 | + __('This method would have been protected but was used on a filter callback' |
|
1518 | 1518 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1519 | - 'event_espresso' ), |
|
1519 | + 'event_espresso'), |
|
1520 | 1520 | '4.8.32.rc.000' |
1521 | 1521 | ); |
1522 | 1522 | return ' |
@@ -1535,20 +1535,20 @@ discard block |
||
1535 | 1535 | * @param string $output |
1536 | 1536 | * @return string |
1537 | 1537 | */ |
1538 | - public function form_after_question_group( $output ) { |
|
1538 | + public function form_after_question_group($output) { |
|
1539 | 1539 | EE_Error::doing_it_wrong( |
1540 | - __CLASS__ . '::' . __FUNCTION__, |
|
1541 | - __( 'This method would have been protected but was used on a filter callback' |
|
1540 | + __CLASS__.'::'.__FUNCTION__, |
|
1541 | + __('This method would have been protected but was used on a filter callback' |
|
1542 | 1542 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1543 | - 'event_espresso' ), |
|
1543 | + 'event_espresso'), |
|
1544 | 1544 | '4.8.32.rc.000' |
1545 | 1545 | ); |
1546 | 1546 | return ' |
1547 | 1547 | <tr class="hide-if-no-js"> |
1548 | 1548 | <th> </th> |
1549 | 1549 | <td class="reg-admin-edit-attendee-question-td"> |
1550 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1551 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1550 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1551 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1552 | 1552 | <div class="dashicons dashicons-edit"></div> |
1553 | 1553 | </a> |
1554 | 1554 | </td> |
@@ -1568,18 +1568,18 @@ discard block |
||
1568 | 1568 | * @param string $label |
1569 | 1569 | * @return string |
1570 | 1570 | */ |
1571 | - public function form_form_field_label_wrap( $label ) { |
|
1571 | + public function form_form_field_label_wrap($label) { |
|
1572 | 1572 | EE_Error::doing_it_wrong( |
1573 | - __CLASS__ . '::' . __FUNCTION__, |
|
1574 | - __( 'This method would have been protected but was used on a filter callback' |
|
1573 | + __CLASS__.'::'.__FUNCTION__, |
|
1574 | + __('This method would have been protected but was used on a filter callback' |
|
1575 | 1575 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1576 | - 'event_espresso' ), |
|
1576 | + 'event_espresso'), |
|
1577 | 1577 | '4.8.32.rc.000' |
1578 | 1578 | ); |
1579 | 1579 | return ' |
1580 | 1580 | <tr> |
1581 | 1581 | <th> |
1582 | - ' . $label . ' |
|
1582 | + ' . $label.' |
|
1583 | 1583 | </th>'; |
1584 | 1584 | } |
1585 | 1585 | |
@@ -1593,17 +1593,17 @@ discard block |
||
1593 | 1593 | * @param string $input |
1594 | 1594 | * @return string |
1595 | 1595 | */ |
1596 | - public function form_form_field_input__wrap( $input ) { |
|
1596 | + public function form_form_field_input__wrap($input) { |
|
1597 | 1597 | EE_Error::doing_it_wrong( |
1598 | - __CLASS__ . '::' . __FUNCTION__, |
|
1599 | - __( 'This method would have been protected but was used on a filter callback' |
|
1598 | + __CLASS__.'::'.__FUNCTION__, |
|
1599 | + __('This method would have been protected but was used on a filter callback' |
|
1600 | 1600 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1601 | - 'event_espresso' ), |
|
1601 | + 'event_espresso'), |
|
1602 | 1602 | '4.8.32.rc.000' |
1603 | 1603 | ); |
1604 | 1604 | return ' |
1605 | 1605 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1606 | - ' . $input . ' |
|
1606 | + ' . $input.' |
|
1607 | 1607 | </td> |
1608 | 1608 | </tr>'; |
1609 | 1609 | } |
@@ -1617,14 +1617,14 @@ discard block |
||
1617 | 1617 | * @return void |
1618 | 1618 | */ |
1619 | 1619 | protected function _update_attendee_registration_form() { |
1620 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1621 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1622 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1623 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1624 | - if( $success ) { |
|
1620 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1621 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1622 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1623 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1624 | + if ($success) { |
|
1625 | 1625 | $what = __('Registration Form', 'event_espresso'); |
1626 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1627 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1626 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1627 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1628 | 1628 | } |
1629 | 1629 | } |
1630 | 1630 | } |
@@ -1635,11 +1635,11 @@ discard block |
||
1635 | 1635 | * @param int $REG_ID |
1636 | 1636 | * @return EE_Registration_Custom_Questions_Form |
1637 | 1637 | */ |
1638 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1639 | - if( ! $this->_reg_custom_questions_form ) { |
|
1640 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1641 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1642 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1638 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1639 | + if ( ! $this->_reg_custom_questions_form) { |
|
1640 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1641 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1642 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1643 | 1643 | } |
1644 | 1644 | return $this->_reg_custom_questions_form; |
1645 | 1645 | } |
@@ -1652,17 +1652,17 @@ discard block |
||
1652 | 1652 | * @param bool $REG_ID |
1653 | 1653 | * @return bool |
1654 | 1654 | */ |
1655 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1655 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1656 | 1656 | |
1657 | 1657 | if ( ! $REG_ID) { |
1658 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1658 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1659 | 1659 | } |
1660 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1661 | - $form->receive_form_submission( $this->_req_data ); |
|
1660 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1661 | + $form->receive_form_submission($this->_req_data); |
|
1662 | 1662 | $success = false; |
1663 | - if( $form->is_valid() ) { |
|
1664 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1665 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1663 | + if ($form->is_valid()) { |
|
1664 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1665 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1666 | 1666 | $where_conditions = array( |
1667 | 1667 | 'QST_ID' => $question_id, |
1668 | 1668 | 'REG_ID' => $REG_ID |
@@ -1670,19 +1670,19 @@ discard block |
||
1670 | 1670 | $possibly_new_values = array( |
1671 | 1671 | 'ANS_value' => $input->normalized_value() |
1672 | 1672 | ); |
1673 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1674 | - if( $answer instanceof EE_Answer ) { |
|
1675 | - $success = $answer->save( $possibly_new_values ); |
|
1673 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1674 | + if ($answer instanceof EE_Answer) { |
|
1675 | + $success = $answer->save($possibly_new_values); |
|
1676 | 1676 | } else { |
1677 | 1677 | //insert it then |
1678 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1679 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1678 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1679 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1680 | 1680 | $success = $answer->save(); |
1681 | 1681 | } |
1682 | 1682 | } |
1683 | 1683 | } |
1684 | 1684 | } else { |
1685 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1685 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1686 | 1686 | } |
1687 | 1687 | return $success; |
1688 | 1688 | } |
@@ -1700,30 +1700,30 @@ discard block |
||
1700 | 1700 | $registrations = $REG->get_all(array( |
1701 | 1701 | array( |
1702 | 1702 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1703 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1703 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1704 | 1704 | ), |
1705 | 1705 | 'force_join'=>array('Attendee'))); |
1706 | 1706 | |
1707 | 1707 | $this->_template_args['attendees'] = array(); |
1708 | 1708 | $this->_template_args['attendee_notice'] = ''; |
1709 | 1709 | EE_Registry::instance()->load_helper('Array'); |
1710 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1711 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1710 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1711 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1712 | 1712 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1713 | 1713 | } else { |
1714 | 1714 | |
1715 | 1715 | $att_nmbr = 1; |
1716 | - foreach ( $registrations as $registration ) { |
|
1716 | + foreach ($registrations as $registration) { |
|
1717 | 1717 | /* @var $registration EE_Registration */ |
1718 | 1718 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1719 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1720 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1721 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1722 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1719 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1720 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1721 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1722 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1723 | 1723 | |
1724 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1724 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1725 | 1725 | |
1726 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1726 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1727 | 1727 | |
1728 | 1728 | $att_nmbr++; |
1729 | 1729 | } |
@@ -1735,8 +1735,8 @@ discard block |
||
1735 | 1735 | |
1736 | 1736 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1737 | 1737 | } |
1738 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1739 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1738 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1739 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1740 | 1740 | |
1741 | 1741 | } |
1742 | 1742 | |
@@ -1757,11 +1757,11 @@ discard block |
||
1757 | 1757 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1758 | 1758 | |
1759 | 1759 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1760 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1760 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1761 | 1761 | $primary_registration = $this->_registration->get_primary_registration(); |
1762 | 1762 | $primary_attendee = $primary_registration->attendee(); |
1763 | 1763 | |
1764 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1764 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1765 | 1765 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1766 | 1766 | $primary_registration = NULL; |
1767 | 1767 | } |
@@ -1770,28 +1770,28 @@ discard block |
||
1770 | 1770 | } |
1771 | 1771 | |
1772 | 1772 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1773 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1774 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1775 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1773 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1774 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1775 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1776 | 1776 | $this->_template_args['phone'] = $attendee->phone(); |
1777 | 1777 | |
1778 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1779 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1778 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1779 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1780 | 1780 | |
1781 | 1781 | |
1782 | 1782 | //edit link |
1783 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1784 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1783 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1784 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1785 | 1785 | |
1786 | 1786 | //create link |
1787 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1787 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1788 | 1788 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1789 | 1789 | |
1790 | 1790 | $this->_template_args['att_check'] = $att_check; |
1791 | 1791 | |
1792 | 1792 | |
1793 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1794 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1793 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1794 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1795 | 1795 | } |
1796 | 1796 | |
1797 | 1797 | |
@@ -1804,7 +1804,7 @@ discard block |
||
1804 | 1804 | * @access protected |
1805 | 1805 | * @return void |
1806 | 1806 | */ |
1807 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1807 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1808 | 1808 | $REGM = EEM_Registration::instance(); |
1809 | 1809 | |
1810 | 1810 | $success = 1; |
@@ -1814,26 +1814,26 @@ discard block |
||
1814 | 1814 | $dtts = array(); |
1815 | 1815 | |
1816 | 1816 | //if empty _REG_ID then get out because there's nothing to do |
1817 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1817 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1818 | 1818 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1819 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1820 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1819 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1820 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | //Checkboxes |
1824 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1824 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1825 | 1825 | // if array has more than one element than success message should be plural |
1826 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1826 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1827 | 1827 | // cycle thru checkboxes |
1828 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1828 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1829 | 1829 | |
1830 | 1830 | $REG = $REGM->get_one_by_ID($REG_ID); |
1831 | 1831 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1832 | - if ( $payment_count > 0 ) { |
|
1833 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1832 | + if ($payment_count > 0) { |
|
1833 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1834 | 1834 | $error = 1; |
1835 | 1835 | $success = 0; |
1836 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1836 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1837 | 1837 | continue; //can't trash this registration because it has payments. |
1838 | 1838 | } |
1839 | 1839 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1842,7 +1842,7 @@ discard block |
||
1842 | 1842 | $dtts = array_merge($dtts, $dtt); |
1843 | 1843 | |
1844 | 1844 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1845 | - if ( !$updated ) { |
|
1845 | + if ( ! $updated) { |
|
1846 | 1846 | $success = 0; |
1847 | 1847 | } else { |
1848 | 1848 | $success = 2; |
@@ -1857,7 +1857,7 @@ discard block |
||
1857 | 1857 | $tickets[$ticket->ID()] = $ticket; |
1858 | 1858 | $dtts = $ticket->get_many_related('Datetime'); |
1859 | 1859 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1860 | - if ( ! $updated ) { |
|
1860 | + if ( ! $updated) { |
|
1861 | 1861 | $success = 0; |
1862 | 1862 | } |
1863 | 1863 | |
@@ -1867,10 +1867,10 @@ discard block |
||
1867 | 1867 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1868 | 1868 | EEM_Datetime::instance()->update_sold($dtts); |
1869 | 1869 | |
1870 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1871 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1870 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1871 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1872 | 1872 | $overwrite_msgs = $error ? TRUE : FALSE; |
1873 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1873 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1874 | 1874 | } |
1875 | 1875 | |
1876 | 1876 | |
@@ -1894,16 +1894,16 @@ discard block |
||
1894 | 1894 | $success = 1; |
1895 | 1895 | |
1896 | 1896 | //Checkboxes |
1897 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1897 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1898 | 1898 | // if array has more than one element than success message should be plural |
1899 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1899 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1900 | 1900 | // cycle thru checkboxes |
1901 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1901 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1902 | 1902 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1903 | - if ( ! $REG instanceof EE_Registration ) |
|
1903 | + if ( ! $REG instanceof EE_Registration) |
|
1904 | 1904 | continue; |
1905 | 1905 | $deleted = $this->_delete_registration($REG); |
1906 | - if ( !$deleted ) { |
|
1906 | + if ( ! $deleted) { |
|
1907 | 1907 | $success = 0; |
1908 | 1908 | } |
1909 | 1909 | } |
@@ -1913,15 +1913,15 @@ discard block |
||
1913 | 1913 | $REG_ID = $this->_req_data['_REG_ID']; |
1914 | 1914 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1915 | 1915 | $deleted = $this->_delete_registration($REG); |
1916 | - if ( ! $deleted ) { |
|
1916 | + if ( ! $deleted) { |
|
1917 | 1917 | $success = 0; |
1918 | 1918 | } |
1919 | 1919 | |
1920 | 1920 | } |
1921 | 1921 | |
1922 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1923 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1924 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1922 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1923 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1924 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1925 | 1925 | } |
1926 | 1926 | |
1927 | 1927 | |
@@ -1933,31 +1933,31 @@ discard block |
||
1933 | 1933 | * @param EE_Registration $REG registration to be deleted permenantly |
1934 | 1934 | * @return boolean true = successful deletion, false = fail. |
1935 | 1935 | */ |
1936 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1936 | + protected function _delete_registration(EE_Registration $REG) { |
|
1937 | 1937 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1938 | 1938 | $TXN = $REG->get_first_related('Transaction'); |
1939 | 1939 | $REGS = $TXN->get_many_related('Registration'); |
1940 | 1940 | |
1941 | 1941 | $all_trashed = TRUE; |
1942 | - foreach ( $REGS as $registration ) { |
|
1943 | - if ( ! $registration->get('REG_deleted') ) |
|
1942 | + foreach ($REGS as $registration) { |
|
1943 | + if ( ! $registration->get('REG_deleted')) |
|
1944 | 1944 | $all_trashed = FALSE; |
1945 | 1945 | } |
1946 | 1946 | |
1947 | - if ( ! $all_trashed ) { |
|
1948 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1947 | + if ( ! $all_trashed) { |
|
1948 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1949 | 1949 | return false; |
1950 | 1950 | } |
1951 | 1951 | |
1952 | 1952 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1953 | - foreach ( $REGS as $registration ) { |
|
1953 | + foreach ($REGS as $registration) { |
|
1954 | 1954 | |
1955 | 1955 | //delete related answers |
1956 | 1956 | $registration->delete_related_permanently('Answer'); |
1957 | 1957 | |
1958 | 1958 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1959 | 1959 | $attendee = $registration->get_first_related('Attendee'); |
1960 | - if ( $attendee instanceof EE_Attendee ) { |
|
1960 | + if ($attendee instanceof EE_Attendee) { |
|
1961 | 1961 | $registration->_remove_relation_to($attendee, 'Attendee'); |
1962 | 1962 | } |
1963 | 1963 | |
@@ -1967,7 +1967,7 @@ discard block |
||
1967 | 1967 | //now delete permanently the checkins related to this registration. |
1968 | 1968 | $registration->delete_related_permanently('Checkin'); |
1969 | 1969 | |
1970 | - if ( $registration->ID() === $REG->ID() ) |
|
1970 | + if ($registration->ID() === $REG->ID()) |
|
1971 | 1971 | continue; //we don't want to delete permanently the existing registration just yet. |
1972 | 1972 | |
1973 | 1973 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2000,34 +2000,34 @@ discard block |
||
2000 | 2000 | * @return void |
2001 | 2001 | */ |
2002 | 2002 | public function new_registration() { |
2003 | - if ( ! $this->_set_reg_event() ) { |
|
2004 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2003 | + if ( ! $this->_set_reg_event()) { |
|
2004 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2005 | 2005 | } |
2006 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2006 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2007 | 2007 | |
2008 | 2008 | // gotta start with a clean slate if we're not coming here via ajax |
2009 | - if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) { |
|
2010 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2009 | + if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) { |
|
2010 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2011 | 2011 | } |
2012 | 2012 | |
2013 | - $this->_template_args['event_name'] = '' ; |
|
2013 | + $this->_template_args['event_name'] = ''; |
|
2014 | 2014 | // event name |
2015 | - if ( $this->_reg_event ) { |
|
2015 | + if ($this->_reg_event) { |
|
2016 | 2016 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2017 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2018 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2019 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2017 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2018 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2019 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2020 | 2020 | } |
2021 | 2021 | |
2022 | 2022 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2023 | 2023 | |
2024 | - if ( defined('DOING_AJAX' ) ) |
|
2024 | + if (defined('DOING_AJAX')) |
|
2025 | 2025 | $this->_return_json(); |
2026 | 2026 | |
2027 | 2027 | |
2028 | 2028 | // grab header |
2029 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2030 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2029 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2030 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2031 | 2031 | |
2032 | 2032 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2033 | 2033 | // the details template wrapper |
@@ -2045,7 +2045,7 @@ discard block |
||
2045 | 2045 | */ |
2046 | 2046 | protected function _get_registration_step_content() { |
2047 | 2047 | |
2048 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php'; |
|
2048 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php'; |
|
2049 | 2049 | $template_args = array( |
2050 | 2050 | 'title' => '', |
2051 | 2051 | 'content' => '', |
@@ -2066,11 +2066,11 @@ discard block |
||
2066 | 2066 | |
2067 | 2067 | //if the cart is empty then we know we're at step one so we'll display ticket selector |
2068 | 2068 | $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
2069 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2070 | - switch ( $step ) { |
|
2069 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2070 | + switch ($step) { |
|
2071 | 2071 | case 'ticket' : |
2072 | 2072 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2073 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2073 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2074 | 2074 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2075 | 2075 | $template_args['show_notification_toggle'] = FALSE; |
2076 | 2076 | break; |
@@ -2083,9 +2083,9 @@ discard block |
||
2083 | 2083 | break; |
2084 | 2084 | } |
2085 | 2085 | |
2086 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2086 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2087 | 2087 | |
2088 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
2088 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
2089 | 2089 | } |
2090 | 2090 | |
2091 | 2091 | |
@@ -2099,11 +2099,11 @@ discard block |
||
2099 | 2099 | * @return boolean |
2100 | 2100 | */ |
2101 | 2101 | private function _set_reg_event() { |
2102 | - if ( is_object( $this->_reg_event )) { |
|
2102 | + if (is_object($this->_reg_event)) { |
|
2103 | 2103 | return TRUE; |
2104 | 2104 | } |
2105 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2106 | - if ( ! $EVT_ID ) { |
|
2105 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2106 | + if ( ! $EVT_ID) { |
|
2107 | 2107 | return FALSE; |
2108 | 2108 | } |
2109 | 2109 | |
@@ -2124,62 +2124,62 @@ discard block |
||
2124 | 2124 | public function process_reg_step() { |
2125 | 2125 | |
2126 | 2126 | $this->_set_reg_event(); |
2127 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2127 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2128 | 2128 | |
2129 | 2129 | //what step are we on? |
2130 | - $cart = EE_Registry::instance()->SSN->get_session_data( 'cart' ); |
|
2131 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2130 | + $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
|
2131 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2132 | 2132 | |
2133 | 2133 | //if doing ajax then we need to verify the nonce |
2134 | - if ( 'DOING_AJAX' ) { |
|
2135 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2136 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2134 | + if ('DOING_AJAX') { |
|
2135 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2136 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2137 | 2137 | } |
2138 | 2138 | |
2139 | - switch ( $step ) { |
|
2139 | + switch ($step) { |
|
2140 | 2140 | case 'ticket' : |
2141 | 2141 | //process ticket selection |
2142 | 2142 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2143 | - if ( $success ) { |
|
2144 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2143 | + if ($success) { |
|
2144 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2145 | 2145 | } else { |
2146 | 2146 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2147 | 2147 | } |
2148 | - if ( defined('DOING_AJAX') ) { |
|
2148 | + if (defined('DOING_AJAX')) { |
|
2149 | 2149 | $this->new_registration(); //display next step |
2150 | 2150 | } else { |
2151 | 2151 | $query_args['action'] = 'new_registration'; |
2152 | 2152 | $query_args['processing_registration'] = true; |
2153 | 2153 | $query_args['event_id'] = $this->_reg_event->ID(); |
2154 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2154 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2155 | 2155 | } |
2156 | 2156 | break; |
2157 | 2157 | case 'questions' : |
2158 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2159 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2158 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2159 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2160 | 2160 | } |
2161 | 2161 | //process registration |
2162 | 2162 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2163 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2163 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2164 | 2164 | $query_args = array( |
2165 | 2165 | 'action' => 'new_registration', |
2166 | 2166 | 'processing_registration' => true, |
2167 | 2167 | 'event_id' => $this->_reg_event->ID() |
2168 | 2168 | ); |
2169 | 2169 | |
2170 | - if ( defined('DOING_AJAX' )) { |
|
2170 | + if (defined('DOING_AJAX')) { |
|
2171 | 2171 | //display registration form again because there are errors (maybe validation?) |
2172 | 2172 | $this->new_registration(); |
2173 | 2173 | return; |
2174 | 2174 | } else { |
2175 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2175 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2176 | 2176 | return; |
2177 | 2177 | } |
2178 | 2178 | } |
2179 | 2179 | /** @type EE_Transaction_Payments $transaction_payments */ |
2180 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2180 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2181 | 2181 | // maybe update status, and make sure to save transaction if not done already |
2182 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2182 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2183 | 2183 | $transaction->save(); |
2184 | 2184 | } |
2185 | 2185 | $query_args = array( |
@@ -2187,8 +2187,8 @@ discard block |
||
2187 | 2187 | 'TXN_ID' => $transaction->ID(), |
2188 | 2188 | 'page' => 'espresso_transactions' |
2189 | 2189 | ); |
2190 | - EE_Error::add_success( __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') ); |
|
2191 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2190 | + EE_Error::add_success(__('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso')); |
|
2191 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2192 | 2192 | break; |
2193 | 2193 | } |
2194 | 2194 | |
@@ -2208,7 +2208,7 @@ discard block |
||
2208 | 2208 | * @return void |
2209 | 2209 | */ |
2210 | 2210 | protected function _attendee_contact_list_table() { |
2211 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2211 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2212 | 2212 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2213 | 2213 | $this->display_admin_list_table_page_with_no_sidebar(); |
2214 | 2214 | } |
@@ -2223,10 +2223,10 @@ discard block |
||
2223 | 2223 | * @access public |
2224 | 2224 | * @return array |
2225 | 2225 | */ |
2226 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2226 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2227 | 2227 | |
2228 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2229 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2228 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2229 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2230 | 2230 | $ATT_MDL = EEM_Attendee::instance(); |
2231 | 2231 | |
2232 | 2232 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2254,47 +2254,47 @@ discard block |
||
2254 | 2254 | $orderby = 'ATT_lname'; |
2255 | 2255 | } |
2256 | 2256 | |
2257 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2257 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2258 | 2258 | |
2259 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2260 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2261 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2259 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2260 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2261 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2262 | 2262 | |
2263 | 2263 | $_where = array(); |
2264 | 2264 | |
2265 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2266 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2265 | + if (isset($this->_req_data['s'])) { |
|
2266 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2267 | 2267 | $_where['OR'] = array( |
2268 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2269 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2270 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2271 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2272 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2273 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2274 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2275 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2276 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2277 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2278 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2279 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2280 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2281 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2282 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2283 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2284 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2268 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2269 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2270 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2271 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2272 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2273 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2274 | + 'ATT_email' => array('LIKE', $sstr), |
|
2275 | + 'ATT_address' => array('LIKE', $sstr), |
|
2276 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2277 | + 'ATT_city' => array('LIKE', $sstr), |
|
2278 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2279 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2280 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2281 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2282 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2283 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2284 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2285 | 2285 | ); |
2286 | 2286 | } |
2287 | 2287 | |
2288 | 2288 | |
2289 | - $offset = ($current_page-1)*$per_page; |
|
2290 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2289 | + $offset = ($current_page - 1) * $per_page; |
|
2290 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2291 | 2291 | |
2292 | - if ( $trash ) { |
|
2293 | - $_where['status'] = array( '!=', 'publish' ); |
|
2294 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2292 | + if ($trash) { |
|
2293 | + $_where['status'] = array('!=', 'publish'); |
|
2294 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2295 | 2295 | } else { |
2296 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2297 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2296 | + $_where['status'] = array('IN', array('publish')); |
|
2297 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2298 | 2298 | } |
2299 | 2299 | |
2300 | 2300 | return $all_attendees; |
@@ -2311,10 +2311,10 @@ discard block |
||
2311 | 2311 | */ |
2312 | 2312 | protected function _resend_registration() { |
2313 | 2313 | $this->_process_resend_registration(); |
2314 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2314 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2315 | 2315 | 'action' => 'default' |
2316 | 2316 | ); |
2317 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2317 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2318 | 2318 | } |
2319 | 2319 | |
2320 | 2320 | |
@@ -2322,27 +2322,27 @@ discard block |
||
2322 | 2322 | |
2323 | 2323 | |
2324 | 2324 | |
2325 | - public function _registrations_report(){ |
|
2326 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2327 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2325 | + public function _registrations_report() { |
|
2326 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2327 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2328 | 2328 | array( |
2329 | 2329 | 'page' => 'espresso_batch', |
2330 | 2330 | 'batch' => 'file', |
2331 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2332 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2333 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2334 | - )) ); |
|
2331 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2332 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2333 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2334 | + ))); |
|
2335 | 2335 | } else { |
2336 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2336 | + EE_Registry::instance()->load_helper('File'); |
|
2337 | 2337 | $new_request_args = array( |
2338 | 2338 | 'export' => 'report', |
2339 | 2339 | 'action' => 'registrations_report_for_event', |
2340 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2340 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2341 | 2341 | ); |
2342 | 2342 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2343 | 2343 | |
2344 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2345 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2344 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2345 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2346 | 2346 | $EE_Export = EE_Export::instance($this->_req_data); |
2347 | 2347 | $EE_Export->export(); |
2348 | 2348 | } |
@@ -2351,28 +2351,28 @@ discard block |
||
2351 | 2351 | |
2352 | 2352 | |
2353 | 2353 | |
2354 | - public function _contact_list_export(){ |
|
2355 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2356 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2357 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2354 | + public function _contact_list_export() { |
|
2355 | + EE_Registry::instance()->load_helper('File'); |
|
2356 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2357 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2358 | 2358 | $EE_Export = EE_Export::instance($this->_req_data); |
2359 | 2359 | $EE_Export->export_attendees(); |
2360 | 2360 | } |
2361 | 2361 | } |
2362 | 2362 | |
2363 | - public function _contact_list_report(){ |
|
2364 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2365 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2363 | + public function _contact_list_report() { |
|
2364 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2365 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2366 | 2366 | array( |
2367 | 2367 | 'page' => 'espresso_batch', |
2368 | 2368 | 'batch' => 'file', |
2369 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2370 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2371 | - )) ); |
|
2369 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2370 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2371 | + ))); |
|
2372 | 2372 | } else { |
2373 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2374 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2375 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2373 | + EE_Registry::instance()->load_helper('File'); |
|
2374 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2375 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2376 | 2376 | $EE_Export = EE_Export::instance($this->_req_data); |
2377 | 2377 | $EE_Export->report_attendees(); |
2378 | 2378 | } |
@@ -2392,73 +2392,73 @@ discard block |
||
2392 | 2392 | * @return void |
2393 | 2393 | */ |
2394 | 2394 | protected function _duplicate_attendee() { |
2395 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2395 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2396 | 2396 | //verify we have necessary info |
2397 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2398 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2399 | - $query_args = array( 'action' => $action ); |
|
2397 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2398 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2399 | + $query_args = array('action' => $action); |
|
2400 | 2400 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2401 | 2401 | } |
2402 | 2402 | |
2403 | 2403 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2404 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2404 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2405 | 2405 | $attendee = $registration->attendee(); |
2406 | 2406 | |
2407 | 2407 | //remove relation of existing attendee on registration |
2408 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2408 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2409 | 2409 | //new attendee |
2410 | 2410 | $new_attendee = clone $attendee; |
2411 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2411 | + $new_attendee->set('ATT_ID', 0); |
|
2412 | 2412 | $new_attendee->save(); |
2413 | 2413 | |
2414 | 2414 | //add new attendee to reg |
2415 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2415 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2416 | 2416 | |
2417 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2417 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2418 | 2418 | |
2419 | 2419 | //redirect to edit page for attendee |
2420 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2420 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2421 | 2421 | |
2422 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2422 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2423 | 2423 | } |
2424 | 2424 | |
2425 | 2425 | |
2426 | 2426 | //related to cpt routes |
2427 | 2427 | protected function _insert_update_cpt_item($post_id, $post) { |
2428 | 2428 | $success = true; |
2429 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2429 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2430 | 2430 | //for attendee updates |
2431 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2431 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2432 | 2432 | //note we should only be UPDATING attendees at this point. |
2433 | 2433 | $updated_fields = array( |
2434 | 2434 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2435 | 2435 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2436 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2436 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2437 | 2437 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2438 | 2438 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2439 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2440 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2441 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2442 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2443 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2444 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2439 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2440 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2441 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2442 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2443 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2444 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2445 | 2445 | ); |
2446 | - foreach ( $updated_fields as $field => $value ) { |
|
2446 | + foreach ($updated_fields as $field => $value) { |
|
2447 | 2447 | $attendee->set($field, $value); |
2448 | 2448 | } |
2449 | 2449 | |
2450 | 2450 | $success = $attendee->save(); |
2451 | 2451 | |
2452 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2453 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2454 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2455 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2452 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2453 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2454 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2455 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2456 | 2456 | } |
2457 | 2457 | } |
2458 | 2458 | } |
2459 | 2459 | |
2460 | - if ( $success === FALSE ) |
|
2461 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2460 | + if ($success === FALSE) |
|
2461 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2462 | 2462 | |
2463 | 2463 | } |
2464 | 2464 | |
@@ -2478,17 +2478,17 @@ discard block |
||
2478 | 2478 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2479 | 2479 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2480 | 2480 | |
2481 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2482 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2481 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2482 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2483 | 2483 | } |
2484 | 2484 | |
2485 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2485 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2486 | 2486 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2487 | 2487 | } |
2488 | 2488 | |
2489 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2490 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2491 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2489 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2490 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2491 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2492 | 2492 | } |
2493 | 2493 | |
2494 | 2494 | |
@@ -2497,10 +2497,10 @@ discard block |
||
2497 | 2497 | * @param WP_Post $post wp post object |
2498 | 2498 | * @return string attendee contact info ( and form ) |
2499 | 2499 | */ |
2500 | - public function attendee_contact_info( $post ) { |
|
2500 | + public function attendee_contact_info($post) { |
|
2501 | 2501 | //get attendee object ( should already have it ) |
2502 | 2502 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2503 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2503 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2504 | 2504 | EEH_Template::display_template($template, $this->_template_args); |
2505 | 2505 | } |
2506 | 2506 | |
@@ -2516,12 +2516,12 @@ discard block |
||
2516 | 2516 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2517 | 2517 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2518 | 2518 | new EE_Question_Form_Input( |
2519 | - EE_Question::new_instance( array( |
|
2519 | + EE_Question::new_instance(array( |
|
2520 | 2520 | 'QST_ID' => 0, |
2521 | 2521 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2522 | 2522 | 'QST_system' => 'admin-state' |
2523 | 2523 | )), |
2524 | - EE_Answer::new_instance( array( |
|
2524 | + EE_Answer::new_instance(array( |
|
2525 | 2525 | 'ANS_ID' => 0, |
2526 | 2526 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2527 | 2527 | )), |
@@ -2534,12 +2534,12 @@ discard block |
||
2534 | 2534 | )); |
2535 | 2535 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2536 | 2536 | new EE_Question_Form_Input( |
2537 | - EE_Question::new_instance( array( |
|
2537 | + EE_Question::new_instance(array( |
|
2538 | 2538 | 'QST_ID' => 0, |
2539 | 2539 | 'QST_display_text' => __('Country', 'event_espresso'), |
2540 | 2540 | 'QST_system' => 'admin-country' |
2541 | 2541 | )), |
2542 | - EE_Answer::new_instance( array( |
|
2542 | + EE_Answer::new_instance(array( |
|
2543 | 2543 | 'ANS_ID' => 0, |
2544 | 2544 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2545 | 2545 | )), |
@@ -2550,8 +2550,8 @@ discard block |
||
2550 | 2550 | 'append_qstn_id' => FALSE |
2551 | 2551 | ) |
2552 | 2552 | )); |
2553 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2554 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2553 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2554 | + EEH_Template::display_template($template, $this->_template_args); |
|
2555 | 2555 | |
2556 | 2556 | } |
2557 | 2557 | |
@@ -2561,11 +2561,11 @@ discard block |
||
2561 | 2561 | * @access protected |
2562 | 2562 | * @return void |
2563 | 2563 | */ |
2564 | - public function attendee_registrations_meta_box( $post ) { |
|
2564 | + public function attendee_registrations_meta_box($post) { |
|
2565 | 2565 | |
2566 | 2566 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2567 | 2567 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2568 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2568 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2569 | 2569 | EEH_Template::display_template($template, $this->_template_args); |
2570 | 2570 | |
2571 | 2571 | } |
@@ -2579,8 +2579,8 @@ discard block |
||
2579 | 2579 | * @return string html for new form. |
2580 | 2580 | */ |
2581 | 2581 | public function after_title_form_fields($post) { |
2582 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2583 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2582 | + if ($post->post_type == 'espresso_attendees') { |
|
2583 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2584 | 2584 | $template_args['attendee'] = $this->_cpt_model_obj; |
2585 | 2585 | EEH_Template::display_template($template, $template_args); |
2586 | 2586 | } |
@@ -2597,21 +2597,21 @@ discard block |
||
2597 | 2597 | * @access protected |
2598 | 2598 | * @return void |
2599 | 2599 | */ |
2600 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2600 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2601 | 2601 | |
2602 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2602 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2603 | 2603 | |
2604 | 2604 | $ATT_MDL = EEM_Attendee::instance(); |
2605 | 2605 | |
2606 | 2606 | $success = 1; |
2607 | 2607 | //Checkboxes |
2608 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2608 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2609 | 2609 | // if array has more than one element than success message should be plural |
2610 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2610 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2611 | 2611 | // cycle thru checkboxes |
2612 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2613 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2614 | - if ( !$updated ) { |
|
2612 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2613 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2614 | + if ( ! $updated) { |
|
2615 | 2615 | $success = 0; |
2616 | 2616 | } |
2617 | 2617 | } |
@@ -2620,18 +2620,18 @@ discard block |
||
2620 | 2620 | // grab single id and delete |
2621 | 2621 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2622 | 2622 | //get attendee |
2623 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2623 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2624 | 2624 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2625 | 2625 | $updated = $att->save(); |
2626 | - if ( ! $updated ) { |
|
2626 | + if ( ! $updated) { |
|
2627 | 2627 | $success = 0; |
2628 | 2628 | } |
2629 | 2629 | |
2630 | 2630 | } |
2631 | 2631 | |
2632 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2633 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2634 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2632 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2633 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2634 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2635 | 2635 | |
2636 | 2636 | } |
2637 | 2637 |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | - * @ link {@link http://www.eventespresso.com} |
|
12 | - * @ since 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Registrations_Admin_Page class |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage includes/core/admin/transactions/Registrations_Admin_Page.core.php |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | + * @ link {@link http://www.eventespresso.com} |
|
12 | + * @ since 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Registrations_Admin_Page class |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage includes/core/admin/transactions/Registrations_Admin_Page.core.php |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class Registrations_Admin_Page extends EE_Admin_Page_CPT { |
25 | 25 | |
26 | 26 | /** |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | |
164 | 164 | /** |
165 | 165 | * grab url requests and route them |
166 | - * @access private |
|
167 | - * @return void |
|
168 | - */ |
|
166 | + * @access private |
|
167 | + * @return void |
|
168 | + */ |
|
169 | 169 | public function _set_page_routes() { |
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | 'title' => __('Registrations Other', 'event_espresso'), |
437 | 437 | 'filename' => 'registrations_overview_other' |
438 | 438 | ) |
439 | - ), |
|
439 | + ), |
|
440 | 440 | 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
441 | 441 | 'qtips' => array('Registration_List_Table_Tips'), |
442 | 442 | 'list_table' => 'EE_Registrations_List_Table', |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
451 | 451 | 'persistent' => FALSE |
452 | 452 | ), |
453 | - 'help_tabs' => array( |
|
453 | + 'help_tabs' => array( |
|
454 | 454 | 'registrations_details_help_tab' => array( |
455 | 455 | 'title' => __('Registration Details', 'event_espresso'), |
456 | 456 | 'filename' => 'registrations_details' |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | 'order' => 20 |
515 | 515 | ), |
516 | 516 | 'list_table' => 'EE_Attendee_Contact_List_Table', |
517 | - 'help_tabs' => array( |
|
517 | + 'help_tabs' => array( |
|
518 | 518 | 'registrations_contact_list_help_tab' => array( |
519 | 519 | 'title' => __('Registrations Contact List', 'event_espresso'), |
520 | 520 | 'filename' => 'registrations_contact_list' |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | 'title' => __('Contact List Other', 'event_espresso'), |
532 | 532 | 'filename' => 'registrations_contact_list_other' |
533 | 533 | ) |
534 | - ), |
|
534 | + ), |
|
535 | 535 | 'help_tour' => array( 'Contact_List_Help_Tour' ), |
536 | 536 | 'metaboxes' => array(), |
537 | 537 | 'require_nonce' => FALSE |
@@ -565,9 +565,9 @@ discard block |
||
565 | 565 | |
566 | 566 | /** |
567 | 567 | * get list of registration statuses |
568 | - * @access private |
|
569 | - * @return void |
|
570 | - */ |
|
568 | + * @access private |
|
569 | + * @return void |
|
570 | + */ |
|
571 | 571 | private function _get_registration_status_array() { |
572 | 572 | self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
573 | 573 | } |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | return TRUE; |
875 | 875 | } |
876 | 876 | |
877 | - $REG = EEM_Registration::instance(); |
|
877 | + $REG = EEM_Registration::instance(); |
|
878 | 878 | |
879 | 879 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
880 | 880 | |
@@ -1097,9 +1097,9 @@ discard block |
||
1097 | 1097 | |
1098 | 1098 | /** |
1099 | 1099 | * generates HTML for the View Registration Details Admin page |
1100 | - * @access protected |
|
1101 | - * @return void |
|
1102 | - */ |
|
1100 | + * @access protected |
|
1101 | + * @return void |
|
1102 | + */ |
|
1103 | 1103 | protected function _registration_details() { |
1104 | 1104 | |
1105 | 1105 | $this->_template_args = array(); |
@@ -1177,9 +1177,9 @@ discard block |
||
1177 | 1177 | |
1178 | 1178 | /** |
1179 | 1179 | * _set_approve_or_decline_reg_status_buttons |
1180 | - * @access protected |
|
1181 | - * @return string |
|
1182 | - */ |
|
1180 | + * @access protected |
|
1181 | + * @return string |
|
1182 | + */ |
|
1183 | 1183 | public function set_reg_status_buttons_metabox() { |
1184 | 1184 | |
1185 | 1185 | //is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown. |
@@ -1368,10 +1368,10 @@ discard block |
||
1368 | 1368 | |
1369 | 1369 | /** |
1370 | 1370 | * approve_registration |
1371 | - * @access protected |
|
1372 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1373 | - * @return void |
|
1374 | - */ |
|
1371 | + * @access protected |
|
1372 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1373 | + * @return void |
|
1374 | + */ |
|
1375 | 1375 | protected function approve_registration( $notify = false ) { |
1376 | 1376 | $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
1377 | 1377 | } |
@@ -1381,10 +1381,10 @@ discard block |
||
1381 | 1381 | |
1382 | 1382 | /** |
1383 | 1383 | * decline_registration |
1384 | - * @access protected |
|
1385 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1386 | - * @return void |
|
1387 | - */ |
|
1384 | + * @access protected |
|
1385 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1386 | + * @return void |
|
1387 | + */ |
|
1388 | 1388 | protected function decline_registration( $notify = false ) { |
1389 | 1389 | $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
1390 | 1390 | } |
@@ -1394,10 +1394,10 @@ discard block |
||
1394 | 1394 | |
1395 | 1395 | /** |
1396 | 1396 | * cancel_registration |
1397 | - * @access protected |
|
1398 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1399 | - * @return void |
|
1400 | - */ |
|
1397 | + * @access protected |
|
1398 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1399 | + * @return void |
|
1400 | + */ |
|
1401 | 1401 | protected function cancel_registration( $notify = false ) { |
1402 | 1402 | $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
1403 | 1403 | } |
@@ -1408,10 +1408,10 @@ discard block |
||
1408 | 1408 | |
1409 | 1409 | /** |
1410 | 1410 | * not_approve_registration |
1411 | - * @access protected |
|
1412 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1413 | - * @return void |
|
1414 | - */ |
|
1411 | + * @access protected |
|
1412 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1413 | + * @return void |
|
1414 | + */ |
|
1415 | 1415 | protected function not_approve_registration( $notify = false ) { |
1416 | 1416 | $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
1417 | 1417 | } |
@@ -1420,10 +1420,10 @@ discard block |
||
1420 | 1420 | |
1421 | 1421 | /** |
1422 | 1422 | * decline_registration |
1423 | - * @access protected |
|
1424 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1425 | - * @return void |
|
1426 | - */ |
|
1423 | + * @access protected |
|
1424 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1425 | + * @return void |
|
1426 | + */ |
|
1427 | 1427 | protected function pending_registration( $notify = false ) { |
1428 | 1428 | $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
1429 | 1429 | } |
@@ -1433,9 +1433,9 @@ discard block |
||
1433 | 1433 | |
1434 | 1434 | /** |
1435 | 1435 | * generates HTML for the Registration main meta box |
1436 | - * @access public |
|
1437 | - * @return void |
|
1438 | - */ |
|
1436 | + * @access public |
|
1437 | + * @return void |
|
1438 | + */ |
|
1439 | 1439 | public function _reg_details_meta_box() { |
1440 | 1440 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1441 | 1441 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | * |
1519 | 1519 | * @access public |
1520 | 1520 | * @return void |
1521 | - */ |
|
1521 | + */ |
|
1522 | 1522 | public function _reg_questions_meta_box() { |
1523 | 1523 | //allow someone to override this method entirely |
1524 | 1524 | if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
@@ -1720,12 +1720,12 @@ discard block |
||
1720 | 1720 | |
1721 | 1721 | /** |
1722 | 1722 | * generates HTML for the Registration main meta box |
1723 | - * @access public |
|
1724 | - * @return void |
|
1725 | - */ |
|
1723 | + * @access public |
|
1724 | + * @return void |
|
1725 | + */ |
|
1726 | 1726 | public function _reg_attendees_meta_box() { |
1727 | 1727 | |
1728 | - $REG = EEM_Registration::instance(); |
|
1728 | + $REG = EEM_Registration::instance(); |
|
1729 | 1729 | //get all other registrations on this transaction, and cache |
1730 | 1730 | //the attendees for them so we don't have to run another query using force_join |
1731 | 1731 | $registrations = $REG->get_all(array( |
@@ -1778,9 +1778,9 @@ discard block |
||
1778 | 1778 | |
1779 | 1779 | /** |
1780 | 1780 | * generates HTML for the Edit Registration side meta box |
1781 | - * @access public |
|
1782 | - * @return void |
|
1783 | - */ |
|
1781 | + * @access public |
|
1782 | + * @return void |
|
1783 | + */ |
|
1784 | 1784 | public function _reg_registrant_side_meta_box() { |
1785 | 1785 | |
1786 | 1786 | /*@var $attendee EE_Attendee */ |
@@ -2159,9 +2159,9 @@ discard block |
||
2159 | 2159 | |
2160 | 2160 | /** |
2161 | 2161 | * set_reg_event |
2162 | - * @access private |
|
2163 | - * @return boolean |
|
2164 | - */ |
|
2162 | + * @access private |
|
2163 | + * @return boolean |
|
2164 | + */ |
|
2165 | 2165 | private function _set_reg_event() { |
2166 | 2166 | if ( is_object( $this->_reg_event )) { |
2167 | 2167 | return TRUE; |
@@ -2301,9 +2301,9 @@ discard block |
||
2301 | 2301 | |
2302 | 2302 | /** |
2303 | 2303 | * generates HTML for the Attendee Contact List |
2304 | - * @access protected |
|
2305 | - * @return void |
|
2306 | - */ |
|
2304 | + * @access protected |
|
2305 | + * @return void |
|
2306 | + */ |
|
2307 | 2307 | protected function _attendee_contact_list_table() { |
2308 | 2308 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
2309 | 2309 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
@@ -2317,9 +2317,9 @@ discard block |
||
2317 | 2317 | /** |
2318 | 2318 | * get_attendees |
2319 | 2319 | * @param bool $count whether to return count or data. |
2320 | - * @access public |
|
2321 | - * @return array |
|
2322 | - */ |
|
2320 | + * @access public |
|
2321 | + * @return array |
|
2322 | + */ |
|
2323 | 2323 | public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
2324 | 2324 | |
2325 | 2325 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2655,9 +2655,9 @@ discard block |
||
2655 | 2655 | |
2656 | 2656 | /** |
2657 | 2657 | * _attendee_details |
2658 | - * @access protected |
|
2659 | - * @return void |
|
2660 | - */ |
|
2658 | + * @access protected |
|
2659 | + * @return void |
|
2660 | + */ |
|
2661 | 2661 | public function attendee_registrations_meta_box( $post ) { |
2662 | 2662 | |
2663 | 2663 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
@@ -2690,10 +2690,10 @@ discard block |
||
2690 | 2690 | |
2691 | 2691 | /** |
2692 | 2692 | * _trash_or_restore_attendee |
2693 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2694 | - * @access protected |
|
2695 | - * @return void |
|
2696 | - */ |
|
2693 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2694 | + * @access protected |
|
2695 | + * @return void |
|
2696 | + */ |
|
2697 | 2697 | protected function _trash_or_restore_attendees( $trash = TRUE ) { |
2698 | 2698 | |
2699 | 2699 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <div id="admin-primary-mbox-dv" class="admin-primary-mbox-dv"> |
2 | 2 | |
3 | 3 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
4 | - <span class="dashicons dashicons-cart"></span><?php _e( 'Transaction Items', 'event_espresso' );?> |
|
4 | + <span class="dashicons dashicons-cart"></span><?php _e('Transaction Items', 'event_espresso'); ?> |
|
5 | 5 | </h3> |
6 | 6 | |
7 | 7 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -10,27 +10,27 @@ discard block |
||
10 | 10 | </div> |
11 | 11 | |
12 | 12 | <a id="display-additional-transaction-session-info" class="display-the-hidden smaller-text" rel="additional-transaction-session-info"> |
13 | - <span class="dashicons dashicons-plus-alt"></span><?php _e( 'view additional transaction session details', 'event_espresso' );?> |
|
13 | + <span class="dashicons dashicons-plus-alt"></span><?php _e('view additional transaction session details', 'event_espresso'); ?> |
|
14 | 14 | </a> |
15 | 15 | |
16 | 16 | <div id="additional-transaction-session-info-dv" class="hidden"> |
17 | 17 | |
18 | 18 | <a id="hide-additional-transaction-session-info" class="hide-the-displayed hidden smaller-text" rel="additional-transaction-session-info"> |
19 | - <span class="dashicons dashicons-dismiss"></span><?php _e( 'hide additional transaction session details', 'event_espresso' );?> |
|
19 | + <span class="dashicons dashicons-dismiss"></span><?php _e('hide additional transaction session details', 'event_espresso'); ?> |
|
20 | 20 | </a> |
21 | 21 | <br class="clear"/> |
22 | 22 | |
23 | - <h3 class="admin-primary-mbox-h4"><?php _e( 'Transaction Session Details', 'event_espresso' );?></h3> |
|
23 | + <h3 class="admin-primary-mbox-h4"><?php _e('Transaction Session Details', 'event_espresso'); ?></h3> |
|
24 | 24 | |
25 | 25 | <table id="admin-primary-mbox-txn-extra-session-info-tbl" class="form-table skinny-rows"> |
26 | 26 | <tbody> |
27 | - <?php foreach ( $txn_details as $key => $txn_detail ) : ?> |
|
27 | + <?php foreach ($txn_details as $key => $txn_detail) : ?> |
|
28 | 28 | <tr> |
29 | 29 | <th> |
30 | - <label for="<?php echo $key;?>"><?php echo $txn_detail['label'];?></label> |
|
30 | + <label for="<?php echo $key; ?>"><?php echo $txn_detail['label']; ?></label> |
|
31 | 31 | </th> |
32 | 32 | <td> |
33 | - <?php echo $txn_detail['value'];?> |
|
33 | + <?php echo $txn_detail['value']; ?> |
|
34 | 34 | </td> |
35 | 35 | </tr> |
36 | 36 | <?php endforeach; // $txn_details?> |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | <br class="clear"/> |
41 | 41 | |
42 | 42 | |
43 | - <?php if ( $attendee instanceof EE_Attendee && ( $grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty( $payments ) ) ) : ?> |
|
43 | + <?php if ($attendee instanceof EE_Attendee && ($grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty($payments))) : ?> |
|
44 | 44 | |
45 | 45 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
46 | - <span class="ee-icon ee-icon-cash"></span><?php _e( 'Payment Details', 'event_espresso' );?> |
|
46 | + <span class="ee-icon ee-icon-cash"></span><?php _e('Payment Details', 'event_espresso'); ?> |
|
47 | 47 | </h3> |
48 | 48 | |
49 | 49 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -52,75 +52,75 @@ discard block |
||
52 | 52 | <tr> |
53 | 53 | <th></th> |
54 | 54 | <th class="jst-cntr"></th> |
55 | - <th class="jst-cntr"><?php _e( 'ID', 'event_espresso' );?></th> |
|
56 | - <th class="jst-left"><?php _e( 'Date', 'event_espresso' );?></th> |
|
57 | - <th class="jst-cntr"><?php _e( 'Source', 'event_espresso' );?></th> |
|
58 | - <th class="jst-left"><?php _e( 'Method', 'event_espresso' );?></th> |
|
59 | - <th class="jst-left"><?php _e( 'Gateway Response', 'event_espresso' );?></th> |
|
60 | - <th class="jst-left"><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></th> |
|
61 | - <th class="jst-left"><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></th> |
|
62 | - <th class="jst-left"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></th> |
|
63 | - <!--<th class="jst-left"><?php _e( 'Details', 'event_espresso' );?></th>--> |
|
64 | - <th class="jst-cntr"><?php _e( 'Amount', 'event_espresso' );?></th> |
|
55 | + <th class="jst-cntr"><?php _e('ID', 'event_espresso'); ?></th> |
|
56 | + <th class="jst-left"><?php _e('Date', 'event_espresso'); ?></th> |
|
57 | + <th class="jst-cntr"><?php _e('Source', 'event_espresso'); ?></th> |
|
58 | + <th class="jst-left"><?php _e('Method', 'event_espresso'); ?></th> |
|
59 | + <th class="jst-left"><?php _e('Gateway Response', 'event_espresso'); ?></th> |
|
60 | + <th class="jst-left"><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></th> |
|
61 | + <th class="jst-left"><?php _e('P.O. / S.O. #', 'event_espresso'); ?></th> |
|
62 | + <th class="jst-left"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></th> |
|
63 | + <!--<th class="jst-left"><?php _e('Details', 'event_espresso'); ?></th>--> |
|
64 | + <th class="jst-cntr"><?php _e('Amount', 'event_espresso'); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if ( $payments ) : ?> |
|
68 | + <?php if ($payments) : ?> |
|
69 | 69 | <?php $payment_total = 0; ?> |
70 | - <?php foreach ( $payments as $PAY_ID => $payment ) : ?> |
|
71 | - <tr id="txn-admin-payment-tr-<?php echo $PAY_ID;?>"> |
|
70 | + <?php foreach ($payments as $PAY_ID => $payment) : ?> |
|
71 | + <tr id="txn-admin-payment-tr-<?php echo $PAY_ID; ?>"> |
|
72 | 72 | <td> |
73 | 73 | <span id="payment-status-<?php echo $PAY_ID; ?>" class="ee-status-strip-td ee-status-strip pymt-status-<?php echo $payment->STS_ID(); ?>"></span> |
74 | - <div id="payment-STS_ID-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->STS_ID();?></div> |
|
75 | - <div id="reg-payments-<?php echo $PAY_ID;?>" class="hidden"><?php echo json_encode( $existing_reg_payments[ $PAY_ID ] );?></div> |
|
74 | + <div id="payment-STS_ID-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->STS_ID(); ?></div> |
|
75 | + <div id="reg-payments-<?php echo $PAY_ID; ?>" class="hidden"><?php echo json_encode($existing_reg_payments[$PAY_ID]); ?></div> |
|
76 | 76 | </td> |
77 | 77 | <td class=" jst-cntr"> |
78 | 78 | <ul class="txn-overview-actions-ul"> |
79 | 79 | <li> |
80 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
80 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
81 | 81 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
82 | 82 | </a> |
83 | 83 | </li> |
84 | 84 | <li> |
85 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
85 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
86 | 86 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
87 | 87 | </a> |
88 | 88 | </li> |
89 | 89 | </ul> |
90 | 90 | </td> |
91 | 91 | <td class=" jst-rght"> |
92 | - <div id="payment-id-<?php echo $PAY_ID;?>"><?php echo $PAY_ID;?></div> |
|
92 | + <div id="payment-id-<?php echo $PAY_ID; ?>"><?php echo $PAY_ID; ?></div> |
|
93 | 93 | </td> |
94 | 94 | <td class=" jst-left"> |
95 | - <div id="payment-date-<?php echo $PAY_ID;?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'h:i a');?></div> |
|
95 | + <div id="payment-date-<?php echo $PAY_ID; ?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'h:i a'); ?></div> |
|
96 | 96 | </td> |
97 | 97 | <td class=" jst-cntr"> |
98 | - <div id="payment-method-<?php echo $PAY_ID;?>"> |
|
99 | - <?php echo $payment->source();?> |
|
98 | + <div id="payment-method-<?php echo $PAY_ID; ?>"> |
|
99 | + <?php echo $payment->source(); ?> |
|
100 | 100 | </div> |
101 | 101 | </td> |
102 | 102 | <td class=" jst-left"> |
103 | - <div id="payment-gateway-<?php echo $PAY_ID;?>"> |
|
104 | - <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso');?> |
|
103 | + <div id="payment-gateway-<?php echo $PAY_ID; ?>"> |
|
104 | + <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'); ?> |
|
105 | 105 | </div> |
106 | - <div id="payment-gateway-id-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0;?></div> |
|
106 | + <div id="payment-gateway-id-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0; ?></div> |
|
107 | 107 | </td> |
108 | 108 | <td class=" jst-left"> |
109 | - <div id="payment-response-<?php echo $PAY_ID;?>"><?php echo $payment->gateway_response();?></div> |
|
109 | + <div id="payment-response-<?php echo $PAY_ID; ?>"><?php echo $payment->gateway_response(); ?></div> |
|
110 | 110 | </td> |
111 | 111 | <td class=" jst-left"> |
112 | - <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->txn_id_chq_nmbr();?></div> |
|
112 | + <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->txn_id_chq_nmbr(); ?></div> |
|
113 | 113 | </td> |
114 | 114 | <td class=" jst-left"> |
115 | - <div id="payment-po-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->po_number();?></div> |
|
115 | + <div id="payment-po-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->po_number(); ?></div> |
|
116 | 116 | </td> |
117 | 117 | <td class=" jst-left"> |
118 | - <div id="payment-accntng-<?php echo $PAY_ID;?>"><?php echo $payment->extra_accntng();?></div> |
|
118 | + <div id="payment-accntng-<?php echo $PAY_ID; ?>"><?php echo $payment->extra_accntng(); ?></div> |
|
119 | 119 | </td> |
120 | 120 | <td class=" jst-rght"> |
121 | - <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-' . $payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
122 | - <span class="<?php echo $payment_class;?>"> |
|
123 | - <div id="payment-amount-<?php echo $PAY_ID;?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE ); ?></div> |
|
121 | + <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-'.$payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
122 | + <span class="<?php echo $payment_class; ?>"> |
|
123 | + <div id="payment-amount-<?php echo $PAY_ID; ?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE); ?></div> |
|
124 | 124 | </span> |
125 | 125 | </td> |
126 | 126 | </tr> |
@@ -130,25 +130,25 @@ discard block |
||
130 | 130 | <?php endforeach; // $payment?> |
131 | 131 | <?php |
132 | 132 | $pay_totals_class = $payment_total > $grand_raw_total ? ' important-notice' : ''; |
133 | - $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">' . __( 'This transaction has been overpaid ! ', 'event_espresso' ) . '</span>' : ''; |
|
133 | + $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">'.__('This transaction has been overpaid ! ', 'event_espresso').'</span>' : ''; |
|
134 | 134 | ?> |
135 | 135 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden"> |
136 | 136 | <td class=" jst-rght" colspan="11"> |
137 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
137 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
138 | 138 | </td> |
139 | 139 | </tr> |
140 | - <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class;?>"> |
|
141 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid . sprintf( __( 'Payments Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );?></span></th> |
|
142 | - <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE);?></span></th> |
|
140 | + <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class; ?>"> |
|
141 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid.sprintf(__('Payments Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); ?></span></th> |
|
142 | + <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE); ?></span></th> |
|
143 | 143 | </tr> |
144 | 144 | <?php else : ?> |
145 | 145 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr"> |
146 | 146 | <td class=" jst-rght" colspan="11"> |
147 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
147 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
148 | 148 | </td> |
149 | 149 | </tr> |
150 | 150 | <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden"> |
151 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __( 'Payments Total', 'event_espresso' );?></span></th> |
|
151 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __('Payments Total', 'event_espresso'); ?></span></th> |
|
152 | 152 | <th class=" jst-rght"><span id="txn-admin-payment-total"></span></th> |
153 | 153 | </tr> |
154 | 154 | <?php endif; // $payments?> |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | <td class=" jst-cntr"> |
162 | 162 | <ul class="txn-overview-actions-ul"> |
163 | 163 | <li> |
164 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
164 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
165 | 165 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
166 | 166 | </a> |
167 | 167 | </li> |
168 | 168 | <li> |
169 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
169 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
170 | 170 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
171 | 171 | </a> |
172 | 172 | </li> |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | <ul id="txn-admin-payment-options-ul"> |
214 | 214 | <li> |
215 | 215 | <a id="display-txn-admin-apply-payment" class="button-primary no-icon no-hide" rel="txn-admin-apply-payment" > <!--display-the-hidden --> |
216 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
216 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
217 | 217 | </a> |
218 | 218 | </li> |
219 | 219 | <li> |
220 | 220 | <a id="display-txn-admin-apply-refund" class="button-secondary no-icon no-hide" rel="txn-admin-apply-refund" > <!--display-the-hidden --> |
221 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
221 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
222 | 222 | </a> |
223 | 223 | </li> |
224 | 224 | </ul> |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | |
229 | 229 | <h2 id="admin-modal-dialog-apply-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
230 | 230 | <div class="ee-icon ee-icon-cash-add float-left"></div> |
231 | - <?php echo __( 'Apply a Payment to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
231 | + <?php echo __('Apply a Payment to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
232 | 232 | </h2> |
233 | 233 | |
234 | 234 | <h2 id="admin-modal-dialog-edit-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
235 | 235 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
236 | 236 | <?php |
237 | 237 | echo sprintf( |
238 | - __( 'Edit Payment #%s for Transaction #%s', 'event_espresso' ), |
|
238 | + __('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
239 | 239 | '<span></span>', |
240 | 240 | $txn_nmbr['value'] |
241 | 241 | ); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
247 | 247 | <?php |
248 | 248 | echo sprintf( |
249 | - __( 'Edit Refund #%s for Transaction #%s', 'event_espresso' ), |
|
249 | + __('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
250 | 250 | '<span></span>', |
251 | 251 | $txn_nmbr['value'] |
252 | 252 | ); |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | |
256 | 256 | <h2 id="admin-modal-dialog-apply-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
257 | 257 | <div class="ee-icon ee-icon-cash-remove float-left"></div> |
258 | - <?php echo __( 'Apply a Refund to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
258 | + <?php echo __('Apply a Refund to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
259 | 259 | </h2> |
260 | 260 | |
261 | 261 | <form name="txn-admin-apply-payment-frm" id="txn-admin-apply-payment-frm" action="<?php echo $apply_payment_form_url; ?>"> |
262 | 262 | <div class="admin-modal-dialog-wrap"> |
263 | 263 | <div class="admin-modal-dialog-inner"> |
264 | 264 | |
265 | - <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_apply_payment_nonce' );?>"/> |
|
265 | + <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce('espresso_apply_payment_nonce'); ?>"/> |
|
266 | 266 | <input type="hidden" name="espresso_ajax" id="espresso-ajax" value="0"/> |
267 | 267 | <input type="hidden" name="noheader" id="txn-admin-noheader-inp" value="0"/> |
268 | 268 | <input type="hidden" name="txn_admin_payment[PAY_ID]" id="txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
@@ -270,108 +270,108 @@ discard block |
||
270 | 270 | <input type="hidden" name="txn_admin_payment[type]" id="txn-admin-payment-type-inp" value="1"/> |
271 | 271 | <input type="hidden" name="txn_admin_payment[details]" id="txn-admin-payment-details-inp" value=""/> |
272 | 272 | <input type="hidden" name="txn_admin_delete_payment_form_url" id="txn-admin-delete-payment-form-url-inp" value="<?php echo $delete_payment_form_url; ?>"/> |
273 | - <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date( 'Y-m-d h:i a', current_time( 'timestamp' )); ?>"/> |
|
273 | + <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date('Y-m-d h:i a', current_time('timestamp')); ?>"/> |
|
274 | 274 | |
275 | 275 | <div class="txn-admin-apply-payment-date-dv admin-modal-dialog-row"> |
276 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
277 | - <label for="txn-admin-payment-date-inp" class=""><?php _e( 'Payment Date', 'event_espresso' );?></label> |
|
278 | - <input name="txn_admin_payment[date]" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date( 'Y-m-d h:i a', current_time( 'timestamp' )); ?>"/> |
|
279 | - <p class="description"><?php _e( 'The date the payment was actually made on', 'event_espresso' );?></p> |
|
276 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
277 | + <label for="txn-admin-payment-date-inp" class=""><?php _e('Payment Date', 'event_espresso'); ?></label> |
|
278 | + <input name="txn_admin_payment[date]" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date('Y-m-d h:i a', current_time('timestamp')); ?>"/> |
|
279 | + <p class="description"><?php _e('The date the payment was actually made on', 'event_espresso'); ?></p> |
|
280 | 280 | </div> |
281 | 281 | |
282 | 282 | <div class="txn-admin-apply-payment-amount-dv admin-modal-dialog-row"> |
283 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
284 | - <label for="txn-admin-payment-amount-inp" class=""><?php _e( 'Amount', 'event_espresso' );?></label> |
|
283 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
284 | + <label for="txn-admin-payment-amount-inp" class=""><?php _e('Amount', 'event_espresso'); ?></label> |
|
285 | 285 | <input name="txn_admin_payment[amount]" id="txn-admin-payment-amount-inp" class="txn-admin-apply-payment-inp required" type="text" value=""/> |
286 | - <p class="description"><?php _e( 'The amount of the payment', 'event_espresso' );?></p> |
|
286 | + <p class="description"><?php _e('The amount of the payment', 'event_espresso'); ?></p> |
|
287 | 287 | </div> |
288 | 288 | |
289 | 289 | <div class="txn-admin-apply-payment-method-dv admin-modal-dialog-row"> |
290 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
291 | - <label for="txn-admin-payment-method-inp" class=""><?php _e( 'Method of Payment', 'event_espresso' );?></label> |
|
290 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
291 | + <label for="txn-admin-payment-method-inp" class=""><?php _e('Method of Payment', 'event_espresso'); ?></label> |
|
292 | 292 | <select name="txn_admin_payment[PMD_ID]" id="txn-admin-payment-method-slct" class="txn-admin-apply-payment-slct required" type="text" > |
293 | - <?php foreach ( $payment_methods as $method ) : ?> |
|
293 | + <?php foreach ($payment_methods as $method) : ?> |
|
294 | 294 | <?php $selected = $method->slug() == 'cash' ? ' selected="selected"' : ''; ?> |
295 | - <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key( $method->admin_desc() ) ? substr( $method->admin_desc(), 0, 128) : $method->admin_name() ; ?> </option> |
|
295 | + <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key($method->admin_desc()) ? substr($method->admin_desc(), 0, 128) : $method->admin_name(); ?> </option> |
|
296 | 296 | <?php endforeach; ?> |
297 | 297 | </select> |
298 | - <p class="description"><?php _e( 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso' );?></p> |
|
298 | + <p class="description"><?php _e('Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso'); ?></p> |
|
299 | 299 | </div> |
300 | 300 | |
301 | 301 | <div class="mop-PP mop-CC mop-CHQ mop"> |
302 | 302 | <div class="txn-admin-apply-payment-gw-txn-id-dv admin-modal-dialog-row"> |
303 | - <label for="txn-admin-payment-txn-id-inp" class=""><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></label> |
|
303 | + <label for="txn-admin-payment-txn-id-inp" class=""><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></label> |
|
304 | 304 | <input name="txn_admin_payment[txn_id_chq_nmbr]" id="txn-admin-payment-txn-id-chq-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
305 | - <p class="description"><?php _e( 'The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso' );?></p> |
|
305 | + <p class="description"><?php _e('The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso'); ?></p> |
|
306 | 306 | </div> |
307 | 307 | </div> |
308 | 308 | |
309 | 309 | <div class="mop-CC mop" style="display:none"> |
310 | 310 | <div class="txn-admin-apply-payment-response-dv admin-modal-dialog-row"> |
311 | - <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e( 'Gateway Response', 'event_espresso' );?></label> |
|
311 | + <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e('Gateway Response', 'event_espresso'); ?></label> |
|
312 | 312 | <input name="txn_admin_payment[gateway_response]" id="txn-admin-payment-gateway-response-inp" class="txn-admin-apply-payment-inp" type="text"/> |
313 | - <p class="description"><?php _e( 'The gateway response string (optional)', 'event_espresso' );?></p> |
|
313 | + <p class="description"><?php _e('The gateway response string (optional)', 'event_espresso'); ?></p> |
|
314 | 314 | </div> |
315 | 315 | </div> |
316 | 316 | |
317 | 317 | <div class="mop-PP mop-CC mop"> |
318 | 318 | <div class="txn-admin-apply-payment-status-dv admin-modal-dialog-row"> |
319 | - <label for="txn-admin-payment-status-inp" class=""><?php _e( 'Payment Status', 'event_espresso' );?></label> |
|
319 | + <label for="txn-admin-payment-status-inp" class=""><?php _e('Payment Status', 'event_espresso'); ?></label> |
|
320 | 320 | <select name="txn_admin_payment[status]" id="txn-admin-payment-status-slct" class="txn-admin-apply-payment-slct" type="text" > |
321 | - <?php foreach ( $payment_status as $STS_ID => $STS_code ) : ?> |
|
321 | + <?php foreach ($payment_status as $STS_ID => $STS_code) : ?> |
|
322 | 322 | <?php $selected = $STS_ID == 'PAP' ? ' selected="selected"' : ''; ?> |
323 | 323 | <option id="payment-status-opt-<?php echo $STS_ID; ?>" value="<?php echo $STS_ID; ?>"<?php echo $selected; ?>><?php echo $STS_code; ?> </option> |
324 | 324 | <?php endforeach; ?> |
325 | 325 | </select> |
326 | - <p class="description"><?php _e( 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso' );?></p> |
|
326 | + <p class="description"><?php _e('Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso'); ?></p> |
|
327 | 327 | </div> |
328 | 328 | </div> |
329 | 329 | |
330 | 330 | <div class="txn-admin-apply-payment-po-nmbr-dv admin-modal-dialog-row"> |
331 | - <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></label> |
|
331 | + <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e('P.O. / S.O. #', 'event_espresso'); ?></label> |
|
332 | 332 | <input name="txn_admin_payment[po_number]" id="txn-admin-payment-po-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
333 | - <p class="description"><?php _e( 'The Purchase or Sales Order Number if any (optional)', 'event_espresso' );?></p> |
|
333 | + <p class="description"><?php _e('The Purchase or Sales Order Number if any (optional)', 'event_espresso'); ?></p> |
|
334 | 334 | </div> |
335 | 335 | |
336 | 336 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
337 | - <label for="txn-admin-payment-accounting-inp" class="last"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></label> |
|
337 | + <label for="txn-admin-payment-accounting-inp" class="last"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></label> |
|
338 | 338 | <input name="txn_admin_payment[accounting]" id="txn-admin-payment-accounting-inp" class="txn-admin-apply-payment-inp" type="text" value="<?php echo $REG_code; ?>" maxlength="100"/> <input type="hidden" id="txn-admin-reg-code-inp" value="<?php echo $REG_code; ?>"/> |
339 | - <p class="description"><?php _e( 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso' );?></p> |
|
339 | + <p class="description"><?php _e('An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso'); ?></p> |
|
340 | 340 | </div> |
341 | 341 | |
342 | 342 | <div class="txn-admin-apply-payment-registrations-dv admin-modal-dialog-row"> |
343 | - <label for="txn-admin-payment-registrations-inp" class="last"><?php _e( 'Registrations to Apply Payment to:', 'event_espresso' ); ?></label> |
|
343 | + <label for="txn-admin-payment-registrations-inp" class="last"><?php _e('Registrations to Apply Payment to:', 'event_espresso'); ?></label> |
|
344 | 344 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
345 | 345 | <input type="radio" value="1" id="txn-admin-apply-payment-to-all-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" checked="checked"/> |
346 | - <?php _e( 'ALL Registrations', 'event_espresso' ); ?> |
|
346 | + <?php _e('ALL Registrations', 'event_espresso'); ?> |
|
347 | 347 | </label> |
348 | 348 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
349 | 349 | <input type="radio" value="0" id="txn-admin-apply-payment-to-some-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" /> |
350 | - <?php _e( 'Just the following Registrations', 'event_espresso' ); ?> |
|
350 | + <?php _e('Just the following Registrations', 'event_espresso'); ?> |
|
351 | 351 | </label> |
352 | 352 | <?php echo $registrations_to_apply_payment_to; ?> |
353 | 353 | </div> |
354 | 354 | |
355 | 355 | <div class="txn-admin-payment-reg-status-dv admin-modal-dialog-row"> |
356 | - <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
356 | + <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
357 | 357 | <?php echo $status_change_select; ?> |
358 | - <p class="description"><?php _e( 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso' ); ?></p> |
|
358 | + <p class="description"><?php _e('If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso'); ?></p> |
|
359 | 359 | <br/> |
360 | 360 | </div> |
361 | 361 | |
362 | 362 | <div class="txn-admin-apply-payment-send-notifications-dv admin-modal-dialog-row"> |
363 | 363 | |
364 | - <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
364 | + <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
365 | 365 | <label class="txn-admin-payment-send-notifications-lbl"> |
366 | 366 | <input type="checkbox" value="1" name="txn_payments[send_notifications]" checked="checked" aria-checked="true" style="vertical-align: middle;"> |
367 | - <?php _e( 'Payment Messages?', 'event_espresso' ); ?> |
|
367 | + <?php _e('Payment Messages?', 'event_espresso'); ?> |
|
368 | 368 | </label> |
369 | 369 | <label class="txn-admin-payment-send-notifications-lbl"> |
370 | 370 | <input type="checkbox" value="1" name="txn_reg_status_change[send_notifications]" style="vertical-align: middle;"> |
371 | - <?php _e( 'Registration Messages?', 'event_espresso' ); ?> |
|
371 | + <?php _e('Registration Messages?', 'event_espresso'); ?> |
|
372 | 372 | </label> |
373 | 373 | <br class="clear-float"/> |
374 | - <p class="description"><?php printf( __('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />' ); ?></p> |
|
374 | + <p class="description"><?php printf(__('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />'); ?></p> |
|
375 | 375 | <label></label> |
376 | 376 | </div> |
377 | 377 | <div class="clear"></div> |
@@ -382,27 +382,27 @@ discard block |
||
382 | 382 | <ul id="admin-modal-dialog-options-ul"> |
383 | 383 | <li> |
384 | 384 | <a id="txn-admin-modal-dialog-apply-payment-lnk" class="button-primary no-icon" style="display:none;" > |
385 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
385 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
386 | 386 | </a> |
387 | 387 | </li> |
388 | 388 | <li> |
389 | 389 | <a id="txn-admin-modal-dialog-edit-payment-lnk" class="button-primary no-icon" style="display:none;" > |
390 | - <?php _e( 'Save Payment Details', 'event_espresso' );?> |
|
390 | + <?php _e('Save Payment Details', 'event_espresso'); ?> |
|
391 | 391 | </a> |
392 | 392 | </li> |
393 | 393 | <li> |
394 | 394 | <a id="txn-admin-modal-dialog-edit-refund-lnk" class="button-primary no-icon" style="display:none;" > |
395 | - <?php _e( 'Save Refund Details', 'event_espresso' );?> |
|
395 | + <?php _e('Save Refund Details', 'event_espresso'); ?> |
|
396 | 396 | </a> |
397 | 397 | </li> |
398 | 398 | <li> |
399 | 399 | <a id="txn-admin-modal-dialog-apply-refund-lnk" class="button-primary no-icon" style="display:none;" > |
400 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
400 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
401 | 401 | </a> |
402 | 402 | </li> |
403 | 403 | <li> |
404 | 404 | <a id="txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
405 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
405 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
406 | 406 | </a> |
407 | 407 | </li> |
408 | 408 | <li> |
@@ -419,29 +419,29 @@ discard block |
||
419 | 419 | |
420 | 420 | <h2 id="admin-modal-dialog-delete-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
421 | 421 | <span class="ee-icon ee-icon-cash-add"></span> |
422 | - <?php echo __( 'Delete Payment/Refund for Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
422 | + <?php echo __('Delete Payment/Refund for Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
423 | 423 | </h2> |
424 | 424 | |
425 | 425 | <form name="txn-admin-delete-payment-frm" id="txn-admin-delete-payment-frm" action="<?php echo $delete_payment_url; ?>"> |
426 | 426 | <div class="admin-modal-dialog-wrap"> |
427 | 427 | <div class="admin-modal-dialog-inner"> |
428 | 428 | |
429 | - <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_delete_payment_nonce' );?>"/> |
|
429 | + <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce('espresso_delete_payment_nonce'); ?>"/> |
|
430 | 430 | <input type="hidden" name="delete_espresso_ajax" id="delete-espresso-ajax" value="0"/> |
431 | 431 | <input type="hidden" name="delete_noheader" id="delete-txn-admin-noheader-inp" value="0"/> |
432 | 432 | <input type="hidden" name="delete_txn_admin_payment[PAY_ID]" id="delete-txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
433 | 433 | <input type="hidden" name="delete_txn_admin_payment[TXN_ID]" id="delete-txn-admin-payment-txn-id-inp" value="<?php echo $txn_nmbr['value']; ?>"/> |
434 | 434 | |
435 | 435 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
436 | - <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
436 | + <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
437 | 437 | <?php echo $delete_status_change_select; ?> |
438 | - <p class="description"><?php printf( __('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>' ); ?></p> |
|
438 | + <p class="description"><?php printf(__('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
439 | 439 | </div> |
440 | 440 | |
441 | 441 | <div class="ee-attention txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
442 | - <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
442 | + <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
443 | 443 | <input type="checkbox" value="1" name="delete_txn_reg_status_change[send_notifications]"> |
444 | - <p class="description"><?php _e( 'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso' );?></p> |
|
444 | + <p class="description"><?php _e('If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso'); ?></p> |
|
445 | 445 | </div> |
446 | 446 | <div class="clear"></div> |
447 | 447 | |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | <ul id="del-admin-modal-dialog-options-ul"> |
452 | 452 | <li> |
453 | 453 | <a id="txn-admin-modal-dialog-delete-lnk" class="button-primary no-icon" style="display:none;" > |
454 | - <?php _e( 'Delete', 'event_espresso' );?> |
|
454 | + <?php _e('Delete', 'event_espresso'); ?> |
|
455 | 455 | </a> |
456 | 456 | </li> |
457 | 457 | <li> |
458 | 458 | <a id="del-txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
459 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
459 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
460 | 460 | </a> |
461 | 461 | </li> |
462 | 462 | <li> |
@@ -472,30 +472,30 @@ discard block |
||
472 | 472 | <?php endif; // $grand_raw_total > 0?> |
473 | 473 | |
474 | 474 | <?php |
475 | - if ( WP_DEBUG ) { |
|
476 | - $delivered_messages = get_option( 'EED_Messages__payment', array() ); |
|
477 | - if ( isset( $delivered_messages[ $TXN_ID ] )) { |
|
475 | + if (WP_DEBUG) { |
|
476 | + $delivered_messages = get_option('EED_Messages__payment', array()); |
|
477 | + if (isset($delivered_messages[$TXN_ID])) { |
|
478 | 478 | ?> |
479 | - <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e( 'Messages Sent to Primary Registrant', 'event_espresso' );?></h4> |
|
479 | + <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e('Messages Sent to Primary Registrant', 'event_espresso'); ?></h4> |
|
480 | 480 | |
481 | 481 | <div class="admin-primary-mbox-tbl-wrap"> |
482 | 482 | <table class="admin-primary-mbox-tbl"> |
483 | 483 | <thead> |
484 | 484 | <tr> |
485 | - <th class="jst-left"><?php _e( 'Date & Time', 'event_espresso' );?></th> |
|
486 | - <th class="jst-left"><?php _e( 'Message Type', 'event_espresso' );?></th> |
|
487 | - <th class="jst-left"><?php _e( 'Payment Status Upon Sending', 'event_espresso' );?></th> |
|
488 | - <th class="jst-left"><?php _e( 'TXN Status Upon Sending', 'event_espresso' );?></th> |
|
485 | + <th class="jst-left"><?php _e('Date & Time', 'event_espresso'); ?></th> |
|
486 | + <th class="jst-left"><?php _e('Message Type', 'event_espresso'); ?></th> |
|
487 | + <th class="jst-left"><?php _e('Payment Status Upon Sending', 'event_espresso'); ?></th> |
|
488 | + <th class="jst-left"><?php _e('TXN Status Upon Sending', 'event_espresso'); ?></th> |
|
489 | 489 | </tr> |
490 | 490 | </thead> |
491 | 491 | <tbody> |
492 | - <?php foreach ( $delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message ) : |
|
492 | + <?php foreach ($delivered_messages[$TXN_ID] as $timestamp => $delivered_message) : |
|
493 | 493 | ?> |
494 | 494 | <tr> |
495 | - <td class="jst-left"><?php echo gmdate( get_option('date_format') . ' ' . get_option('time_format'), ( $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );?></td> |
|
496 | - <td class="jst-left"><?php echo isset( $delivered_message['message_type'] ) ? $delivered_message['message_type'] : '';?></td> |
|
497 | - <td class="jst-left"><?php echo isset( $delivered_message['pay_status'] ) ? $delivered_message['pay_status'] : '';?></td> |
|
498 | - <td class="jst-left"><?php echo isset( $delivered_message['txn_status'] ) ? $delivered_message['txn_status'] : '';?></td> |
|
495 | + <td class="jst-left"><?php echo gmdate(get_option('date_format').' '.get_option('time_format'), ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))); ?></td> |
|
496 | + <td class="jst-left"><?php echo isset($delivered_message['message_type']) ? $delivered_message['message_type'] : ''; ?></td> |
|
497 | + <td class="jst-left"><?php echo isset($delivered_message['pay_status']) ? $delivered_message['pay_status'] : ''; ?></td> |
|
498 | + <td class="jst-left"><?php echo isset($delivered_message['txn_status']) ? $delivered_message['txn_status'] : ''; ?></td> |
|
499 | 499 | </tr> |
500 | 500 | <?php endforeach; // $delivered_messages?> |
501 | 501 | </tbody> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | //is for lower than 4.8.33 |
14 | 14 | add_filter( |
15 | 15 | 'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
16 | - array( $this, 'remove_checkin_routes_earlier_than_4_8_33' ), |
|
16 | + array($this, 'remove_checkin_routes_earlier_than_4_8_33'), |
|
17 | 17 | 10, |
18 | 18 | 2 |
19 | 19 | ); |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * @param string $version |
27 | 27 | * @return array like $routes_on_this_version |
28 | 28 | */ |
29 | - public function remove_checkin_routes_earlier_than_4_8_33( $routes_on_this_version, $version ) { |
|
30 | - if( $this->applies_to_version( $version ) ) { |
|
31 | - unset( $routes_on_this_version[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] ); |
|
29 | + public function remove_checkin_routes_earlier_than_4_8_33($routes_on_this_version, $version) { |
|
30 | + if ($this->applies_to_version($version)) { |
|
31 | + unset($routes_on_this_version['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)']); |
|
32 | 32 | } |
33 | 33 | return $routes_on_this_version; |
34 | 34 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api\controllers; |
3 | 3 | |
4 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | protected $_requested_version; |
37 | 37 | |
38 | 38 | public function __construct() { |
39 | - $this->_debug_mode = defined( 'EE_REST_API_DEBUG_MODE' ) ? EE_REST_API_DEBUG_MODE : false; |
|
39 | + $this->_debug_mode = defined('EE_REST_API_DEBUG_MODE') ? EE_REST_API_DEBUG_MODE : false; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * Sets the version the user requested |
45 | 45 | * @param string $version eg '4.8' |
46 | 46 | */ |
47 | - public function set_requested_version( $version ) { |
|
47 | + public function set_requested_version($version) { |
|
48 | 48 | $this->_requested_version = $version; |
49 | 49 | } |
50 | 50 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param string $key |
54 | 54 | * @param string|array $info |
55 | 55 | */ |
56 | - protected function _set_debug_info( $key, $info ){ |
|
57 | - $this->_debug_info[ $key ] = $info; |
|
56 | + protected function _set_debug_info($key, $info) { |
|
57 | + $this->_debug_info[$key] = $info; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | * @param \WP_Error $wp_error_response |
63 | 63 | * @return \WP_Error |
64 | 64 | */ |
65 | - protected function _add_ee_errors_to_response( \WP_Error $wp_error_response ) { |
|
65 | + protected function _add_ee_errors_to_response(\WP_Error $wp_error_response) { |
|
66 | 66 | $notices_during_checkin = \EE_Error::get_raw_notices(); |
67 | - if( ! empty( $notices_during_checkin[ 'errors' ] ) ) { |
|
68 | - foreach( $notices_during_checkin[ 'errors' ] as $error_code => $error_message ) { |
|
67 | + if ( ! empty($notices_during_checkin['errors'])) { |
|
68 | + foreach ($notices_during_checkin['errors'] as $error_code => $error_message) { |
|
69 | 69 | $wp_error_response->add( |
70 | - sanitize_key( $error_code ), |
|
71 | - strip_tags( $error_message ) ); |
|
70 | + sanitize_key($error_code), |
|
71 | + strip_tags($error_message) ); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | return $wp_error_response; |
@@ -86,26 +86,26 @@ discard block |
||
86 | 86 | * @param array|\WP_Error|\Exception $response |
87 | 87 | * @return \WP_REST_Response |
88 | 88 | */ |
89 | - public function send_response( $response ) { |
|
90 | - if( $response instanceof \Exception ) { |
|
91 | - $response = new \WP_Error( $response->getCode(), $response->getMessage() ); |
|
89 | + public function send_response($response) { |
|
90 | + if ($response instanceof \Exception) { |
|
91 | + $response = new \WP_Error($response->getCode(), $response->getMessage()); |
|
92 | 92 | } |
93 | - if( $response instanceof \WP_Error ) { |
|
94 | - $response = $this->_add_ee_errors_to_response( $response ); |
|
95 | - $rest_response = $this->_create_rest_response_from_wp_error( $response ); |
|
96 | - }else{ |
|
97 | - $rest_response = new \WP_REST_Response( $response, 200 ); |
|
93 | + if ($response instanceof \WP_Error) { |
|
94 | + $response = $this->_add_ee_errors_to_response($response); |
|
95 | + $rest_response = $this->_create_rest_response_from_wp_error($response); |
|
96 | + } else { |
|
97 | + $rest_response = new \WP_REST_Response($response, 200); |
|
98 | 98 | } |
99 | 99 | $headers = array(); |
100 | - if( $this->_debug_mode && is_array( $this->_debug_info ) ) { |
|
101 | - foreach( $this->_debug_info as $debug_key => $debug_info ) { |
|
102 | - if( is_array( $debug_info ) ) { |
|
103 | - $debug_info = json_encode( $debug_info ); |
|
100 | + if ($this->_debug_mode && is_array($this->_debug_info)) { |
|
101 | + foreach ($this->_debug_info as $debug_key => $debug_info) { |
|
102 | + if (is_array($debug_info)) { |
|
103 | + $debug_info = json_encode($debug_info); |
|
104 | 104 | } |
105 | - $headers[ 'X-EE4-Debug-' . ucwords( $debug_key ) ] = $debug_info; |
|
105 | + $headers['X-EE4-Debug-'.ucwords($debug_key)] = $debug_info; |
|
106 | 106 | } |
107 | 107 | } |
108 | - $rest_response->set_headers( $headers ); |
|
108 | + $rest_response->set_headers($headers); |
|
109 | 109 | return $rest_response; |
110 | 110 | } |
111 | 111 | |
@@ -116,31 +116,31 @@ discard block |
||
116 | 116 | * @param \WP_Error $wp_error |
117 | 117 | * @return \WP_REST_Response |
118 | 118 | */ |
119 | - protected function _create_rest_response_from_wp_error( \WP_Error $wp_error ) { |
|
119 | + protected function _create_rest_response_from_wp_error(\WP_Error $wp_error) { |
|
120 | 120 | $error_data = $wp_error->get_error_data(); |
121 | - if ( is_array( $error_data ) && isset( $error_data['status'] ) ) { |
|
121 | + if (is_array($error_data) && isset($error_data['status'])) { |
|
122 | 122 | $status = $error_data['status']; |
123 | 123 | } else { |
124 | 124 | $status = 500; |
125 | 125 | } |
126 | 126 | |
127 | 127 | $errors = array(); |
128 | - foreach ( (array) $wp_error->errors as $code => $messages ) { |
|
129 | - foreach ( (array) $messages as $message ) { |
|
128 | + foreach ((array) $wp_error->errors as $code => $messages) { |
|
129 | + foreach ((array) $messages as $message) { |
|
130 | 130 | $errors[] = array( |
131 | 131 | 'code' => $code, |
132 | 132 | 'message' => $message, |
133 | - 'data' => $wp_error->get_error_data( $code ) |
|
133 | + 'data' => $wp_error->get_error_data($code) |
|
134 | 134 | ); |
135 | 135 | } |
136 | 136 | } |
137 | - $data = isset( $errors[0] ) ? $errors[0] : array(); |
|
138 | - if ( count( $errors ) > 1 ) { |
|
137 | + $data = isset($errors[0]) ? $errors[0] : array(); |
|
138 | + if (count($errors) > 1) { |
|
139 | 139 | // Remove the primary error. |
140 | - array_shift( $errors ); |
|
140 | + array_shift($errors); |
|
141 | 141 | $data['additional_errors'] = $errors; |
142 | 142 | } |
143 | - return new \WP_REST_Response( $data, $status ); |
|
143 | + return new \WP_REST_Response($data, $status); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | * @param string $route |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function get_requested_version( $route ) { |
|
153 | + public function get_requested_version($route) { |
|
154 | 154 | $matches = $this->parse_route( |
155 | 155 | $route, |
156 | - '~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . '~', |
|
157 | - array( 'version' ) |
|
156 | + '~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'~', |
|
157 | + array('version') |
|
158 | 158 | ); |
159 | - if( isset( $matches[ 'version' ] ) ) { |
|
160 | - return $matches[ 'version' ]; |
|
159 | + if (isset($matches['version'])) { |
|
160 | + return $matches['version']; |
|
161 | 161 | } else { |
162 | 162 | return \EED_Core_Rest_Api::latest_rest_api_version(); |
163 | 163 | } |
@@ -182,23 +182,23 @@ discard block |
||
182 | 182 | * array( 'model' => 'foo', 'id' => 'bar' ) |
183 | 183 | * @throws \EE_Error if it couldn't be parsed |
184 | 184 | */ |
185 | - public function parse_route( $route, $regex, $match_keys ) { |
|
185 | + public function parse_route($route, $regex, $match_keys) { |
|
186 | 186 | $indexed_matches = array(); |
187 | - $success = preg_match( $regex, $route, $matches ); |
|
188 | - if( |
|
189 | - is_array( $matches ) ) { |
|
187 | + $success = preg_match($regex, $route, $matches); |
|
188 | + if ( |
|
189 | + is_array($matches) ) { |
|
190 | 190 | //skip the overall regex match. Who cares |
191 | - for( $i = 1; $i <= count( $match_keys ); $i++ ) { |
|
192 | - if( ! isset( $matches[ $i ] ) ) { |
|
191 | + for ($i = 1; $i <= count($match_keys); $i++) { |
|
192 | + if ( ! isset($matches[$i])) { |
|
193 | 193 | $success = false; |
194 | 194 | } else { |
195 | - $indexed_matches[ $match_keys[ $i - 1 ] ] = $matches[ $i ]; |
|
195 | + $indexed_matches[$match_keys[$i - 1]] = $matches[$i]; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | } |
199 | - if( ! $success ) { |
|
199 | + if ( ! $success) { |
|
200 | 200 | throw new \EE_Error( |
201 | - __( 'We could not parse the URL. Please contact Event Espresso Support', 'event_espresso' ), |
|
201 | + __('We could not parse the URL. Please contact Event Espresso Support', 'event_espresso'), |
|
202 | 202 | 'endpoint_parsing_error' |
203 | 203 | ); |
204 | 204 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Core_Rest_Api |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | |
59 | 59 | public static function set_hooks_both() { |
60 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 ); |
|
61 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 ); |
|
62 | - add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 ); |
|
63 | - add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) ); |
|
60 | + add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10); |
|
61 | + add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5); |
|
62 | + add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2); |
|
63 | + add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index')); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | protected static function _set_hooks_for_changes() { |
76 | - $folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false ); |
|
77 | - foreach( $folder_contents as $classname_in_namespace => $filepath ) { |
|
76 | + $folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false); |
|
77 | + foreach ($folder_contents as $classname_in_namespace => $filepath) { |
|
78 | 78 | //ignore the base parent class |
79 | - if( $classname_in_namespace === 'Changes_In_Base' ) { |
|
79 | + if ($classname_in_namespace === 'Changes_In_Base') { |
|
80 | 80 | continue; |
81 | 81 | } |
82 | - $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace; |
|
83 | - if ( class_exists( $full_classname )) { |
|
82 | + $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace; |
|
83 | + if (class_exists($full_classname)) { |
|
84 | 84 | $instance_of_class = new $full_classname; |
85 | - if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) { |
|
85 | + if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) { |
|
86 | 86 | $instance_of_class->set_hooks(); |
87 | 87 | } |
88 | 88 | } |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | * so we actually prefer to only do it when an EE plugin is activated or upgraded |
96 | 96 | */ |
97 | 97 | public static function register_routes() { |
98 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
99 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
100 | - foreach( $routes as $route ) { |
|
98 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
99 | + foreach ($relative_urls as $endpoint => $routes) { |
|
100 | + foreach ($routes as $route) { |
|
101 | 101 | register_rest_route( |
102 | 102 | $namespace, |
103 | 103 | $endpoint, |
104 | 104 | array( |
105 | - 'callback' => $route[ 'callback' ], |
|
106 | - 'methods' => $route[ 'methods' ], |
|
107 | - 'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(), |
|
105 | + 'callback' => $route['callback'], |
|
106 | + 'methods' => $route['methods'], |
|
107 | + 'args' => isset($route['args']) ? $route['args'] : array(), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * } |
122 | 122 | */ |
123 | 123 | public static function get_ee_route_data() { |
124 | - $ee_routes = get_option( self::saved_routes_option_names, null ); |
|
125 | - if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){ |
|
124 | + $ee_routes = get_option(self::saved_routes_option_names, null); |
|
125 | + if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) { |
|
126 | 126 | self::save_ee_routes(); |
127 | - $ee_routes = get_option( self::saved_routes_option_names, array() ); |
|
127 | + $ee_routes = get_option(self::saved_routes_option_names, array()); |
|
128 | 128 | } |
129 | 129 | return $ee_routes; |
130 | 130 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @return void |
136 | 136 | */ |
137 | 137 | public static function save_ee_routes() { |
138 | - if( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
138 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
139 | 139 | $instance = self::instance(); |
140 | 140 | $routes = apply_filters( |
141 | 141 | 'EED_Core_Rest_Api__save_ee_routes__routes', |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $instance->_register_rpc_routes() |
147 | 147 | ) |
148 | 148 | ); |
149 | - update_option( self::saved_routes_option_names, $routes, true ); |
|
149 | + update_option(self::saved_routes_option_names, $routes, true); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @return array @see get_ee_route_data |
156 | 156 | */ |
157 | 157 | protected function _register_model_routes() { |
158 | - EE_Registry::instance()->load_helper( 'Inflector' ); |
|
158 | + EE_Registry::instance()->load_helper('Inflector'); |
|
159 | 159 | $models_to_register = apply_filters( |
160 | 160 | 'FHEE__EED_Core_REST_API___register_model_routes', |
161 | 161 | EE_Registry::instance()->non_abstract_db_models |
@@ -164,23 +164,23 @@ discard block |
||
164 | 164 | unset($models_to_register['Extra_Meta']); |
165 | 165 | unset($models_to_register['Extra_Join']); |
166 | 166 | $model_routes = array( ); |
167 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
167 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
168 | 168 | |
169 | - foreach ( $models_to_register as $model_name => $model_classname ) { |
|
169 | + foreach ($models_to_register as $model_name => $model_classname) { |
|
170 | 170 | //yes we could just register one route for ALL models, but then they wouldn't show up in the index |
171 | - $ee_namespace = self::ee_api_namespace . $version; |
|
172 | - $plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name ); |
|
173 | - $singular_model_route = $plural_model_route . '/(?P<id>\d+)' ; |
|
174 | - $model_routes[ $ee_namespace ][ $plural_model_route ] = array( |
|
171 | + $ee_namespace = self::ee_api_namespace.$version; |
|
172 | + $plural_model_route = EEH_Inflector::pluralize_and_lower($model_name); |
|
173 | + $singular_model_route = $plural_model_route.'/(?P<id>\d+)'; |
|
174 | + $model_routes[$ee_namespace][$plural_model_route] = array( |
|
175 | 175 | array( |
176 | 176 | 'callback' => array( |
177 | 177 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
178 | 178 | 'handle_request_get_all' ), |
179 | 179 | 'methods' => WP_REST_Server::READABLE, |
180 | 180 | 'hidden_endpoint' => $hidden_endpoint, |
181 | - 'args' => $this->_get_read_query_params( $model_name ), |
|
181 | + 'args' => $this->_get_read_query_params($model_name), |
|
182 | 182 | '_links' => array( |
183 | - 'self' => rest_url( $ee_namespace . $singular_model_route ), |
|
183 | + 'self' => rest_url($ee_namespace.$singular_model_route), |
|
184 | 184 | ) |
185 | 185 | ), |
186 | 186 | // array( |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | // 'hidden_endpoint' => $hidden_endpoint |
192 | 192 | // ) |
193 | 193 | ); |
194 | - $model_routes[ $ee_namespace ][ $singular_model_route ] = array( |
|
194 | + $model_routes[$ee_namespace][$singular_model_route] = array( |
|
195 | 195 | array( |
196 | 196 | 'callback' => array( |
197 | 197 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'include' => array( |
203 | 203 | 'required' => false, |
204 | 204 | 'default' => '*', |
205 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ), |
|
205 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'), |
|
206 | 206 | ), |
207 | 207 | ) |
208 | 208 | ), |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | // ), |
216 | 216 | ); |
217 | 217 | //@todo: also handle DELETE for a single item |
218 | - $model = EE_Registry::instance()->load_model( $model_classname ); |
|
219 | - foreach ( $model->relation_settings() as $relation_name => $relation_obj ) { |
|
218 | + $model = EE_Registry::instance()->load_model($model_classname); |
|
219 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
220 | 220 | $related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name( |
221 | 221 | $relation_name, |
222 | 222 | $relation_obj |
223 | 223 | ); |
224 | - $model_routes[ $ee_namespace ][ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array( |
|
224 | + $model_routes[$ee_namespace][$singular_model_route.'/'.$related_model_name_endpoint_part] = array( |
|
225 | 225 | array( |
226 | 226 | 'callback' => array( |
227 | 227 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
228 | 228 | 'handle_request_get_related' ), |
229 | 229 | 'methods' => WP_REST_Server::READABLE, |
230 | 230 | 'hidden_endpoint' => $hidden_endpoint, |
231 | - 'args' => $this->_get_read_query_params( $relation_name ), |
|
231 | + 'args' => $this->_get_read_query_params($relation_name), |
|
232 | 232 | ), |
233 | 233 | // array( |
234 | 234 | // 'callback' => array( |
@@ -252,11 +252,11 @@ discard block |
||
252 | 252 | */ |
253 | 253 | protected function _register_rpc_routes() { |
254 | 254 | $routes = array(); |
255 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
256 | - $ee_namespace = self::ee_api_namespace . $version; |
|
255 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
256 | + $ee_namespace = self::ee_api_namespace.$version; |
|
257 | 257 | $this_versions_routes = array(); |
258 | 258 | //checkin endpoint |
259 | - $this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array( |
|
259 | + $this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array( |
|
260 | 260 | array( |
261 | 261 | 'callback' => array( |
262 | 262 | 'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin', |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | 'force' => array( |
268 | 268 | 'required' => false, |
269 | 269 | 'default' => false, |
270 | - 'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' ) |
|
270 | + 'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso') |
|
271 | 271 | ) |
272 | 272 | ) |
273 | 273 | ) |
274 | 274 | ); |
275 | - $routes[ $ee_namespace ] = apply_filters( |
|
275 | + $routes[$ee_namespace] = apply_filters( |
|
276 | 276 | 'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
277 | 277 | $this_versions_routes, |
278 | 278 | $version, |
@@ -287,47 +287,47 @@ discard block |
||
287 | 287 | * @param string $model_name eg 'Event' or 'Venue' |
288 | 288 | * @return array describing the args acceptable when querying this model |
289 | 289 | */ |
290 | - protected function _get_read_query_params( $model_name ) { |
|
291 | - $model = EE_Registry::instance()->load_model( $model_name ); |
|
290 | + protected function _get_read_query_params($model_name) { |
|
291 | + $model = EE_Registry::instance()->load_model($model_name); |
|
292 | 292 | $default_orderby = array(); |
293 | - foreach( $model->get_combined_primary_key_fields() as $key_field ) { |
|
294 | - $default_orderby[ $key_field->get_name() ] = 'ASC'; |
|
293 | + foreach ($model->get_combined_primary_key_fields() as $key_field) { |
|
294 | + $default_orderby[$key_field->get_name()] = 'ASC'; |
|
295 | 295 | } |
296 | 296 | return array( |
297 | 297 | 'where' => array( |
298 | 298 | 'required' => false, |
299 | 299 | 'default' => array(), |
300 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso' ), |
|
300 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso'), |
|
301 | 301 | ), |
302 | 302 | 'limit' => array( |
303 | 303 | 'required' => false, |
304 | 304 | 'default' => 50, |
305 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso' ) |
|
305 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso') |
|
306 | 306 | ), |
307 | 307 | 'order_by' => array( |
308 | 308 | 'required' => false, |
309 | 309 | 'default' => $default_orderby, |
310 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso' ) |
|
310 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso') |
|
311 | 311 | ), |
312 | 312 | 'group_by' => array( |
313 | 313 | 'required' => false, |
314 | 314 | 'default' => null, |
315 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso' ) |
|
315 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso') |
|
316 | 316 | ), |
317 | 317 | 'having' => array( |
318 | 318 | 'required' => false, |
319 | 319 | 'default' => null, |
320 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso' ) |
|
320 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso') |
|
321 | 321 | ), |
322 | 322 | 'caps' => array( |
323 | 323 | 'required' => false, |
324 | 324 | 'default' => EEM_Base::caps_read, |
325 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso' ) |
|
325 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso') |
|
326 | 326 | ), |
327 | 327 | 'include' => array( |
328 | 328 | 'required' => false, |
329 | 329 | 'default' => '*', |
330 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ), |
|
330 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'), |
|
331 | 331 | ), |
332 | 332 | ); |
333 | 333 | } |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | */ |
339 | 339 | protected function _register_config_routes() { |
340 | 340 | $config_routes = array(); |
341 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
342 | - $config_routes[ self::ee_api_namespace . $version ][ 'config' ] = array( |
|
341 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
342 | + $config_routes[self::ee_api_namespace.$version]['config'] = array( |
|
343 | 343 | array( |
344 | 344 | 'callback' => array( |
345 | 345 | 'EventEspresso\core\libraries\rest_api\controllers\config\Read', |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | */ |
359 | 359 | protected function _register_meta_routes() { |
360 | 360 | $meta_routes = array(); |
361 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
362 | - $meta_routes[ self::ee_api_namespace . $version ][ '/resources' ] = array( |
|
361 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
362 | + $meta_routes[self::ee_api_namespace.$version]['/resources'] = array( |
|
363 | 363 | array( |
364 | 364 | 'callback' => array( |
365 | 365 | 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | * @param array $route_data |
381 | 381 | * @return array |
382 | 382 | */ |
383 | - public static function hide_old_endpoints( $route_data ) { |
|
384 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
385 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
386 | - foreach( $routes as $route ) { |
|
387 | - if( $route[ 'hidden_endpoint' ] ) { |
|
388 | - $full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' ); |
|
389 | - unset( $route_data[ $full_route ] ); |
|
383 | + public static function hide_old_endpoints($route_data) { |
|
384 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
385 | + foreach ($relative_urls as $endpoint => $routes) { |
|
386 | + foreach ($routes as $route) { |
|
387 | + if ($route['hidden_endpoint']) { |
|
388 | + $full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/'); |
|
389 | + unset($route_data[$full_route]); |
|
390 | 390 | } |
391 | 391 | } |
392 | 392 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | */ |
424 | 424 | public static function latest_rest_api_version() { |
425 | 425 | $versions_served = \EED_Core_Rest_Api::versions_served(); |
426 | - return end( array_keys( $versions_served ) ); |
|
426 | + return end(array_keys($versions_served)); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | /** |
@@ -437,17 +437,17 @@ discard block |
||
437 | 437 | public static function versions_served() { |
438 | 438 | $version_compatibilities = EED_Core_Rest_Api::version_compatibilities(); |
439 | 439 | $versions_served = array(); |
440 | - $lowest_compatible_version = $version_compatibilities[ EED_Core_Rest_Api::core_version() ]; |
|
440 | + $lowest_compatible_version = $version_compatibilities[EED_Core_Rest_Api::core_version()]; |
|
441 | 441 | //for each version of core we have ever served: |
442 | - foreach( array_keys( EED_Core_Rest_Api::version_compatibilities() ) as $possibly_served_version ) { |
|
442 | + foreach (array_keys(EED_Core_Rest_Api::version_compatibilities()) as $possibly_served_version) { |
|
443 | 443 | //if it's not above the current core version, and it's compatible with the current version of core |
444 | - if( |
|
444 | + if ( |
|
445 | 445 | $possibly_served_version < EED_Core_Rest_Api::core_version() |
446 | 446 | && $possibly_served_version >= $lowest_compatible_version |
447 | 447 | ) { |
448 | - $versions_served[ $possibly_served_version ] = true; |
|
449 | - }else { |
|
450 | - $versions_served[ $possibly_served_version ] = false; |
|
448 | + $versions_served[$possibly_served_version] = true; |
|
449 | + } else { |
|
450 | + $versions_served[$possibly_served_version] = false; |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | return $versions_served; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @return string |
461 | 461 | */ |
462 | 462 | public static function core_version() { |
463 | - return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) ); |
|
463 | + return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3))); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param WP $WP |
473 | 473 | * @return void |
474 | 474 | */ |
475 | - public function run( $WP ) { |
|
475 | + public function run($WP) { |
|
476 | 476 | |
477 | 477 | } |
478 | 478 |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,21 +176,21 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
187 | - EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ] = sprintf( |
|
188 | - __( '%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | + EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
|
188 | + __('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
189 | 189 | '<h4 class="important-notice">', |
190 | 190 | '</h4>', |
191 | 191 | '<br />', |
192 | 192 | '<p>', |
193 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
193 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
194 | 194 | '">', |
195 | 195 | '</a>', |
196 | 196 | '</p>' |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public static function load_reg_steps() { |
211 | 211 | static $reg_steps_loaded = FALSE; |
212 | - if ( $reg_steps_loaded ) { |
|
212 | + if ($reg_steps_loaded) { |
|
213 | 213 | return; |
214 | 214 | } |
215 | 215 | // filter list of reg_steps |
@@ -218,24 +218,24 @@ discard block |
||
218 | 218 | EED_Single_Page_Checkout::get_reg_steps() |
219 | 219 | ); |
220 | 220 | // sort by key (order) |
221 | - ksort( $reg_steps_to_load ); |
|
221 | + ksort($reg_steps_to_load); |
|
222 | 222 | // loop through folders |
223 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
223 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
224 | 224 | // we need a |
225 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
225 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
226 | 226 | // copy over to the reg_steps_array |
227 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
227 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
228 | 228 | // register custom key route for each reg step |
229 | 229 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
230 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
230 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
231 | 231 | // add AJAX or other hooks |
232 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
232 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
233 | 233 | // setup autoloaders if necessary |
234 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
235 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
234 | + if ( ! class_exists($reg_step['class_name'])) { |
|
235 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
236 | 236 | } |
237 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
238 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
237 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
238 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | } |
@@ -254,28 +254,28 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public static function get_reg_steps() { |
256 | 256 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
257 | - if ( empty( $reg_steps )) { |
|
257 | + if (empty($reg_steps)) { |
|
258 | 258 | $reg_steps = array( |
259 | 259 | 10 => array( |
260 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
260 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
261 | 261 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
262 | 262 | 'slug' => 'attendee_information', |
263 | 263 | 'has_hooks' => FALSE |
264 | 264 | ), |
265 | 265 | 20 => array( |
266 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
266 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
267 | 267 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
268 | 268 | 'slug' => 'registration_confirmation', |
269 | 269 | 'has_hooks' => FALSE |
270 | 270 | ), |
271 | 271 | 30 => array( |
272 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
272 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
273 | 273 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
274 | 274 | 'slug' => 'payment_options', |
275 | 275 | 'has_hooks' => TRUE |
276 | 276 | ), |
277 | 277 | 999 => array( |
278 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
278 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
279 | 279 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
280 | 280 | 'slug' => 'finalize_registration', |
281 | 281 | 'has_hooks' => FALSE |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public static function registration_checkout_for_admin() { |
297 | 297 | EED_Single_Page_Checkout::load_reg_steps(); |
298 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
299 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
300 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
298 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
299 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
300 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
301 | 301 | EED_Single_Page_Checkout::instance()->_initialize(); |
302 | 302 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
303 | 303 | return EE_Registry::instance()->REQ->get_output(); |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public static function process_registration_from_admin() { |
315 | 315 | EED_Single_Page_Checkout::load_reg_steps(); |
316 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
317 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
318 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
316 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
317 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
318 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
319 | 319 | EED_Single_Page_Checkout::instance()->_initialize(); |
320 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
321 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
322 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
323 | - if ( $final_reg_step->process_reg_step() ) { |
|
320 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
321 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
322 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
323 | + if ($final_reg_step->process_reg_step()) { |
|
324 | 324 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
325 | 325 | } |
326 | 326 | } |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * @param WP_Query $WP_Query |
338 | 338 | * @return void |
339 | 339 | */ |
340 | - public function run( $WP_Query ) { |
|
340 | + public function run($WP_Query) { |
|
341 | 341 | if ( |
342 | 342 | $WP_Query instanceof WP_Query |
343 | 343 | && $WP_Query->is_main_query() |
344 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
344 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
345 | 345 | ) { |
346 | 346 | $this->_initialize(); |
347 | 347 | } |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | * @param WP_Query $WP_Query |
358 | 358 | * @return void |
359 | 359 | */ |
360 | - public static function init( $WP_Query ) { |
|
361 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
360 | + public static function init($WP_Query) { |
|
361 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | |
@@ -372,29 +372,29 @@ discard block |
||
372 | 372 | */ |
373 | 373 | private function _initialize() { |
374 | 374 | // ensure SPCO doesn't run twice |
375 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
375 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
376 | 376 | return; |
377 | 377 | } |
378 | 378 | $this->_verify_session(); |
379 | 379 | // setup the EE_Checkout object |
380 | 380 | $this->checkout = $this->_initialize_checkout(); |
381 | 381 | // filter checkout |
382 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
382 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
383 | 383 | // get the $_GET |
384 | 384 | $this->_get_request_vars(); |
385 | 385 | // filter continue_reg |
386 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
386 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
387 | 387 | // load the reg steps array |
388 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
388 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
389 | 389 | EED_Single_Page_Checkout::$_initialized = true; |
390 | 390 | return; |
391 | 391 | } |
392 | 392 | // set the current step |
393 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
393 | + $this->checkout->set_current_step($this->checkout->step); |
|
394 | 394 | // and the next step |
395 | 395 | $this->checkout->set_next_step(); |
396 | 396 | // verify that everything has been setup correctly |
397 | - if ( ! ( $this->_verify_transaction_and_get_registrations() && $this->_final_verifications() ) ) { |
|
397 | + if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) { |
|
398 | 398 | EED_Single_Page_Checkout::$_initialized = true; |
399 | 399 | return; |
400 | 400 | } |
@@ -419,9 +419,9 @@ discard block |
||
419 | 419 | // set no cache headers and constants |
420 | 420 | EE_System::do_not_cache(); |
421 | 421 | // add anchor |
422 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
422 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
423 | 423 | // remove transaction lock |
424 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
424 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | |
@@ -434,16 +434,16 @@ discard block |
||
434 | 434 | * @throws EE_Error |
435 | 435 | */ |
436 | 436 | private function _verify_session() { |
437 | - if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
438 | - throw new EE_Error( __( 'The EE_Session class could not be loaded.', 'event_espresso' ) ); |
|
437 | + if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
438 | + throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso')); |
|
439 | 439 | } |
440 | 440 | // is session still valid ? |
441 | - if ( EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) === '' ) { |
|
441 | + if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') { |
|
442 | 442 | $this->checkout = new EE_Checkout(); |
443 | 443 | EE_Registry::instance()->SSN->reset_cart(); |
444 | 444 | EE_Registry::instance()->SSN->reset_checkout(); |
445 | 445 | EE_Registry::instance()->SSN->reset_transaction(); |
446 | - EE_Error::add_attention( EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ], __FILE__, __FUNCTION__, __LINE__ ); |
|
446 | + EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__, __FUNCTION__, __LINE__); |
|
447 | 447 | EE_Registry::instance()->SSN->reset_expired(); |
448 | 448 | } |
449 | 449 | } |
@@ -463,20 +463,20 @@ discard block |
||
463 | 463 | /** @type EE_Checkout $checkout */ |
464 | 464 | $checkout = EE_Registry::instance()->SSN->checkout(); |
465 | 465 | // verify |
466 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
466 | + if ( ! $checkout instanceof EE_Checkout) { |
|
467 | 467 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
468 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
468 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
469 | 469 | // verify again |
470 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
471 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
470 | + if ( ! $checkout instanceof EE_Checkout) { |
|
471 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
472 | 472 | } |
473 | 473 | } else { |
474 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
475 | - wp_safe_redirect( $checkout->redirect_url ); |
|
474 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
475 | + wp_safe_redirect($checkout->redirect_url); |
|
476 | 476 | exit(); |
477 | 477 | } |
478 | 478 | } |
479 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
479 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
480 | 480 | // reset anything that needs a clean slate for each request |
481 | 481 | $checkout->reset_for_current_request(); |
482 | 482 | return $checkout; |
@@ -494,24 +494,24 @@ discard block |
||
494 | 494 | // load classes |
495 | 495 | EED_Single_Page_Checkout::load_request_handler(); |
496 | 496 | //make sure this request is marked as belonging to EE |
497 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
497 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
498 | 498 | // which step is being requested ? |
499 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
499 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
500 | 500 | // which step is being edited ? |
501 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
501 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
502 | 502 | // and what we're doing on the current step |
503 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
503 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
504 | 504 | // returning to edit ? |
505 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
505 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
506 | 506 | // or some other kind of revisit ? |
507 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
507 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
508 | 508 | // and whether or not to generate a reg form for this request |
509 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
509 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
510 | 510 | // and whether or not to process a reg form submission for this request |
511 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
511 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
512 | 512 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
513 | 513 | ? $this->checkout->process_form_submission |
514 | - : FALSE; // TRUE FALSE |
|
514 | + : FALSE; // TRUE FALSE |
|
515 | 515 | //$this->_display_request_vars(); |
516 | 516 | } |
517 | 517 | |
@@ -524,17 +524,17 @@ discard block |
||
524 | 524 | * @return void |
525 | 525 | */ |
526 | 526 | protected function _display_request_vars() { |
527 | - if ( ! WP_DEBUG ) { |
|
527 | + if ( ! WP_DEBUG) { |
|
528 | 528 | return; |
529 | 529 | } |
530 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
531 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
532 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
533 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
534 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
535 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
536 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
537 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
530 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
531 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
532 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
533 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
534 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
535 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
536 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
537 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * @return array |
549 | 549 | */ |
550 | 550 | private function _get_first_step() { |
551 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
552 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
551 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
552 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
@@ -565,27 +565,27 @@ discard block |
||
565 | 565 | private function _load_and_instantiate_reg_steps() { |
566 | 566 | // have reg_steps already been instantiated ? |
567 | 567 | if ( |
568 | - empty( $this->checkout->reg_steps ) || |
|
569 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
568 | + empty($this->checkout->reg_steps) || |
|
569 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
570 | 570 | ) { |
571 | 571 | // if not, then loop through raw reg steps array |
572 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
573 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
572 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
573 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
574 | 574 | return false; |
575 | 575 | } |
576 | 576 | } |
577 | 577 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
578 | 578 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
579 | 579 | // skip the registration_confirmation page ? |
580 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
580 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
581 | 581 | // just remove it from the reg steps array |
582 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
582 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
583 | 583 | } else if ( |
584 | 584 | EE_Registry::instance()->CFG->registration->reg_confirmation_last |
585 | - && isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
585 | + && isset($this->checkout->reg_steps['registration_confirmation']) |
|
586 | 586 | ) { |
587 | 587 | // set the order to something big like 100 |
588 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
588 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
589 | 589 | } |
590 | 590 | // filter the array for good luck |
591 | 591 | $this->checkout->reg_steps = apply_filters( |
@@ -595,13 +595,13 @@ discard block |
||
595 | 595 | // finally re-sort based on the reg step class order properties |
596 | 596 | $this->checkout->sort_reg_steps(); |
597 | 597 | } else { |
598 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
598 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
599 | 599 | // set all current step stati to FALSE |
600 | - $reg_step->set_is_current_step( FALSE ); |
|
600 | + $reg_step->set_is_current_step(FALSE); |
|
601 | 601 | } |
602 | 602 | } |
603 | - if ( empty( $this->checkout->reg_steps )) { |
|
604 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
603 | + if (empty($this->checkout->reg_steps)) { |
|
604 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
605 | 605 | return false; |
606 | 606 | } |
607 | 607 | // make reg step details available to JS |
@@ -619,10 +619,10 @@ discard block |
||
619 | 619 | * @param int $order |
620 | 620 | * @return bool |
621 | 621 | */ |
622 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
622 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
623 | 623 | |
624 | 624 | // we need a file_path, class_name, and slug to add a reg step |
625 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
625 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
626 | 626 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
627 | 627 | if ( |
628 | 628 | $this->checkout->reg_url_link |
@@ -640,26 +640,26 @@ discard block |
||
640 | 640 | FALSE |
641 | 641 | ); |
642 | 642 | // did we gets the goods ? |
643 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
643 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
644 | 644 | // set reg step order based on config |
645 | - $reg_step_obj->set_order( $order ); |
|
645 | + $reg_step_obj->set_order($order); |
|
646 | 646 | // add instantiated reg step object to the master reg steps array |
647 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
647 | + $this->checkout->add_reg_step($reg_step_obj); |
|
648 | 648 | } else { |
649 | 649 | EE_Error::add_error( |
650 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
650 | + __('The current step could not be set.', 'event_espresso'), |
|
651 | 651 | __FILE__, __FUNCTION__, __LINE__ |
652 | 652 | ); |
653 | 653 | return false; |
654 | 654 | } |
655 | 655 | } else { |
656 | - if ( WP_DEBUG ) { |
|
656 | + if (WP_DEBUG) { |
|
657 | 657 | EE_Error::add_error( |
658 | 658 | sprintf( |
659 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
660 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
661 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
662 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
659 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
660 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
661 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
662 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
663 | 663 | '<ul>', |
664 | 664 | '<li>', |
665 | 665 | '</li>', |
@@ -683,15 +683,15 @@ discard block |
||
683 | 683 | */ |
684 | 684 | private function _verify_transaction_and_get_registrations() { |
685 | 685 | // was there already a valid transaction in the checkout from the session ? |
686 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
686 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
687 | 687 | // get transaction from db or session |
688 | 688 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
689 | 689 | ? $this->_get_transaction_and_cart_for_previous_visit() |
690 | 690 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
691 | 691 | |
692 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
692 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
693 | 693 | EE_Error::add_error( |
694 | - __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), |
|
694 | + __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
695 | 695 | __FILE__, __FUNCTION__, __LINE__ |
696 | 696 | ); |
697 | 697 | $this->checkout->transaction = EE_Transaction::new_instance(); |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | return false; |
702 | 702 | } |
703 | 703 | // and the registrations for the transaction |
704 | - $this->_get_registrations( $this->checkout->transaction ); |
|
704 | + $this->_get_registrations($this->checkout->transaction); |
|
705 | 705 | } |
706 | 706 | return true; |
707 | 707 | } |
@@ -716,16 +716,16 @@ discard block |
||
716 | 716 | */ |
717 | 717 | private function _get_transaction_and_cart_for_previous_visit() { |
718 | 718 | /** @var $TXN_model EEM_Transaction */ |
719 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
719 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
720 | 720 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
721 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
721 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
722 | 722 | // verify transaction |
723 | - if ( $transaction instanceof EE_Transaction ) { |
|
723 | + if ($transaction instanceof EE_Transaction) { |
|
724 | 724 | // and get the cart that was used for that transaction |
725 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
725 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
726 | 726 | return $transaction; |
727 | 727 | } else { |
728 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
728 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
729 | 729 | return NULL; |
730 | 730 | } |
731 | 731 | } |
@@ -739,11 +739,11 @@ discard block |
||
739 | 739 | * @param EE_Transaction $transaction |
740 | 740 | * @return EE_Cart |
741 | 741 | */ |
742 | - private function _get_cart_for_transaction( $transaction ) { |
|
743 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
742 | + private function _get_cart_for_transaction($transaction) { |
|
743 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
744 | 744 | // verify cart |
745 | - if ( ! $cart instanceof EE_Cart ) { |
|
746 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
745 | + if ( ! $cart instanceof EE_Cart) { |
|
746 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
747 | 747 | } |
748 | 748 | return $cart; |
749 | 749 | } |
@@ -758,8 +758,8 @@ discard block |
||
758 | 758 | * @param EE_Transaction $transaction |
759 | 759 | * @return EE_Cart |
760 | 760 | */ |
761 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
762 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
761 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
762 | + return EE_Cart::get_cart_from_txn($transaction); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | |
@@ -774,15 +774,15 @@ discard block |
||
774 | 774 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
775 | 775 | // if there's no transaction, then this is the FIRST visit to SPCO |
776 | 776 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
777 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
777 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
778 | 778 | // and then create a new transaction |
779 | 779 | $transaction = $this->_initialize_transaction(); |
780 | 780 | // verify transaction |
781 | - if ( $transaction instanceof EE_Transaction ) { |
|
781 | + if ($transaction instanceof EE_Transaction) { |
|
782 | 782 | // and save TXN data to the cart |
783 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
783 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
784 | 784 | } else { |
785 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
785 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
786 | 786 | } |
787 | 787 | return $transaction; |
788 | 788 | } |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | // grab the cart grand total |
803 | 803 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
804 | 804 | // create new TXN |
805 | - $transaction = EE_Transaction::new_instance( array( |
|
805 | + $transaction = EE_Transaction::new_instance(array( |
|
806 | 806 | 'TXN_timestamp' => time(), |
807 | 807 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
808 | 808 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | $transaction->ID() |
818 | 818 | ); |
819 | 819 | return $transaction; |
820 | - } catch( Exception $e ) { |
|
821 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
820 | + } catch (Exception $e) { |
|
821 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
822 | 822 | } |
823 | 823 | return NULL; |
824 | 824 | } |
@@ -832,34 +832,34 @@ discard block |
||
832 | 832 | * @param EE_Transaction $transaction |
833 | 833 | * @return EE_Cart |
834 | 834 | */ |
835 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
835 | + private function _get_registrations(EE_Transaction $transaction) { |
|
836 | 836 | // first step: grab the registrants { : o |
837 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
837 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
838 | 838 | // verify registrations have been set |
839 | - if ( empty( $registrations )) { |
|
839 | + if (empty($registrations)) { |
|
840 | 840 | // if no cached registrations, then check the db |
841 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
841 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
842 | 842 | // still nothing ? well as long as this isn't a revisit |
843 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
843 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
844 | 844 | // generate new registrations from scratch |
845 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
845 | + $registrations = $this->_initialize_registrations($transaction); |
|
846 | 846 | } |
847 | 847 | } |
848 | 848 | // sort by their original registration order |
849 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
849 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
850 | 850 | // then loop thru the array |
851 | - foreach ( $registrations as $registration ) { |
|
851 | + foreach ($registrations as $registration) { |
|
852 | 852 | // verify each registration |
853 | - if ( $registration instanceof EE_Registration ) { |
|
853 | + if ($registration instanceof EE_Registration) { |
|
854 | 854 | // we display all attendee info for the primary registrant |
855 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
855 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
856 | 856 | $this->checkout->primary_revisit = TRUE; |
857 | 857 | break; |
858 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
858 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
859 | 859 | // but hide info if it doesn't belong to you |
860 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
860 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
861 | 861 | } |
862 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
862 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
863 | 863 | } |
864 | 864 | } |
865 | 865 | } |
@@ -873,17 +873,17 @@ discard block |
||
873 | 873 | * @param EE_Transaction $transaction |
874 | 874 | * @return array |
875 | 875 | */ |
876 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
876 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
877 | 877 | $att_nmbr = 0; |
878 | 878 | $registrations = array(); |
879 | - if ( $transaction instanceof EE_Transaction ) { |
|
879 | + if ($transaction instanceof EE_Transaction) { |
|
880 | 880 | /** @type EE_Registration_Processor $registration_processor */ |
881 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
881 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
882 | 882 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
883 | 883 | // now let's add the cart items to the $transaction |
884 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
884 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
885 | 885 | //do the following for each ticket of this type they selected |
886 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
886 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
887 | 887 | $att_nmbr++; |
888 | 888 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
889 | 889 | $line_item, |
@@ -891,12 +891,12 @@ discard block |
||
891 | 891 | $att_nmbr, |
892 | 892 | $this->checkout->total_ticket_count |
893 | 893 | ); |
894 | - if ( $registration instanceof EE_Registration ) { |
|
895 | - $registrations[ $registration->ID() ] = $registration; |
|
894 | + if ($registration instanceof EE_Registration) { |
|
895 | + $registrations[$registration->ID()] = $registration; |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | } |
899 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
899 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
900 | 900 | } |
901 | 901 | return $registrations; |
902 | 902 | } |
@@ -911,12 +911,12 @@ discard block |
||
911 | 911 | * @param EE_Registration $reg_B |
912 | 912 | * @return array() |
913 | 913 | */ |
914 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
914 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
915 | 915 | // this shouldn't ever happen within the same TXN, but oh well |
916 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
916 | + if ($reg_A->count() == $reg_B->count()) { |
|
917 | 917 | return 0; |
918 | 918 | } |
919 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
919 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | |
@@ -931,35 +931,35 @@ discard block |
||
931 | 931 | */ |
932 | 932 | private function _final_verifications() { |
933 | 933 | // filter checkout |
934 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
934 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
935 | 935 | //verify that current step is still set correctly |
936 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
937 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
936 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
937 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
938 | 938 | return false; |
939 | 939 | } |
940 | 940 | // if returning to SPCO, then verify that primary registrant is set |
941 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
941 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
942 | 942 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
943 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
944 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
943 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
944 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
945 | 945 | return false; |
946 | 946 | } |
947 | 947 | $valid_registrant = null; |
948 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
949 | - if ( $registration instanceof EE_Registration ) { |
|
950 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
948 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
949 | + if ($registration instanceof EE_Registration) { |
|
950 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
951 | 951 | $valid_registrant = $registration; |
952 | 952 | } |
953 | 953 | } |
954 | 954 | } |
955 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
956 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
955 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
956 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
957 | 957 | return false; |
958 | 958 | } |
959 | 959 | } |
960 | 960 | // now that things have been kinda sufficiently verified, |
961 | 961 | // let's add the checkout to the session so that's available other systems |
962 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
962 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
963 | 963 | return true; |
964 | 964 | } |
965 | 965 | |
@@ -975,28 +975,28 @@ discard block |
||
975 | 975 | * @access private |
976 | 976 | * @param bool $reinitializing |
977 | 977 | */ |
978 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
979 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
978 | + private function _initialize_reg_steps($reinitializing = false) { |
|
979 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
980 | 980 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
981 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
982 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
981 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
982 | + if ( ! $reg_step->initialize_reg_step()) { |
|
983 | 983 | // if not initialized then maybe this step is being removed... |
984 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
984 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
985 | 985 | // if it was the current step, then we need to start over here |
986 | - $this->_initialize_reg_steps( true ); |
|
986 | + $this->_initialize_reg_steps(true); |
|
987 | 987 | return; |
988 | 988 | } |
989 | 989 | continue; |
990 | 990 | } |
991 | 991 | // i18n |
992 | 992 | $reg_step->translate_js_strings(); |
993 | - if ( $reg_step->is_current_step() ) { |
|
993 | + if ($reg_step->is_current_step()) { |
|
994 | 994 | // the text that appears on the reg step form submit button |
995 | 995 | $reg_step->set_submit_button_text(); |
996 | 996 | } |
997 | 997 | } |
998 | 998 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
999 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
999 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | |
@@ -1009,39 +1009,39 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | private function _check_form_submission() { |
1011 | 1011 | //does this request require the reg form to be generated ? |
1012 | - if ( $this->checkout->generate_reg_form ) { |
|
1012 | + if ($this->checkout->generate_reg_form) { |
|
1013 | 1013 | // ever heard that song by Blue Rodeo ? |
1014 | 1014 | try { |
1015 | 1015 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
1016 | 1016 | // if not displaying a form, then check for form submission |
1017 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
1017 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
1018 | 1018 | // clear out any old data in case this step is being run again |
1019 | - $this->checkout->current_step->set_valid_data( array() ); |
|
1019 | + $this->checkout->current_step->set_valid_data(array()); |
|
1020 | 1020 | // capture submitted form data |
1021 | 1021 | $this->checkout->current_step->reg_form->receive_form_submission( |
1022 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1022 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1023 | 1023 | ); |
1024 | 1024 | // validate submitted form data |
1025 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
1025 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
1026 | 1026 | // thou shall not pass !!! |
1027 | 1027 | $this->checkout->continue_reg = FALSE; |
1028 | 1028 | // any form validation errors? |
1029 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
1029 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
1030 | 1030 | $submission_error_messages = array(); |
1031 | 1031 | // bad, bad, bad registrant |
1032 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1033 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1034 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
1032 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1033 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1034 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
1035 | 1035 | } |
1036 | 1036 | } |
1037 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1037 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1038 | 1038 | } |
1039 | 1039 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1040 | 1040 | $this->go_to_next_step(); |
1041 | 1041 | return; |
1042 | 1042 | } |
1043 | 1043 | } |
1044 | - } catch( EE_Error $e ) { |
|
1044 | + } catch (EE_Error $e) { |
|
1045 | 1045 | $e->get_error(); |
1046 | 1046 | } |
1047 | 1047 | } |
@@ -1057,38 +1057,38 @@ discard block |
||
1057 | 1057 | */ |
1058 | 1058 | private function _process_form_action() { |
1059 | 1059 | // what cha wanna do? |
1060 | - switch( $this->checkout->action ) { |
|
1060 | + switch ($this->checkout->action) { |
|
1061 | 1061 | // AJAX next step reg form |
1062 | 1062 | case 'display_spco_reg_step' : |
1063 | 1063 | $this->checkout->redirect = FALSE; |
1064 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1065 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1064 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1065 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1066 | 1066 | } |
1067 | 1067 | break; |
1068 | 1068 | |
1069 | 1069 | default : |
1070 | 1070 | // meh... do one of those other steps first |
1071 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1071 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1072 | 1072 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1073 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1073 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1074 | 1074 | // call action on current step |
1075 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1075 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1076 | 1076 | // good registrant, you get to proceed |
1077 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
1078 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
1079 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
1077 | + if ($this->checkout->current_step->success_message() != '') { |
|
1078 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
1079 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
1080 | 1080 | } |
1081 | 1081 | } |
1082 | 1082 | // pack it up, pack it in... |
1083 | 1083 | $this->_setup_redirect(); |
1084 | 1084 | } |
1085 | 1085 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1086 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1086 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1087 | 1087 | |
1088 | 1088 | } else { |
1089 | 1089 | EE_Error::add_error( |
1090 | 1090 | sprintf( |
1091 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1091 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1092 | 1092 | $this->checkout->action, |
1093 | 1093 | $this->checkout->current_step->name() |
1094 | 1094 | ), |
@@ -1114,10 +1114,10 @@ discard block |
||
1114 | 1114 | public function add_styles_and_scripts() { |
1115 | 1115 | // i18n |
1116 | 1116 | $this->translate_js_strings(); |
1117 | - if ( $this->checkout->admin_request ) { |
|
1118 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1117 | + if ($this->checkout->admin_request) { |
|
1118 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1119 | 1119 | } else { |
1120 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1120 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1121 | 1121 | } |
1122 | 1122 | } |
1123 | 1123 | |
@@ -1133,50 +1133,50 @@ discard block |
||
1133 | 1133 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1134 | 1134 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1135 | 1135 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1136 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1137 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1138 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1136 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1137 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1138 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1139 | 1139 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1140 | 1140 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1141 | 1141 | EE_Registry::$i18n_js_strings['process_registration'] = sprintf( |
1142 | - __( 'Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso' ), |
|
1142 | + __('Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso'), |
|
1143 | 1143 | '<br/>' |
1144 | 1144 | ); |
1145 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1145 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1146 | 1146 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1147 | 1147 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1148 | 1148 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1149 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1150 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1151 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1152 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1153 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1154 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1155 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1156 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1157 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1158 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1159 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1160 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1161 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1162 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1149 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1150 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1151 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1152 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1153 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1154 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1155 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1156 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1157 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1158 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1159 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1160 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1161 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1162 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1163 | 1163 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1164 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1164 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1165 | 1165 | '<h4 class="important-notice">', |
1166 | 1166 | '</h4>', |
1167 | 1167 | '<br />', |
1168 | 1168 | '<p>', |
1169 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1169 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1170 | 1170 | '">', |
1171 | 1171 | '</a>', |
1172 | 1172 | '</p>' |
1173 | 1173 | ); |
1174 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1175 | - EE_Registry::$i18n_js_strings[ 'session_extension' ] = absint( |
|
1176 | - apply_filters( 'FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS ) |
|
1174 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1175 | + EE_Registry::$i18n_js_strings['session_extension'] = absint( |
|
1176 | + apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS) |
|
1177 | 1177 | ); |
1178 | - EE_Registry::$i18n_js_strings[ 'session_expiration' ] = gmdate( |
|
1179 | - 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) |
|
1178 | + EE_Registry::$i18n_js_strings['session_expiration'] = gmdate( |
|
1179 | + 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1180 | 1180 | ); |
1181 | 1181 | |
1182 | 1182 | |
@@ -1192,31 +1192,31 @@ discard block |
||
1192 | 1192 | */ |
1193 | 1193 | public function enqueue_styles_and_scripts() { |
1194 | 1194 | // load css |
1195 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1196 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1195 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1196 | + wp_enqueue_style('single_page_checkout'); |
|
1197 | 1197 | // load JS |
1198 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1199 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1198 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1199 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1200 | 1200 | wp_register_script( |
1201 | 1201 | 'single_page_checkout', |
1202 | - SPCO_JS_URL . 'single_page_checkout.js', |
|
1203 | - array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), |
|
1202 | + SPCO_JS_URL.'single_page_checkout.js', |
|
1203 | + array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), |
|
1204 | 1204 | EVENT_ESPRESSO_VERSION, |
1205 | 1205 | TRUE |
1206 | 1206 | ); |
1207 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1207 | + wp_enqueue_script('single_page_checkout'); |
|
1208 | 1208 | |
1209 | 1209 | /** |
1210 | 1210 | * global action hook for enqueueing styles and scripts with |
1211 | 1211 | * spco calls. |
1212 | 1212 | */ |
1213 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1213 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1214 | 1214 | |
1215 | 1215 | /** |
1216 | 1216 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1217 | 1217 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1218 | 1218 | */ |
1219 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1219 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1220 | 1220 | |
1221 | 1221 | // add css and JS for current step |
1222 | 1222 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1232,21 +1232,21 @@ discard block |
||
1232 | 1232 | */ |
1233 | 1233 | private function _display_spco_reg_form() { |
1234 | 1234 | // if registering via the admin, just display the reg form for the current step |
1235 | - if ( $this->checkout->admin_request ) { |
|
1236 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1235 | + if ($this->checkout->admin_request) { |
|
1236 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1237 | 1237 | } else { |
1238 | 1238 | // add powered by EE msg |
1239 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1239 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1240 | 1240 | |
1241 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1242 | - EE_Registry::$i18n_js_strings[ 'empty_cart' ] = $empty_cart; |
|
1241 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1242 | + EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart; |
|
1243 | 1243 | $cookies_not_set_msg = ''; |
1244 | - if ( $empty_cart ) { |
|
1245 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1244 | + if ($empty_cart) { |
|
1245 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1246 | 1246 | $cookies_not_set_msg = apply_filters( |
1247 | 1247 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1248 | 1248 | sprintf( |
1249 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1249 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1250 | 1250 | '<div class="ee-attention">', |
1251 | 1251 | '</div>', |
1252 | 1252 | '<h6 class="important-notice">', |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | 'layout_strategy' => |
1268 | 1268 | new EE_Template_Layout( |
1269 | 1269 | array( |
1270 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1270 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1271 | 1271 | 'template_args' => array( |
1272 | 1272 | 'empty_cart' => $empty_cart, |
1273 | 1273 | 'revisit' => $this->checkout->revisit, |
@@ -1276,8 +1276,8 @@ discard block |
||
1276 | 1276 | 'empty_msg' => apply_filters( |
1277 | 1277 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1278 | 1278 | sprintf( |
1279 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1280 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1279 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1280 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1281 | 1281 | '">', |
1282 | 1282 | '</a>' |
1283 | 1283 | ) |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | ) |
1296 | 1296 | ); |
1297 | 1297 | // load template and add to output sent that gets filtered into the_content() |
1298 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1298 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1299 | 1299 | } |
1300 | 1300 | } |
1301 | 1301 | |
@@ -1309,8 +1309,8 @@ discard block |
||
1309 | 1309 | * @internal param string $label |
1310 | 1310 | * @return string |
1311 | 1311 | */ |
1312 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1313 | - if ( $next_step == 'finalize_registration' ) { |
|
1312 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1313 | + if ($next_step == 'finalize_registration') { |
|
1314 | 1314 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1315 | 1315 | } |
1316 | 1316 | } |
@@ -1324,18 +1324,18 @@ discard block |
||
1324 | 1324 | * @return string |
1325 | 1325 | */ |
1326 | 1326 | public static function display_registration_footer() { |
1327 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1328 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1329 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1330 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1327 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1328 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1329 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1330 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1331 | 1331 | echo apply_filters( |
1332 | 1332 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1333 | 1333 | sprintf( |
1334 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1335 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1334 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1335 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1336 | 1336 | '" target="_blank">', |
1337 | 1337 | '</a>', |
1338 | - '<a href="' . $url . '" title="', |
|
1338 | + '<a href="'.$url.'" title="', |
|
1339 | 1339 | '" target="_blank">', |
1340 | 1340 | '</a></div>' |
1341 | 1341 | ) |
@@ -1366,12 +1366,12 @@ discard block |
||
1366 | 1366 | * @return array |
1367 | 1367 | */ |
1368 | 1368 | private function _setup_redirect() { |
1369 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1369 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1370 | 1370 | $this->checkout->redirect = TRUE; |
1371 | - if ( empty( $this->checkout->redirect_url )) { |
|
1371 | + if (empty($this->checkout->redirect_url)) { |
|
1372 | 1372 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1373 | 1373 | } |
1374 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1374 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1375 | 1375 | } |
1376 | 1376 | } |
1377 | 1377 | |
@@ -1384,12 +1384,12 @@ discard block |
||
1384 | 1384 | * @return void |
1385 | 1385 | */ |
1386 | 1386 | public function go_to_next_step() { |
1387 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1387 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1388 | 1388 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1389 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1389 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1390 | 1390 | } |
1391 | 1391 | // just return for these conditions |
1392 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1392 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1393 | 1393 | return; |
1394 | 1394 | } |
1395 | 1395 | // AJAX response |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | */ |
1411 | 1411 | protected function _handle_json_response() { |
1412 | 1412 | // if this is an ajax request |
1413 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1413 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1414 | 1414 | // DEBUG LOG |
1415 | 1415 | //$this->checkout->log( |
1416 | 1416 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1420,10 +1420,10 @@ discard block |
||
1420 | 1420 | // 'continue_reg' => $this->checkout->continue_reg, |
1421 | 1421 | // ) |
1422 | 1422 | //); |
1423 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1424 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1423 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1424 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1425 | 1425 | // just send the ajax ( |
1426 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1426 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1427 | 1427 | $this->unlock_transaction(); |
1428 | 1428 | echo $json_response; |
1429 | 1429 | exit(); |
@@ -1440,9 +1440,9 @@ discard block |
||
1440 | 1440 | */ |
1441 | 1441 | protected function _handle_html_redirects() { |
1442 | 1442 | // going somewhere ? |
1443 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1443 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1444 | 1444 | // store notices in a transient |
1445 | - EE_Error::get_notices( false, true, true ); |
|
1445 | + EE_Error::get_notices(false, true, true); |
|
1446 | 1446 | $this->unlock_transaction(); |
1447 | 1447 | // DEBUG LOG |
1448 | 1448 | //$this->checkout->log( |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | // 'headers_list' => headers_list(), |
1454 | 1454 | // ) |
1455 | 1455 | //); |
1456 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1456 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1457 | 1457 | exit(); |
1458 | 1458 | } |
1459 | 1459 | } |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @return void |
29 | 29 | */ |
30 | 30 | public static function set_hooks() { |
31 | - add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) ); |
|
32 | - add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
33 | - add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
34 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
35 | - add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
36 | - add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) ); |
|
37 | - add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
31 | + add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')); |
|
32 | + add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
33 | + add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
34 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
35 | + add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
36 | + add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')); |
|
37 | + add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
38 | 38 | ); |
39 | - add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 ); |
|
39 | + add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * ajax switch_spco_billing_form |
46 | 46 | */ |
47 | 47 | public static function switch_spco_billing_form() { |
48 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
48 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * ajax save_payer_details |
55 | 55 | */ |
56 | 56 | public static function save_payer_details() { |
57 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
57 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * ajax get_transaction_details |
64 | 64 | */ |
65 | 65 | public static function get_transaction_details() { |
66 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
66 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | * @param EE_Checkout $checkout |
92 | 92 | * @return \EE_SPCO_Reg_Step_Payment_Options |
93 | 93 | */ |
94 | - public function __construct( EE_Checkout $checkout ) { |
|
94 | + public function __construct(EE_Checkout $checkout) { |
|
95 | 95 | $this->_slug = 'payment_options'; |
96 | 96 | $this->_name = __('Payment Options', 'event_espresso'); |
97 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
97 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
98 | 98 | $this->checkout = $checkout; |
99 | 99 | $this->_reset_success_message(); |
100 | - $this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
100 | + $this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param null $line_item_display |
116 | 116 | */ |
117 | - public function set_line_item_display( $line_item_display ) { |
|
117 | + public function set_line_item_display($line_item_display) { |
|
118 | 118 | $this->line_item_display = $line_item_display; |
119 | 119 | } |
120 | 120 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | public function translate_js_strings() { |
128 | - EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' ); |
|
129 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' ); |
|
130 | - EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' ); |
|
128 | + EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso'); |
|
129 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso'); |
|
130 | + EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -156,20 +156,20 @@ discard block |
||
156 | 156 | // $ 0.00 transactions (no payment required) |
157 | 157 | ! $this->checkout->payment_required() |
158 | 158 | // but do NOT remove if current action being called belongs to this reg step |
159 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
159 | + && ! is_callable(array($this, $this->checkout->action)) |
|
160 | 160 | && ! $this->completed() |
161 | 161 | ) { |
162 | 162 | // and if so, then we no longer need the Payment Options step |
163 | - if ( $this->is_current_step() ) { |
|
163 | + if ($this->is_current_step()) { |
|
164 | 164 | $this->checkout->generate_reg_form = false; |
165 | 165 | } |
166 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
166 | + $this->checkout->remove_reg_step($this->_slug); |
|
167 | 167 | // DEBUG LOG |
168 | 168 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
169 | 169 | return false; |
170 | 170 | } |
171 | 171 | // load EEM_Payment_Method |
172 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
172 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
173 | 173 | // get all active payment methods |
174 | 174 | $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
175 | 175 | $this->checkout->transaction, EEM_Payment_Method::scope_cart |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return bool |
184 | 184 | */ |
185 | 185 | public function generate_reg_form() { |
186 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
186 | + EE_Registry::instance()->load_helper('HTML'); |
|
187 | 187 | // reset in case someone changes their mind |
188 | 188 | $this->_reset_selected_method_of_payment(); |
189 | 189 | // set some defaults |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | $reg_count = 0; |
196 | 196 | $no_payment_required = true; |
197 | 197 | // loop thru registrations to gather info |
198 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
199 | - foreach ( $registrations as $registration ) { |
|
198 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
199 | + foreach ($registrations as $registration) { |
|
200 | 200 | /** @var $registration EE_Registration */ |
201 | 201 | $reg_count++; |
202 | 202 | // registrant is NOT Approved |
203 | - if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) { |
|
203 | + if ($registration->status_ID() === EEM_Registration::status_id_not_approved) { |
|
204 | 204 | // add event to list of events with pre-approval reg status |
205 | - $registrations_requiring_pre_approval[ $registration->ID() ] = $registration; |
|
205 | + $registrations_requiring_pre_approval[$registration->ID()] = $registration; |
|
206 | 206 | do_action( |
207 | 207 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
208 | 208 | $registration->event(), |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | // anything other than Approved |
217 | 217 | && $registration->status_ID() !== EEM_Registration::status_id_approved |
218 | 218 | // event hasn't sold out since initial visit |
219 | - && $registration->event()->is_sold_out( true ) |
|
219 | + && $registration->event()->is_sold_out(true) |
|
220 | 220 | ) { |
221 | 221 | // add event to list of events that are sold out |
222 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
222 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
223 | 223 | do_action( |
224 | 224 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
225 | 225 | $registration->event(), |
@@ -228,29 +228,29 @@ discard block |
||
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | // are they allowed to pay now and is there monies owing? |
231 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
232 | - $registrations_requiring_payment[ $registration->ID() ] = $registration; |
|
231 | + if ($registration->owes_monies_and_can_pay()) { |
|
232 | + $registrations_requiring_payment[$registration->ID()] = $registration; |
|
233 | 233 | do_action( |
234 | 234 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
235 | 235 | $registration->event(), |
236 | 236 | $this |
237 | 237 | ); |
238 | - } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free() ) { |
|
239 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
238 | + } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) { |
|
239 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | $subsections = array(); |
243 | 243 | // now decide which template to load |
244 | - if ( ! empty( $sold_out_events )) { |
|
245 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
244 | + if ( ! empty($sold_out_events)) { |
|
245 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
246 | 246 | } |
247 | - if ( ! empty( $registrations_requiring_pre_approval )) { |
|
248 | - $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval ); |
|
247 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
248 | + $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval); |
|
249 | 249 | } |
250 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
251 | - $subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events ); |
|
250 | + if ( ! empty($registrations_for_free_events)) { |
|
251 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
252 | 252 | } |
253 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
253 | + if ( ! empty($registrations_requiring_payment)) { |
|
254 | 254 | // autoload Line_Item_Display classes |
255 | 255 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
256 | 256 | $line_item_filter_processor = new EE_Line_Item_Filter_Processor( |
@@ -261,17 +261,17 @@ discard block |
||
261 | 261 | $this->checkout->cart->get_grand_total() |
262 | 262 | ); |
263 | 263 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
264 | - if ( $this->checkout->amount_owing > 0 ) { |
|
264 | + if ($this->checkout->amount_owing > 0) { |
|
265 | 265 | EEH_Autoloader::register_line_item_display_autoloaders(); |
266 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
267 | - $subsections[ 'payment_options' ] = $this->_display_payment_options( |
|
266 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
267 | + $subsections['payment_options'] = $this->_display_payment_options( |
|
268 | 268 | $this->line_item_display->display_line_item( |
269 | 269 | $filtered_line_item_tree, |
270 | - array( 'registrations' => $registrations ) |
|
270 | + array('registrations' => $registrations) |
|
271 | 271 | ) |
272 | 272 | ); |
273 | 273 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
274 | - $this->_apply_registration_payments_to_amount_owing( $registrations ); |
|
274 | + $this->_apply_registration_payments_to_amount_owing($registrations); |
|
275 | 275 | } |
276 | 276 | $no_payment_required = false; |
277 | 277 | } else { |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $this->_save_selected_method_of_payment(); |
281 | 281 | |
282 | 282 | $subsections['default_hidden_inputs'] = $this->reg_step_hidden_inputs(); |
283 | - $subsections['extra_hidden_inputs' ] = $this->_extra_hidden_inputs( $no_payment_required ); |
|
283 | + $subsections['extra_hidden_inputs'] = $this->_extra_hidden_inputs($no_payment_required); |
|
284 | 284 | |
285 | 285 | return new EE_Form_Section_Proper( |
286 | 286 | array( |
@@ -308,21 +308,21 @@ discard block |
||
308 | 308 | * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection |
309 | 309 | * @return \EE_Line_Item_Filter_Collection |
310 | 310 | */ |
311 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
312 | - if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
311 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
312 | + if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
313 | 313 | return $line_item_filter_collection; |
314 | 314 | } |
315 | - if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout ) { |
|
315 | + if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout) { |
|
316 | 316 | return $line_item_filter_collection; |
317 | 317 | } |
318 | - if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction ) { |
|
318 | + if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction) { |
|
319 | 319 | return $line_item_filter_collection; |
320 | 320 | } |
321 | 321 | $registrations = EE_Registry::instance()->SSN->checkout()->transaction->registrations( |
322 | 322 | EE_Registry::instance()->SSN->checkout()->reg_cache_where_params |
323 | 323 | ); |
324 | - $line_item_filter_collection->add( new EE_Billable_Line_Item_Filter( $registrations ) ); |
|
325 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
324 | + $line_item_filter_collection->add(new EE_Billable_Line_Item_Filter($registrations)); |
|
325 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
326 | 326 | return $line_item_filter_collection; |
327 | 327 | } |
328 | 328 | |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | * @return void |
337 | 337 | */ |
338 | 338 | protected function _hide_reg_step_submit_button_if_revisit() { |
339 | - if ( $this->checkout->revisit ) { |
|
340 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
339 | + if ($this->checkout->revisit) { |
|
340 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
@@ -348,18 +348,18 @@ discard block |
||
348 | 348 | * @param \EE_Event[] $sold_out_events_array |
349 | 349 | * @return \EE_Form_Section_Proper |
350 | 350 | */ |
351 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
351 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
352 | 352 | // set some defaults |
353 | 353 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
354 | 354 | $sold_out_events = ''; |
355 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
356 | - $sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )); |
|
355 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
356 | + $sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')); |
|
357 | 357 | } |
358 | 358 | return new EE_Form_Section_Proper( |
359 | 359 | array( |
360 | 360 | 'layout_strategy' => new EE_Template_Layout( |
361 | 361 | array( |
362 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template |
|
362 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template |
|
363 | 363 | 'template_args' => apply_filters( |
364 | 364 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
365 | 365 | array( |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | 'sold_out_events_msg' => apply_filters( |
368 | 368 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg', |
369 | 369 | sprintf( |
370 | - __( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso' ), |
|
370 | + __('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso'), |
|
371 | 371 | '<strong>', |
372 | 372 | '</strong>', |
373 | 373 | '<br />' |
@@ -388,14 +388,14 @@ discard block |
||
388 | 388 | * @param array $registrations_requiring_pre_approval |
389 | 389 | * @return \EE_Form_Section_Proper |
390 | 390 | */ |
391 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) { |
|
391 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
392 | 392 | $events_requiring_pre_approval = ''; |
393 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
394 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
395 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
396 | - EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
393 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
394 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
395 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
396 | + EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
397 | 397 | ) |
398 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
398 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
399 | 399 | ); |
400 | 400 | } |
401 | 401 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | array( |
404 | 404 | 'layout_strategy' => new EE_Template_Layout( |
405 | 405 | array( |
406 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template |
|
406 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template |
|
407 | 407 | 'template_args' => apply_filters( |
408 | 408 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
409 | 409 | array( |
410 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
410 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
411 | 411 | 'events_requiring_pre_approval_msg' => apply_filters( |
412 | 412 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
413 | - __( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' ) |
|
413 | + __('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso') |
|
414 | 414 | ) |
415 | 415 | ) |
416 | 416 | ), |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * @param \EE_Event[] $registrations_for_free_events |
429 | 429 | * @return \EE_Form_Section_Proper |
430 | 430 | */ |
431 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
431 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
432 | 432 | // set some defaults |
433 | 433 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
434 | 434 | // generate no_payment_required form |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | array( |
437 | 437 | 'layout_strategy' => new EE_Template_Layout( |
438 | 438 | array( |
439 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template |
|
439 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template |
|
440 | 440 | 'template_args' => apply_filters( |
441 | 441 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
442 | 442 | array( |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | 'registrations' => array(), |
445 | 445 | 'ticket_count' => array(), |
446 | 446 | 'registrations_for_free_events' => $registrations_for_free_events, |
447 | - 'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' )) |
|
447 | + 'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso')) |
|
448 | 448 | ) |
449 | 449 | ), |
450 | 450 | ) |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @param string $transaction_details |
462 | 462 | * @return \EE_Form_Section_Proper |
463 | 463 | */ |
464 | - private function _display_payment_options( $transaction_details = '' ) { |
|
464 | + private function _display_payment_options($transaction_details = '') { |
|
465 | 465 | // has method_of_payment been set by no-js user? |
466 | 466 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
467 | 467 | // build payment options form |
@@ -473,18 +473,18 @@ discard block |
||
473 | 473 | 'before_payment_options' => apply_filters( |
474 | 474 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
475 | 475 | new EE_Form_Section_Proper( |
476 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
476 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
477 | 477 | ) |
478 | 478 | ), |
479 | 479 | 'payment_options' => $this->_setup_payment_options(), |
480 | 480 | 'after_payment_options' => apply_filters( |
481 | 481 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
482 | 482 | new EE_Form_Section_Proper( |
483 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
483 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
484 | 484 | ) |
485 | 485 | ), |
486 | 486 | ), |
487 | - 'layout_strategy' => new EE_Template_Layout( array( |
|
487 | + 'layout_strategy' => new EE_Template_Layout(array( |
|
488 | 488 | 'layout_template_file' => $this->_template, |
489 | 489 | 'template_args' => apply_filters( |
490 | 490 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args', |
@@ -508,11 +508,11 @@ discard block |
||
508 | 508 | * @param bool $no_payment_required |
509 | 509 | * @return \EE_Form_Section_Proper |
510 | 510 | */ |
511 | - private function _extra_hidden_inputs( $no_payment_required = TRUE ) { |
|
511 | + private function _extra_hidden_inputs($no_payment_required = TRUE) { |
|
512 | 512 | |
513 | 513 | return new EE_Form_Section_Proper( |
514 | 514 | array( |
515 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
515 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
516 | 516 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
517 | 517 | 'subsections' => array( |
518 | 518 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -545,16 +545,16 @@ discard block |
||
545 | 545 | * @access protected |
546 | 546 | * @return void |
547 | 547 | */ |
548 | - protected function _apply_registration_payments_to_amount_owing( $registrations ) { |
|
548 | + protected function _apply_registration_payments_to_amount_owing($registrations) { |
|
549 | 549 | $payments = array(); |
550 | - foreach ( $registrations as $registration ) { |
|
551 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
550 | + foreach ($registrations as $registration) { |
|
551 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
552 | 552 | $payments = $payments + $registration->registration_payments(); |
553 | 553 | } |
554 | 554 | } |
555 | - if ( ! empty( $payments ) ) { |
|
556 | - foreach ( $payments as $payment ) { |
|
557 | - if ( $payment instanceof EE_Registration_Payment ) { |
|
555 | + if ( ! empty($payments)) { |
|
556 | + foreach ($payments as $payment) { |
|
557 | + if ($payment instanceof EE_Registration_Payment) { |
|
558 | 558 | $this->checkout->amount_owing -= $payment->amount(); |
559 | 559 | } |
560 | 560 | } |
@@ -569,9 +569,9 @@ discard block |
||
569 | 569 | * @param bool $force_reset |
570 | 570 | * @return void |
571 | 571 | */ |
572 | - private function _reset_selected_method_of_payment( $force_reset = FALSE ) { |
|
573 | - $reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE )); |
|
574 | - if ( $reset_payment_method ) { |
|
572 | + private function _reset_selected_method_of_payment($force_reset = FALSE) { |
|
573 | + $reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE)); |
|
574 | + if ($reset_payment_method) { |
|
575 | 575 | $this->checkout->selected_method_of_payment = NULL; |
576 | 576 | $this->checkout->payment_method = NULL; |
577 | 577 | $this->checkout->billing_form = NULL; |
@@ -590,9 +590,9 @@ discard block |
||
590 | 590 | * @param string $selected_method_of_payment |
591 | 591 | * @return EE_Billing_Info_Form |
592 | 592 | */ |
593 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
594 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
595 | - EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment )); |
|
593 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
594 | + $selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
595 | + EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment)); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | |
@@ -605,40 +605,40 @@ discard block |
||
605 | 605 | // load payment method classes |
606 | 606 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
607 | 607 | // switch up header depending on number of available payment methods |
608 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
609 | - ? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' )) |
|
610 | - : apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' )); |
|
608 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
609 | + ? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso')) |
|
610 | + : apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso')); |
|
611 | 611 | $available_payment_methods = array( |
612 | 612 | // display the "Payment Method" header |
613 | 613 | 'payment_method_header' => new EE_Form_Section_HTML( |
614 | - EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' ) |
|
614 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
615 | 615 | ) |
616 | 616 | ); |
617 | 617 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
618 | 618 | $available_payment_method_options = array(); |
619 | 619 | $default_payment_method_option = array(); |
620 | 620 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
621 | - $payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' ))); |
|
621 | + $payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;'))); |
|
622 | 622 | // loop through payment methods |
623 | - foreach( $this->checkout->available_payment_methods as $payment_method ) { |
|
624 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
625 | - $payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' ); |
|
623 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
624 | + if ($payment_method instanceof EE_Payment_Method) { |
|
625 | + $payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img'); |
|
626 | 626 | // check if any payment methods are set as default |
627 | 627 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
628 | - if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) { |
|
628 | + if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) { |
|
629 | 629 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
630 | 630 | $this->_save_selected_method_of_payment(); |
631 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
631 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
632 | 632 | } else { |
633 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
633 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
634 | 634 | } |
635 | - $payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method ); |
|
635 | + $payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method); |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | // prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs |
639 | 639 | $available_payment_method_options = $default_payment_method_option + $available_payment_method_options; |
640 | 640 | // now generate the actual form inputs |
641 | - $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options ); |
|
641 | + $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options); |
|
642 | 642 | $available_payment_methods = $available_payment_methods + $payment_methods_billing_info; |
643 | 643 | |
644 | 644 | // build the available payment methods form |
@@ -658,19 +658,19 @@ discard block |
||
658 | 658 | * @return EE_Payment_Method[] |
659 | 659 | */ |
660 | 660 | protected function _get_available_payment_methods() { |
661 | - if ( ! empty( $this->checkout->available_payment_methods )) { |
|
661 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
662 | 662 | return $this->checkout->available_payment_methods; |
663 | 663 | } |
664 | 664 | $available_payment_methods = array(); |
665 | 665 | // load EEM_Payment_Method |
666 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
666 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
667 | 667 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
668 | 668 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
669 | 669 | // get all active payment methods |
670 | - $payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart ); |
|
671 | - foreach ( $payment_methods as $payment_method ) { |
|
672 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
673 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
670 | + $payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart); |
|
671 | + foreach ($payment_methods as $payment_method) { |
|
672 | + if ($payment_method instanceof EE_Payment_Method) { |
|
673 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
674 | 674 | } |
675 | 675 | } |
676 | 676 | return $available_payment_methods; |
@@ -686,14 +686,14 @@ discard block |
||
686 | 686 | * @param array $available_payment_method_options |
687 | 687 | * @return \EE_Form_Section_Proper |
688 | 688 | */ |
689 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
689 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
690 | 690 | // generate inputs |
691 | 691 | return new EE_Form_Section_Proper( |
692 | 692 | array( |
693 | 693 | 'html_id' => 'ee-available-payment-method-inputs', |
694 | 694 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
695 | 695 | 'subsections' => array( |
696 | - '' => new EE_Radio_Button_Input ( |
|
696 | + '' => new EE_Radio_Button_Input( |
|
697 | 697 | $available_payment_method_options, |
698 | 698 | array( |
699 | 699 | 'html_name' => 'selected_method_of_payment', |
@@ -717,36 +717,36 @@ discard block |
||
717 | 717 | * @param EE_Payment_Method $payment_method |
718 | 718 | * @return \EE_Form_Section_Proper |
719 | 719 | */ |
720 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
720 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
721 | 721 | $currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE; |
722 | 722 | // generate the billing form for payment method |
723 | - $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML(); |
|
723 | + $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML(); |
|
724 | 724 | $this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form; |
725 | 725 | // it's all in the details |
726 | - $info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' ); |
|
726 | + $info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr'); |
|
727 | 727 | // add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not |
728 | - if ( $payment_method->description() ) { |
|
728 | + if ($payment_method->description()) { |
|
729 | 729 | $payment_method_info = $payment_method->description(); |
730 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
731 | - $payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
730 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
731 | + $payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
732 | 732 | } else { |
733 | - $payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
733 | + $payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
734 | 734 | } |
735 | - $info_html .= EEH_HTML::p ( |
|
736 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ), |
|
735 | + $info_html .= EEH_HTML::p( |
|
736 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info), |
|
737 | 737 | '', |
738 | 738 | 'spco-payment-method-desc ee-attention' |
739 | 739 | ); |
740 | 740 | |
741 | 741 | return new EE_Form_Section_Proper( |
742 | 742 | array( |
743 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
743 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
744 | 744 | 'html_class' => 'spco-payment-method-info-dv', |
745 | 745 | // only display the selected or default PM |
746 | 746 | 'html_style' => $currently_selected ? '' : 'display:none;', |
747 | 747 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
748 | 748 | 'subsections' => array( |
749 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
749 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
750 | 750 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
751 | 751 | ) |
752 | 752 | ) |
@@ -764,12 +764,12 @@ discard block |
||
764 | 764 | */ |
765 | 765 | public function get_billing_form_html_for_payment_method() { |
766 | 766 | // how have they chosen to pay? |
767 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
767 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
768 | 768 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
769 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
769 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
770 | 770 | return FALSE; |
771 | 771 | } |
772 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
772 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
773 | 773 | EE_Error::add_success( |
774 | 774 | apply_filters( |
775 | 775 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -778,20 +778,20 @@ discard block |
||
778 | 778 | ); |
779 | 779 | } |
780 | 780 | // now generate billing form for selected method of payment |
781 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
781 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
782 | 782 | // fill form with attendee info if applicable |
783 | - if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
784 | - $payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
783 | + if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
784 | + $payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
785 | 785 | } |
786 | 786 | // and debug content |
787 | - if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
788 | - $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form ); |
|
787 | + if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
788 | + $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form); |
|
789 | 789 | } |
790 | 790 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : ''; |
791 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info )); |
|
791 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
792 | 792 | // localize validation rules for main form |
793 | 793 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
794 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
794 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
795 | 795 | return TRUE; |
796 | 796 | } |
797 | 797 | |
@@ -804,15 +804,15 @@ discard block |
||
804 | 804 | * @param EE_Payment_Method $payment_method |
805 | 805 | * @return \EE_Billing_Info_Form |
806 | 806 | */ |
807 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
808 | - $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) ); |
|
809 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
810 | - if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
|
811 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
807 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
808 | + $billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing)); |
|
809 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
810 | + if (EE_Registry::instance()->REQ->is_set('payment_method')) { |
|
811 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
812 | 812 | EE_Error::add_success( |
813 | 813 | apply_filters( |
814 | 814 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
815 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
815 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name()) |
|
816 | 816 | ) |
817 | 817 | ); |
818 | 818 | } |
@@ -837,27 +837,27 @@ discard block |
||
837 | 837 | * @param string $request_param |
838 | 838 | * @return NULL|string |
839 | 839 | */ |
840 | - private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) { |
|
840 | + private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') { |
|
841 | 841 | // is selected_method_of_payment set in the request ? |
842 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE ); |
|
843 | - if ( $selected_method_of_payment ) { |
|
842 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE); |
|
843 | + if ($selected_method_of_payment) { |
|
844 | 844 | // sanitize it |
845 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment; |
|
846 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
845 | + $selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment; |
|
846 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
847 | 847 | // store it in the session so that it's available for all subsequent requests including AJAX |
848 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
848 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
849 | 849 | } else { |
850 | 850 | // or is is set in the session ? |
851 | - $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' ); |
|
851 | + $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment'); |
|
852 | 852 | } |
853 | 853 | // do ya really really gotta have it? |
854 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
854 | + if (empty($selected_method_of_payment) && $required) { |
|
855 | 855 | EE_Error::add_error( |
856 | 856 | sprintf( |
857 | - __( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ), |
|
857 | + __('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'), |
|
858 | 858 | '<br/>', |
859 | 859 | '<br/>', |
860 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
860 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
861 | 861 | ), |
862 | 862 | __FILE__, __FUNCTION__, __LINE__ |
863 | 863 | ); |
@@ -883,37 +883,37 @@ discard block |
||
883 | 883 | * @return string |
884 | 884 | */ |
885 | 885 | public function switch_payment_method() { |
886 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
886 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
887 | 887 | return false; |
888 | 888 | } |
889 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
889 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
890 | 890 | EE_Error::add_success( |
891 | 891 | apply_filters( |
892 | 892 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
893 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() ) |
|
893 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
894 | 894 | ) |
895 | 895 | ); |
896 | 896 | } |
897 | 897 | // generate billing form for selected method of payment if it hasn't been done already |
898 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
899 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
898 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
899 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
900 | 900 | } |
901 | 901 | // fill form with attendee info if applicable |
902 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
903 | - $this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
902 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
903 | + $this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
904 | 904 | } |
905 | 905 | // and debug content |
906 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
907 | - $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form ); |
|
906 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
907 | + $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form); |
|
908 | 908 | } |
909 | 909 | // get html and validation rules for form |
910 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
911 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() )); |
|
910 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
911 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html())); |
|
912 | 912 | // localize validation rules for main form |
913 | - $this->checkout->billing_form->localize_validation_rules( TRUE ); |
|
914 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
913 | + $this->checkout->billing_form->localize_validation_rules(TRUE); |
|
914 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
915 | 915 | } else { |
916 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' )); |
|
916 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
917 | 917 | } |
918 | 918 | //prevents advancement to next step |
919 | 919 | $this->checkout->continue_reg = FALSE; |
@@ -928,18 +928,18 @@ discard block |
||
928 | 928 | */ |
929 | 929 | protected function _verify_payment_method_is_set() { |
930 | 930 | // generate billing form for selected method of payment if it hasn't been done already |
931 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
931 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
932 | 932 | // how have they chosen to pay? |
933 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
933 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
934 | 934 | } else { |
935 | 935 | // choose your own adventure based on method_of_payment |
936 | - switch ( $this->checkout->selected_method_of_payment ) { |
|
936 | + switch ($this->checkout->selected_method_of_payment) { |
|
937 | 937 | case 'events_sold_out' : |
938 | 938 | EE_Error::add_attention( |
939 | 939 | apply_filters( |
940 | 940 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__sold_out_events_msg', |
941 | - __( 'It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.', |
|
942 | - 'event_espresso' ) |
|
941 | + __('It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.', |
|
942 | + 'event_espresso') |
|
943 | 943 | ), |
944 | 944 | __FILE__, __FUNCTION__, __LINE__ |
945 | 945 | ); |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | EE_Error::add_attention( |
950 | 950 | apply_filters( |
951 | 951 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__payments_closed_msg', |
952 | - __( 'It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso' ) |
|
952 | + __('It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso') |
|
953 | 953 | ), |
954 | 954 | __FILE__, __FUNCTION__, __LINE__ |
955 | 955 | ); |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | EE_Error::add_attention( |
960 | 960 | apply_filters( |
961 | 961 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__no_payment_required_msg', |
962 | - __( 'It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso' ) |
|
962 | + __('It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso') |
|
963 | 963 | ), |
964 | 964 | __FILE__, __FUNCTION__, __LINE__ |
965 | 965 | ); |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | } |
970 | 970 | } |
971 | 971 | // verify payment method |
972 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
972 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
973 | 973 | // get payment method for selected method of payment |
974 | 974 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
975 | 975 | } |
@@ -989,23 +989,23 @@ discard block |
||
989 | 989 | * @return void |
990 | 990 | */ |
991 | 991 | public function save_payer_details_via_ajax() { |
992 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
992 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
993 | 993 | return; |
994 | 994 | } |
995 | 995 | // generate billing form for selected method of payment if it hasn't been done already |
996 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
997 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
996 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
997 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
998 | 998 | } |
999 | 999 | // generate primary attendee from payer info if applicable |
1000 | 1000 | if ( ! $this->checkout->transaction_has_primary_registrant()) { |
1001 | 1001 | $attendee = $this->_create_attendee_from_request_data(); |
1002 | - if ( $attendee instanceof EE_Attendee ) { |
|
1003 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
1004 | - if ( $registration->is_primary_registrant() ) { |
|
1002 | + if ($attendee instanceof EE_Attendee) { |
|
1003 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
1004 | + if ($registration->is_primary_registrant()) { |
|
1005 | 1005 | $this->checkout->primary_attendee_obj = $attendee; |
1006 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1007 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1008 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1006 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1007 | + $registration->set_attendee_id($attendee->ID()); |
|
1008 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1009 | 1009 | } |
1010 | 1010 | } |
1011 | 1011 | } |
@@ -1018,56 +1018,56 @@ discard block |
||
1018 | 1018 | * uses info from alternate GET or POST data (such as AJAX) to create a new attendee |
1019 | 1019 | * @return \EE_Attendee |
1020 | 1020 | */ |
1021 | - protected function _create_attendee_from_request_data(){ |
|
1021 | + protected function _create_attendee_from_request_data() { |
|
1022 | 1022 | // get State ID |
1023 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
1024 | - if ( ! empty( $STA_ID )) { |
|
1023 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
1024 | + if ( ! empty($STA_ID)) { |
|
1025 | 1025 | // can we get state object from name ? |
1026 | - EE_Registry::instance()->load_model( 'State' ); |
|
1027 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' ); |
|
1028 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
1026 | + EE_Registry::instance()->load_model('State'); |
|
1027 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
1028 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
1029 | 1029 | } |
1030 | 1030 | // get Country ISO |
1031 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
1032 | - if ( ! empty( $CNT_ISO )) { |
|
1031 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
1032 | + if ( ! empty($CNT_ISO)) { |
|
1033 | 1033 | // can we get country object from name ? |
1034 | - EE_Registry::instance()->load_model( 'Country' ); |
|
1035 | - $country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' ); |
|
1036 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
1034 | + EE_Registry::instance()->load_model('Country'); |
|
1035 | + $country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO'); |
|
1036 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
1037 | 1037 | } |
1038 | 1038 | // grab attendee data |
1039 | 1039 | $attendee_data = array( |
1040 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
1041 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
1042 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
1043 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
1044 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
1045 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
1040 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
1041 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
1042 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
1043 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
1044 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
1045 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
1046 | 1046 | 'STA_ID' => $STA_ID, |
1047 | 1047 | 'CNT_ISO' => $CNT_ISO, |
1048 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
1049 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
1048 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
1049 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
1050 | 1050 | ); |
1051 | 1051 | // validate the email address since it is the most important piece of info |
1052 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) { |
|
1053 | - EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1052 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) { |
|
1053 | + EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1054 | 1054 | } |
1055 | 1055 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1056 | - if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) { |
|
1057 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
1056 | + if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) { |
|
1057 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
1058 | 1058 | 'ATT_fname' => $attendee_data['ATT_fname'], |
1059 | 1059 | 'ATT_lname' => $attendee_data['ATT_lname'], |
1060 | 1060 | 'ATT_email' => $attendee_data['ATT_email'] |
1061 | 1061 | )); |
1062 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
1062 | + if ($existing_attendee instanceof EE_Attendee) { |
|
1063 | 1063 | return $existing_attendee; |
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | // no existing attendee? kk let's create a new one |
1067 | 1067 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1068 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1069 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1070 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1068 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1069 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1070 | + return EE_Attendee::new_instance($attendee_data); |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | |
@@ -1087,22 +1087,22 @@ discard block |
||
1087 | 1087 | */ |
1088 | 1088 | public function process_reg_step() { |
1089 | 1089 | // how have they chosen to pay? |
1090 | - $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE ); |
|
1090 | + $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE); |
|
1091 | 1091 | // choose your own adventure based on method_of_payment |
1092 | - switch( $this->checkout->selected_method_of_payment ) { |
|
1092 | + switch ($this->checkout->selected_method_of_payment) { |
|
1093 | 1093 | |
1094 | 1094 | case 'events_sold_out' : |
1095 | 1095 | $this->checkout->redirect = TRUE; |
1096 | 1096 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1097 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1097 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1098 | 1098 | // mark this reg step as completed |
1099 | 1099 | $this->set_completed(); |
1100 | 1100 | return FALSE; |
1101 | 1101 | break; |
1102 | 1102 | |
1103 | 1103 | case 'payments_closed' : |
1104 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) { |
|
1105 | - EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1104 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) { |
|
1105 | + EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1106 | 1106 | } |
1107 | 1107 | // mark this reg step as completed |
1108 | 1108 | $this->set_completed(); |
@@ -1110,8 +1110,8 @@ discard block |
||
1110 | 1110 | break; |
1111 | 1111 | |
1112 | 1112 | case 'no_payment_required' : |
1113 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) { |
|
1114 | - EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1113 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) { |
|
1114 | + EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1115 | 1115 | } |
1116 | 1116 | // mark this reg step as completed |
1117 | 1117 | $this->set_completed(); |
@@ -1120,9 +1120,9 @@ discard block |
||
1120 | 1120 | |
1121 | 1121 | default: |
1122 | 1122 | $payment_successful = $this->_process_payment(); |
1123 | - if ( $payment_successful ) { |
|
1123 | + if ($payment_successful) { |
|
1124 | 1124 | $this->checkout->continue_reg = true; |
1125 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1125 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1126 | 1126 | } else { |
1127 | 1127 | $this->checkout->continue_reg = false; |
1128 | 1128 | } |
@@ -1140,8 +1140,8 @@ discard block |
||
1140 | 1140 | * @param \EE_Payment_Method $payment_method |
1141 | 1141 | * @return void |
1142 | 1142 | */ |
1143 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1144 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1143 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1144 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1145 | 1145 | case EE_PMT_Base::offsite : |
1146 | 1146 | break; |
1147 | 1147 | case EE_PMT_Base::onsite : |
@@ -1164,15 +1164,15 @@ discard block |
||
1164 | 1164 | public function update_reg_step() { |
1165 | 1165 | $success = TRUE; |
1166 | 1166 | // if payment required |
1167 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1168 | - do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction ); |
|
1167 | + if ($this->checkout->transaction->total() > 0) { |
|
1168 | + do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction); |
|
1169 | 1169 | // attempt payment via payment method |
1170 | 1170 | $success = $this->process_reg_step(); |
1171 | 1171 | } |
1172 | - if ( $success && ! $this->checkout->redirect ) { |
|
1173 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
1172 | + if ($success && ! $this->checkout->redirect) { |
|
1173 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
1174 | 1174 | // set return URL |
1175 | - $this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url ); |
|
1175 | + $this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url); |
|
1176 | 1176 | } |
1177 | 1177 | return $success; |
1178 | 1178 | } |
@@ -1190,32 +1190,32 @@ discard block |
||
1190 | 1190 | */ |
1191 | 1191 | private function _process_payment() { |
1192 | 1192 | // basically confirm that the event hasn't sold out since they hit the page |
1193 | - if ( ! $this->_last_second_ticket_verifications() ) { |
|
1193 | + if ( ! $this->_last_second_ticket_verifications()) { |
|
1194 | 1194 | return false; |
1195 | 1195 | } |
1196 | 1196 | // ya gotta make a choice man |
1197 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
1198 | - $this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' )); |
|
1197 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1198 | + $this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso')); |
|
1199 | 1199 | return FALSE; |
1200 | 1200 | } |
1201 | 1201 | // get EE_Payment_Method object |
1202 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1202 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1203 | 1203 | return FALSE; |
1204 | 1204 | } |
1205 | 1205 | // setup billing form |
1206 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1207 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
1206 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1207 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
1208 | 1208 | // bad billing form ? |
1209 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1209 | + if ( ! $this->_billing_form_is_valid()) { |
|
1210 | 1210 | return FALSE; |
1211 | 1211 | } |
1212 | 1212 | } |
1213 | 1213 | // ensure primary registrant has been fully processed |
1214 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1214 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1215 | 1215 | return FALSE; |
1216 | 1216 | } |
1217 | 1217 | // if session is close to expiring (under 10 minutes by default) |
1218 | - if ( ( time() - EE_Registry::instance()->SSN->expiration() ) < EE_Registry::instance()->SSN->extension() ) { |
|
1218 | + if ((time() - EE_Registry::instance()->SSN->expiration()) < EE_Registry::instance()->SSN->extension()) { |
|
1219 | 1219 | // add some time to session expiration so that payment can be completed |
1220 | 1220 | EE_Registry::instance()->SSN->extend_expiration(); |
1221 | 1221 | } |
@@ -1224,24 +1224,24 @@ discard block |
||
1224 | 1224 | // in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved |
1225 | 1225 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1226 | 1226 | // attempt payment |
1227 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1227 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1228 | 1228 | // process results |
1229 | - $payment = $this->_validate_payment( $payment ); |
|
1230 | - $payment = $this->_post_payment_processing( $payment ); |
|
1229 | + $payment = $this->_validate_payment($payment); |
|
1230 | + $payment = $this->_post_payment_processing($payment); |
|
1231 | 1231 | // verify payment |
1232 | - if ( $payment instanceof EE_Payment ) { |
|
1232 | + if ($payment instanceof EE_Payment) { |
|
1233 | 1233 | // store that for later |
1234 | 1234 | $this->checkout->payment = $payment; |
1235 | 1235 | /** @type EE_Transaction_Processor $transaction_processor */ |
1236 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1236 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1237 | 1237 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1238 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1239 | - if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) { |
|
1238 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1239 | + if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) { |
|
1240 | 1240 | return true; |
1241 | 1241 | } else { |
1242 | 1242 | return false; |
1243 | 1243 | } |
1244 | - } else if ( $payment === true ) { |
|
1244 | + } else if ($payment === true) { |
|
1245 | 1245 | // please note that offline payment methods will NOT make a payment, |
1246 | 1246 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1247 | 1247 | $this->checkout->payment = $payment; |
@@ -1261,22 +1261,22 @@ discard block |
||
1261 | 1261 | */ |
1262 | 1262 | protected function _last_second_ticket_verifications() { |
1263 | 1263 | // don't bother re-validating if not a return visit |
1264 | - if ( ! $this->checkout->revisit ) { |
|
1264 | + if ( ! $this->checkout->revisit) { |
|
1265 | 1265 | return true; |
1266 | 1266 | } |
1267 | 1267 | $registrations = $this->checkout->transaction->registrations(); |
1268 | - if ( empty( $registrations ) ) { |
|
1268 | + if (empty($registrations)) { |
|
1269 | 1269 | return false; |
1270 | 1270 | } |
1271 | - foreach ( $registrations as $registration ) { |
|
1272 | - if ( $registration instanceof EE_Registration ) { |
|
1271 | + foreach ($registrations as $registration) { |
|
1272 | + if ($registration instanceof EE_Registration) { |
|
1273 | 1273 | $event = $registration->event_obj(); |
1274 | - if ( ! ( $event instanceof EE_Event && $event->is_sold_out( true ) ) ) { |
|
1274 | + if ( ! ($event instanceof EE_Event && $event->is_sold_out(true))) { |
|
1275 | 1275 | EE_Error::add_error( |
1276 | 1276 | apply_filters( |
1277 | 1277 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___last_second_ticket_verifications__sold_out_events_msg', |
1278 | 1278 | sprintf( |
1279 | - __( 'It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ), |
|
1279 | + __('It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso'), |
|
1280 | 1280 | $event->name() |
1281 | 1281 | ) |
1282 | 1282 | ), |
@@ -1300,10 +1300,10 @@ discard block |
||
1300 | 1300 | * @return bool |
1301 | 1301 | */ |
1302 | 1302 | public function redirect_form() { |
1303 | - $payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() ); |
|
1303 | + $payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment()); |
|
1304 | 1304 | $html = $payment_method_billing_info->get_html_and_js(); |
1305 | 1305 | $html .= $this->checkout->redirect_form; |
1306 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1306 | + EE_Registry::instance()->REQ->add_output($html); |
|
1307 | 1307 | return TRUE; |
1308 | 1308 | } |
1309 | 1309 | |
@@ -1316,36 +1316,36 @@ discard block |
||
1316 | 1316 | * @return bool |
1317 | 1317 | */ |
1318 | 1318 | private function _billing_form_is_valid() { |
1319 | - if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1319 | + if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1320 | 1320 | return TRUE; |
1321 | 1321 | } |
1322 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1323 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1322 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1323 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1324 | 1324 | $this->checkout->billing_form->receive_form_submission(); |
1325 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1325 | + if ($this->checkout->billing_form->is_valid()) { |
|
1326 | 1326 | return TRUE; |
1327 | 1327 | } |
1328 | 1328 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1329 | 1329 | $error_strings = array(); |
1330 | - foreach( $validation_errors as $validation_error ){ |
|
1331 | - if( $validation_error instanceof EE_Validation_Error ){ |
|
1330 | + foreach ($validation_errors as $validation_error) { |
|
1331 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1332 | 1332 | $form_section = $validation_error->get_form_section(); |
1333 | - if( $form_section instanceof EE_Form_Input_Base ){ |
|
1333 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1334 | 1334 | $label = $form_section->html_label_text(); |
1335 | - }elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1335 | + }elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1336 | 1336 | $label = $form_section->name(); |
1337 | - }else{ |
|
1338 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1337 | + } else { |
|
1338 | + $label = __('Validation Error', 'event_espresso'); |
|
1339 | 1339 | } |
1340 | - $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1340 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1341 | 1341 | } |
1342 | 1342 | } |
1343 | - EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings ) ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1343 | + EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__); |
|
1344 | 1344 | } else { |
1345 | - EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1345 | + EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1346 | 1346 | } |
1347 | 1347 | } else { |
1348 | - EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1348 | + EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1349 | 1349 | } |
1350 | 1350 | return FALSE; |
1351 | 1351 | } |
@@ -1363,9 +1363,9 @@ discard block |
||
1363 | 1363 | */ |
1364 | 1364 | private function _setup_primary_registrant_prior_to_payment() { |
1365 | 1365 | // check if transaction has a primary registrant and that it has a related Attendee object |
1366 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1366 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1367 | 1367 | // need to at least gather some primary registrant data before attempting payment |
1368 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) { |
|
1368 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) { |
|
1369 | 1369 | return FALSE; |
1370 | 1370 | } |
1371 | 1371 | } |
@@ -1373,13 +1373,13 @@ discard block |
||
1373 | 1373 | // grab the primary_registration object |
1374 | 1374 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1375 | 1375 | /** @type EE_Transaction_Processor $transaction_processor */ |
1376 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1376 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1377 | 1377 | // at this point we'll consider a TXN to not have been failed |
1378 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1378 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1379 | 1379 | // save the TXN ( which clears cached copy of primary_registration) |
1380 | 1380 | $this->checkout->transaction->save(); |
1381 | 1381 | // grab TXN ID and save it to the primary_registration |
1382 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1382 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1383 | 1383 | // save what we have so far |
1384 | 1384 | $primary_registration->save(); |
1385 | 1385 | return TRUE; |
@@ -1396,41 +1396,41 @@ discard block |
||
1396 | 1396 | private function _capture_primary_registration_data_from_billing_form() { |
1397 | 1397 | // convert billing form data into an attendee |
1398 | 1398 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1399 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1399 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1400 | 1400 | EE_Error::add_error( |
1401 | 1401 | sprintf( |
1402 | - __( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1402 | + __('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1403 | 1403 | '<br/>', |
1404 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1404 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1405 | 1405 | ), __FILE__, __FUNCTION__, __LINE__ |
1406 | 1406 | ); |
1407 | 1407 | return FALSE; |
1408 | 1408 | } |
1409 | 1409 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1410 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1410 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1411 | 1411 | EE_Error::add_error( |
1412 | 1412 | sprintf( |
1413 | - __( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1413 | + __('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1414 | 1414 | '<br/>', |
1415 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1415 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1416 | 1416 | ), __FILE__, __FUNCTION__, __LINE__ |
1417 | 1417 | ); |
1418 | 1418 | return FALSE; |
1419 | 1419 | } |
1420 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) { |
|
1420 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) { |
|
1421 | 1421 | EE_Error::add_error( |
1422 | 1422 | sprintf( |
1423 | - __( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1423 | + __('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1424 | 1424 | '<br/>', |
1425 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1425 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1426 | 1426 | ), __FILE__, __FUNCTION__, __LINE__ |
1427 | 1427 | ); |
1428 | 1428 | return FALSE; |
1429 | 1429 | } |
1430 | 1430 | /** @type EE_Registration_Processor $registration_processor */ |
1431 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1431 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1432 | 1432 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1433 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1433 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1434 | 1434 | |
1435 | 1435 | return TRUE; |
1436 | 1436 | } |
@@ -1446,35 +1446,35 @@ discard block |
||
1446 | 1446 | */ |
1447 | 1447 | private function _get_payment_method_for_selected_method_of_payment() { |
1448 | 1448 | // get EE_Payment_Method object |
1449 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) { |
|
1450 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1449 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1450 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1451 | 1451 | } else { |
1452 | 1452 | // load EEM_Payment_Method |
1453 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1453 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1454 | 1454 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1455 | 1455 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1456 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1456 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1457 | 1457 | } |
1458 | 1458 | // verify $payment_method |
1459 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1459 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1460 | 1460 | // not a payment |
1461 | 1461 | EE_Error::add_error( |
1462 | 1462 | sprintf( |
1463 | - __( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1463 | + __('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1464 | 1464 | '<br/>', |
1465 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1465 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1466 | 1466 | ), __FILE__, __FUNCTION__, __LINE__ |
1467 | 1467 | ); |
1468 | 1468 | return NULL; |
1469 | 1469 | } |
1470 | 1470 | // and verify it has a valid Payment_Method Type object |
1471 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1471 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1472 | 1472 | // not a payment |
1473 | 1473 | EE_Error::add_error( |
1474 | 1474 | sprintf( |
1475 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1475 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1476 | 1476 | '<br/>', |
1477 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1477 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1478 | 1478 | ), __FILE__, __FUNCTION__, __LINE__ |
1479 | 1479 | ); |
1480 | 1480 | return NULL; |
@@ -1493,30 +1493,30 @@ discard block |
||
1493 | 1493 | * @type EE_Payment_Method $payment_method |
1494 | 1494 | * @return mixed EE_Payment | boolean |
1495 | 1495 | */ |
1496 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1497 | - $payment =NULL; |
|
1496 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1497 | + $payment = NULL; |
|
1498 | 1498 | $this->checkout->transaction->save(); |
1499 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1500 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1499 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1500 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1501 | 1501 | return FALSE; |
1502 | 1502 | } |
1503 | 1503 | try { |
1504 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1504 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1505 | 1505 | // generate payment object |
1506 | 1506 | $payment = $payment_processor->process_payment( |
1507 | 1507 | $payment_method, |
1508 | 1508 | $this->checkout->transaction, |
1509 | 1509 | $this->checkout->amount_owing, |
1510 | 1510 | $this->checkout->billing_form, |
1511 | - $this->_get_return_url( $payment_method ), |
|
1511 | + $this->_get_return_url($payment_method), |
|
1512 | 1512 | 'CART', |
1513 | 1513 | $this->checkout->admin_request, |
1514 | 1514 | TRUE, |
1515 | 1515 | $this->reg_step_url() |
1516 | 1516 | ); |
1517 | 1517 | |
1518 | - } catch( Exception $e ) { |
|
1519 | - $this->_handle_payment_processor_exception( $e ); |
|
1518 | + } catch (Exception $e) { |
|
1519 | + $this->_handle_payment_processor_exception($e); |
|
1520 | 1520 | } |
1521 | 1521 | return $payment; |
1522 | 1522 | } |
@@ -1530,12 +1530,12 @@ discard block |
||
1530 | 1530 | * @param \Exception $e |
1531 | 1531 | * @return void |
1532 | 1532 | */ |
1533 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
1533 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
1534 | 1534 | EE_Error::add_error( |
1535 | 1535 | sprintf( |
1536 | - __( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ), |
|
1536 | + __('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'), |
|
1537 | 1537 | '<br/>', |
1538 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
1538 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
1539 | 1539 | $e->getMessage(), |
1540 | 1540 | $e->getFile(), |
1541 | 1541 | $e->getLine() |
@@ -1552,9 +1552,9 @@ discard block |
||
1552 | 1552 | * @param \EE_Payment_Method $payment_method |
1553 | 1553 | * @return string |
1554 | 1554 | */ |
1555 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
1555 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
1556 | 1556 | $return_url = ''; |
1557 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1557 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1558 | 1558 | |
1559 | 1559 | case EE_PMT_Base::offsite : |
1560 | 1560 | $return_url = add_query_arg( |
@@ -1585,18 +1585,18 @@ discard block |
||
1585 | 1585 | * @param EE_Payment $payment |
1586 | 1586 | * @return EE_Payment | FALSE |
1587 | 1587 | */ |
1588 | - private function _validate_payment( $payment = NULL ) { |
|
1589 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
1588 | + private function _validate_payment($payment = NULL) { |
|
1589 | + if ($this->checkout->payment_method->is_off_line()) { |
|
1590 | 1590 | return TRUE; |
1591 | 1591 | } |
1592 | 1592 | // verify payment object |
1593 | - if ( ! $payment instanceof EE_Payment ) { |
|
1593 | + if ( ! $payment instanceof EE_Payment) { |
|
1594 | 1594 | // not a payment |
1595 | 1595 | EE_Error::add_error( |
1596 | 1596 | sprintf( |
1597 | - __( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1597 | + __('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1598 | 1598 | '<br/>', |
1599 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1599 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1600 | 1600 | ), __FILE__, __FUNCTION__, __LINE__ |
1601 | 1601 | ); |
1602 | 1602 | return FALSE; |
@@ -1613,23 +1613,23 @@ discard block |
||
1613 | 1613 | * @param EE_Payment $payment |
1614 | 1614 | * @return bool |
1615 | 1615 | */ |
1616 | - private function _post_payment_processing( $payment = NULL ) { |
|
1616 | + private function _post_payment_processing($payment = NULL) { |
|
1617 | 1617 | // On-Site payment? |
1618 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1619 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) { |
|
1618 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1619 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
1620 | 1620 | //$this->_setup_redirect_for_next_step(); |
1621 | 1621 | $this->checkout->continue_reg = false; |
1622 | 1622 | } |
1623 | 1623 | // Off-Site payment? |
1624 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
1624 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
1625 | 1625 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
1626 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ){ |
|
1627 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
1626 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
1627 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
1628 | 1628 | $this->checkout->redirect = TRUE; |
1629 | 1629 | $this->checkout->redirect_form = $payment->redirect_form(); |
1630 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
1630 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
1631 | 1631 | // set JSON response |
1632 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
1632 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
1633 | 1633 | // set cron job for finalizing the TXN |
1634 | 1634 | // in case the user does not return from the off-site gateway |
1635 | 1635 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -1637,21 +1637,21 @@ discard block |
||
1637 | 1637 | $this->checkout->transaction->ID() |
1638 | 1638 | ); |
1639 | 1639 | // and lastly, let's bump the payment status to pending |
1640 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
1640 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
1641 | 1641 | $payment->save(); |
1642 | 1642 | } else { |
1643 | 1643 | // not a payment |
1644 | 1644 | $this->checkout->continue_reg = false; |
1645 | 1645 | EE_Error::add_error( |
1646 | 1646 | sprintf( |
1647 | - __( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1647 | + __('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1648 | 1648 | '<br/>', |
1649 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1649 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1650 | 1650 | ), __FILE__, __FUNCTION__, __LINE__ |
1651 | 1651 | ); |
1652 | 1652 | } |
1653 | 1653 | // Off-Line payment? |
1654 | - } else if ( $payment === TRUE ) { |
|
1654 | + } else if ($payment === TRUE) { |
|
1655 | 1655 | //$this->_setup_redirect_for_next_step(); |
1656 | 1656 | return TRUE; |
1657 | 1657 | } else { |
@@ -1687,65 +1687,65 @@ discard block |
||
1687 | 1687 | * @return bool |
1688 | 1688 | * @throws \EE_Error |
1689 | 1689 | */ |
1690 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
1690 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
1691 | 1691 | // off-line payment? carry on |
1692 | - if ( $payment_occurs == EE_PMT_Base::offline ) { |
|
1692 | + if ($payment_occurs == EE_PMT_Base::offline) { |
|
1693 | 1693 | return true; |
1694 | 1694 | } |
1695 | 1695 | // verify payment validity |
1696 | - if ( $payment instanceof EE_Payment ) { |
|
1697 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
1696 | + if ($payment instanceof EE_Payment) { |
|
1697 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
1698 | 1698 | $msg = $payment->gateway_response(); |
1699 | 1699 | // check results |
1700 | - switch ( $payment->status() ) { |
|
1700 | + switch ($payment->status()) { |
|
1701 | 1701 | |
1702 | 1702 | // good payment |
1703 | 1703 | case EEM_Payment::status_id_approved : |
1704 | - EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1704 | + EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1705 | 1705 | return TRUE; |
1706 | 1706 | break; |
1707 | 1707 | |
1708 | 1708 | // slow payment |
1709 | 1709 | case EEM_Payment::status_id_pending : |
1710 | - if ( empty( $msg )) { |
|
1711 | - $msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' ); |
|
1710 | + if (empty($msg)) { |
|
1711 | + $msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso'); |
|
1712 | 1712 | } |
1713 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1713 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1714 | 1714 | return TRUE; |
1715 | 1715 | break; |
1716 | 1716 | |
1717 | 1717 | // don't wanna payment |
1718 | 1718 | case EEM_Payment::status_id_cancelled : |
1719 | - if ( empty( $msg )) { |
|
1719 | + if (empty($msg)) { |
|
1720 | 1720 | $msg = _n( |
1721 | 1721 | 'Payment cancelled. Please try again.', |
1722 | 1722 | 'Payment cancelled. Please try again or select another method of payment.', |
1723 | - count( $this->checkout->available_payment_methods ), |
|
1723 | + count($this->checkout->available_payment_methods), |
|
1724 | 1724 | 'event_espresso' |
1725 | 1725 | ); |
1726 | 1726 | } |
1727 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1727 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1728 | 1728 | return FALSE; |
1729 | 1729 | break; |
1730 | 1730 | |
1731 | 1731 | // not enough payment |
1732 | 1732 | case EEM_Payment::status_id_declined : |
1733 | - if ( empty( $msg )) { |
|
1733 | + if (empty($msg)) { |
|
1734 | 1734 | $msg = _n( |
1735 | 1735 | 'We\'re sorry but your payment was declined. Please try again.', |
1736 | 1736 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
1737 | - count( $this->checkout->available_payment_methods ), |
|
1737 | + count($this->checkout->available_payment_methods), |
|
1738 | 1738 | 'event_espresso' |
1739 | 1739 | ); |
1740 | 1740 | } |
1741 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1741 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1742 | 1742 | return FALSE; |
1743 | 1743 | break; |
1744 | 1744 | |
1745 | 1745 | // bad payment |
1746 | 1746 | case EEM_Payment::status_id_failed : |
1747 | - if ( ! empty( $msg ) ) { |
|
1748 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1747 | + if ( ! empty($msg)) { |
|
1748 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1749 | 1749 | return false; |
1750 | 1750 | } |
1751 | 1751 | // default to error below |
@@ -1755,14 +1755,14 @@ discard block |
||
1755 | 1755 | } |
1756 | 1756 | // off-site payment gateway responses are too unreliable, so let's just assume that |
1757 | 1757 | // the payment processing is just running slower than the registrant's request |
1758 | - if ( $payment_occurs == EE_PMT_Base::offsite ) { |
|
1758 | + if ($payment_occurs == EE_PMT_Base::offsite) { |
|
1759 | 1759 | return true; |
1760 | 1760 | } |
1761 | 1761 | EE_Error::add_error( |
1762 | 1762 | sprintf( |
1763 | - __( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1763 | + __('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1764 | 1764 | '<br/>', |
1765 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1765 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1766 | 1766 | ), |
1767 | 1767 | __FILE__, __FUNCTION__, __LINE__ |
1768 | 1768 | ); |
@@ -1795,13 +1795,13 @@ discard block |
||
1795 | 1795 | public function process_gateway_response() { |
1796 | 1796 | $payment = null; |
1797 | 1797 | // how have they chosen to pay? |
1798 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1798 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1799 | 1799 | // get EE_Payment_Method object |
1800 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1800 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1801 | 1801 | $this->checkout->continue_reg = false; |
1802 | 1802 | return false; |
1803 | 1803 | } |
1804 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
1804 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
1805 | 1805 | return false; |
1806 | 1806 | } |
1807 | 1807 | $this->_validate_offsite_return(); |
@@ -1815,23 +1815,23 @@ discard block |
||
1815 | 1815 | // true |
1816 | 1816 | //); |
1817 | 1817 | // verify TXN |
1818 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1818 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1819 | 1819 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
1820 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
1820 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
1821 | 1821 | $this->checkout->continue_reg = false; |
1822 | 1822 | return false; |
1823 | 1823 | } |
1824 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
1825 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
1826 | - $payment = $this->_validate_payment( $payment ); |
|
1824 | + $payment = $this->_process_off_site_payment($gateway); |
|
1825 | + $payment = $this->_process_cancelled_payments($payment); |
|
1826 | + $payment = $this->_validate_payment($payment); |
|
1827 | 1827 | // if payment was not declined by the payment gateway or cancelled by the registrant |
1828 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
1828 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
1829 | 1829 | //$this->_setup_redirect_for_next_step(); |
1830 | 1830 | // store that for later |
1831 | 1831 | $this->checkout->payment = $payment; |
1832 | 1832 | // mark this reg step as completed, as long as gateway doesn't use a separate IPN request, |
1833 | 1833 | // because we will complete this step during the IPN processing then |
1834 | - if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) { |
|
1834 | + if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) { |
|
1835 | 1835 | $this->set_completed(); |
1836 | 1836 | } |
1837 | 1837 | return true; |
@@ -1854,19 +1854,19 @@ discard block |
||
1854 | 1854 | * @return bool |
1855 | 1855 | */ |
1856 | 1856 | private function _validate_offsite_return() { |
1857 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
1858 | - if ( $TXN_ID != $this->checkout->transaction->ID() ) { |
|
1857 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
1858 | + if ($TXN_ID != $this->checkout->transaction->ID()) { |
|
1859 | 1859 | // Houston... we might have a problem |
1860 | 1860 | $invalid_TXN = false; |
1861 | 1861 | // first gather some info |
1862 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1862 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1863 | 1863 | $primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null; |
1864 | 1864 | // let's start by retrieving the cart for this TXN |
1865 | - $cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction ); |
|
1866 | - if ( $cart instanceof EE_Cart ) { |
|
1865 | + $cart = EE_Cart::get_cart_from_txn($this->checkout->transaction); |
|
1866 | + if ($cart instanceof EE_Cart) { |
|
1867 | 1867 | // verify that the current cart has tickets |
1868 | 1868 | $tickets = $cart->get_tickets(); |
1869 | - if ( empty( $tickets ) ) { |
|
1869 | + if (empty($tickets)) { |
|
1870 | 1870 | $invalid_TXN = true; |
1871 | 1871 | } |
1872 | 1872 | } else { |
@@ -1874,39 +1874,39 @@ discard block |
||
1874 | 1874 | } |
1875 | 1875 | $valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null; |
1876 | 1876 | // validate current Session ID and compare against valid TXN session ID |
1877 | - if ( EE_Session::instance()->id() === null ) { |
|
1877 | + if (EE_Session::instance()->id() === null) { |
|
1878 | 1878 | $invalid_TXN = true; |
1879 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
1879 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
1880 | 1880 | // WARNING !!! |
1881 | 1881 | // this could be PayPal sending back duplicate requests (ya they do that) |
1882 | 1882 | // or it **could** mean someone is simply registering AGAIN after having just done so |
1883 | 1883 | // so now we need to determine if this current TXN looks valid or not |
1884 | 1884 | /** @type EE_Transaction_Processor $transaction_processor */ |
1885 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1885 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1886 | 1886 | // has this step even been started ? |
1887 | - if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false ) |
|
1887 | + if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false) |
|
1888 | 1888 | ) { |
1889 | 1889 | // really? you're half way through this reg step, but you never started it ? |
1890 | 1890 | $invalid_TXN = true; |
1891 | 1891 | } |
1892 | 1892 | } |
1893 | - if ( $invalid_TXN ) { |
|
1893 | + if ($invalid_TXN) { |
|
1894 | 1894 | // is the valid TXN completed ? |
1895 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
1895 | + if ($valid_TXN instanceof EE_Transaction) { |
|
1896 | 1896 | /** @type EE_Transaction_Processor $transaction_processor */ |
1897 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1897 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1898 | 1898 | // has this step even been started ? |
1899 | - $reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() ); |
|
1900 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
1899 | + $reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug()); |
|
1900 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
1901 | 1901 | // so it **looks** like this is a double request from PayPal |
1902 | 1902 | // so let's try to pick up where we left off |
1903 | 1903 | $this->checkout->transaction = $valid_TXN; |
1904 | - $this->checkout->refresh_all_entities( true ); |
|
1904 | + $this->checkout->refresh_all_entities(true); |
|
1905 | 1905 | return; |
1906 | 1906 | } |
1907 | 1907 | } |
1908 | 1908 | // you appear to be lost? |
1909 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
1909 | + $this->_redirect_wayward_request($primary_registrant); |
|
1910 | 1910 | } |
1911 | 1911 | } |
1912 | 1912 | } |
@@ -1920,16 +1920,16 @@ discard block |
||
1920 | 1920 | * @param \EE_Registration $primary_registrant |
1921 | 1921 | * @return bool |
1922 | 1922 | */ |
1923 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
1924 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1923 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
1924 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1925 | 1925 | // try redirecting based on the current TXN |
1926 | 1926 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null; |
1927 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1927 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1928 | 1928 | EE_Error::add_error( |
1929 | 1929 | sprintf( |
1930 | - __( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1930 | + __('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1931 | 1931 | '<br/>', |
1932 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1932 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1933 | 1933 | ), |
1934 | 1934 | __FILE__, __FUNCTION__, __LINE__ |
1935 | 1935 | ); |
@@ -1957,16 +1957,16 @@ discard block |
||
1957 | 1957 | * @param \EE_Offsite_Gateway $gateway |
1958 | 1958 | * @return \EE_Payment |
1959 | 1959 | */ |
1960 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
1960 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
1961 | 1961 | try { |
1962 | 1962 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
1963 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
1963 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
1964 | 1964 | $payment = $this->checkout->transaction->last_payment(); |
1965 | 1965 | //$payment_source = 'last_payment'; |
1966 | 1966 | } else { |
1967 | 1967 | // get payment details and process results |
1968 | 1968 | /** @type EE_Payment_Processor $payment_processor */ |
1969 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1969 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1970 | 1970 | $payment = $payment_processor->process_ipn( |
1971 | 1971 | $_REQUEST, |
1972 | 1972 | $this->checkout->transaction, |
@@ -1976,14 +1976,14 @@ discard block |
||
1976 | 1976 | ); |
1977 | 1977 | //$payment_source = 'process_ipn'; |
1978 | 1978 | } |
1979 | - } catch ( Exception $e ) { |
|
1979 | + } catch (Exception $e) { |
|
1980 | 1980 | // let's just eat the exception and try to move on using any previously set payment info |
1981 | 1981 | $payment = $this->checkout->transaction->last_payment(); |
1982 | 1982 | //$payment_source = 'last_payment after Exception'; |
1983 | 1983 | // but if we STILL don't have a payment object |
1984 | - if ( ! $payment instanceof EE_Payment ) { |
|
1984 | + if ( ! $payment instanceof EE_Payment) { |
|
1985 | 1985 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
1986 | - $this->_handle_payment_processor_exception( $e ); |
|
1986 | + $this->_handle_payment_processor_exception($e); |
|
1987 | 1987 | } |
1988 | 1988 | } |
1989 | 1989 | // DEBUG LOG |
@@ -2007,13 +2007,13 @@ discard block |
||
2007 | 2007 | * @param EE_Payment $payment |
2008 | 2008 | * @return EE_Payment | FALSE |
2009 | 2009 | */ |
2010 | - private function _process_cancelled_payments( $payment = NULL ) { |
|
2010 | + private function _process_cancelled_payments($payment = NULL) { |
|
2011 | 2011 | if ( |
2012 | - isset( $_REQUEST[ 'ee_cancel_payment' ] ) |
|
2012 | + isset($_REQUEST['ee_cancel_payment']) |
|
2013 | 2013 | && $payment instanceof EE_Payment |
2014 | 2014 | && $payment->status() == EEM_Payment::status_id_failed |
2015 | 2015 | ) { |
2016 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
2016 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
2017 | 2017 | } |
2018 | 2018 | return $payment; |
2019 | 2019 | } |
@@ -2030,23 +2030,23 @@ discard block |
||
2030 | 2030 | public function get_transaction_details_for_gateways() { |
2031 | 2031 | $txn_details = array(); |
2032 | 2032 | // ya gotta make a choice man |
2033 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
2033 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
2034 | 2034 | $txn_details = array( |
2035 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
2035 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
2036 | 2036 | ); |
2037 | 2037 | } |
2038 | 2038 | // get EE_Payment_Method object |
2039 | 2039 | if ( |
2040 | - empty( $txn_details ) && |
|
2040 | + empty($txn_details) && |
|
2041 | 2041 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
2042 | 2042 | ) { |
2043 | 2043 | $txn_details = array( |
2044 | 2044 | 'selected_method_of_payment' => $this->checkout->selected_method_of_payment, |
2045 | - 'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' ) |
|
2045 | + 'error' => __('A valid Payment Method could not be determined.', 'event_espresso') |
|
2046 | 2046 | ); |
2047 | 2047 | } |
2048 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
2049 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
2048 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
2049 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
2050 | 2050 | $txn_details = array( |
2051 | 2051 | 'TXN_ID' => $this->checkout->transaction->ID(), |
2052 | 2052 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -2057,7 +2057,7 @@ discard block |
||
2057 | 2057 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
2058 | 2058 | 'payment_amount' => $this->checkout->amount_owing, |
2059 | 2059 | 'return_url' => $return_url, |
2060 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
2060 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
2061 | 2061 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
2062 | 2062 | array( |
2063 | 2063 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -2066,7 +2066,7 @@ discard block |
||
2066 | 2066 | ) |
2067 | 2067 | ); |
2068 | 2068 | } |
2069 | - echo json_encode( $txn_details ); |
|
2069 | + echo json_encode($txn_details); |
|
2070 | 2070 | exit(); |
2071 | 2071 | } |
2072 | 2072 |