/**
  * 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;
 }
 /**
  *
  * @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');
 }
 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()))));
 }
 /**
  * @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);
 }
 /**
  * _update_payment_method_button
  *
  * @access protected
  * @param \EE_Payment_Method $payment_method
  * @return \EE_Form_Section_HTML
  */
 protected function _update_payment_method_button(EE_Payment_Method $payment_method)
 {
     $update_button = new EE_Submit_Input(array('html_id' => 'save_' . $payment_method->slug() . '_settings', 'default' => sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()), 'html_label' => EEH_HTML::nbsp()));
     return new EE_Form_Section_HTML(EEH_HTML::no_row(EEH_HTML::br(2)) . EEH_HTML::tr(EEH_HTML::th(__('Update Settings', 'event_espresso')) . EEH_HTML::td($update_button->get_html_for_input())));
 }
 /**
  * Gets the HTML for redirecting the user to an offsite gateway
  * You can pass it special content to put inside the form, or use
  * the default inner content (or possibly generate this all yourself using
  * redirect_url() and redirect_args() or redirect_args_as_inputs()).
  * Creates a POST request by default, but if no redirect args are specified, creates a GET request instead
  * (and any querystring variables in the redirect_url are converted into html inputs
  * so browsers submit them properly)
  * @param string $inside_form_html
  * @return string html
  */
 function redirect_form($inside_form_html = NULL)
 {
     $redirect_url = $this->redirect_url();
     if (!empty($redirect_url)) {
         EE_Registry::instance()->load_helper('HTML');
         // what ? no inner form content?
         if ($inside_form_html === NULL) {
             $inside_form_html = EEH_HTML::p(sprintf(__('If you are not automatically redirected to the payment website within 10 seconds... %1$s %2$s Click Here %3$s', 'event_espresso'), EEH_HTML::br(2), '<input type="submit" value="', '">'), '', '', 'text-align:center;');
         }
         $method = apply_filters('FHEE__EE_Payment__redirect_form__method', $this->redirect_args() ? 'POST' : 'GET', $this);
         //if it's a GET request, we need to remove all the GET params in the querystring
         //and put them into the form instead
         if ($method == 'GET') {
             $querystring = parse_url($redirect_url, PHP_URL_QUERY);
             $get_params = null;
             parse_str($querystring, $get_params);
             $inside_form_html .= $this->_args_as_inputs($get_params);
             $redirect_url = str_replace('?' . $querystring, '', $redirect_url);
         }
         $form = EEH_HTML::nl(1) . '<form method="' . $method . '" name="gateway_form" action="' . $redirect_url . '">';
         $form .= EEH_HTML::nl(1) . $this->redirect_args_as_inputs();
         $form .= $inside_form_html;
         $form .= EEH_HTML::nl(-1) . '</form>' . EEH_HTML::nl(-1);
         return $form;
     } else {
         return NULL;
     }
 }
 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;
 }
 /**
  * Gets the HTML for redirecting the user to an offsite gateway
  * You can pass it special content to put inside the form, or use
  * the default inner content (or possibly generate this all yourself using
  * redirect_url() and redirect_args() or redirect_args_as_inputs()).
  * Creates a POST request by default, but if no redirect args are specified, creates a GET request instead.
  * @param string $inside_form_html
  * @return string html
  */
 function redirect_form($inside_form_html = NULL)
 {
     $redirect_url = $this->redirect_url();
     if (!empty($redirect_url)) {
         EE_Registry::instance()->load_helper('HTML');
         // what ? no inner form content?
         if ($inside_form_html === NULL) {
             $inside_form_html = EEH_HTML::p(sprintf(__('If you are not automatically redirected to the payment website within 10 seconds... %1$s %2$s Click Here %3$s', 'event_espresso'), EEH_HTML::br(2), '<input type="submit" value="', '">'), '', '', 'text-align:center;');
         }
         $method = $this->redirect_args() ? 'POST' : 'GET';
         $form = EEH_HTML::nl(1) . '<form method="' . $method . '" name="gateway_form" action="' . $redirect_url . '">';
         $form .= EEH_HTML::nl(1) . $this->redirect_args_as_inputs();
         $form .= $inside_form_html;
         $form .= EEH_HTML::nl(-1) . '</form>' . EEH_HTML::nl(-1);
         return $form;
     } else {
         return NULL;
     }
 }