/**
  *
  * @throws EE_Error
  * @return string of html to display the field
  */
 public function display()
 {
     $input = $this->get_input();
     //d( $input );
     $multi = count($input->options()) > 1 ? TRUE : FALSE;
     $input->set_label_sizes();
     $label_size_class = $input->get_label_size_class();
     $html = '';
     if (!is_array($input->raw_value()) && $input->raw_value() !== NULL) {
         EE_Error::doing_it_wrong('EE_Checkbox_Display_Strategy::display()', sprintf(__('Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', 'event_espresso'), $input->html_id(), var_export($input->raw_value(), true), $input->html_name() . '[]'), '4.8.1');
     }
     $input_raw_value = (array) $input->raw_value();
     foreach ($input->options() as $value => $display_text) {
         $value = $input->get_normalization_strategy()->unnormalize_one($value);
         $html_id = $multi ? $this->get_sub_input_id($value) : $input->html_id();
         $html .= EEH_HTML::nl(0, 'checkbox');
         $html .= '<label for="' . $html_id . '" id="' . $html_id . '-lbl" class="ee-checkbox-label-after' . $label_size_class . '">';
         $html .= EEH_HTML::nl(1, 'checkbox');
         $html .= '<input type="checkbox"';
         $html .= ' name="' . $input->html_name() . '[]"';
         $html .= ' id="' . $html_id . '"';
         $html .= ' class="' . $input->html_class() . '"';
         $html .= ' style="' . $input->html_style() . '"';
         $html .= ' value="' . esc_attr($value) . '"';
         $html .= !empty($input_raw_value) && in_array($value, $input_raw_value) ? ' checked="checked"' : '';
         $html .= ' ' . $this->_input->other_html_attributes();
         $html .= '>&nbsp;';
         $html .= $display_text;
         $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
     }
     return $html;
 }
 /**
  *
  * @throws EE_Error
  * @return string of html to display the field
  */
 function display()
 {
     if (!$this->_input instanceof EE_Form_Input_With_Options_Base) {
         throw new EE_Error(sprintf(__('Can not use Radio Button Display Strategy with an input that doesn\'t have options', 'event_espresso')));
     }
     $this->_input->set_label_sizes();
     $label_size_class = $this->_input->get_label_size_class();
     $html = '';
     foreach ($this->_input->options() as $value => $display_text) {
         $value = $this->_input->get_normalization_strategy()->unnormalize($value);
         $html_id = $this->_append_chars($this->_input->html_id(), '-') . sanitize_key($value);
         $html .= EEH_HTML::nl(0, 'radio');
         $html .= '<label for="' . $html_id . '"';
         $html .= ' id="' . $html_id . '-lbl"';
         $html .= ' class="ee-radio-label-after' . $label_size_class . '">';
         $html .= EEH_HTML::nl(1, 'radio');
         $html .= '<input id="' . $html_id . '"';
         $html .= ' name="' . $this->_input->html_name() . '"';
         $html .= ' class="' . $this->_input->html_class() . '"';
         $html .= ' style="' . $this->_input->html_style() . '"';
         $html .= ' type="radio"';
         $html .= ' value="' . esc_attr($value) . '"';
         $html .= $this->_input->raw_value() === $value ? ' checked="checked"' : '';
         $html .= '>&nbsp;';
         $html .= $display_text;
         $html .= EEH_HTML::nl(-1, 'radio') . '</label>';
     }
     $html .= EEH_HTML::div('', '', 'clear-float');
     $html .= EEH_HTML::divx();
     return $html;
 }
 /**
  *
  * @throws EE_Error
  * @return string of html to display the field
  */
 function display()
 {
     if (!$this->_input instanceof EE_Form_Input_With_Options_Base) {
         throw new EE_Error(sprintf(__("Cannot use Checkbox Display Strategy with an input that doesn't have options", "event_espresso")));
     }
     //d( $this->_input );
     $multi = count($this->_input->options()) > 1 ? TRUE : FALSE;
     $this->_input->set_label_sizes();
     $label_size_class = $this->_input->get_label_size_class();
     $html = '';
     foreach ($this->_input->options() as $value => $display_text) {
         $option_value_as_string = $this->_input->get_normalization_strategy()->unnormalize_one($value);
         $html_id = $multi ? $this->_input->html_id() . '-' . sanitize_key($option_value_as_string) : $this->_input->html_id();
         $html .= EEH_HTML::nl(0, 'checkbox');
         $html .= '<label for="' . $html_id . '" id="' . $html_id . '-lbl" class="ee-checkbox-label-after' . $label_size_class . '">';
         $html .= EEH_HTML::nl(1, 'checkbox');
         $html .= '<input type="checkbox"';
         $html .= ' name="' . $this->_input->html_name() . '[]"';
         $html .= ' id="' . $html_id . '"';
         $html .= ' class="' . $this->_input->html_class() . '"';
         $html .= ' style="' . $this->_input->html_style() . '"';
         $html .= ' value="' . esc_attr($value) . '"';
         $html .= $this->_input->raw_value() && in_array($value, $this->_input->raw_value()) ? ' checked="checked"' : '';
         $html .= '>&nbsp;';
         $html .= $display_text;
         $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
     }
     return $html;
 }
 /**
  * Lays out the row for the input, including label and errors
  * @param EE_Form_Input_Base $input
  * @return string
  */
 public function layout_input($input)
 {
     $html = '';
     if ($input instanceof EE_Hidden_Input) {
         $html .= EEH_HTML::nl() . $input->get_html_for_input();
     } else {
         if ($input instanceof EE_Submit_Input) {
             $html .= EEH_HTML::br();
             $html .= $input->get_html_for_input();
         } else {
             if ($input instanceof EE_Select_Input) {
                 $html .= EEH_HTML::br();
                 $html .= EEH_HTML::nl(1) . $input->get_html_for_label();
                 $html .= EEH_HTML::nl() . $input->get_html_for_errors();
                 $html .= EEH_HTML::nl() . $input->get_html_for_input();
                 $html .= EEH_HTML::nl() . $input->get_html_for_help();
                 $html .= EEH_HTML::br();
             } else {
                 if ($input instanceof EE_Form_Input_With_Options_Base) {
                     $html .= EEH_HTML::br();
                     $html .= EEH_HTML::nl() . $input->get_html_for_errors();
                     $html .= EEH_HTML::nl() . $input->get_html_for_input();
                     $html .= EEH_HTML::nl() . $input->get_html_for_help();
                 } else {
                     $html .= EEH_HTML::br();
                     $html .= EEH_HTML::nl(1) . $input->get_html_for_label();
                     $html .= EEH_HTML::nl() . $input->get_html_for_errors();
                     $html .= EEH_HTML::nl() . $input->get_html_for_input();
                     $html .= EEH_HTML::nl() . $input->get_html_for_help();
                 }
             }
         }
     }
     return $html;
 }
 /**
  *
  * @throws EE_Error
  * @return string of html to display the field
  */
 public function display()
 {
     if (!$this->_input instanceof EE_Form_Input_With_Options_Base) {
         throw new EE_Error(sprintf(__('Cannot use Select Multiple Display Strategy with an input that doesn\'t have options', "event_espresso")));
     }
     $html = EEH_HTML::nl(0, 'select');
     $html .= '<select multiple';
     $html .= ' id="' . $this->_input->html_id() . '"';
     $html .= ' name="' . $this->_input->html_name() . '[]"';
     $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
     $html .= ' class="' . $class . '"';
     // add html5 required
     $html .= $this->_input->required() ? ' required' : '';
     $html .= ' style="' . $this->_input->html_style() . '"';
     $html .= '>';
     EE_Registry::instance()->load_helper('Array');
     EEH_HTML::indent(1, 'select');
     if (EEH_Array::is_multi_dimensional_array($this->_input->options())) {
         throw new EE_Error(sprintf(__("Select multiple display strategy does not allow for nested arrays of options.", "event_espresso")));
     } else {
         $html .= $this->_display_options($this->_input->options());
     }
     $html .= EEH_HTML::nl(-1, 'select') . "</select>";
     return $html;
 }
 /**
  *
  * @throws EE_Error
  * @return string of html to display the field
  */
 public function display()
 {
     $input = $this->get_input();
     $input->set_label_sizes();
     $label_size_class = $input->get_label_size_class();
     $html = '';
     foreach ($input->options() as $value => $display_text) {
         $value = $input->get_normalization_strategy()->unnormalize($value);
         $html_id = $this->get_sub_input_id($value);
         $html .= EEH_HTML::nl(0, 'radio');
         $html .= '<label for="' . $html_id . '"';
         $html .= ' id="' . $html_id . '-lbl"';
         $html .= ' class="ee-radio-label-after' . $label_size_class . '">';
         $html .= EEH_HTML::nl(1, 'radio');
         $html .= '<input id="' . $html_id . '"';
         $html .= ' name="' . $input->html_name() . '"';
         $html .= ' class="' . $input->html_class() . '"';
         $html .= ' style="' . $input->html_style() . '"';
         $html .= ' type="radio"';
         $html .= ' value="' . esc_attr($value) . '"';
         $html .= $input->raw_value() === $value ? ' checked="checked"' : '';
         $html .= ' ' . $this->_input->other_html_attributes();
         $html .= '>&nbsp;';
         $html .= $display_text;
         $html .= EEH_HTML::nl(-1, 'radio') . '</label>';
     }
     $html .= EEH_HTML::div('', '', 'clear-float');
     $html .= EEH_HTML::divx();
     return $html;
 }
 /**
  *
  * @throws EE_Error
  * @return string of html to display the field
  */
 function display()
 {
     if (!$this->_input instanceof EE_Form_Input_With_Options_Base) {
         throw new EE_Error(sprintf(__("Cannot use Checkbox Display Strategy with an input that doesn't have options", "event_espresso")));
     }
     //d( $this->_input );
     $multi = count($this->_input->options()) > 1 ? TRUE : FALSE;
     $this->_input->set_label_sizes();
     $label_size_class = $this->_input->get_label_size_class();
     $html = '';
     if (!is_array($this->_input->raw_value()) && $this->_input->raw_value() !== NULL) {
         EE_Error::doing_it_wrong('EE_Checkbox_Display_Strategy::display()', sprintf(__('Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', 'event_espresso'), $this->_input->html_id(), var_export($this->_input->raw_value(), true), $this->_input->html_name() . '[]'), '4.8.1');
     }
     $input_raw_value = (array) $this->_input->raw_value();
     foreach ($this->_input->options() as $value => $display_text) {
         $option_value_as_string = $this->_input->get_normalization_strategy()->unnormalize_one($value);
         $html_id = $multi ? $this->_input->html_id() . '-' . sanitize_key($option_value_as_string) : $this->_input->html_id();
         $html .= EEH_HTML::nl(0, 'checkbox');
         $html .= '<label for="' . $html_id . '" id="' . $html_id . '-lbl" class="ee-checkbox-label-after' . $label_size_class . '">';
         $html .= EEH_HTML::nl(1, 'checkbox');
         $html .= '<input type="checkbox"';
         $html .= ' name="' . $this->_input->html_name() . '[]"';
         $html .= ' id="' . $html_id . '"';
         $html .= ' class="' . $this->_input->html_class() . '"';
         $html .= ' style="' . $this->_input->html_style() . '"';
         $html .= ' value="' . esc_attr($value) . '"';
         $html .= !empty($input_raw_value) && in_array($value, $input_raw_value) ? ' checked="checked"' : '';
         $html .= '>&nbsp;';
         $html .= $display_text;
         $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
     }
     return $html;
 }
 /**
  * Lays out a row for the subsection
  * @param EE_Form_Section_Proper $form_section
  * @return string
  */
 public function layout_subsection($form_section)
 {
     $html = '';
     if ($form_section instanceof EE_Form_Section_HTML) {
         $html .= $form_section->get_html_and_js();
     } else {
         $html .= EEH_HTML::tr(EEH_HTML::td($form_section->get_html_and_js(), '', '', '', 'colspan="2"'));
     }
     return $html;
 }
 /**
  * Displays a flat list of options as option tags
  * @param array $options
  * @return string
  */
 protected function _display_options($options)
 {
     $html = '';
     EEH_HTML::indent(1, 'option');
     foreach ($options as $value => $display_text) {
         $unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one($value);
         $selected = $this->_check_if_option_selected($unnormalized_value) ? ' selected="selected"' : '';
         $html .= EEH_HTML::nl(0, 'option') . '<option value="' . esc_attr($unnormalized_value) . '"' . $selected . '>' . $display_text . '</option>';
     }
     EEH_HTML::indent(-1, 'option');
     return $html;
 }
 /**
  *
  * @return string of html to display the field
  */
 function display()
 {
     // the actual input
     $input = '<input type="text" size="34" ';
     $input .= 'name="' . $this->_input->html_name() . '" ';
     $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url ' . $this->_input->html_class() . '" ' : 'class="large-text ee_media_url" ';
     $input .= 'value="' . $this->_input->raw_value_in_form() . '" ';
     $input .= $this->_input->other_html_attributes() . '>';
     // image uploader
     $uploader = EEH_HTML::link('#', '<img src="' . admin_url('images/media-button-image.gif') . '" >', __('click to add an image', 'event_espresso'), '', 'ee_media_upload');
     //only attempt to show the image if it at least exists
     $image = $this->src_exists($this->_input->raw_value()) ? EEH_HTML::br(2) . EEH_HTML::img($this->_input->raw_value(), __('logo', 'event_espresso'), '', 'ee_media_image') : '';
     // html string
     return EEH_HTML::div($input . EEH_HTML::nbsp() . $uploader . $image, '', 'ee_media_uploader_area');
 }
    /**
     *
     * @param EE_Question_Group $question_group
     * @param EE_Registration   $registration
     * @return \EE_Form_Section_Proper
     * @throws \EE_Error
     */
    public function build_subform_from_question_group($question_group, $registration)
    {
        if (!$question_group instanceof EE_Question_Group || !$registration instanceof EE_Registration) {
            throw new EE_Error(__('A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso'));
        }
        $parts_of_subsection = array('title' => new EE_Form_Section_HTML(EEH_HTML::h5($question_group->name(), $question_group->identifier(), 'espresso-question-group-title-h5 section-title')));
        foreach ($question_group->questions(array(array('QST_system' => ''))) as $question) {
            $parts_of_subsection[$question->ID()] = $question->generate_form_input($registration);
        }
        $parts_of_subsection['edit_link'] = new EE_Form_Section_HTML('<tr><th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso') . '">
					<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso') . '</span>
					<div class="dashicons dashicons-edit"></div>
				</a></td></tr>');
        return new EE_Form_Section_Proper(array('subsections' => $parts_of_subsection, 'html_class' => 'question-group-questions'));
    }
 /**
  * Lays out the row for the input, including label and errors
  * @param EE_Form_Input_Base $input
  * @return string
  */
 public function layout_input($input)
 {
     if ($input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy) {
         $input->set_html_class($input->html_class() . ' large-text');
     }
     if ($input instanceof EE_Text_Area_Input) {
         $input->set_rows(4);
         $input->set_cols(60);
     }
     $input_html = $input->get_html_for_input();
     // maybe add errors and help text ?
     $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : '';
     $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : '';
     //overriding parent to add wp admin specific things.
     $html = '';
     if ($input instanceof EE_Hidden_Input) {
         $html .= EEH_HTML::no_row($input->get_html_for_input(), 2);
     } else {
         $html .= EEH_HTML::tr(EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"') . EEH_HTML::td($input_html));
     }
     return $html;
 }
 /**
  * payment_fields_autofilled_notice_html
  * @return string
  */
 public function payment_fields_autofilled_notice_html()
 {
     EE_Registry::instance()->load_helper('HTML');
     return new EE_Form_Section_HTML(EEH_HTML::p(apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __('Payment fields have been autofilled because you are in debug mode', 'event_espresso')), '', 'important-notice'));
 }
 /**
  * closing div tag for a form
  * @return string
  */
 public function layout_form_end()
 {
     return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class());
 }
 /**
  * closing div tag for a form
  * @return string
  */
 public function layout_form_end()
 {
     return EEH_HTML::nl(-1) . '</fieldset>';
 }
 /**
  * div_class - returns nothing for current step, but a css class of "hidden" for others
  * @return string
  */
 public function reg_step_submit_button()
 {
     if (!$this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
         return '';
     }
     ob_start();
     do_action('AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout);
     $html = ob_get_clean();
     // generate submit button
     $sbmt_btn = new EE_Submit_Input(array('html_name' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), 'html_id' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), 'html_class' => 'spco-next-step-btn', 'other_html_attributes' => ' rel="' . $this->slug() . '"', 'default' => $this->submit_button_text()));
     $sbmt_btn->set_button_css_attributes(TRUE, 'large');
     $sbmt_btn_html = $sbmt_btn->get_html_for_input();
     EE_Registry::instance()->load_helper('HTML');
     $html .= EEH_HTML::div(apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this), 'spco-' . $this->slug() . '-whats-next-buttons-dv', 'spco-whats-next-buttons');
     return $html;
 }
 public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form)
 {
     // only add the 'new_state_micro_form' when displaying reg forms,
     // not during processing since we process the 'new_state_micro_form' in it's own AJAX request
     $action = EE_Registry::instance()->REQ->get('action', '');
     if ($action === 'process_reg_step' || $action === 'update_reg_step') {
         return $question_group_reg_form;
     }
     // is the "state" question in this form section?
     $input = $question_group_reg_form->get_subsection('state');
     // we're only doing this for state select inputs
     if ($input instanceof EE_State_Select_Input) {
         // load helpers
         EE_Registry::instance()->load_helper('HTML');
         // grab any set values from the request
         $country_name = str_replace('state', 'new_state_country', $input->html_name());
         $state_name = str_replace('state', 'new_state_name', $input->html_name());
         $abbrv_name = str_replace('state', 'new_state_abbrv', $input->html_name());
         $new_state_submit_id = str_replace('state', 'new_state', $input->html_id());
         $country_options = array();
         $countries = EEM_Country::instance()->get_all_countries();
         if (!empty($countries)) {
             foreach ($countries as $country) {
                 if ($country instanceof EE_Country) {
                     $country_options[$country->ID()] = $country->name();
                 }
             }
         }
         $new_state_micro_form = new EE_Form_Section_Proper(array('name' => 'new_state_micro_form', 'html_id' => 'new_state_micro_form', 'layout_strategy' => new EE_No_Layout(), 'subsections' => array('add_new_state' => new EE_Hidden_Input(array('html_name' => str_replace('state', 'add_new_state', $input->html_name()), 'html_id' => str_replace('state', 'add_new_state', $input->html_id()), 'default' => 0)), 'click_here_link' => new EE_Form_Section_HTML(apply_filters('FHEE__EED_Add_New_State__display_add_new_state_micro_form__click_here_link', EEH_HTML::link('', __('click here to add a new state/province', 'event_espresso'), '', 'display-' . $input->html_id(), 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', '', 'rel="' . $input->html_id() . '"'))), 'add_new_state_micro_form' => new EE_Form_Section_HTML(apply_filters('FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', EEH_HTML::div('', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', 'display: none;') . EEH_HTML::h6(__('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')) . EEH_HTML::ul() . EEH_HTML::li(__('first select the Country that your State/Province belongs to', 'event_espresso')) . EEH_HTML::li(__('enter the name of your State/Province', 'event_espresso')) . EEH_HTML::li(__('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso')) . EEH_HTML::li(__('click the ADD button', 'event_espresso')) . EEH_HTML::ulx())), 'new_state_country' => new EE_Country_Select_Input($country_options, array('html_name' => $country_name, 'html_id' => str_replace('state', 'new_state_country', $input->html_id()), 'html_class' => $input->html_class() . ' new-state-country', 'html_label_text' => __('New State/Province Country', 'event_espresso'), 'default' => EE_Registry::instance()->REQ->get($country_name, ''), 'required' => false)), 'new_state_name' => new EE_Text_Input(array('html_name' => $state_name, 'html_id' => str_replace('state', 'new_state_name', $input->html_id()), 'html_class' => $input->html_class() . ' new-state-state', 'html_label_text' => __('New State/Province Name', 'event_espresso'), 'default' => EE_Registry::instance()->REQ->get($state_name, ''), 'required' => false)), 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()), 'new_state_abbrv' => new EE_Text_Input(array('html_name' => $abbrv_name, 'html_id' => str_replace('state', 'new_state_abbrv', $input->html_id()), 'html_class' => $input->html_class() . ' new-state-abbrv', 'html_label_text' => __('New State/Province Abbreviation', 'event_espresso'), 'html_other_attributes' => 'size="24"', 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), 'required' => false)), 'add_new_state_submit_button' => new EE_Form_Section_HTML(apply_filters('FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', EEH_HTML::nbsp(3) . EEH_HTML::link('', __('ADD', 'event_espresso'), '', 'submit-' . $new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="' . $new_state_submit_id . '"'))), 'add_new_state_extra' => new EE_Form_Section_HTML(apply_filters('FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra', EEH_HTML::br(2) . EEH_HTML::div('', '', 'small-text') . EEH_HTML::strong(__('Don\'t know your State/Province Abbreviation?', 'event_espresso')) . EEH_HTML::br() . sprintf(__('You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', 'event_espresso'), EEH_HTML::link('http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk')) . EEH_HTML::divx() . EEH_HTML::br() . EEH_HTML::link('', __('cancel new state/province', 'event_espresso'), '', 'hide-' . $input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="' . $input->html_id() . '"') . EEH_HTML::divx() . EEH_HTML::br())))));
         $question_group_reg_form->add_subsections(array('new_state_micro_form' => $new_state_micro_form), 'state', false);
     }
     return $question_group_reg_form;
 }
 /**
  * @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);
 }
 /**
  * returns HTML for generating the closing form HTML tag (</form>)
  * @return string
  */
 public function form_close()
 {
     return EEH_HTML::nl(-1, 'form') . '</form>' . EEH_HTML::nl() . '<!-- end of ee-' . $this->html_id() . '-form -->' . EEH_HTML::nl();
 }
 /**
  * closing div tag for a form
  * @return string
  */
 public function layout_form_end()
 {
     return EEH_HTML::nl(-1);
 }
 /**
  * _recaptcha_main_settings
  *
  * @access protected
  * @return EE_Form_Section_Proper
  */
 protected static function _recaptcha_settings_form()
 {
     return new EE_Form_Section_Proper(array('name' => 'recaptcha_settings_form', 'html_id' => 'recaptcha_settings_form', 'layout_strategy' => new EE_Div_Per_Section_Layout(), 'subsections' => apply_filters('FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections', array('main_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Anti-spam Settings', 'event_espresso') . EEH_Template::get_help_tab_link('recaptcha_info'))), 'main_settings' => EED_Recaptcha::_recaptcha_main_settings(), 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))), 'appearance_settings' => EED_Recaptcha::_recaptcha_appearance_settings(), 'required_fields_note' => new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text'))))));
 }
 /**
  * Converts a 1d array of key-value pairs into html hidden inputs
  * and returns the string of html
  * @param array $args key-value pairs
  * @return string
  */
 protected function _args_as_inputs($args)
 {
     $html = '';
     if ($args !== NULL && is_array($args)) {
         EE_Registry::instance()->load_helper('HTML');
         foreach ($args as $name => $value) {
             $html .= EEH_HTML::nl(0) . '<input type="hidden" name="' . $name . '" value="' . esc_attr($value) . '"/>';
         }
     }
     return $html;
 }
 /**
  *    _payments_and_amount_owing_rows
  *
  * @param EE_Line_Item $line_item
  * @param array        $options
  * @return mixed
  */
 private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array())
 {
     $html = '';
     $owing = $line_item->total();
     $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
     if ($transaction instanceof EE_Transaction) {
         $registration_payments = array();
         $registrations = !empty($options['registrations']) ? $options['registrations'] : $transaction->registrations();
         foreach ($registrations as $registration) {
             if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
                 $registration_payments = $registration_payments + $registration->registration_payments();
             }
         }
         if (!empty($registration_payments)) {
             foreach ($registration_payments as $registration_payment) {
                 if ($registration_payment instanceof EE_Registration_Payment) {
                     $owing = $owing - $registration_payment->amount();
                     $payment = $registration_payment->payment();
                     if ($payment instanceof EE_Payment) {
                         $payment_desc = sprintf(__('Payment%1$s Received: %2$s', 'event_espresso'), $payment->txn_id_chq_nmbr() != '' ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' : '', $payment->timestamp());
                     } else {
                         $payment_desc = '';
                     }
                     // start of row
                     $html .= EEH_HTML::tr('', '', 'total_tr odd');
                     // payment desc
                     $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
                     // total td
                     $html .= EEH_HTML::td(EEH_Template::format_currency($registration_payment->amount(), false, false), '', 'total jst-rght');
                     // end of row
                     $html .= EEH_HTML::trx();
                 }
             }
             if ($line_item->total()) {
                 // start of row
                 $html .= EEH_HTML::tr('', '', 'total_tr odd');
                 // total td
                 $html .= EEH_HTML::td(__('Amount Owing', 'event_espresso'), '', 'total_currency total jst-rght', '', ' colspan="3"');
                 // total td
                 $html .= EEH_HTML::td(EEH_Template::format_currency($owing, false, false), '', 'total jst-rght');
                 // end of row
                 $html .= EEH_HTML::trx();
             }
         }
     }
     $this->_grand_total = $owing;
     return $html;
 }
 /**
  * _email_validation_settings_form
  *
  * @access protected
  * @return EE_Form_Section_Proper
  */
 protected function _email_validation_settings_form()
 {
     return new EE_Form_Section_Proper(array('name' => 'email_validation_settings', 'html_id' => 'email_validation_settings', 'layout_strategy' => new EE_Admin_Two_Column_Layout(), 'subsections' => array('email_validation_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('Email Validation Settings', 'event_espresso'))), 'email_validation_level' => new EE_Select_Input(array('basic' => __('Basic', 'event_espresso'), 'wp_default' => __('WordPress Default', 'event_espresso'), 'i18n' => __('International', 'event_espresso'), 'i18n_dns' => __('International + DNS Check', 'event_espresso')), array('html_label_text' => __('Email Validation Level', 'event_espresso') . EEH_Template::get_help_tab_link('email_validation_info'), 'html_help_text' => __('These levels range from basic validation ( ie: text@text.text ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'), 'default' => isset(EE_Registry::instance()->CFG->registration->email_validation_level) ? EE_Registry::instance()->CFG->registration->email_validation_level : 'wp_default', 'required' => false)))));
 }
 /**
  * _fine_print
  *
  * @access protected
  * @return \EE_Form_Section_HTML
  */
 protected function _fine_print()
 {
     return new EE_Form_Section_HTML(EEH_HTML::tr(EEH_HTML::th() . EEH_HTML::td(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text'))));
 }
 /**
  *    _payment_method_billing_info
  *
  * @access 	private
  * @param 	EE_Payment_Method $payment_method
  * @return 	\EE_Form_Section_Proper
  */
 private function _payment_method_billing_info(EE_Payment_Method $payment_method)
 {
     $currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE;
     // generate the billing form for payment method
     $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML();
     $this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form;
     // it's all in the details
     $info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr');
     // add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not
     if ($payment_method->description()) {
         $payment_method_info = $payment_method->description();
     } elseif ($billing_form instanceof EE_Billing_Info_Form) {
         $payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
     } else {
         $payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
     }
     $info_html .= EEH_HTML::p(apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info), '', 'spco-payment-method-desc ee-attention');
     return new EE_Form_Section_Proper(array('html_id' => 'spco-payment-method-info-' . $payment_method->slug(), 'html_class' => 'spco-payment-method-info-dv', 'html_style' => $currently_selected ? '' : 'display:none;', 'layout_strategy' => new EE_Div_Per_Section_Layout(), 'subsections' => array('info' => new EE_Form_Section_HTML($info_html), 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML())));
 }
 /**
  * 	_separator_row
  *
  * @param array        $options
  * @return mixed
  */
 private function _separator_row($options = array())
 {
     // colspan
     $colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"';
     // start of row
     $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan));
     //		// separator td
     //		$html .= EEH_HTML::td( '<hr>', '',  '',  '',  $colspan );
     //		// end of row
     //		$html .= EEH_HTML::trx();
     return $html;
 }
 /**
  * 	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();
 }
 public static function _ticket_selector_settings_form()
 {
     EE_Registry::instance()->load_helper('HTML');
     EE_Registry::instance()->load_helper('Template');
     return new EE_Form_Section_Proper(array('name' => 'ticket_selector_settings_form', 'html_id' => 'ticket_selector_settings_form', 'layout_strategy' => new EE_Div_Per_Section_Layout(), 'subsections' => apply_filters('FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections', array('appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::br(2) . EEH_HTML::h2(__('Ticket Selector Template Settings', 'event_espresso'))), 'appearance_settings' => EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings()))));
 }
 /**
  * 	_sub_item_row
  *
  * @param EE_Line_Item $line_item
  * @param array        $options
  * @return mixed
  */
 private function _sub_item_row(EE_Line_Item $line_item, $options = array())
 {
     // start of row
     $html = EEH_HTML::tr('', 'item sub-item-row');
     // name && desc
     $name_and_desc = $line_item->name();
     $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '';
     // name td
     $html .= EEH_HTML::td($name_and_desc, '', 'item_l sub-item');
     // discount/surcharge td
     if ($line_item->is_percent()) {
         $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c');
     } else {
         $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
     }
     // total td
     $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
     // end of row
     $html .= EEH_HTML::trx();
     return $html;
 }