@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | * @param string $context This should correspond with a valid context for the message type |
613 | 613 | * @param string $messenger This should correspond with a valid messenger. |
614 | 614 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
615 | - * @return string The body of the message. |
|
615 | + * @return boolean The body of the message. |
|
616 | 616 | */ |
617 | 617 | public function preview_message( $type, $context, $messenger, $send = FALSE ) { |
618 | 618 | return EED_Messages::preview_message( $type, $context, $messenger, $send ); |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * >>>>>>>>>>>> 1 usage in \EEH_MSG_Template::generate_new_templates() |
739 | 739 | * |
740 | 740 | * @deprecated 4.9.0 |
741 | - * @param $messenger |
|
741 | + * @param string $messenger |
|
742 | 742 | * @param string $message_type message type that the templates are being created for |
743 | 743 | * @param int $GRP_ID |
744 | 744 | * @param bool $is_global |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | * >>>>>>>>>>>> 1 usage in \EE_Messages::get_installed() |
1145 | 1145 | * |
1146 | 1146 | * @deprecated 4.9.0 |
1147 | - * @return array |
|
1147 | + * @return EE_Messenger[] |
|
1148 | 1148 | */ |
1149 | 1149 | public function get_installed_messengers() { |
1150 | 1150 | return $this->_message_resource_manager->installed_messengers(); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // __( 'EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.' ), |
124 | 124 | // '4.9.0' |
125 | 125 | //); |
126 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
126 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
127 | 127 | // get list of active messengers and active message types |
128 | 128 | //$this->_set_active_messengers_and_message_types(); |
129 | 129 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @param string $messenger_name |
179 | 179 | * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
180 | 180 | */ |
181 | - public function ensure_messenger_is_active( $messenger_name ){ |
|
182 | - return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name ); |
|
181 | + public function ensure_messenger_is_active($messenger_name) { |
|
182 | + return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name); |
|
183 | 183 | //note: active messengers indexed by their names |
184 | 184 | //$active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
185 | 185 | //if( ! isset( $active_messengers[ $messenger_name ] ) ) { |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | * @return bool true if it got activated (or was active) and false if not. |
206 | 206 | * @throws \EE_Error |
207 | 207 | */ |
208 | - public function ensure_message_type_is_active( $message_type, $messenger ) { |
|
209 | - return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger ); |
|
208 | + public function ensure_message_type_is_active($message_type, $messenger) { |
|
209 | + return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger); |
|
210 | 210 | //first validate that the incoming messenger allows this message type to be activated. |
211 | 211 | //$messengers = $this->get_installed_messengers(); |
212 | 212 | //if ( ! isset( $messengers[$messenger] ) ) { |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | * they are already setup.) |
243 | 243 | * @return boolean an array of generated templates or false if nothing generated/activated. |
244 | 244 | */ |
245 | - public function activate_messenger( $messenger_name, $mts_to_activate = array() ){ |
|
246 | - return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate ); |
|
245 | + public function activate_messenger($messenger_name, $mts_to_activate = array()) { |
|
246 | + return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate); |
|
247 | 247 | //$active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
248 | 248 | //$message_types = $this->get_installed_message_types(); |
249 | 249 | //$installed_messengers = $this->get_installed_messengers(); |
@@ -405,8 +405,8 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
407 | 407 | */ |
408 | - public function is_generating_messenger_and_active( EE_Messenger $messenger, EE_message_type $message_type ) { |
|
409 | - return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type ); |
|
408 | + public function is_generating_messenger_and_active(EE_Messenger $messenger, EE_message_type $message_type) { |
|
409 | + return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type); |
|
410 | 410 | //get the $messengers the message type says it can be used with. |
411 | 411 | //$used_with = $message_type->with_messengers(); |
412 | 412 | //foreach ( $used_with as $generating_msgr => $secondary_msgrs ) { |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | * @param string $messenger |
434 | 434 | * @return EE_Messenger | null |
435 | 435 | */ |
436 | - public function get_messenger_if_active( $messenger ) { |
|
437 | - return $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
436 | + public function get_messenger_if_active($messenger) { |
|
437 | + return $this->_message_resource_manager->get_active_messenger($messenger); |
|
438 | 438 | //return ! empty( $this->_active_messengers[$messenger] ) ? $this->_active_messengers[$messenger] : null; |
439 | 439 | } |
440 | 440 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | * 'message_type' => null |
463 | 463 | * ) |
464 | 464 | */ |
465 | - public function validate_for_use( EE_Message $message ) { |
|
465 | + public function validate_for_use(EE_Message $message) { |
|
466 | 466 | return array( |
467 | 467 | 'messenger' => $message->messenger_object(), |
468 | 468 | 'message_type' => $message->message_type_object(), |
@@ -490,35 +490,35 @@ discard block |
||
490 | 490 | * @param bool $send Default TRUE. If false, then this will just return the generated EE_Messages objects which might be used by the trigger to setup a batch message (typically html messenger uses it). |
491 | 491 | * @return bool |
492 | 492 | */ |
493 | - public function send_message( $type, $vars, $sending_messenger = '', $generating_messenger='', $context='', $send = TRUE ) { |
|
494 | - $processor = new EE_Messages_Processor( $this ); |
|
493 | + public function send_message($type, $vars, $sending_messenger = '', $generating_messenger = '', $context = '', $send = TRUE) { |
|
494 | + $processor = new EE_Messages_Processor($this); |
|
495 | 495 | $error = FALSE; |
496 | 496 | |
497 | 497 | //try to intelligently determine what method we'll call based on the incoming data. |
498 | 498 | //if generating and sending are different then generate and send immediately. |
499 | - if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) { |
|
499 | + if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
500 | 500 | //in the legacy system, when generating and sending were different, that means all the |
501 | 501 | //vars are already in the request object. So let's just use that. |
502 | 502 | try { |
503 | - $mtg = new EE_Message_To_Generate_From_Request( $this, EE_Registry::instance()->REQ ); |
|
504 | - $processor->generate_and_send_now( $mtg ); |
|
505 | - } catch ( EE_Error $e ) { |
|
506 | - $error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' ); |
|
503 | + $mtg = new EE_Message_To_Generate_From_Request($this, EE_Registry::instance()->REQ); |
|
504 | + $processor->generate_and_send_now($mtg); |
|
505 | + } catch (EE_Error $e) { |
|
506 | + $error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso'); |
|
507 | 507 | // add specific message for developers if WP_DEBUG in on |
508 | - $error_msg .= '||' . $e->getMessage(); |
|
509 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
508 | + $error_msg .= '||'.$e->getMessage(); |
|
509 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
510 | 510 | $error = true; |
511 | 511 | } |
512 | 512 | } else { |
513 | - $processor->generate_for_all_active_messengers( $type, $vars, $send ); |
|
513 | + $processor->generate_for_all_active_messengers($type, $vars, $send); |
|
514 | 514 | //let's find out if there were any errors and how many successfully were queued. |
515 | - $count_errors = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_failed ); |
|
516 | - $count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
|
517 | - $count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry ); |
|
515 | + $count_errors = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_failed); |
|
516 | + $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
517 | + $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry); |
|
518 | 518 | $count_errors = $count_errors + $count_retry; |
519 | - if ( $count_errors > 0 ) { |
|
519 | + if ($count_errors > 0) { |
|
520 | 520 | $error = true; |
521 | - if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) { |
|
521 | + if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) { |
|
522 | 522 | $message = sprintf( |
523 | 523 | __( |
524 | 524 | 'There were %d errors and %d messages successfully queued for generation and sending', |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $count_errors, |
528 | 528 | $count_queued |
529 | 529 | ); |
530 | - } elseif ( $count_errors > 1 && $count_queued === 1 ) { |
|
530 | + } elseif ($count_errors > 1 && $count_queued === 1) { |
|
531 | 531 | $message = sprintf( |
532 | 532 | __( |
533 | 533 | 'There were %d errors and %d message successfully queued for generation.', |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $count_errors, |
537 | 537 | $count_queued |
538 | 538 | ); |
539 | - } elseif ( $count_errors === 1 && $count_queued > 1 ) { |
|
539 | + } elseif ($count_errors === 1 && $count_queued > 1) { |
|
540 | 540 | $message = sprintf( |
541 | 541 | __( |
542 | 542 | 'There was %d error and %d messages successfully queued for generation.', |
@@ -554,9 +554,9 @@ discard block |
||
554 | 554 | $count_errors |
555 | 555 | ); |
556 | 556 | } |
557 | - EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ ); |
|
557 | + EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__); |
|
558 | 558 | } else { |
559 | - if ( $count_queued === 1 ) { |
|
559 | + if ($count_queued === 1) { |
|
560 | 560 | $message = sprintf( |
561 | 561 | __( |
562 | 562 | '%d message successfully queued for generation.', |
@@ -573,18 +573,18 @@ discard block |
||
573 | 573 | $count_queued |
574 | 574 | ); |
575 | 575 | } |
576 | - EE_Error::add_success( $message ); |
|
576 | + EE_Error::add_success($message); |
|
577 | 577 | } |
578 | 578 | } |
579 | 579 | //if no error then return the generated message(s). |
580 | - if ( ! $error && ! $send ) { |
|
581 | - $generated_queue = $processor->generate_queue( false ); |
|
580 | + if ( ! $error && ! $send) { |
|
581 | + $generated_queue = $processor->generate_queue(false); |
|
582 | 582 | //get message and return. |
583 | 583 | $generated_queue->get_queue()->rewind(); |
584 | 584 | $messages = array(); |
585 | - while( $generated_queue->get_queue()->valid() ) { |
|
585 | + while ($generated_queue->get_queue()->valid()) { |
|
586 | 586 | $message = $generated_queue->get_queue()->current(); |
587 | - if ( $message instanceof EE_Message ) { |
|
587 | + if ($message instanceof EE_Message) { |
|
588 | 588 | //set properties that might be expected by add-ons (backward compat) |
589 | 589 | $message->content = $message->content(); |
590 | 590 | $message->template_pack = $message->get_template_pack(); |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
615 | 615 | * @return string The body of the message. |
616 | 616 | */ |
617 | - public function preview_message( $type, $context, $messenger, $send = FALSE ) { |
|
618 | - return EED_Messages::preview_message( $type, $context, $messenger, $send ); |
|
617 | + public function preview_message($type, $context, $messenger, $send = FALSE) { |
|
618 | + return EED_Messages::preview_message($type, $context, $messenger, $send); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -632,11 +632,11 @@ discard block |
||
632 | 632 | * |
633 | 633 | * @return bool success or fail. |
634 | 634 | */ |
635 | - public function send_message_with_messenger_only( $messenger, $message_type, $message ) { |
|
635 | + public function send_message_with_messenger_only($messenger, $message_type, $message) { |
|
636 | 636 | //setup for sending to new method. |
637 | - $queue = new EE_Messages_Queue( $this ); |
|
637 | + $queue = new EE_Messages_Queue($this); |
|
638 | 638 | //make sure we have a proper message object |
639 | - if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) { |
|
639 | + if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
640 | 640 | $msg = EE_Message_Factory::create( |
641 | 641 | array( |
642 | 642 | 'MSG_messenger' => $messenger, |
@@ -649,15 +649,15 @@ discard block |
||
649 | 649 | $msg = $message; |
650 | 650 | } |
651 | 651 | |
652 | - if ( ! $msg instanceof EE_Message ) { |
|
652 | + if ( ! $msg instanceof EE_Message) { |
|
653 | 653 | return false; |
654 | 654 | } |
655 | 655 | //make sure any content in a content property (if not empty) is set on the MSG_content. |
656 | - if ( ! empty( $msg->content ) ) { |
|
657 | - $msg->set( 'MSG_content', $msg->content ); |
|
656 | + if ( ! empty($msg->content)) { |
|
657 | + $msg->set('MSG_content', $msg->content); |
|
658 | 658 | } |
659 | - $queue->add( $msg ); |
|
660 | - return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue ); |
|
659 | + $queue->add($msg); |
|
660 | + return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | |
@@ -745,10 +745,10 @@ discard block |
||
745 | 745 | * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned. |
746 | 746 | * @throws \EE_Error |
747 | 747 | */ |
748 | - public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) { |
|
748 | + public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) { |
|
749 | 749 | /** @type EEH_MSG_Template $MSG_Template */ |
750 | - $MSG_Template = EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
751 | - return $MSG_Template->create_new_templates( $messenger, $message_type, $GRP_ID, $is_global ); |
|
750 | + $MSG_Template = EE_Registry::instance()->load_helper('MSG_Template'); |
|
751 | + return $MSG_Template->create_new_templates($messenger, $message_type, $GRP_ID, $is_global); |
|
752 | 752 | //$valid_mt = $this->_validate_setup($messenger, $message_type, $is_global); |
753 | 753 | // |
754 | 754 | //if ( is_wp_error($valid_mt) && $is_global ) { |
@@ -869,10 +869,10 @@ discard block |
||
869 | 869 | * @param string $message_type_name name of EE_message_type |
870 | 870 | * @return array |
871 | 871 | */ |
872 | - public function get_fields( $messenger_name, $message_type_name ) { |
|
872 | + public function get_fields($messenger_name, $message_type_name) { |
|
873 | 873 | /** @type EEH_MSG_Template $MSG_Template */ |
874 | - $MSG_Template = EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
875 | - return $MSG_Template->get_fields( $messenger_name, $message_type_name ); |
|
874 | + $MSG_Template = EE_Registry::instance()->load_helper('MSG_Template'); |
|
875 | + return $MSG_Template->get_fields($messenger_name, $message_type_name); |
|
876 | 876 | //$template_fields = array(); |
877 | 877 | ///** @type EE_Message_Resource_Manager $Message_Resource_Manager */ |
878 | 878 | //$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
@@ -916,11 +916,11 @@ discard block |
||
916 | 916 | * @return array multidimensional array of messenger and message_type objects |
917 | 917 | * (messengers index, and message_type index); |
918 | 918 | */ |
919 | - public function get_installed( $type = 'all', $skip_cache = false ) { |
|
920 | - if ( $skip_cache ) { |
|
919 | + public function get_installed($type = 'all', $skip_cache = false) { |
|
920 | + if ($skip_cache) { |
|
921 | 921 | $this->_message_resource_manager->reset_active_messengers_and_message_types(); |
922 | 922 | } |
923 | - switch ( $type ) { |
|
923 | + switch ($type) { |
|
924 | 924 | |
925 | 925 | case 'messengers' : |
926 | 926 | return array( |
@@ -1070,8 +1070,8 @@ discard block |
||
1070 | 1070 | * @param string $messenger The messenger being checked |
1071 | 1071 | * @return EE_message_type[] (or empty array if none present) |
1072 | 1072 | */ |
1073 | - public function get_active_message_types_per_messenger( $messenger ) { |
|
1074 | - return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger ); |
|
1073 | + public function get_active_message_types_per_messenger($messenger) { |
|
1074 | + return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger); |
|
1075 | 1075 | //$messenger = (string) $messenger; |
1076 | 1076 | //if ( empty( $this->_active_message_types[$messenger] ) ) { |
1077 | 1077 | // return array(); |
@@ -1100,8 +1100,8 @@ discard block |
||
1100 | 1100 | * @param string $message_type The string should correspond to a message type. |
1101 | 1101 | * @return EE_Message_Type|null |
1102 | 1102 | */ |
1103 | - public function get_active_message_type( $messenger, $message_type ) { |
|
1104 | - return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type ); |
|
1103 | + public function get_active_message_type($messenger, $message_type) { |
|
1104 | + return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type); |
|
1105 | 1105 | //$installed_message_types = $this->get_installed_message_types(); |
1106 | 1106 | //if ( !empty( $this->_active_message_types[$messenger][$message_type] ) && !empty( $installed_message_types[$message_type] ) ) { |
1107 | 1107 | // return $installed_message_types[$message_type]; |
@@ -1185,8 +1185,8 @@ discard block |
||
1185 | 1185 | * @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type. |
1186 | 1186 | * @return array |
1187 | 1187 | */ |
1188 | - public function get_all_contexts( $slugs_only = true ) { |
|
1189 | - return $this->_message_resource_manager->get_all_contexts( $slugs_only ); |
|
1188 | + public function get_all_contexts($slugs_only = true) { |
|
1189 | + return $this->_message_resource_manager->get_all_contexts($slugs_only); |
|
1190 | 1190 | //$key = $slugs_only ? 'slugs' : 'all'; |
1191 | 1191 | //if ( ! empty( $this->_contexts[$key] ) ) { |
1192 | 1192 | // return $this->_contexts[$key]; |
@@ -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,14 +176,14 @@ 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 ); |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -198,31 +198,31 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public static function load_reg_steps() { |
200 | 200 | static $reg_steps_loaded = FALSE; |
201 | - if ( $reg_steps_loaded ) { |
|
201 | + if ($reg_steps_loaded) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | // load EE_SPCO_Reg_Step base class |
205 | 205 | // EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class' ); |
206 | 206 | // filter list of reg_steps |
207 | - $reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() ); |
|
207 | + $reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps()); |
|
208 | 208 | // sort by key (order) |
209 | - ksort( $reg_steps_to_load ); |
|
209 | + ksort($reg_steps_to_load); |
|
210 | 210 | // loop through folders |
211 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
211 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
212 | 212 | // we need a |
213 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
213 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
214 | 214 | // copy over to the reg_steps_array |
215 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
215 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
216 | 216 | // register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now ) |
217 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
217 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
218 | 218 | // add AJAX or other hooks |
219 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
219 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
220 | 220 | // setup autoloaders if necessary |
221 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
222 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
221 | + if ( ! class_exists($reg_step['class_name'])) { |
|
222 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
223 | 223 | } |
224 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
225 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
224 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
225 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | } |
@@ -241,28 +241,28 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public static function get_reg_steps() { |
243 | 243 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
244 | - if ( empty( $reg_steps )) { |
|
244 | + if (empty($reg_steps)) { |
|
245 | 245 | $reg_steps = array( |
246 | 246 | 10 => array( |
247 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
247 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
248 | 248 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
249 | 249 | 'slug' => 'attendee_information', |
250 | 250 | 'has_hooks' => FALSE |
251 | 251 | ), |
252 | 252 | 20 => array( |
253 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
253 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
254 | 254 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
255 | 255 | 'slug' => 'registration_confirmation', |
256 | 256 | 'has_hooks' => FALSE |
257 | 257 | ), |
258 | 258 | 30 => array( |
259 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
259 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
260 | 260 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
261 | 261 | 'slug' => 'payment_options', |
262 | 262 | 'has_hooks' => TRUE |
263 | 263 | ), |
264 | 264 | 999 => array( |
265 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
265 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
266 | 266 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
267 | 267 | 'slug' => 'finalize_registration', |
268 | 268 | 'has_hooks' => FALSE |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public static function registration_checkout_for_admin() { |
284 | 284 | EED_Single_Page_Checkout::load_reg_steps(); |
285 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
286 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
287 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
285 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
286 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
287 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
288 | 288 | EED_Single_Page_Checkout::instance()->_initialize(); |
289 | 289 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
290 | 290 | return EE_Registry::instance()->REQ->get_output(); |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public static function process_registration_from_admin() { |
302 | 302 | EED_Single_Page_Checkout::load_reg_steps(); |
303 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
304 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
305 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
303 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
304 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
305 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
306 | 306 | EED_Single_Page_Checkout::instance()->_initialize(); |
307 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
308 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
309 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
310 | - if ( $final_reg_step->process_reg_step() ) { |
|
307 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
308 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
309 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
310 | + if ($final_reg_step->process_reg_step()) { |
|
311 | 311 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
312 | 312 | } |
313 | 313 | } |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | * @param WP_Query $WP_Query |
325 | 325 | * @return void |
326 | 326 | */ |
327 | - public function run( $WP_Query ) { |
|
328 | - if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )) { |
|
327 | + public function run($WP_Query) { |
|
328 | + if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)) { |
|
329 | 329 | $this->_initialize(); |
330 | 330 | } |
331 | 331 | } |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | * @param WP_Query $WP_Query |
341 | 341 | * @return void |
342 | 342 | */ |
343 | - public static function init( $WP_Query ) { |
|
344 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
343 | + public static function init($WP_Query) { |
|
344 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -355,32 +355,32 @@ discard block |
||
355 | 355 | */ |
356 | 356 | private function _initialize() { |
357 | 357 | // ensure SPCO doesn't run twice |
358 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
358 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
359 | 359 | return; |
360 | 360 | } |
361 | 361 | // setup the EE_Checkout object |
362 | 362 | $this->checkout = $this->_initialize_checkout(); |
363 | 363 | // filter checkout |
364 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
364 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
365 | 365 | // get the $_GET |
366 | 366 | $this->_get_request_vars(); |
367 | 367 | // filter continue_reg |
368 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
368 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
369 | 369 | // load the reg steps array |
370 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
370 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
371 | 371 | EED_Single_Page_Checkout::$_initialized = true; |
372 | 372 | return; |
373 | 373 | } |
374 | 374 | // set the current step |
375 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
375 | + $this->checkout->set_current_step($this->checkout->step); |
|
376 | 376 | // and the next step |
377 | 377 | $this->checkout->set_next_step(); |
378 | 378 | // was there already a valid transaction in the checkout from the session ? |
379 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
379 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
380 | 380 | // get transaction from db or session |
381 | 381 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
382 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
383 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
382 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
383 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
384 | 384 | // add some style and make it dance |
385 | 385 | $this->checkout->transaction = EE_Transaction::new_instance(); |
386 | 386 | $this->add_styles_and_scripts(); |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | return; |
389 | 389 | } |
390 | 390 | // and the registrations for the transaction |
391 | - $this->_get_registrations( $this->checkout->transaction ); |
|
391 | + $this->_get_registrations($this->checkout->transaction); |
|
392 | 392 | } |
393 | 393 | // verify that everything has been setup correctly |
394 | - if ( ! $this->_final_verifications() ) { |
|
394 | + if ( ! $this->_final_verifications()) { |
|
395 | 395 | EED_Single_Page_Checkout::$_initialized = true; |
396 | 396 | return; |
397 | 397 | } |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | // set no cache headers and constants |
417 | 417 | EE_System::do_not_cache(); |
418 | 418 | // add anchor |
419 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
419 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
420 | 420 | // remove transaction lock |
421 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
421 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -435,20 +435,20 @@ discard block |
||
435 | 435 | // look in session for existing checkout |
436 | 436 | $checkout = EE_Registry::instance()->SSN->checkout(); |
437 | 437 | // verify |
438 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
438 | + if ( ! $checkout instanceof EE_Checkout) { |
|
439 | 439 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
440 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
440 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
441 | 441 | // verify again |
442 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
443 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
442 | + if ( ! $checkout instanceof EE_Checkout) { |
|
443 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
444 | 444 | } |
445 | 445 | } else { |
446 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
447 | - wp_safe_redirect( $checkout->redirect_url ); |
|
446 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
447 | + wp_safe_redirect($checkout->redirect_url); |
|
448 | 448 | exit(); |
449 | 449 | } |
450 | 450 | } |
451 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
451 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
452 | 452 | // reset anything that needs a clean slate for each request |
453 | 453 | $checkout->reset_for_current_request(); |
454 | 454 | return $checkout; |
@@ -466,22 +466,22 @@ discard block |
||
466 | 466 | // load classes |
467 | 467 | EED_Single_Page_Checkout::load_request_handler(); |
468 | 468 | //make sure this request is marked as belonging to EE |
469 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
469 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
470 | 470 | // which step is being requested ? |
471 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
471 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
472 | 472 | // which step is being edited ? |
473 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
473 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
474 | 474 | // and what we're doing on the current step |
475 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
475 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
476 | 476 | // returning to edit ? |
477 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
477 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
478 | 478 | // or some other kind of revisit ? |
479 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
479 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
480 | 480 | // and whether or not to generate a reg form for this request |
481 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
481 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
482 | 482 | // and whether or not to process a reg form submission for this request |
483 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
484 | - $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
483 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
484 | + $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
485 | 485 | //$this->_display_request_vars(); |
486 | 486 | } |
487 | 487 | |
@@ -494,17 +494,17 @@ discard block |
||
494 | 494 | * @return void |
495 | 495 | */ |
496 | 496 | protected function _display_request_vars() { |
497 | - if ( ! WP_DEBUG ) { |
|
497 | + if ( ! WP_DEBUG) { |
|
498 | 498 | return; |
499 | 499 | } |
500 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
501 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
502 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
503 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
504 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
505 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
506 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
507 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
500 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
501 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
502 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
503 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
504 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
505 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
506 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
507 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | * @return array |
519 | 519 | */ |
520 | 520 | private function _get_first_step() { |
521 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
522 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
521 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
522 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | |
@@ -535,37 +535,37 @@ discard block |
||
535 | 535 | private function _load_and_instantiate_reg_steps() { |
536 | 536 | // have reg_steps already been instantiated ? |
537 | 537 | if ( |
538 | - empty( $this->checkout->reg_steps ) || |
|
539 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
538 | + empty($this->checkout->reg_steps) || |
|
539 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
540 | 540 | ) { |
541 | 541 | // if not, then loop through raw reg steps array |
542 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
543 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
542 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
543 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
544 | 544 | return false; |
545 | 545 | } |
546 | 546 | } |
547 | 547 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
548 | 548 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
549 | 549 | // skip the registration_confirmation page ? |
550 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
550 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
551 | 551 | // just remove it from the reg steps array |
552 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
553 | - } else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( $this->checkout->reg_steps['registration_confirmation'] )) { |
|
552 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
553 | + } else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) { |
|
554 | 554 | // set the order to something big like 100 |
555 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
555 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
556 | 556 | } |
557 | 557 | // filter the array for good luck |
558 | - $this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps ); |
|
558 | + $this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps); |
|
559 | 559 | // finally re-sort based on the reg step class order properties |
560 | 560 | $this->checkout->sort_reg_steps(); |
561 | 561 | } else { |
562 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
562 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
563 | 563 | // set all current step stati to FALSE |
564 | - $reg_step->set_is_current_step( FALSE ); |
|
564 | + $reg_step->set_is_current_step(FALSE); |
|
565 | 565 | } |
566 | 566 | } |
567 | - if ( empty( $this->checkout->reg_steps )) { |
|
568 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
567 | + if (empty($this->checkout->reg_steps)) { |
|
568 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
569 | 569 | return false; |
570 | 570 | } |
571 | 571 | // make reg step details available to JS |
@@ -583,34 +583,34 @@ discard block |
||
583 | 583 | * @param int $order |
584 | 584 | * @return bool |
585 | 585 | */ |
586 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
586 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
587 | 587 | |
588 | 588 | // we need a file_path, class_name, and slug to add a reg step |
589 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
589 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
590 | 590 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
591 | - if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) { |
|
591 | + if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') { |
|
592 | 592 | return true; |
593 | 593 | } |
594 | 594 | // instantiate step class using file path and class name |
595 | - $reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE ); |
|
595 | + $reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE); |
|
596 | 596 | // did we gets the goods ? |
597 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
597 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
598 | 598 | // set reg step order based on config |
599 | - $reg_step_obj->set_order( $order ); |
|
599 | + $reg_step_obj->set_order($order); |
|
600 | 600 | // add instantiated reg step object to the master reg steps array |
601 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
601 | + $this->checkout->add_reg_step($reg_step_obj); |
|
602 | 602 | } else { |
603 | - EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
603 | + EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
604 | 604 | return false; |
605 | 605 | } |
606 | 606 | } else { |
607 | - if ( WP_DEBUG ) { |
|
607 | + if (WP_DEBUG) { |
|
608 | 608 | EE_Error::add_error( |
609 | 609 | sprintf( |
610 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
611 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
612 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
613 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
610 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
611 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
612 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
613 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
614 | 614 | '<ul>', |
615 | 615 | '<li>', |
616 | 616 | '</li>', |
@@ -634,16 +634,16 @@ discard block |
||
634 | 634 | */ |
635 | 635 | private function _get_transaction_and_cart_for_previous_visit() { |
636 | 636 | /** @var $TXN_model EEM_Transaction */ |
637 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
637 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
638 | 638 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
639 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
639 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
640 | 640 | // verify transaction |
641 | - if ( $transaction instanceof EE_Transaction ) { |
|
641 | + if ($transaction instanceof EE_Transaction) { |
|
642 | 642 | // and get the cart that was used for that transaction |
643 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
643 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
644 | 644 | return $transaction; |
645 | 645 | } else { |
646 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
646 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
647 | 647 | return NULL; |
648 | 648 | } |
649 | 649 | } |
@@ -657,8 +657,8 @@ discard block |
||
657 | 657 | * @param EE_Transaction $transaction |
658 | 658 | * @return EE_Cart |
659 | 659 | */ |
660 | - private function _get_cart_for_transaction( $transaction ) { |
|
661 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
660 | + private function _get_cart_for_transaction($transaction) { |
|
661 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | |
@@ -670,8 +670,8 @@ discard block |
||
670 | 670 | * @param EE_Transaction $transaction |
671 | 671 | * @return EE_Cart |
672 | 672 | */ |
673 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
674 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
673 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
674 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | |
@@ -686,17 +686,17 @@ discard block |
||
686 | 686 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
687 | 687 | // if there's no transaction, then this is the FIRST visit to SPCO |
688 | 688 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
689 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
689 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
690 | 690 | // and then create a new transaction |
691 | 691 | $transaction = $this->_initialize_transaction(); |
692 | 692 | // verify transaction |
693 | - if ( $transaction instanceof EE_Transaction ) { |
|
693 | + if ($transaction instanceof EE_Transaction) { |
|
694 | 694 | // save it so that we have an ID for other objects to use |
695 | 695 | $transaction->save(); |
696 | 696 | // and save TXN data to the cart |
697 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
697 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
698 | 698 | } else { |
699 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
699 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
700 | 700 | } |
701 | 701 | return $transaction; |
702 | 702 | } |
@@ -716,15 +716,15 @@ discard block |
||
716 | 716 | // grab the cart grand total |
717 | 717 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
718 | 718 | // create new TXN |
719 | - return EE_Transaction::new_instance( array( |
|
719 | + return EE_Transaction::new_instance(array( |
|
720 | 720 | 'TXN_timestamp' => time(), |
721 | 721 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
722 | 722 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
723 | 723 | 'TXN_paid' => 0, |
724 | 724 | 'STS_ID' => EEM_Transaction::failed_status_code, |
725 | 725 | )); |
726 | - } catch( Exception $e ) { |
|
727 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
726 | + } catch (Exception $e) { |
|
727 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
728 | 728 | } |
729 | 729 | return NULL; |
730 | 730 | } |
@@ -738,34 +738,34 @@ discard block |
||
738 | 738 | * @param EE_Transaction $transaction |
739 | 739 | * @return EE_Cart |
740 | 740 | */ |
741 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
741 | + private function _get_registrations(EE_Transaction $transaction) { |
|
742 | 742 | // first step: grab the registrants { : o |
743 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
743 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
744 | 744 | // verify registrations have been set |
745 | - if ( empty( $registrations )) { |
|
745 | + if (empty($registrations)) { |
|
746 | 746 | // if no cached registrations, then check the db |
747 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
747 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
748 | 748 | // still nothing ? well as long as this isn't a revisit |
749 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
749 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
750 | 750 | // generate new registrations from scratch |
751 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
751 | + $registrations = $this->_initialize_registrations($transaction); |
|
752 | 752 | } |
753 | 753 | } |
754 | 754 | // sort by their original registration order |
755 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
755 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
756 | 756 | // then loop thru the array |
757 | - foreach ( $registrations as $registration ) { |
|
757 | + foreach ($registrations as $registration) { |
|
758 | 758 | // verify each registration |
759 | - if ( $registration instanceof EE_Registration ) { |
|
759 | + if ($registration instanceof EE_Registration) { |
|
760 | 760 | // we display all attendee info for the primary registrant |
761 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
761 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
762 | 762 | $this->checkout->primary_revisit = TRUE; |
763 | 763 | break; |
764 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
764 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
765 | 765 | // but hide info if it doesn't belong to you |
766 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
766 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
767 | 767 | } |
768 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
768 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
769 | 769 | } |
770 | 770 | } |
771 | 771 | } |
@@ -779,17 +779,17 @@ discard block |
||
779 | 779 | * @param EE_Transaction $transaction |
780 | 780 | * @return array |
781 | 781 | */ |
782 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
782 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
783 | 783 | $att_nmbr = 0; |
784 | 784 | $registrations = array(); |
785 | - if ( $transaction instanceof EE_Transaction ) { |
|
785 | + if ($transaction instanceof EE_Transaction) { |
|
786 | 786 | /** @type EE_Registration_Processor $registration_processor */ |
787 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
787 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
788 | 788 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
789 | 789 | // now let's add the cart items to the $transaction |
790 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
790 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
791 | 791 | //do the following for each ticket of this type they selected |
792 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
792 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
793 | 793 | $att_nmbr++; |
794 | 794 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
795 | 795 | $line_item, |
@@ -797,12 +797,12 @@ discard block |
||
797 | 797 | $att_nmbr, |
798 | 798 | $this->checkout->total_ticket_count |
799 | 799 | ); |
800 | - if ( $registration instanceof EE_Registration ) { |
|
801 | - $registrations[ $registration->ID() ] = $registration; |
|
800 | + if ($registration instanceof EE_Registration) { |
|
801 | + $registrations[$registration->ID()] = $registration; |
|
802 | 802 | } |
803 | 803 | } |
804 | 804 | } |
805 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
805 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
806 | 806 | } |
807 | 807 | return $registrations; |
808 | 808 | } |
@@ -817,12 +817,12 @@ discard block |
||
817 | 817 | * @param EE_Registration $reg_B |
818 | 818 | * @return array() |
819 | 819 | */ |
820 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
820 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
821 | 821 | // this shouldn't ever happen within the same TXN, but oh well |
822 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
822 | + if ($reg_A->count() == $reg_B->count()) { |
|
823 | 823 | return 0; |
824 | 824 | } |
825 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
825 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | |
@@ -837,35 +837,35 @@ discard block |
||
837 | 837 | */ |
838 | 838 | private function _final_verifications() { |
839 | 839 | // filter checkout |
840 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
840 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
841 | 841 | //verify that current step is still set correctly |
842 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
843 | - 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__ ); |
|
842 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
843 | + 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__); |
|
844 | 844 | return false; |
845 | 845 | } |
846 | 846 | // if returning to SPCO, then verify that primary registrant is set |
847 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
847 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
848 | 848 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
849 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
850 | - 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__ ); |
|
849 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
850 | + 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__); |
|
851 | 851 | return false; |
852 | 852 | } |
853 | 853 | $valid_registrant = null; |
854 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
855 | - if ( $registration instanceof EE_Registration ) { |
|
856 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
854 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
855 | + if ($registration instanceof EE_Registration) { |
|
856 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
857 | 857 | $valid_registrant = $registration; |
858 | 858 | } |
859 | 859 | } |
860 | 860 | } |
861 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
862 | - 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__ ); |
|
861 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
862 | + 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__); |
|
863 | 863 | return false; |
864 | 864 | } |
865 | 865 | } |
866 | 866 | // now that things have been kinda sufficiently verified, |
867 | 867 | // let's add the checkout to the session so that's available other systems |
868 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
868 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
869 | 869 | return true; |
870 | 870 | } |
871 | 871 | |
@@ -881,28 +881,28 @@ discard block |
||
881 | 881 | * @access private |
882 | 882 | * @param bool $reinitializing |
883 | 883 | */ |
884 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
885 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
884 | + private function _initialize_reg_steps($reinitializing = false) { |
|
885 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
886 | 886 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
887 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
888 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
887 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
888 | + if ( ! $reg_step->initialize_reg_step()) { |
|
889 | 889 | // if not initialized then maybe this step is being removed... |
890 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
890 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
891 | 891 | // if it was the current step, then we need to start over here |
892 | - $this->_initialize_reg_steps( true ); |
|
892 | + $this->_initialize_reg_steps(true); |
|
893 | 893 | return; |
894 | 894 | } |
895 | 895 | continue; |
896 | 896 | } |
897 | 897 | // i18n |
898 | 898 | $reg_step->translate_js_strings(); |
899 | - if ( $reg_step->is_current_step() ) { |
|
899 | + if ($reg_step->is_current_step()) { |
|
900 | 900 | // the text that appears on the reg step form submit button |
901 | 901 | $reg_step->set_submit_button_text(); |
902 | 902 | } |
903 | 903 | } |
904 | 904 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
905 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
905 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | |
@@ -915,39 +915,39 @@ discard block |
||
915 | 915 | */ |
916 | 916 | private function _check_form_submission() { |
917 | 917 | //does this request require the reg form to be generated ? |
918 | - if ( $this->checkout->generate_reg_form ) { |
|
918 | + if ($this->checkout->generate_reg_form) { |
|
919 | 919 | // ever heard that song by Blue Rodeo ? |
920 | 920 | try { |
921 | 921 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
922 | 922 | // if not displaying a form, then check for form submission |
923 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
923 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
924 | 924 | // clear out any old data in case this step is being run again |
925 | - $this->checkout->current_step->set_valid_data( array() ); |
|
925 | + $this->checkout->current_step->set_valid_data(array()); |
|
926 | 926 | // capture submitted form data |
927 | 927 | $this->checkout->current_step->reg_form->receive_form_submission( |
928 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
928 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
929 | 929 | ); |
930 | 930 | // validate submitted form data |
931 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
931 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
932 | 932 | // thou shall not pass !!! |
933 | 933 | $this->checkout->continue_reg = FALSE; |
934 | 934 | // any form validation errors? |
935 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
935 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
936 | 936 | $submission_error_messages = array(); |
937 | 937 | // bad, bad, bad registrant |
938 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
939 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
940 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
938 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
939 | + if ($validation_error instanceof EE_Validation_Error) { |
|
940 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
941 | 941 | } |
942 | 942 | } |
943 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
943 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
944 | 944 | } |
945 | 945 | // well not really... what will happen is we'll just get redirected back to redo the current step |
946 | 946 | $this->go_to_next_step(); |
947 | 947 | return; |
948 | 948 | } |
949 | 949 | } |
950 | - } catch( EE_Error $e ) { |
|
950 | + } catch (EE_Error $e) { |
|
951 | 951 | $e->get_error(); |
952 | 952 | } |
953 | 953 | } |
@@ -963,38 +963,38 @@ discard block |
||
963 | 963 | */ |
964 | 964 | private function _process_form_action() { |
965 | 965 | // what cha wanna do? |
966 | - switch( $this->checkout->action ) { |
|
966 | + switch ($this->checkout->action) { |
|
967 | 967 | // AJAX next step reg form |
968 | 968 | case 'display_spco_reg_step' : |
969 | 969 | $this->checkout->redirect = FALSE; |
970 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
971 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
970 | + if (EE_Registry::instance()->REQ->ajax) { |
|
971 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
972 | 972 | } |
973 | 973 | break; |
974 | 974 | |
975 | 975 | default : |
976 | 976 | // meh... do one of those other steps first |
977 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
977 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
978 | 978 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
979 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
979 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
980 | 980 | // call action on current step |
981 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
981 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
982 | 982 | // good registrant, you get to proceed |
983 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
984 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
985 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
983 | + if ($this->checkout->current_step->success_message() != '') { |
|
984 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
985 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
986 | 986 | } |
987 | 987 | } |
988 | 988 | // pack it up, pack it in... |
989 | 989 | $this->_setup_redirect(); |
990 | 990 | } |
991 | 991 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
992 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
992 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
993 | 993 | |
994 | 994 | } else { |
995 | 995 | EE_Error::add_error( |
996 | 996 | sprintf( |
997 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
997 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
998 | 998 | $this->checkout->action, |
999 | 999 | $this->checkout->current_step->name() |
1000 | 1000 | ), |
@@ -1020,10 +1020,10 @@ discard block |
||
1020 | 1020 | public function add_styles_and_scripts() { |
1021 | 1021 | // i18n |
1022 | 1022 | $this->translate_js_strings(); |
1023 | - if ( $this->checkout->admin_request ) { |
|
1024 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1023 | + if ($this->checkout->admin_request) { |
|
1024 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1025 | 1025 | } else { |
1026 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1026 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1027 | 1027 | } |
1028 | 1028 | } |
1029 | 1029 | |
@@ -1039,42 +1039,42 @@ discard block |
||
1039 | 1039 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1040 | 1040 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1041 | 1041 | 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'); |
1042 | - 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' ); |
|
1043 | - 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' ); |
|
1044 | - 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' ); |
|
1042 | + 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'); |
|
1043 | + 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'); |
|
1044 | + 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'); |
|
1045 | 1045 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1046 | 1046 | 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'); |
1047 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1048 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1047 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1048 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1049 | 1049 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1050 | 1050 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1051 | 1051 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1052 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1053 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1054 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1055 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1056 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1057 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1058 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1059 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1060 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1061 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1062 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1063 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1064 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1065 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1052 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1053 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1054 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1055 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1056 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1057 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1058 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1059 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1060 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1061 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1062 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1063 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1064 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1065 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1066 | 1066 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1067 | - __( '%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' ), |
|
1067 | + __('%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'), |
|
1068 | 1068 | '<h4 class="important-notice">', |
1069 | 1069 | '</h4>', |
1070 | 1070 | '<br />', |
1071 | 1071 | '<p>', |
1072 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1072 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1073 | 1073 | '">', |
1074 | 1074 | '</a>', |
1075 | 1075 | '</p>' |
1076 | 1076 | ); |
1077 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1077 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | |
@@ -1087,25 +1087,25 @@ discard block |
||
1087 | 1087 | */ |
1088 | 1088 | public function enqueue_styles_and_scripts() { |
1089 | 1089 | // load css |
1090 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1091 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1090 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1091 | + wp_enqueue_style('single_page_checkout'); |
|
1092 | 1092 | // load JS |
1093 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1094 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1095 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1096 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1093 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1094 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1095 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1096 | + wp_enqueue_script('single_page_checkout'); |
|
1097 | 1097 | |
1098 | 1098 | /** |
1099 | 1099 | * global action hook for enqueueing styles and scripts with |
1100 | 1100 | * spco calls. |
1101 | 1101 | */ |
1102 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1102 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1103 | 1103 | |
1104 | 1104 | /** |
1105 | 1105 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1106 | 1106 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1107 | 1107 | */ |
1108 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1108 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1109 | 1109 | |
1110 | 1110 | // add css and JS for current step |
1111 | 1111 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1121,20 +1121,20 @@ discard block |
||
1121 | 1121 | */ |
1122 | 1122 | private function _display_spco_reg_form() { |
1123 | 1123 | // if registering via the admin, just display the reg form for the current step |
1124 | - if ( $this->checkout->admin_request ) { |
|
1125 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1124 | + if ($this->checkout->admin_request) { |
|
1125 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1126 | 1126 | } else { |
1127 | 1127 | // add powered by EE msg |
1128 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1128 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1129 | 1129 | |
1130 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1130 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1131 | 1131 | $cookies_not_set_msg = ''; |
1132 | - if ( $empty_cart ) { |
|
1133 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1132 | + if ($empty_cart) { |
|
1133 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1134 | 1134 | $cookies_not_set_msg = apply_filters( |
1135 | 1135 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1136 | 1136 | sprintf( |
1137 | - __( '%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' ), |
|
1137 | + __('%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'), |
|
1138 | 1138 | '<div class="ee-attention">', |
1139 | 1139 | '</div>', |
1140 | 1140 | '<h6 class="important-notice">', |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | 'layout_strategy' => |
1156 | 1156 | new EE_Template_Layout( |
1157 | 1157 | array( |
1158 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1158 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1159 | 1159 | 'template_args' => array( |
1160 | 1160 | 'empty_cart' => $empty_cart, |
1161 | 1161 | 'revisit' => $this->checkout->revisit, |
@@ -1164,8 +1164,8 @@ discard block |
||
1164 | 1164 | 'empty_msg' => apply_filters( |
1165 | 1165 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1166 | 1166 | sprintf( |
1167 | - __( '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' ), |
|
1168 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1167 | + __('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'), |
|
1168 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1169 | 1169 | '">', |
1170 | 1170 | '</a>' |
1171 | 1171 | ) |
@@ -1173,14 +1173,14 @@ discard block |
||
1173 | 1173 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1174 | 1174 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1175 | 1175 | 'session_expiration' => |
1176 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1176 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1177 | 1177 | ) |
1178 | 1178 | ) |
1179 | 1179 | ) |
1180 | 1180 | ) |
1181 | 1181 | ); |
1182 | 1182 | // load template and add to output sent that gets filtered into the_content() |
1183 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1183 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1184 | 1184 | } |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1194,8 +1194,8 @@ discard block |
||
1194 | 1194 | * @internal param string $label |
1195 | 1195 | * @return string |
1196 | 1196 | */ |
1197 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1198 | - if ( $next_step == 'finalize_registration' ) { |
|
1197 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1198 | + if ($next_step == 'finalize_registration') { |
|
1199 | 1199 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1200 | 1200 | } |
1201 | 1201 | } |
@@ -1209,18 +1209,18 @@ discard block |
||
1209 | 1209 | * @return string |
1210 | 1210 | */ |
1211 | 1211 | public static function display_registration_footer() { |
1212 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1213 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1214 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1215 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1212 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1213 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1214 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1215 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1216 | 1216 | echo apply_filters( |
1217 | 1217 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1218 | 1218 | sprintf( |
1219 | - __( '%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' ), |
|
1220 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1219 | + __('%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'), |
|
1220 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1221 | 1221 | '" target="_blank">', |
1222 | 1222 | '</a>', |
1223 | - '<a href="' . $url . '" title="', |
|
1223 | + '<a href="'.$url.'" title="', |
|
1224 | 1224 | '" target="_blank">', |
1225 | 1225 | '</a></div>' |
1226 | 1226 | ) |
@@ -1251,12 +1251,12 @@ discard block |
||
1251 | 1251 | * @return array |
1252 | 1252 | */ |
1253 | 1253 | private function _setup_redirect() { |
1254 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1254 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1255 | 1255 | $this->checkout->redirect = TRUE; |
1256 | - if ( empty( $this->checkout->redirect_url )) { |
|
1256 | + if (empty($this->checkout->redirect_url)) { |
|
1257 | 1257 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1258 | 1258 | } |
1259 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1259 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1260 | 1260 | } |
1261 | 1261 | } |
1262 | 1262 | |
@@ -1269,12 +1269,12 @@ discard block |
||
1269 | 1269 | * @return void |
1270 | 1270 | */ |
1271 | 1271 | public function go_to_next_step() { |
1272 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1272 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1273 | 1273 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1274 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1274 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1275 | 1275 | } |
1276 | 1276 | // just return for these conditions |
1277 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1277 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1278 | 1278 | return; |
1279 | 1279 | } |
1280 | 1280 | // AJAX response |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | */ |
1296 | 1296 | protected function _handle_json_response() { |
1297 | 1297 | // if this is an ajax request |
1298 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1298 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1299 | 1299 | // DEBUG LOG |
1300 | 1300 | //$this->checkout->log( |
1301 | 1301 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1305,10 +1305,10 @@ discard block |
||
1305 | 1305 | // 'continue_reg' => $this->checkout->continue_reg, |
1306 | 1306 | // ) |
1307 | 1307 | //); |
1308 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1309 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1308 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1309 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1310 | 1310 | // just send the ajax ( |
1311 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1311 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1312 | 1312 | $this->unlock_transaction(); |
1313 | 1313 | echo $json_response; |
1314 | 1314 | exit(); |
@@ -1325,9 +1325,9 @@ discard block |
||
1325 | 1325 | */ |
1326 | 1326 | protected function _handle_html_redirects() { |
1327 | 1327 | // going somewhere ? |
1328 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1328 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1329 | 1329 | // store notices in a transient |
1330 | - EE_Error::get_notices( false, true, true ); |
|
1330 | + EE_Error::get_notices(false, true, true); |
|
1331 | 1331 | $this->unlock_transaction(); |
1332 | 1332 | // DEBUG LOG |
1333 | 1333 | //$this->checkout->log( |
@@ -1338,7 +1338,7 @@ discard block |
||
1338 | 1338 | // 'headers_list' => headers_list(), |
1339 | 1339 | // ) |
1340 | 1340 | //); |
1341 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1341 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1342 | 1342 | exit(); |
1343 | 1343 | } |
1344 | 1344 | } |
@@ -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 | /** |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | * @return \EEH_Autoloader |
41 | 41 | */ |
42 | 42 | private function __construct() { |
43 | - if ( self::$_autoloaders === null ) { |
|
43 | + if (self::$_autoloaders === null) { |
|
44 | 44 | self::$_autoloaders = array(); |
45 | 45 | $this->_register_custom_autoloaders(); |
46 | - spl_autoload_register( array( $this, 'espresso_autoloader' ) ); |
|
46 | + spl_autoload_register(array($this, 'espresso_autoloader')); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public static function instance() { |
57 | 57 | // check if class object is instantiated |
58 | - if ( ! self::$_instance instanceof EEH_Autoloader ) { |
|
58 | + if ( ! self::$_instance instanceof EEH_Autoloader) { |
|
59 | 59 | self::$_instance = new self(); |
60 | 60 | } |
61 | 61 | return self::$_instance; |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * @internal param string $class_name - simple class name ie: session |
73 | 73 | * @return void |
74 | 74 | */ |
75 | - public static function espresso_autoloader( $class_name ) { |
|
76 | - if ( isset( self::$_autoloaders[ $class_name ] ) ) { |
|
77 | - require_once( self::$_autoloaders[ $class_name ] ); |
|
75 | + public static function espresso_autoloader($class_name) { |
|
76 | + if (isset(self::$_autoloaders[$class_name])) { |
|
77 | + require_once(self::$_autoloaders[$class_name]); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -90,26 +90,26 @@ discard block |
||
90 | 90 | * @return void |
91 | 91 | * @throws \EE_Error |
92 | 92 | */ |
93 | - public static function register_autoloader( $class_paths, $read_check = true, $debug = false ) { |
|
94 | - $class_paths = is_array( $class_paths ) ? $class_paths : array( $class_paths ); |
|
95 | - foreach ( $class_paths as $class => $path ) { |
|
93 | + public static function register_autoloader($class_paths, $read_check = true, $debug = false) { |
|
94 | + $class_paths = is_array($class_paths) ? $class_paths : array($class_paths); |
|
95 | + foreach ($class_paths as $class => $path) { |
|
96 | 96 | // don't give up! you gotta... |
97 | 97 | // get some class |
98 | - if ( empty( $class )) { |
|
99 | - throw new EE_Error ( sprintf( __( 'No Class name was specified while registering an autoloader for the following path: %s.','event_espresso' ), $path )); |
|
98 | + if (empty($class)) { |
|
99 | + throw new EE_Error(sprintf(__('No Class name was specified while registering an autoloader for the following path: %s.', 'event_espresso'), $path)); |
|
100 | 100 | } |
101 | 101 | // one day you will find the path young grasshopper |
102 | - if ( empty( $path )) { |
|
103 | - throw new EE_Error ( sprintf( __( 'No path was specified while registering an autoloader for the %s class.','event_espresso' ), $class )); |
|
102 | + if (empty($path)) { |
|
103 | + throw new EE_Error(sprintf(__('No path was specified while registering an autoloader for the %s class.', 'event_espresso'), $class)); |
|
104 | 104 | } |
105 | 105 | // is file readable ? |
106 | - if ( $read_check && ! is_readable( $path )) { |
|
107 | - throw new EE_Error ( sprintf( __( 'The file for the %s class could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s','event_espresso' ), $class, $path )); |
|
106 | + if ($read_check && ! is_readable($path)) { |
|
107 | + throw new EE_Error(sprintf(__('The file for the %s class could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), $class, $path)); |
|
108 | 108 | } |
109 | - if ( ! isset( self::$_autoloaders[ $class ] )) { |
|
110 | - self::$_autoloaders[ $class ] = str_replace( array( '/', '\\' ), DS, $path ); |
|
111 | - if ( WP_DEBUG && $debug ) { |
|
112 | - EEH_Debug_Tools::printr( self::$_autoloaders[ $class ], $class, __FILE__, __LINE__ ); |
|
109 | + if ( ! isset(self::$_autoloaders[$class])) { |
|
110 | + self::$_autoloaders[$class] = str_replace(array('/', '\\'), DS, $path); |
|
111 | + if (WP_DEBUG && $debug) { |
|
112 | + EEH_Debug_Tools::printr(self::$_autoloaders[$class], $class, __FILE__, __LINE__); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | * @return void |
139 | 139 | */ |
140 | 140 | private function _register_custom_autoloaders() { |
141 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'interfaces' ); |
|
142 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE ); |
|
143 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_INTERFACES, true ); |
|
144 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_MODELS, true ); |
|
145 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CLASSES ); |
|
146 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_FORM_SECTIONS, true ); |
|
147 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'messages' ); |
|
141 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces'); |
|
142 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE); |
|
143 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_INTERFACES, true); |
|
144 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_MODELS, true); |
|
145 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CLASSES); |
|
146 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_FORM_SECTIONS, true); |
|
147 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'messages'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @return void |
171 | 171 | */ |
172 | 172 | public static function register_line_item_display_autoloaders() { |
173 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'line_item_display' , true ); |
|
173 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_display', true); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return void |
184 | 184 | */ |
185 | 185 | public static function register_line_item_filter_autoloaders() { |
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'line_item_filters' , true ); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_filters', true); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @return void |
197 | 197 | */ |
198 | 198 | public static function register_template_part_autoloaders() { |
199 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'template_parts', true ); |
|
199 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'template_parts', true); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -214,30 +214,30 @@ discard block |
||
214 | 214 | * @return void |
215 | 215 | * @throws \EE_Error |
216 | 216 | */ |
217 | - public static function register_autoloaders_for_each_file_in_folder( $folder, $recursive = false, $debug = false ){ |
|
217 | + public static function register_autoloaders_for_each_file_in_folder($folder, $recursive = false, $debug = false) { |
|
218 | 218 | // make sure last char is a / |
219 | - $folder .= $folder[strlen($folder)-1] != DS ? DS : ''; |
|
219 | + $folder .= $folder[strlen($folder) - 1] != DS ? DS : ''; |
|
220 | 220 | $class_to_filepath_map = array(); |
221 | - $exclude = array( 'index' ); |
|
221 | + $exclude = array('index'); |
|
222 | 222 | //get all the files in that folder that end in php |
223 | - $filepaths = glob( $folder.'*'); |
|
223 | + $filepaths = glob($folder.'*'); |
|
224 | 224 | |
225 | - if ( empty( $filepaths ) ) { |
|
225 | + if (empty($filepaths)) { |
|
226 | 226 | return; |
227 | 227 | } |
228 | 228 | |
229 | - foreach( $filepaths as $filepath ) { |
|
230 | - if ( substr( $filepath, -4, 4 ) == '.php' ) { |
|
231 | - $class_name = EEH_File::get_classname_from_filepath_with_standard_filename( $filepath ); |
|
232 | - if ( ! in_array( $class_name, $exclude )) { |
|
233 | - $class_to_filepath_map [ $class_name ] = $filepath; |
|
229 | + foreach ($filepaths as $filepath) { |
|
230 | + if (substr($filepath, -4, 4) == '.php') { |
|
231 | + $class_name = EEH_File::get_classname_from_filepath_with_standard_filename($filepath); |
|
232 | + if ( ! in_array($class_name, $exclude)) { |
|
233 | + $class_to_filepath_map [$class_name] = $filepath; |
|
234 | 234 | } |
235 | - } else if ( $recursive ) { |
|
236 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $filepath, $recursive, $debug ); |
|
235 | + } else if ($recursive) { |
|
236 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($filepath, $recursive, $debug); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | // we remove the necessity to do a is_readable() check via the $read_check flag because glob by nature will not return non_readable files/directories. |
240 | - self::register_autoloader( $class_to_filepath_map, false, $debug ); |
|
240 | + self::register_autoloader($class_to_filepath_map, false, $debug); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | * @param string $class_name - simple class name ie: EE_Session |
251 | 251 | * @param string $alias - variation on class name ie: EE_session, session, etc |
252 | 252 | */ |
253 | - public static function add_alias( $class_name, $alias ) { |
|
254 | - if ( isset( self::$_autoloaders[ $class_name ] ) ) { |
|
255 | - self::$_autoloaders[ $alias ] = self::$_autoloaders[ $class_name ]; |
|
253 | + public static function add_alias($class_name, $alias) { |
|
254 | + if (isset(self::$_autoloaders[$class_name])) { |
|
255 | + self::$_autoloaders[$alias] = self::$_autoloaders[$class_name]; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * @param \EE_Message_Resource_Manager $Message_Resource_Manager |
54 | 54 | * @return \EE_Message_Factory instance |
55 | 55 | */ |
56 | - public static function instance( EE_Message_Resource_Manager $Message_Resource_Manager ) { |
|
56 | + public static function instance(EE_Message_Resource_Manager $Message_Resource_Manager) { |
|
57 | 57 | // check if class object is instantiated, and instantiated properly |
58 | - if ( ! self::$_instance instanceof EE_Message_Factory ) { |
|
59 | - self::$_instance = new EE_Message_Factory( $Message_Resource_Manager ); |
|
58 | + if ( ! self::$_instance instanceof EE_Message_Factory) { |
|
59 | + self::$_instance = new EE_Message_Factory($Message_Resource_Manager); |
|
60 | 60 | } |
61 | 61 | return self::$_instance; |
62 | 62 | } |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * @param array $props_n_values |
69 | 69 | * @return mixed |
70 | 70 | */ |
71 | - public static function create( $props_n_values = array() ) { |
|
72 | - $Message_Factory = EE_Registry::instance()->load_lib( 'Message_Factory' ); |
|
73 | - return $Message_Factory->_create( $props_n_values ); |
|
71 | + public static function create($props_n_values = array()) { |
|
72 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
73 | + return $Message_Factory->_create($props_n_values); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | * @return \EE_Message |
82 | 82 | * @throws \EE_Error |
83 | 83 | */ |
84 | - public static function set_messenger_and_message_type( EE_Message $message ) { |
|
85 | - $Message_Factory = EE_Registry::instance()->load_lib( 'Message_Factory' ); |
|
86 | - return $Message_Factory->_set_messenger_and_message_type( $message ); |
|
84 | + public static function set_messenger_and_message_type(EE_Message $message) { |
|
85 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
86 | + return $Message_Factory->_set_messenger_and_message_type($message); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * @return \EE_Message |
95 | 95 | * @throws \EE_Error |
96 | 96 | */ |
97 | - public static function set_messenger( EE_Message $message ) { |
|
98 | - $Message_Factory = EE_Registry::instance()->load_lib( 'Message_Factory' ); |
|
99 | - return $Message_Factory->_set_messenger( $message ); |
|
97 | + public static function set_messenger(EE_Message $message) { |
|
98 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
99 | + return $Message_Factory->_set_messenger($message); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | * @return \EE_Message |
108 | 108 | * @throws \EE_Error |
109 | 109 | */ |
110 | - public static function set_message_type( EE_Message $message ) { |
|
111 | - $Message_Factory = EE_Registry::instance()->load_lib( 'Message_Factory' ); |
|
112 | - return $Message_Factory->_set_message_type( $message ); |
|
110 | + public static function set_message_type(EE_Message $message) { |
|
111 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
112 | + return $Message_Factory->_set_message_type($message); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | * @return \EE_Message |
121 | 121 | * @throws \EE_Error |
122 | 122 | */ |
123 | - protected function _create( $props_n_values = array() ) { |
|
124 | - if ( ! empty( $props_n_values['MSG_ID'] ) ) { |
|
125 | - $message = EE_Message::new_instance_from_db( $props_n_values ); |
|
123 | + protected function _create($props_n_values = array()) { |
|
124 | + if ( ! empty($props_n_values['MSG_ID'])) { |
|
125 | + $message = EE_Message::new_instance_from_db($props_n_values); |
|
126 | 126 | } else { |
127 | - $message = EE_Message::new_instance( $props_n_values ); |
|
127 | + $message = EE_Message::new_instance($props_n_values); |
|
128 | 128 | } |
129 | - return $this->_set_messenger_and_message_type( $message ); |
|
129 | + return $this->_set_messenger_and_message_type($message); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | * @return \EE_Message |
138 | 138 | * @throws \EE_Error |
139 | 139 | */ |
140 | - protected function _set_messenger_and_message_type( EE_Message $message ) { |
|
141 | - $message = $this->_set_messenger( $message ); |
|
142 | - $message = $this->_set_message_type( $message ); |
|
140 | + protected function _set_messenger_and_message_type(EE_Message $message) { |
|
141 | + $message = $this->_set_messenger($message); |
|
142 | + $message = $this->_set_message_type($message); |
|
143 | 143 | return $message; |
144 | 144 | } |
145 | 145 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * @return \EE_Message |
152 | 152 | * @throws \EE_Error |
153 | 153 | */ |
154 | - protected function _set_messenger( EE_Message $message ) { |
|
155 | - $messenger = $this->_message_resource_manager->get_messenger( $message->messenger() ); |
|
156 | - if ( $messenger instanceof EE_Messenger ) { |
|
157 | - $message->set_messenger_object( $messenger ); |
|
154 | + protected function _set_messenger(EE_Message $message) { |
|
155 | + $messenger = $this->_message_resource_manager->get_messenger($message->messenger()); |
|
156 | + if ($messenger instanceof EE_Messenger) { |
|
157 | + $message->set_messenger_object($messenger); |
|
158 | 158 | } |
159 | 159 | return $message; |
160 | 160 | } |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | * @return \EE_Message |
168 | 168 | * @throws \EE_Error |
169 | 169 | */ |
170 | - protected function _set_message_type( EE_Message $message ) { |
|
171 | - $message_type = $this->_message_resource_manager->get_message_type( $message->message_type() ); |
|
172 | - if ( $message_type instanceof EE_Message_Type ) { |
|
173 | - $message->set_message_type_object( $message_type ); |
|
170 | + protected function _set_message_type(EE_Message $message) { |
|
171 | + $message_type = $this->_message_resource_manager->get_message_type($message->message_type()); |
|
172 | + if ($message_type instanceof EE_Message_Type) { |
|
173 | + $message->set_message_type_object($message_type); |
|
174 | 174 | } |
175 | 175 | return $message; |
176 | 176 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * fields for the given group not the message template group itself |
123 | 123 | * @throws \EE_Error |
124 | 124 | */ |
125 | - public function __construct( EE_Messages $messages, $messenger_name, $message_type_name, $GRP_ID = 0 ) { |
|
125 | + public function __construct(EE_Messages $messages, $messenger_name, $message_type_name, $GRP_ID = 0) { |
|
126 | 126 | $this->_EE_MSG = $messages; |
127 | 127 | |
128 | 128 | //set the model object |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | $this->_mt_name = $message_type_name; |
135 | 135 | |
136 | 136 | //make sure required props have been set |
137 | - if ( empty( $this->_m_name) || empty( $this->_mt_name ) ) { |
|
137 | + if (empty($this->_m_name) || empty($this->_mt_name)) { |
|
138 | 138 | $msg[] = __('Message Templates cannot be generated because the Messenger and Message Types haven\'t been defined for the generator.', 'event_espresso'); |
139 | 139 | $msg[] = __('You need to set the "$m_name" and "$mt_name" properties', 'event_espresso'); |
140 | - throw new EE_Error( implode( '||', $msg ) ); |
|
140 | + throw new EE_Error(implode('||', $msg)); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | $this->_init(); |
@@ -153,20 +153,20 @@ discard block |
||
153 | 153 | * @param string $template_pack This corresponds to a template pack class reference which will contain information about where to obtain the templates. |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - final private function _set_templates( $template_pack ) { |
|
156 | + final private function _set_templates($template_pack) { |
|
157 | 157 | |
158 | 158 | //get the corresponding template pack object (if present. If not then we just load the default and add a notice). The class name should be something like 'EE_Messages_Template_Pack_Default' where "default' would be the incoming template pack reference. |
159 | - $class_name = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $template_pack ) ) ); |
|
159 | + $class_name = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $template_pack))); |
|
160 | 160 | |
161 | - if ( ! class_exists( $class_name ) ) { |
|
162 | - EE_Error::add_error( sprintf( __('The template pack represented by a class corresponding to "%s" does not exist. Likely the autoloader for this class has the wrong path or the incoming reference is mispelled. The default template pack been used to generate the templates instead.', 'event_espresso'), $class_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
161 | + if ( ! class_exists($class_name)) { |
|
162 | + EE_Error::add_error(sprintf(__('The template pack represented by a class corresponding to "%s" does not exist. Likely the autoloader for this class has the wrong path or the incoming reference is mispelled. The default template pack been used to generate the templates instead.', 'event_espresso'), $class_name), __FILE__, __FUNCTION__, __LINE__); |
|
163 | 163 | $class_name = 'EE_Messages_Template_Pack_Default'; |
164 | 164 | } |
165 | 165 | |
166 | 166 | $template_pack = new $class_name; |
167 | 167 | |
168 | 168 | //get all the templates from the template pack. |
169 | - $this->_templates = $template_pack->get_templates( $this->_messenger, $this->_message_type ); |
|
169 | + $this->_templates = $template_pack->get_templates($this->_messenger, $this->_message_type); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | $active_message_types = $this->_EE_MSG->get_installed_message_types(); |
184 | 184 | |
185 | 185 | //check if messenger is active |
186 | - if ( !isset($active_messengers[$this->_m_name] ) ) { |
|
186 | + if ( ! isset($active_messengers[$this->_m_name])) { |
|
187 | 187 | $msg[] = __('Message Templates cannot be generated because the given messenger is not active', 'event_espresso'); |
188 | - $msg[] = sprintf( __('The "$_m_name" property has "%s" as its value. Check the spelling and make sure it matches an available messenger', 'event_espresso'), $this->_m_name ); |
|
189 | - throw new EE_Error( implode( '||', $msg ) ); |
|
188 | + $msg[] = sprintf(__('The "$_m_name" property has "%s" as its value. Check the spelling and make sure it matches an available messenger', 'event_espresso'), $this->_m_name); |
|
189 | + throw new EE_Error(implode('||', $msg)); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | //check if message type is installed |
193 | - if ( !isset($active_messengers[$this->_m_name] ) ) { |
|
193 | + if ( ! isset($active_messengers[$this->_m_name])) { |
|
194 | 194 | $msg[] = __( |
195 | 195 | 'Message Templates cannot be generated because the given message type is not installed', |
196 | 196 | 'event_espresso' |
@@ -202,32 +202,32 @@ discard block |
||
202 | 202 | ), |
203 | 203 | $this->_mt_name |
204 | 204 | ); |
205 | - throw new EE_Error( implode( '||', $msg ) ); |
|
205 | + throw new EE_Error(implode('||', $msg)); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | $this->_messenger = $active_messengers[$this->_m_name]; |
209 | 209 | $this->_message_type = $active_message_types[$this->_mt_name]; |
210 | 210 | |
211 | 211 | //verify we have the messenger and message type objects |
212 | - if ( ! $this->_messenger instanceof EE_Messenger ) { |
|
212 | + if ( ! $this->_messenger instanceof EE_Messenger) { |
|
213 | 213 | throw new EE_Error( |
214 | 214 | sprintf( |
215 | 215 | __( |
216 | 216 | 'The _messenger property must be an instance of EE_Messenger by this point. It isn\'t. Something has gone wrong. Here is the value it holds: %s', |
217 | 217 | 'event_espresso' |
218 | 218 | ), |
219 | - '<br />' . print_r( $this->_messenger, true ) |
|
219 | + '<br />'.print_r($this->_messenger, true) |
|
220 | 220 | ) |
221 | 221 | ); |
222 | 222 | } |
223 | - if ( ! $this->_message_type instanceof EE_message_type ) { |
|
223 | + if ( ! $this->_message_type instanceof EE_message_type) { |
|
224 | 224 | throw new EE_Error( |
225 | 225 | sprintf( |
226 | 226 | __( |
227 | 227 | 'The _message_type property must be an instance of EE_message_type by this point. It isn\'t. Something has gone wrong. Here is the value it holds: %s', |
228 | 228 | 'event_espresso' |
229 | 229 | ), |
230 | - '<br />' . print_r( $this->_message_type, true ) |
|
230 | + '<br />'.print_r($this->_message_type, true) |
|
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | } |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | public function create_new_templates() { |
256 | 256 | $template_pack = 'default'; |
257 | 257 | //if we have the GRP_ID then let's use that to see if there is a set template pack and use that for the new templates. |
258 | - if ( !empty( $this->_GRP_ID ) ) { |
|
259 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_GRP_ID ); |
|
258 | + if ( ! empty($this->_GRP_ID)) { |
|
259 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_GRP_ID); |
|
260 | 260 | $template_pack = $mtpg instanceof EE_Message_Template_Group ? $mtpg->get_template_pack_name() : 'default'; |
261 | 261 | //we also need to reset the template variation to default |
262 | - $mtpg->set_template_pack_variation( 'default' ); |
|
262 | + $mtpg->set_template_pack_variation('default'); |
|
263 | 263 | } |
264 | - return $this->_create_new_templates( $template_pack ); |
|
264 | + return $this->_create_new_templates($template_pack); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -274,15 +274,15 @@ discard block |
||
274 | 274 | * @param string $template_pack This corresponds to a template pack class reference which will contain information about where to obtain the templates. |
275 | 275 | * @return mixed (array|bool) success array or false. |
276 | 276 | */ |
277 | - private function _create_new_templates( $template_pack ) { |
|
277 | + private function _create_new_templates($template_pack) { |
|
278 | 278 | |
279 | - $this->_set_templates( $template_pack ); |
|
279 | + $this->_set_templates($template_pack); |
|
280 | 280 | |
281 | 281 | //necessary properties are set, let's save the default templates |
282 | 282 | |
283 | - if ( empty( $this->_GRP_ID ) ) { |
|
283 | + if (empty($this->_GRP_ID)) { |
|
284 | 284 | |
285 | - $main_template_data = array( |
|
285 | + $main_template_data = array( |
|
286 | 286 | 'MTP_messenger' => $this->_messenger->name, |
287 | 287 | 'MTP_message_type' => $this->_message_type->name, |
288 | 288 | 'MTP_is_override' => 0, |
@@ -294,24 +294,24 @@ discard block |
||
294 | 294 | |
295 | 295 | |
296 | 296 | //let's insert the above and get our GRP_ID, then reset the template data array to just include the GRP_ID |
297 | - $grp_id = $this->_EEM_data->insert( $main_template_data ); |
|
297 | + $grp_id = $this->_EEM_data->insert($main_template_data); |
|
298 | 298 | |
299 | - if ( empty( $grp_id ) ) return $grp_id; |
|
299 | + if (empty($grp_id)) return $grp_id; |
|
300 | 300 | $this->_GRP_ID = $grp_id; |
301 | 301 | } |
302 | 302 | |
303 | - $template_data = array( 'GRP_ID' => $this->_GRP_ID ); |
|
303 | + $template_data = array('GRP_ID' => $this->_GRP_ID); |
|
304 | 304 | |
305 | - foreach ( $this->_contexts as $context => $details ) { |
|
306 | - foreach ( $this->_fields as $field => $field_type ) { |
|
307 | - if ( $field != 'extra' ) { |
|
305 | + foreach ($this->_contexts as $context => $details) { |
|
306 | + foreach ($this->_fields as $field => $field_type) { |
|
307 | + if ($field != 'extra') { |
|
308 | 308 | $template_data['MTP_context'] = $context; |
309 | 309 | $template_data['MTP_template_field'] = $field; |
310 | 310 | $template_data['MTP_content'] = $this->_templates[$context][$field]; |
311 | 311 | |
312 | 312 | $MTP = EEM_Message_Template::instance()->insert($template_data); |
313 | - if ( !$MTP ) { |
|
314 | - EE_Error::add_error( sprintf(__('There was an error in saving new template data for %s messenger, %s message type, %s context and %s template field.', 'event_espresso'), $this->_messenger->name, $this->_message_type->name, $context, $field), __FILE__, __FUNCTION__, __LINE__ ); |
|
313 | + if ( ! $MTP) { |
|
314 | + EE_Error::add_error(sprintf(__('There was an error in saving new template data for %s messenger, %s message type, %s context and %s template field.', 'event_espresso'), $this->_messenger->name, $this->_message_type->name, $context, $field), __FILE__, __FUNCTION__, __LINE__); |
|
315 | 315 | return false; |
316 | 316 | } |
317 | 317 | } |
@@ -2,15 +2,15 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * EE_Message_Template_Group class |
|
6 | - * |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage includes/classes/EE_Message_Template_Group.class.php |
|
10 | - * @author Darren Ethier |
|
11 | - * |
|
12 | - * ------------------------------------------------------------------------ |
|
13 | - */ |
|
5 | + * EE_Message_Template_Group class |
|
6 | + * |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage includes/classes/EE_Message_Template_Group.class.php |
|
10 | + * @author Darren Ethier |
|
11 | + * |
|
12 | + * ------------------------------------------------------------------------ |
|
13 | + */ |
|
14 | 14 | class EE_Message_Template_Group extends EE_Soft_Delete_Base_Class { |
15 | 15 | |
16 | 16 | /** |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_Message_Template_Group class |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | * @param string $timezone |
19 | 19 | * @return EE_Message_Template_Group|mixed |
20 | 20 | */ |
21 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
22 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
23 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
21 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
22 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
23 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | * @param string $timezone |
31 | 31 | * @return EE_Message_Template_Group |
32 | 32 | */ |
33 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
34 | - return new self( $props_n_values, TRUE, $timezone ); |
|
33 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
34 | + return new self($props_n_values, TRUE, $timezone); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * @param bool $message_type |
41 | 41 | * @throws EE_Error |
42 | 42 | */ |
43 | - public function set_message_type( $message_type = FALSE ) { |
|
44 | - if ( ! $message_type ) { |
|
45 | - throw new EE_Error( __( 'Missing required value for the message_type parameter', 'event_espresso' ) ); |
|
43 | + public function set_message_type($message_type = FALSE) { |
|
44 | + if ( ! $message_type) { |
|
45 | + throw new EE_Error(__('Missing required value for the message_type parameter', 'event_espresso')); |
|
46 | 46 | } |
47 | - $this->set( 'MTP_message_type', $message_type ); |
|
47 | + $this->set('MTP_message_type', $message_type); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | * @param bool $messenger |
54 | 54 | * @throws EE_Error |
55 | 55 | */ |
56 | - public function set_messenger( $messenger = FALSE ) { |
|
57 | - if ( ! $messenger ) { |
|
58 | - throw new EE_Error( __( 'Missing required value for the messenger parameter', 'event_espresso' ) ); |
|
56 | + public function set_messenger($messenger = FALSE) { |
|
57 | + if ( ! $messenger) { |
|
58 | + throw new EE_Error(__('Missing required value for the messenger parameter', 'event_espresso')); |
|
59 | 59 | } |
60 | - $this->set( 'MTP_messenger', $messenger ); |
|
60 | + $this->set('MTP_messenger', $messenger); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | * @param bool $GRP_ID |
67 | 67 | * @throws EE_Error |
68 | 68 | */ |
69 | - public function set_group_template_id( $GRP_ID = FALSE ) { |
|
70 | - if ( ! $GRP_ID ) { |
|
71 | - throw new EE_Error( __( 'Missing required value for the message template group id', 'event_espresso' ) ); |
|
69 | + public function set_group_template_id($GRP_ID = FALSE) { |
|
70 | + if ( ! $GRP_ID) { |
|
71 | + throw new EE_Error(__('Missing required value for the message template group id', 'event_espresso')); |
|
72 | 72 | } |
73 | - $this->set( 'GRP_ID', $GRP_ID ); |
|
73 | + $this->set('GRP_ID', $GRP_ID); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return int |
82 | 82 | */ |
83 | 83 | public function GRP_ID() { |
84 | - return $this->get( 'GRP_ID' ); |
|
84 | + return $this->get('GRP_ID'); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | * @return int |
93 | 93 | */ |
94 | 94 | public function user() { |
95 | - $user_id = $this->get( 'MTP_user_id' ); |
|
96 | - return empty( $user_id ) ? get_current_user_id() : $user_id; |
|
95 | + $user_id = $this->get('MTP_user_id'); |
|
96 | + return empty($user_id) ? get_current_user_id() : $user_id; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @return int |
117 | 117 | */ |
118 | 118 | public function count_events() { |
119 | - return $this->count_related( 'Event' ); |
|
119 | + return $this->count_related('Event'); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @return string |
127 | 127 | */ |
128 | 128 | public function name() { |
129 | - return $this->get( 'MTP_name' ); |
|
129 | + return $this->get('MTP_name'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @return string |
137 | 137 | */ |
138 | 138 | public function description() { |
139 | - return $this->get( 'MTP_description' ); |
|
139 | + return $this->get('MTP_description'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | * @param array $query_params like EEM_Base::get_all() |
147 | 147 | * @return EE_Message_Template[] |
148 | 148 | */ |
149 | - public function message_templates( $query_params = array() ) { |
|
150 | - return $this->get_many_related( 'Message_Template', $query_params ); |
|
149 | + public function message_templates($query_params = array()) { |
|
150 | + return $this->get_many_related('Message_Template', $query_params); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @return string |
159 | 159 | */ |
160 | 160 | public function messenger() { |
161 | - return $this->get( 'MTP_messenger' ); |
|
161 | + return $this->get('MTP_messenger'); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function messenger_obj() { |
176 | 176 | $messenger = $this->messenger(); |
177 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
177 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
178 | 178 | try { |
179 | - $messenger = EEH_MSG_Template::messenger_obj( $messenger ); |
|
180 | - } catch( EE_Error $e ) { |
|
179 | + $messenger = EEH_MSG_Template::messenger_obj($messenger); |
|
180 | + } catch (EE_Error $e) { |
|
181 | 181 | //if an exception was thrown then let's deactivate this message template group because it means there is no class for this messenger in this group. |
182 | - $this->set( 'MTP_is_active', false ); |
|
182 | + $this->set('MTP_is_active', false); |
|
183 | 183 | $this->save(); |
184 | 184 | return null; |
185 | 185 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @return string |
196 | 196 | */ |
197 | 197 | public function message_type() { |
198 | - return $this->get( 'MTP_message_type' ); |
|
198 | + return $this->get('MTP_message_type'); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function message_type_obj() { |
214 | 214 | $message_type = $this->message_type(); |
215 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
215 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
216 | 216 | try { |
217 | - $message_type = EEH_MSG_Template::message_type_obj( $message_type ); |
|
218 | - } catch(EE_Error $e) { |
|
217 | + $message_type = EEH_MSG_Template::message_type_obj($message_type); |
|
218 | + } catch (EE_Error $e) { |
|
219 | 219 | //if an exception was thrown then let's deactivate this message template group because it means there is no class for the message type in this group. |
220 | - $this->set( 'MTP_is_active', false ); |
|
220 | + $this->set('MTP_is_active', false); |
|
221 | 221 | $this->save(); |
222 | 222 | return null; |
223 | 223 | } |
@@ -254,13 +254,13 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function context_templates() { |
256 | 256 | $mtps_arr = array(); |
257 | - $mtps = $this->get_many_related( 'Message_Template' ); |
|
258 | - if ( empty( $mtps ) ) { |
|
257 | + $mtps = $this->get_many_related('Message_Template'); |
|
258 | + if (empty($mtps)) { |
|
259 | 259 | return array(); |
260 | 260 | } |
261 | 261 | //note contexts could have CHECKBOX fields per context. So we return the objects indexed by context AND field. |
262 | - foreach ( $mtps as $mtp ) { |
|
263 | - $mtps_arr[ $mtp->get( 'MTP_context' ) ][ $mtp->get( 'MTP_template_field' ) ] = $mtp; |
|
262 | + foreach ($mtps as $mtp) { |
|
263 | + $mtps_arr[$mtp->get('MTP_context')][$mtp->get('MTP_template_field')] = $mtp; |
|
264 | 264 | } |
265 | 265 | return $mtps_arr; |
266 | 266 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @return boolean true if it is, false if it isn't |
273 | 273 | */ |
274 | 274 | public function is_global() { |
275 | - return $this->get( 'MTP_is_global' ); |
|
275 | + return $this->get('MTP_is_global'); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @return boolean true if it is, false if it isn't |
283 | 283 | */ |
284 | 284 | public function is_active() { |
285 | - return $this->get( 'MTP_is_active' ); |
|
285 | + return $this->get('MTP_is_active'); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -298,11 +298,11 @@ discard block |
||
298 | 298 | * @param bool $merged If TRUE then we don't return shortcodes indexed by field but instead an array of the unique shortcodes for all the given (or all) fields. |
299 | 299 | * @return mixed (array|bool) an array of shortcodes in the format array( '[shortcode] => 'label') OR FALSE if no shortcodes found. |
300 | 300 | */ |
301 | - public function get_shortcodes( $context, $fields = array(), $merged = FALSE ) { |
|
301 | + public function get_shortcodes($context, $fields = array(), $merged = FALSE) { |
|
302 | 302 | $messenger = $this->messenger(); |
303 | 303 | $message_type = $this->message_type(); |
304 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
305 | - return EEH_MSG_Template::get_shortcodes( $message_type, $messenger, $fields, $context, $merged ); |
|
304 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
305 | + return EEH_MSG_Template::get_shortcodes($message_type, $messenger, $fields, $context, $merged); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * @return string |
344 | 344 | */ |
345 | 345 | public function get_template_pack_name() { |
346 | - return $this->get_extra_meta( 'MTP_template_pack', TRUE, 'default' ); |
|
346 | + return $this->get_extra_meta('MTP_template_pack', TRUE, 'default'); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | */ |
359 | 359 | public function get_template_pack() { |
360 | 360 | $pack_name = $this->get_template_pack_name(); |
361 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
362 | - return EEH_MSG_Template::get_template_pack( $pack_name ); |
|
361 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
362 | + return EEH_MSG_Template::get_template_pack($pack_name); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * @return string |
373 | 373 | */ |
374 | 374 | public function get_template_pack_variation() { |
375 | - return $this->get_extra_meta( 'MTP_variation', TRUE, 'default' ); |
|
375 | + return $this->get_extra_meta('MTP_variation', TRUE, 'default'); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | * @param string $template_pack_name What message template pack is assigned. |
385 | 385 | * @return int |
386 | 386 | */ |
387 | - public function set_template_pack_name( $template_pack_name ) { |
|
388 | - return $this->update_extra_meta( 'MTP_template_pack', $template_pack_name ); |
|
387 | + public function set_template_pack_name($template_pack_name) { |
|
388 | + return $this->update_extra_meta('MTP_template_pack', $template_pack_name); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | |
@@ -397,8 +397,8 @@ discard block |
||
397 | 397 | * @param string $variation What variation is being set on the message template group. |
398 | 398 | * @return int |
399 | 399 | */ |
400 | - public function set_template_pack_variation( $variation ) { |
|
401 | - return $this->update_extra_meta( 'MTP_variation', $variation ); |
|
400 | + public function set_template_pack_variation($variation) { |
|
401 | + return $this->update_extra_meta('MTP_variation', $variation); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | //end EE_Message_Template_Group class |