/**
  * @access public
  * @param EE_Question_Group $question_group
  * @return 	EE_Form_Section_HTML
  */
 public function question_group_header(EE_Question_Group $question_group)
 {
     $html = '';
     // group_name
     if ($question_group->show_group_name() && $question_group->name() != '') {
         EE_Registry::instance()->load_helper('HTML');
         if ($this->checkout->admin_request) {
             $html .= EEH_HTML::br();
             $html .= EEH_HTML::h3($question_group->name(), '', 'ee-reg-form-qstn-grp-title title', 'font-size: 1.3em; padding-left:0;');
         } else {
             $html .= EEH_HTML::h4($question_group->name(), '', 'ee-reg-form-qstn-grp-title section-title');
         }
     }
     // group_desc
     if ($question_group->show_group_desc() && $question_group->desc() != '') {
         $html .= EEH_HTML::p($question_group->desc(), '', $this->checkout->admin_request ? 'ee-reg-form-qstn-grp-desc-pg' : 'ee-reg-form-qstn-grp-desc-pg small-text lt-grey-text');
     }
     return new EE_Form_Section_HTML($html);
 }
 /**
  * _setup_payment_options
  * @return \EE_Form_Section_Proper
  */
 public function _setup_payment_options()
 {
     // load payment method classes
     $this->checkout->available_payment_methods = $this->_get_available_payment_methods();
     // switch up header depending on number of available payment methods
     $payment_method_header = count($this->checkout->available_payment_methods) > 1 ? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso')) : apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso'));
     $available_payment_methods = array('payment_method_header' => new EE_Form_Section_HTML(EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')));
     // the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
     $available_payment_method_options = array();
     $default_payment_method_option = array();
     // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
     $payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;')));
     // loop through payment methods
     foreach ($this->checkout->available_payment_methods as $payment_method) {
         if ($payment_method instanceof EE_Payment_Method) {
             $payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img');
             // check if any payment methods are set as default
             // if payment method is already selected OR nothing is selected and this payment method should be open_by_default
             if ($this->checkout->selected_method_of_payment == $payment_method->slug() || !$this->checkout->selected_method_of_payment && $payment_method->open_by_default()) {
                 $this->checkout->selected_method_of_payment = $payment_method->slug();
                 $this->_save_selected_method_of_payment();
                 $default_payment_method_option[$payment_method->slug()] = $payment_method_button;
             } else {
                 $available_payment_method_options[$payment_method->slug()] = $payment_method_button;
             }
             $payment_methods_billing_info[$payment_method->slug() . '-info'] = $this->_payment_method_billing_info($payment_method);
         }
     }
     // prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs
     $available_payment_method_options = $default_payment_method_option + $available_payment_method_options;
     // now generate the actual form  inputs
     $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options);
     $available_payment_methods = $available_payment_methods + $payment_methods_billing_info;
     // build the available payment methods form
     return new EE_Form_Section_Proper(array('html_id' => 'spco-available-methods-of-payment-dv', 'subsections' => $available_payment_methods, 'layout_strategy' => new EE_Div_Per_Section_Layout()));
 }
 /**
  * 	init
  *
  *  @access 	public
  *  @return 	void
  */
 public function init()
 {
     $this->_get_reg_url_link();
     if (!$this->get_txn()) {
         EE_Registry::instance()->load_helper('HTML');
         echo EEH_HTML::div(EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') . sprintf(__('This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', 'event_espresso'), '<br/>'), '', 'ee-attention');
         return NULL;
     }
     // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete"
     if ($this->_current_txn->status_ID() == EEM_Transaction::failed_status_code) {
         $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code);
         $this->_current_txn->save();
     }
     $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration ? $this->_current_txn->primary_registration() : NULL;
     $this->_is_primary = $this->_primary_registrant->reg_url_link() == $this->_reg_url_link ? TRUE : FALSE;
     $show_try_pay_again_link_default = apply_filters('AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default', TRUE);
     // txn status ?
     if ($this->_current_txn->is_completed()) {
         $this->_show_try_pay_again_link = $show_try_pay_again_link_default;
     } else {
         if ($this->_current_txn->is_incomplete() && ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment())) {
             $this->_show_try_pay_again_link = TRUE;
         } else {
             if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) {
                 // its pending
                 $this->_show_try_pay_again_link = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) && EE_Registry::instance()->CFG->registration->show_pending_payment_options ? TRUE : $show_try_pay_again_link_default;
             } else {
                 $this->_show_try_pay_again_link = $show_try_pay_again_link_default;
             }
         }
     }
     $this->_payments_closed = !$this->_current_txn->payment_method() instanceof EE_Payment_Method ? TRUE : FALSE;
     if (!$this->_current_txn->payment_method() instanceof EE_Payment_Method || $this->_current_txn->payment_method() instanceof EE_Payment_Method && $this->_current_txn->payment_method()->is_off_line()) {
         $this->_is_offline_payment_method = true;
     } else {
         $this->_is_offline_payment_method = false;
     }
     // link to SPCO
     $revisit_spco_url = add_query_arg(array('ee' => '_register', 'revisit' => TRUE, 'e_reg_url_link' => $this->_reg_url_link), EE_Registry::instance()->CFG->core->reg_page_url());
     // link to SPCO payment_options
     $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->payment_overview_url() : add_query_arg(array('step' => 'payment_options'), $revisit_spco_url);
     // link to SPCO attendee_information
     $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->edit_attendee_information_url() : FALSE;
     EE_Registry::instance()->load_helper('Template');
     EE_Registry::instance()->load_helper('Template_Validator');
     do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn);
     // set no cache headers and constants
     EE_System::do_not_cache();
 }
 /**
  *    _add_promotions_form_inputs
  *
  * @access    	private
  * @param 	EE_Form_Section_Proper $before_payment_options
  * @return    	EE_Form_Section_Proper
  */
 private function _add_promotions_form_inputs($before_payment_options)
 {
     add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
     EE_Registry::instance()->load_helper('HTML');
     $before_payment_options->add_subsections(array('promotions_form' => new EE_Form_Section_Proper(array('layout_strategy' => new EE_No_Layout(), 'subsections' => array('ee_promotion_code_input' => new EE_Text_Input(array('default' => '', 'html_id' => 'ee-promotion-code-input', 'html_class' => 'ee-promotion-code-input ee-reg-qstn', 'html_name' => 'ee_promotion_code_input', 'html_label_text' => apply_filters('FHEE__EED_Promotions___add_promotions_form_inputs__ee_promotion_code_input__html_label_text', EEH_HTML::h4($this->_config->label->singular)))), 'ee_promotion_code_submit' => new EE_Submit_Input(array('html_id' => 'ee-promotion-code', 'html_name' => 'ee_promotion_code_submit', 'default' => apply_filters('FHEE__EED_Promotions___add_promotions_form_inputs__ee_promotion_code_submit__default', sprintf(__('Submit %s', 'event_espresso'), $this->_config->label->singular)))), 'ee_promotion_code_header' => new EE_Form_Section_HTML(EEH_HTML::div(' ', '', 'clear-float')))))));
     return $before_payment_options;
 }