tabs = array( 'fields' => __('Checkout Fields', 'woo-checkout-field-editor-pro'), 'advanced_settings' => __('Advanced Settings', 'woo-checkout-field-editor-pro'), 'pro' => __('Premium Features', 'woo-checkout-field-editor-pro'), 'themehigh_plugins' => __('Other Free Plugins', 'woo-checkout-field-editor-pro'), ); } public function get_tabs(){ return $this->tabs; } public function get_current_tab(){ return $this->page_id; } public function get_current_section(){ return isset( $_GET['section'] ) ? sanitize_key( $_GET['section'] ) : $this->section_id; } public function render_tabs(){ $current_tab = $this->get_current_tab(); $tabs = $this->get_tabs(); if(empty($tabs)){ return; } echo ''; } // public function render_sections() { // $current_section = $this->get_current_section(); // $sections = $this->get_sections(); // if(empty($sections)){ // return; // } // $array_keys = array_keys( $sections ); // echo ''; // } public function get_admin_url($tab = false, $section = false){ $url = 'admin.php?page=checkout_form_designer'; if($tab && !empty($tab)){ $url .= '&tab='. $tab; } if($section && !empty($section)){ $url .= '§ion='. $section; } return admin_url($url); } public function print_notices($msg, $type='updated', $return=false){ $notice = '

'. $msg .'

'; if(!$return){ echo $notice; } return $notice; } /******************************************* *-------- HTML FORM FRAGMENTS - START ----- *******************************************/ public function render_form_element_tooltip($tooltip=''){ $tooltip_html = ''; if($tooltip){ // $icon = THWCFD_ASSETS_URL_ADMIN.'/css/help.png'; // $tooltip_html = ''; } ?>   render_form_element_tooltip(false); ?>   '', 'input_cell_props' => '', 'label_cell_colspan' => '', 'input_cell_colspan' => '', ), $atts ); $ftype = isset($field['type']) ? $field['type'] : 'text'; $flabel = isset($field['label']) && !empty($field['label']) ? __($field['label'], 'woo-checkout-field-editor-pro') : ''; $sub_label = isset($field['sub_label']) && !empty($field['sub_label']) ? __($field['sub_label'], 'woo-checkout-field-editor-pro') : ''; $tooltip = isset($field['hint_text']) && !empty($field['hint_text']) ? __($field['hint_text'], 'woo-checkout-field-editor-pro') : ''; $field_html = ''; if($ftype == 'text'){ $field_html = $this->render_form_field_element_inputtext($field, $atts); }else if($ftype == 'textarea'){ $field_html = $this->render_form_field_element_textarea($field, $atts); }else if($ftype == 'checkbox'){ $field_html = $this->render_form_field_element_checkbox($field, $atts, $render_cell); $flabel = ' '; } if($render_cell){ $required_html = isset($field['required']) && $field['required'] ? '*' : ''; $label_cell_props = !empty($args['label_cell_props']) ? $args['label_cell_props'] : ''; $input_cell_props = !empty($args['input_cell_props']) ? $args['input_cell_props'] : ''; ?> >
render_form_element_tooltip($tooltip); ?> > '', 'input_name_prefix' => 'i_', 'input_name_suffix' => '', ), $atts ); $ftype = isset($field['type']) ? $field['type'] : 'text'; if($ftype == 'multiselect'){ $args['input_name_suffix'] = $args['input_name_suffix'].'[]'; } $fname = $args['input_name_prefix'].$field['name'].$args['input_name_suffix']; $fvalue = isset($field['value']) ? esc_html($field['value']) : ''; $input_width = $args['input_width'] ? 'width:'.$args['input_width'].';' : ''; $field_props = 'name="'. $fname .'" value="'. $fvalue .'" style="'. $input_width .'"'; $field_props .= ( isset($field['placeholder']) && !empty($field['placeholder']) ) ? ' placeholder="'.$field['placeholder'].'"' : ''; $field_props .= ( isset($field['onchange']) && !empty($field['onchange']) ) ? ' onchange="'.$field['onchange'].'"' : ''; return $field_props; } private function render_form_field_element_inputtext($field, $atts = array()){ $field_html = ''; if($field && is_array($field)){ $field_props = $this->prepare_form_field_props($field, $atts); $field_html = ''; } return $field_html; } private function render_form_field_element_textarea($field, $atts = array()){ $field_html = ''; if($field && is_array($field)){ $args = shortcode_atts( array( 'rows' => '5', 'cols' => '100', ), $atts ); $fvalue = isset($field['value']) ? $field['value'] : ''; $field_props = $this->prepare_form_field_props($field, $atts); $field_html = ''; } return $field_html; } private function render_form_field_element_checkbox($field, $atts = array(), $render_cell = true){ $field_html = ''; if($field && is_array($field)){ $args = shortcode_atts( array( 'label_props' => '', 'cell_props' => 3, 'render_input_cell' => false, ), $atts ); $fid = 'a_f'. $field['name']; $flabel = isset($field['label']) && !empty($field['label']) ? __($field['label'], 'woo-checkout-field-editor-pro') : ''; $field_props = $this->prepare_form_field_props($field, $atts); $field_props .= isset($field['checked']) && $field['checked'] === 1 ? ' checked' : ''; $field_html = ''; $field_html .= ''; } if(!$render_cell && $args['render_input_cell']){ return ''. $field_html .''; }else{ return $field_html; } } /******************************************* *-------- HTML FORM FRAGMENTS - END ----- *******************************************/ } endif;