/** * * @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 .= '> '; $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 */ 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 .= '> '; $html .= $display_text; $html .= EEH_HTML::nl(-1, 'radio') . '</label>'; } $html .= EEH_HTML::div('', '', 'clear-float'); $html .= EEH_HTML::divx(); 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'); }
/** * 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::div($input->get_html_for_input(), $input->html_id() . '-submit-dv', $input->html_class() . '-submit-dv'); } else { if ($input instanceof EE_Select_Input) { $html .= EEH_HTML::div(EEH_HTML::nl(1) . $input->get_html_for_label() . EEH_HTML::nl() . $input->get_html_for_errors() . EEH_HTML::nl() . $input->get_html_for_input() . EEH_HTML::nl() . $input->get_html_for_help(), $input->html_id() . '-input-dv', $input->html_class() . '-input-dv'); } else { if ($input instanceof EE_Form_Input_With_Options_Base) { $html .= EEH_HTML::div(EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) . EEH_HTML::nl() . $input->get_html_for_errors() . EEH_HTML::nl() . $input->get_html_for_input() . EEH_HTML::nl() . $input->get_html_for_help(), $input->html_id() . '-input-dv', $input->html_class() . '-input-dv'); } else { $html .= EEH_HTML::div(EEH_HTML::nl(1) . $input->get_html_for_label() . EEH_HTML::nl() . $input->get_html_for_errors() . EEH_HTML::nl() . $input->get_html_for_input() . EEH_HTML::nl() . $input->get_html_for_help(), $input->html_id() . '-input-dv', $input->html_class() . '-input-dv'); } } } } return $html; }
/** * 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; }
/** * 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(); }
/** * _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())); }
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; }
/** * display_bot_trap_success * shows a "success" screen to bots so that they (ie: the ppl managing them) think the form was submitted successfully * * @access public * @return void */ public static function display_bot_trap_success() { add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false'); $bot_notice = __('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso'); $bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice; EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention')); }
/** * _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; }