/** * generate s HTML for the billing info form during registration * @access protected * @param array $billing_inputs - array of input field details * @param array $section - what part of the billing info form, "address", "credit_card", or "other" * @return string */ protected function _generate_billing_info_form_fields($billing_inputs = array(), $section = FALSE) { do_action('AHEE_log', __FILE__, __FUNCTION__, ''); if (empty($billing_inputs) || !$section) { return; } global $wp_filter, $css_class; // fill out section name $section = '_billing_info_' . $section . '_fields'; // if you don't behave - this is what you're gonna get !!! $output = ''; // cycle thru billing inputs foreach ($billing_inputs as $input_key => $billing_input) { // is the billing input in the requested section ? if (in_array($input_key, $this->{$section})) { // required fields get a * $required = $billing_input['required'] ? EEH_Form_Fields::prep_required(array('class' => 'required', 'label' => '<em>*</em>')) : ''; // answer $answer = EE_Registry::instance()->REQ->is_set($input_key) ? EE_Registry::instance()->REQ->get($input_key) : $billing_input['value']; if ($input_key == '_reg-page-billing-card-exp-date-mnth-' . $this->_gateway_name) { // Credit Card MONTH add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_month_input_wrap'), 10, 2); remove_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2); remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2); $output .= EEH_Form_Fields::select(__('Expiry Date', 'event_espresso'), $answer, EEH_Form_Fields::two_digit_months_dropdown_options(), $input_key, $input_key, $css_class . ' ee-credit-card-month display-inline small-txt', $required, '', '', '', FALSE, TRUE, FALSE); remove_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_month_input_wrap'), 10, 2); add_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2); add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2); $output .= "\n\t\t\t" . ' / '; } elseif ($input_key == '_reg-page-billing-card-exp-date-year-' . $this->_gateway_name) { // Credit Card YEAR // remove label add_filter('FHEE__EEH_Form_Fields__label_html', array('EEH_Form_Fields', 'remove_label_keep_required_msg'), 10, 2); add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_year_input_wrap'), 10, 2); remove_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2); remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2); $output .= EEH_Form_Fields::select(__('Year', 'event_espresso'), $answer, EEH_Form_Fields::next_decade_two_digit_year_dropdown_options(), $input_key, $input_key, $css_class . ' ee-credit-card-year display-inline small-txt', $required, '', '', '', FALSE, TRUE, FALSE); // remove filter that removes label, or else no other inputs will have labels remove_filter('FHEE__EEH_Form_Fields__label_html', array('EEH_Form_Fields', 'remove_label_keep_required_msg'), 10, 2); remove_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_year_input_wrap'), 10, 2); add_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2); add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2); $output .= "\n\t\t\t" . '<span class="small-text lt-grey-text">' . __('(mm/yy)', 'event_espresso') . '</span>'; } else { // create question form input $QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => $billing_input['label'], 'QST_system' => $billing_input['db-col'], 'QST_type' => $billing_input['input'], 'QST_required' => $billing_input['required'])), EE_Answer::new_instance(array('ANS_value' => $answer)), array('input_name' => $input_key, 'input_id' => $input_key, 'input_class' => $css_class, 'input_prefix' => '', 'append_qstn_id' => FALSE)); // add options if (isset($billing_input['options'])) { $options = is_array($billing_input['options']) ? $billing_input['options'] : explode(',', $billing_input['options']); foreach ($options as $option) { $QSO = EE_Question_Option::new_instance(array('QSO_value' => $option, 'QSO_desc' => $option)); $QFI->add_temp_option($QSO); } } $output .= EEH_Form_Fields::generate_form_input($QFI); } } // end if ( in_array( $input_key, $this->$section )) } // end foreach( $billing_inputs as $input_key => $billing_input ) return $output; }