/**
  * Media Uploader Using the WordPress Media Library.
  *
  * Parameters:
  *
  * string $_id - A token to identify this field (the name).
  * string $_value - The value of the field, if present.
  * string $_desc - An optional description of the field.
  *
  */
 static function optionsframework_uploader($_id, $_value, $_desc = '', $_name = '')
 {
     // Gets the unique option id
     $options_framework = new Options_Framework();
     $option_name = $options_framework->get_option_name();
     $output = '';
     $id = '';
     $class = '';
     $int = '';
     $value = '';
     $name = '';
     $id = strip_tags(strtolower($_id));
     // If a value is passed and we don't have a stored value, use the value that's passed through.
     if ($_value != '' && $value == '') {
         $value = $_value;
     }
     if ($_name != '') {
         $name = $_name;
     } else {
         $name = $option_name . '[' . $id . ']';
     }
     if ($value) {
         $class = ' has-file';
     }
     $output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="' . $name . '" value="' . $value . '" placeholder="' . __('No file chosen', 'accesspress-store') . '" />' . "\n";
     if (function_exists('wp_enqueue_media')) {
         if ($value == '') {
             $output .= '<input id="upload-' . $id . '" class="upload-button-wdgt button" type="button" value="' . __('Upload', 'accesspress-store') . '" />' . "\n";
         } else {
             $output .= '<input id="remove-' . $id . '" class="remove-file button" type="button" value="' . __('Remove', 'accesspress-store') . '" />' . "\n";
         }
     } else {
         $output .= '<p><i>' . __('Upgrade your version of WordPress for full media support.', 'accesspress-store') . '</i></p>';
     }
     if ($_desc != '') {
         $output .= '<span class="of-metabox-desc">' . $_desc . '</span>' . "\n";
     }
     $output .= '<div class="screenshot" id="' . $id . '-image">' . "\n";
     if ($value != '') {
         $remove = '<a class="remove-image">Remove</a>';
         $image = preg_match('/(^.*\\.jpg|jpeg|png|gif|ico*)/i', $value);
         if ($image) {
             $output .= '<img src="' . $value . '" alt="" />' . $remove;
         } else {
             $parts = explode("/", $value);
             for ($i = 0; $i < sizeof($parts); ++$i) {
                 $title = $parts[$i];
             }
             // No output preview if it's not an image.
             $output .= '';
             // Standard generic output if it's not an image.
             $title = __('View File', 'accesspress-store');
             $output .= '<div class="no-image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">' . $title . '</a></span></div>';
         }
     }
     $output .= '</div>' . "\n";
     return $output;
 }
 /**
  * Registers the settings
  *
  * @since 1.7.0
  */
 function settings_init()
 {
     // Get the option name
     $name = Options_Framework::get_option_name();
     // Registers the settings fields and callback
     register_setting('optionsframework', $name, array($this, 'validate_options'));
     // Displays notice after options save
     add_action('optionsframework_after_validate', array($this, 'save_options_notice'));
 }
 /**
  * Generates the options fields that are used in the form.
  */
 static function optionsframework_fields()
 {
     global $allowedtags;
     $allowedtags['a'] = array('href' => true, 'title' => true, 'target' => true);
     $allowedtags['br'] = true;
     $options_framework = new Options_Framework();
     $option_name = $options_framework->get_option_name();
     $settings = get_option($option_name);
     $options =& Options_Framework::_optionsframework_options();
     $counter = 0;
     $menu = '';
     foreach ($options as $value) {
         $val = '';
         $select_value = '';
         $output = '';
         // Wrap all options
         if ($value['type'] != "heading" && $value['type'] != "info" && $value['type'] != "title" && $value['type'] != 'groupstart' && $value['type'] != 'groupend') {
             // Keep all ids lowercase with no spaces
             $value['id'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['id']));
             $id = 'section-' . $value['id'];
             $class = 'section';
             if (isset($value['type'])) {
                 $class .= ' section-' . $value['type'];
             }
             if (isset($value['class'])) {
                 $class .= ' ' . $value['class'];
             }
             $output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '">' . "\n";
             if (isset($value['name'])) {
                 $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
             }
             if ($value['type'] != 'editor') {
                 $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
             } else {
                 $output .= '<div class="option">' . "\n" . '<div>' . "\n";
             }
         }
         // Set default value to $val
         if (isset($value['std'])) {
             $val = $value['std'];
         }
         // If the option is already saved, override $val
         if ($value['type'] != 'heading' && $value['type'] != 'info' && $value['type'] != "title" && $value['type'] != 'groupstart' && $value['type'] != 'groupend') {
             if (isset($settings[$value['id']])) {
                 $val = $settings[$value['id']];
                 // Striping slashes of non-array options
                 if (!is_array($val)) {
                     $val = stripslashes($val);
                 }
             }
         }
         // If there is a description save it for labels
         $explain_value = '';
         if (isset($value['desc'])) {
             $explain_value = $value['desc'];
         }
         // Set the placeholder if one exists
         $placeholder = '';
         if (isset($value['placeholder'])) {
             $placeholder = ' placeholder="' . esc_attr($value['placeholder']) . '"';
         }
         if (has_filter('optionsframework_' . $value['type'])) {
             $output .= apply_filters('optionsframework_' . $value['type'], $option_name, $value, $val);
         }
         switch ($value['type']) {
             // Basic text input
             case 'text':
                 $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '"' . $placeholder . ' />';
                 break;
             case 'num':
                 $output .= '<div class="addon-input">';
                 $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '"' . $placeholder . ' />';
                 $output .= '</div>';
                 break;
                 // Password input
             // Password input
             case 'password':
                 $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="password" value="' . esc_attr($val) . '" />';
                 break;
                 // Textarea
             // Textarea
             case 'textarea':
                 $rows = '8';
                 if (isset($value['settings']['rows'])) {
                     $custom_rows = $value['settings']['rows'];
                     if (is_numeric($custom_rows)) {
                         $rows = $custom_rows;
                     }
                 }
                 $val = stripslashes($val);
                 $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" rows="' . $rows . '"' . $placeholder . '>' . esc_textarea($val) . '</textarea>';
                 break;
                 // Select Box
             // Select Box
             case 'select':
                 $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                 foreach ($value['options'] as $key => $option) {
                     $output .= '<option' . selected($val, $key, false) . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
                 }
                 $output .= '</select>';
                 break;
                 // Radio Box
             // Radio Box
             case "radio":
                 $name = $option_name . '[' . $value['id'] . ']';
                 foreach ($value['options'] as $key => $option) {
                     $id = $option_name . '-' . $value['id'] . '-' . $key;
                     $output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr($name) . '" id="' . esc_attr($id) . '" value="' . esc_attr($key) . '" ' . checked($val, $key, false) . ' /><label for="' . esc_attr($id) . '">' . esc_html($option) . '</label>';
                 }
                 break;
                 // Image Selectors
             // Image Selectors
             case "images":
                 $name = $option_name . '[' . $value['id'] . ']';
                 foreach ($value['options'] as $key => $option) {
                     $selected = '';
                     if ($val != '' && $val == $key) {
                         $selected = ' of-radio-img-selected';
                     }
                     $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . checked($val, $key, false) . ' />';
                     $output .= '<div class="of-radio-img-label">' . esc_html($key) . '</div>';
                     $output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;" />';
                 }
                 break;
                 // Checkbox
             // Checkbox
             case "checkbox":
                 $output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
                 $output .= '<label class="explain" for="' . esc_attr($value['id']) . '">' . wp_kses($explain_value, $allowedtags) . '</label>';
                 break;
                 // Switch
             // Switch
             case "switch":
                 $output .= '<div class="switch_options">';
                 $output .= '<span class="switch_enable">' . esc_attr($value['on']) . '</span>';
                 $output .= '<span class="switch_disable">' . esc_attr($value['off']) . '</span>';
                 $output .= '<input id="' . esc_attr($value['id']) . '" type="hidden" class="switch_val" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" value="' . esc_attr($val) . '"/>';
                 $output .= '</div>';
                 break;
                 // SliderUI
             // SliderUI
             case "sliderui":
                 $s_min = $s_max = $s_step = $s_edit = '';
                 $s_edit = ' readonly="readonly"';
                 if (!isset($value['min'])) {
                     $s_min = '0';
                 } else {
                     $s_min = $value['min'];
                 }
                 if (!isset($value['max'])) {
                     $s_max = $s_min + 1;
                 } else {
                     $s_max = $value['max'];
                 }
                 if (!isset($value['step'])) {
                     $s_step = '1';
                 } else {
                     $s_step = $value['step'];
                 }
                 //values
                 $s_data = 'data-id="' . $value['id'] . '" data-val="' . esc_attr($val) . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                 //html output
                 $output .= '<input type="text" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" value="' . esc_attr($val) . '" ' . $s_edit . ' />';
                 $output .= '<div id="' . $value['id'] . '-slider" class="ap_sliderui" ' . $s_data . '></div>';
                 break;
                 // Multicheck
             // Multicheck
             case "multicheck":
                 foreach ($value['options'] as $key => $option) {
                     $checked = '';
                     $label = $option;
                     $option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
                     $id = $option_name . '-' . $value['id'] . '-' . $option;
                     $name = $option_name . '[' . $value['id'] . '][' . $option . ']';
                     if (isset($val[$option])) {
                         $checked = checked($val[$option], 1, false);
                     }
                     $output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . ' /><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
                 }
                 break;
                 // Color picker
             // Color picker
             case "color":
                 $default_color = '';
                 if (isset($value['std'])) {
                     if ($val != $value['std']) {
                         $default_color = ' data-default-color="' . $value['std'] . '" ';
                     }
                 }
                 $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color"  type="text" value="' . esc_attr($val) . '"' . $default_color . ' />';
                 break;
                 // Uploader
             // Uploader
             case "upload":
                 $output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
                 break;
                 // Install Demo
             // Install Demo
             case 'demo':
                 $output .= '<a href="#">' . __('Install Demo', 'accesspress-mag') . '</a>';
                 break;
                 // Typography
             // Typography
             case 'typography':
                 unset($font_size, $font_style, $font_face, $font_color);
                 $typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
                 $typography_stored = wp_parse_args($val, $typography_defaults);
                 $typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
                 if (isset($value['options'])) {
                     $typography_options = wp_parse_args($value['options'], $typography_options);
                 }
                 // Font Size
                 if ($typography_options['sizes']) {
                     $font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                     $sizes = $typography_options['sizes'];
                     foreach ($sizes as $i) {
                         $size = $i . 'px';
                         $font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                     }
                     $font_size .= '</select>';
                 }
                 // Font Face
                 if ($typography_options['faces']) {
                     $font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                     $faces = $typography_options['faces'];
                     foreach ($faces as $key => $face) {
                         $font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                     }
                     $font_face .= '</select>';
                 }
                 // Font Styles
                 if ($typography_options['styles']) {
                     $font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                     $styles = $typography_options['styles'];
                     foreach ($styles as $key => $style) {
                         $font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
                     }
                     $font_style .= '</select>';
                 }
                 // Font Color
                 if ($typography_options['color']) {
                     $default_color = '';
                     if (isset($value['std']['color'])) {
                         if ($val != $value['std']['color']) {
                             $default_color = ' data-default-color="' . $value['std']['color'] . '" ';
                         }
                     }
                     $font_color = '<input name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" class="of-color of-typography-color  type="text" value="' . esc_attr($typography_stored['color']) . '"' . $default_color . ' />';
                 }
                 // Allow modification/injection of typography fields
                 $typography_fields = compact('font_size', 'font_face', 'font_style', 'font_color');
                 $typography_fields = apply_filters('of_typography_fields', $typography_fields, $typography_stored, $option_name, $value);
                 $output .= implode('', $typography_fields);
                 break;
                 // Background
             // Background
             case 'background':
                 $background = $val;
                 // Background Color
                 $default_color = '';
                 if (isset($value['std']['color'])) {
                     if ($val != $value['std']['color']) {
                         $default_color = ' data-default-color="' . $value['std']['color'] . '" ';
                     }
                 }
                 $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" class="of-color of-background-color"  type="text" value="' . esc_attr($background['color']) . '"' . $default_color . ' />';
                 // Background Image
                 if (!isset($background['image'])) {
                     $background['image'] = '';
                 }
                 $output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $background['image'], null, esc_attr($option_name . '[' . $value['id'] . '][image]'));
                 $class = 'of-background-properties';
                 if ('' == $background['image']) {
                     $class .= ' hide';
                 }
                 $output .= '<div class="' . esc_attr($class) . '">';
                 // Background Repeat
                 $output .= '<select class="of-background of-background-repeat" name="' . esc_attr($option_name . '[' . $value['id'] . '][repeat]') . '" id="' . esc_attr($value['id'] . '_repeat') . '">';
                 $repeats = of_recognized_background_repeat();
                 foreach ($repeats as $key => $repeat) {
                     $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['repeat'], $key, false) . '>' . esc_html($repeat) . '</option>';
                 }
                 $output .= '</select>';
                 // Background Position
                 $output .= '<select class="of-background of-background-position" name="' . esc_attr($option_name . '[' . $value['id'] . '][position]') . '" id="' . esc_attr($value['id'] . '_position') . '">';
                 $positions = of_recognized_background_position();
                 foreach ($positions as $key => $position) {
                     $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['position'], $key, false) . '>' . esc_html($position) . '</option>';
                 }
                 $output .= '</select>';
                 // Background Attachment
                 $output .= '<select class="of-background of-background-attachment" name="' . esc_attr($option_name . '[' . $value['id'] . '][attachment]') . '" id="' . esc_attr($value['id'] . '_attachment') . '">';
                 $attachments = of_recognized_background_attachment();
                 foreach ($attachments as $key => $attachment) {
                     $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['attachment'], $key, false) . '>' . esc_html($attachment) . '</option>';
                 }
                 $output .= '</select>';
                 $output .= '</div>';
                 break;
                 // Editor
             // Editor
             case 'editor':
                 $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
                 echo $output;
                 $textarea_name = esc_attr($option_name . '[' . $value['id'] . ']');
                 $default_editor_settings = array('textarea_name' => $textarea_name, 'media_buttons' => false, 'tinymce' => array('plugins' => 'wordpress'));
                 $editor_settings = array();
                 if (isset($value['settings'])) {
                     $editor_settings = $value['settings'];
                 }
                 $editor_settings = array_merge($default_editor_settings, $editor_settings);
                 wp_editor($val, $value['id'], $editor_settings);
                 $output = '';
                 break;
                 // Info
             // Info
             case "info":
                 $id = '';
                 $class = 'section';
                 if (isset($value['id'])) {
                     $id = 'id="' . esc_attr($value['id']) . '" ';
                 }
                 if (isset($value['type'])) {
                     $class .= ' section-' . $value['type'];
                 }
                 if (isset($value['class'])) {
                     $class .= ' ' . $value['class'];
                 }
                 $output .= '<div ' . $id . 'class="' . esc_attr($class) . '">' . "\n";
                 if (isset($value['name'])) {
                     $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                 }
                 if (isset($value['desc'])) {
                     $output .= '<div class="option"><div class="explain">' . wp_kses($value['desc'], $allowedtags) . '</div></div>' . "\n";
                     //$output .= $value['desc'] . "\n";
                 }
                 $output .= '</div>' . "\n";
                 break;
                 // Heading for Navigation
             // Heading for Navigation
             case "heading":
                 $counter++;
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $class = '';
                 $class = !empty($value['id']) ? $value['id'] : $value['name'];
                 $class = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($class));
                 $output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
                 $output .= '<h3>' . esc_html($value['name']) . '</h3>' . "\n";
                 break;
                 // Custom Static Heading for Navigation
             // Custom Static Heading for Navigation
             case 'static_heading':
                 break;
                 //Custom Group Start
             //Custom Group Start
             case 'groupstart':
                 $id = '';
                 $group = '';
                 $class = 'section';
                 if (isset($value['id'])) {
                     $id = 'id="' . esc_attr($value['id']) . '" ';
                 }
                 if (isset($value['type'])) {
                     $class .= ' section-' . $value['type'];
                 }
                 if (isset($value['class'])) {
                     $class .= ' ' . $value['class'];
                 }
                 if (isset($value['group'])) {
                     $group .= '[' . $value['group'] . ']';
                 }
                 $output .= '<div ' . $id . 'class="' . esc_attr($class) . '">' . "\n";
                 if (isset($value['name'])) {
                     $output .= '<h4 class="group-heading">' . esc_html($value['name']) . '<span class="heading-arrow side"><i class="fa fa-angle-right"></i></span></h4>' . "\n";
                 }
                 $output .= '<div class="group-content">';
                 $output .= '<input class="section-order" type="hidden" name="' . esc_attr($option_name . $group . '[' . $value['id'] . ']') . '">' . "\n";
                 break;
                 //Custom Group End
             //Custom Group End
             case 'groupend':
                 $output .= '</div></div>' . "\n";
                 break;
         }
         if ($value['type'] != "heading" && ($value['type'] != "info" && $value['type'] != "title" && $value['type'] != 'groupstart' && $value['type'] != 'groupend')) {
             $output .= '</div>';
             if ($value['type'] != "checkbox" && $value['type'] != "editor") {
                 $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
             }
             $output .= '</div></div>' . "\n";
         }
         echo $output;
     }
     // Outputs closing div if there tabs
     if (Options_Framework_Interface::optionsframework_tabs() != '') {
         echo '</div>';
     }
 }
 /**
  * Generates the options fields that are used in the form.
  */
 static function optionsframework_fields()
 {
     global $allowedposttags, $allowedtags;
     $options_framework = new Options_Framework();
     $option_name = $options_framework->get_option_name();
     $settings = get_option($option_name);
     $options =& Options_Framework::_optionsframework_options();
     $counter = 0;
     $menu = '';
     foreach ($options as $value) {
         $val = '';
         $select_value = '';
         $output = '';
         // Wrap all options
         if ($value['type'] != "heading" && $value['type'] != "info") {
             // Keep all ids lowercase with no spaces
             $value['id'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['id']));
             $id = 'section-' . $value['id'];
             $class = 'section';
             if (isset($value['type'])) {
                 $class .= ' section-' . $value['type'];
             }
             if (isset($value['class'])) {
                 $class .= ' ' . $value['class'];
             }
             $output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '">' . "\n";
             if (isset($value['name'])) {
                 $output .= '<h4 class="heading">' . wp_kses($value['name'], $allowedposttags) . '</h4>' . "\n";
             }
             if ($value['type'] != 'editor') {
                 $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
             } else {
                 $output .= '<div class="option">' . "\n" . '<div>' . "\n";
             }
         }
         // Set default value to $val
         if (isset($value['std'])) {
             $val = $value['std'];
         }
         // If the option is already saved, override $val
         if ($value['type'] != 'heading' && $value['type'] != 'info') {
             if (isset($settings[$value['id']])) {
                 $val = $settings[$value['id']];
                 // Striping slashes of non-array options
                 if (!is_array($val)) {
                     $val = stripslashes($val);
                 }
             }
         }
         // If there is a description save it for labels
         $explain_value = '';
         if (isset($value['desc'])) {
             $explain_value = $value['desc'];
         }
         // Set the placeholder if one exists
         $placeholder = '';
         if (isset($value['placeholder'])) {
             $placeholder = ' placeholder="' . esc_attr($value['placeholder']) . '"';
         }
         if (has_filter('optionsframework_' . $value['type'])) {
             $output .= apply_filters('optionsframework_' . $value['type'], $option_name, $value, $val);
         }
         switch ($value['type']) {
             // Basic text input
             case 'text':
                 $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '"' . $placeholder . ' />';
                 if ($value['id'] == 'section_num') {
                     $output .= '<input type="submit" class="save-section-num button-primary" value="' . __('Save', 'onetone') . '">';
                 }
                 break;
                 break;
                 // Password input
             // Password input
             case 'password':
                 $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="password" value="' . esc_attr($val) . '" />';
                 break;
                 // Textarea
             // Textarea
             case 'textarea':
                 $rows = '8';
                 if (isset($value['settings']['rows'])) {
                     $custom_rows = $value['settings']['rows'];
                     if (is_numeric($custom_rows)) {
                         $rows = $custom_rows;
                     }
                 }
                 $val = stripslashes($val);
                 $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" rows="' . $rows . '"' . $placeholder . '>' . esc_textarea($val) . '</textarea>';
                 break;
                 // Select Box
             // Select Box
             case 'select':
                 $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                 foreach ($value['options'] as $key => $option) {
                     $output .= '<option' . selected($val, $key, false) . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
                 }
                 $output .= '</select>';
                 break;
                 // Radio Box
             // Radio Box
             case "radio":
                 $name = $option_name . '[' . $value['id'] . ']';
                 foreach ($value['options'] as $key => $option) {
                     $id = $option_name . '-' . $value['id'] . '-' . $key;
                     $output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr($name) . '" id="' . esc_attr($id) . '" value="' . esc_attr($key) . '" ' . checked($val, $key, false) . ' /><label for="' . esc_attr($id) . '">' . esc_html($option) . '</label>';
                 }
                 break;
                 // Image Selectors
             // Image Selectors
             case "images":
                 $name = $option_name . '[' . $value['id'] . ']';
                 foreach ($value['options'] as $key => $option) {
                     $selected = '';
                     if ($val != '' && $val == $key) {
                         $selected = ' of-radio-img-selected';
                     }
                     $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . checked($val, $key, false) . ' />';
                     $output .= '<div class="of-radio-img-label">' . esc_html($key) . '</div>';
                     $output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;" />';
                 }
                 break;
                 // Checkbox
             // Checkbox
             case "checkbox":
                 $output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
                 $output .= '<label class="explain" for="' . esc_attr($value['id']) . '">' . wp_kses($explain_value, $allowedtags) . '</label>';
                 break;
                 // Multicheck
             // Multicheck
             case "multicheck":
                 foreach ($value['options'] as $key => $option) {
                     $checked = '';
                     $label = $option;
                     $option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
                     $id = $option_name . '-' . $value['id'] . '-' . $option;
                     $name = $option_name . '[' . $value['id'] . '][' . $option . ']';
                     if (isset($val[$option])) {
                         $checked = checked($val[$option], 1, false);
                     }
                     $output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . ' /><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
                 }
                 break;
                 // Color picker
             // Color picker
             case "color":
                 $default_color = '';
                 if (isset($value['std'])) {
                     if ($val != $value['std']) {
                         $default_color = ' data-default-color="' . $value['std'] . '" ';
                     }
                 }
                 $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color"  type="text" value="' . esc_attr($val) . '"' . $default_color . ' />';
                 break;
                 // Uploader
             // Uploader
             case "upload":
                 $output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
                 break;
                 // Typography
             // Typography
             case 'typography':
                 unset($font_size, $font_style, $font_face, $font_color);
                 $typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
                 $typography_stored = wp_parse_args($val, $typography_defaults);
                 $typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
                 if (isset($value['options'])) {
                     $typography_options = wp_parse_args($value['options'], $typography_options);
                 }
                 // Font Size
                 if ($typography_options['sizes']) {
                     $font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                     $sizes = $typography_options['sizes'];
                     foreach ($sizes as $i) {
                         $size = $i . 'px';
                         $font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                     }
                     $font_size .= '</select>';
                 }
                 // Font Face
                 if ($typography_options['faces']) {
                     $font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                     $faces = $typography_options['faces'];
                     foreach ($faces as $key => $face) {
                         $font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                     }
                     $font_face .= '</select>';
                 }
                 // Font Styles
                 if ($typography_options['styles']) {
                     $font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                     $styles = $typography_options['styles'];
                     foreach ($styles as $key => $style) {
                         $font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
                     }
                     $font_style .= '</select>';
                 }
                 // Font Color
                 if ($typography_options['color']) {
                     $default_color = '';
                     if (isset($value['std']['color'])) {
                         if ($val != $value['std']['color']) {
                             $default_color = ' data-default-color="' . $value['std']['color'] . '" ';
                         }
                     }
                     $font_color = '<input name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" class="of-color of-typography-color  type="text" value="' . esc_attr($typography_stored['color']) . '"' . $default_color . ' />';
                 }
                 // Allow modification/injection of typography fields
                 $typography_fields = compact('font_size', 'font_face', 'font_style', 'font_color');
                 $typography_fields = apply_filters('of_typography_fields', $typography_fields, $typography_stored, $option_name, $value);
                 $output .= implode('', $typography_fields);
                 break;
                 // Background
             // Background
             case 'background':
                 $background = $val;
                 // Background Color
                 $default_color = '';
                 if (isset($value['std']['color'])) {
                     if ($val != $value['std']['color']) {
                         $default_color = ' data-default-color="' . $value['std']['color'] . '" ';
                     }
                 }
                 $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" class="of-color of-background-color"  type="text" value="' . esc_attr($background['color']) . '"' . $default_color . ' />';
                 // Background Image
                 if (!isset($background['image'])) {
                     $background['image'] = '';
                 }
                 $output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $background['image'], null, esc_attr($option_name . '[' . $value['id'] . '][image]'));
                 $class = 'of-background-properties';
                 if ('' == $background['image']) {
                     $class .= ' hide';
                 }
                 $output .= '<div class="' . esc_attr($class) . '">';
                 // Background Repeat
                 $output .= '<select class="of-background of-background-repeat" name="' . esc_attr($option_name . '[' . $value['id'] . '][repeat]') . '" id="' . esc_attr($value['id'] . '_repeat') . '">';
                 $repeats = of_recognized_background_repeat();
                 foreach ($repeats as $key => $repeat) {
                     $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['repeat'], $key, false) . '>' . esc_html($repeat) . '</option>';
                 }
                 $output .= '</select>';
                 // Background Position
                 $output .= '<select class="of-background of-background-position" name="' . esc_attr($option_name . '[' . $value['id'] . '][position]') . '" id="' . esc_attr($value['id'] . '_position') . '">';
                 $positions = of_recognized_background_position();
                 foreach ($positions as $key => $position) {
                     $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['position'], $key, false) . '>' . esc_html($position) . '</option>';
                 }
                 $output .= '</select>';
                 // Background Attachment
                 $output .= '<select class="of-background of-background-attachment" name="' . esc_attr($option_name . '[' . $value['id'] . '][attachment]') . '" id="' . esc_attr($value['id'] . '_attachment') . '">';
                 $attachments = of_recognized_background_attachment();
                 foreach ($attachments as $key => $attachment) {
                     $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['attachment'], $key, false) . '>' . esc_html($attachment) . '</option>';
                 }
                 $output .= '</select>';
                 $output .= '</div>';
                 break;
                 // Editor
             // Editor
             case 'editor':
                 $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
                 echo $output;
                 $textarea_name = esc_attr($option_name . '[' . $value['id'] . ']');
                 $default_editor_settings = array('textarea_name' => $textarea_name, 'media_buttons' => true, 'tinymce' => array('plugins' => 'wordpress,wplink'));
                 $editor_settings = array();
                 if (isset($value['settings'])) {
                     $editor_settings = $value['settings'];
                 }
                 $editor_settings = array_merge($default_editor_settings, $editor_settings);
                 wp_editor($val, $value['id'], $editor_settings);
                 $output = '';
                 break;
                 // Info
             // Info
             case "info":
                 $id = '';
                 $class = 'section';
                 if (isset($value['id'])) {
                     $id = 'id="' . esc_attr($value['id']) . '" ';
                 }
                 if (isset($value['type'])) {
                     $class .= ' section-' . $value['type'];
                 }
                 if (isset($value['class'])) {
                     $class .= ' ' . $value['class'];
                 }
                 $output .= '<div ' . $id . 'class="' . esc_attr($class) . '">' . "\n";
                 if (isset($value['name'])) {
                     $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                 }
                 if (isset($value['desc'])) {
                     $output .= $value['desc'] . "\n";
                 }
                 $output .= '</div>' . "\n";
                 break;
                 // Heading for Navigation
             // Heading for Navigation
             case "heading":
                 $counter++;
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $class = '';
                 $class = !empty($value['id']) ? $value['id'] : $value['name'];
                 $class = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($class));
                 $output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
                 $output .= '<h3>' . esc_html($value['name']) . '</h3>' . "\n";
                 break;
                 // custom option types
             // custom option types
             case "textblock-titled":
                 /* format setting outer wrapper */
                 $output .= '<div class="format-setting type-textblock titled wide-desc">';
                 /* description */
                 if (isset($value['desc'])) {
                     $output .= '<div class="description">' . htmlspecialchars_decode($value['desc']) . '</div>';
                 }
                 $output .= '</div>';
                 break;
             case "css":
                 $rows = '8';
                 if (isset($value['settings']['rows'])) {
                     $custom_rows = $value['settings']['rows'];
                     if (is_numeric($custom_rows)) {
                         $rows = $custom_rows;
                     }
                 }
                 $val = stripslashes($val);
                 /* format setting outer wrapper */
                 $output .= '<div class="format-setting type-css simple ">';
                 /* format setting inner wrapper */
                 $output .= '<div class="format-setting-inner">';
                 /* build textarea for CSS */
                 $output .= '<textarea class=" of-input" id="' . esc_attr($value['id']) . '" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '">' . esc_textarea($val) . '</textarea>';
                 /* build pre to convert it into ace editor later */
                 $output .= '<pre class="of-css-editor ' . esc_attr($value['class']) . '" data-textarea="' . esc_attr($value['id']) . '" id="textarea_' . esc_attr($value['id']) . '">' . esc_textarea($val) . '</pre>';
                 $output .= '</div>';
                 $output .= '</div>';
                 break;
             case "start_group":
                 $class = '';
                 $class = !empty($value['id']) ? $value['id'] : $value['name'];
                 $output .= '<div class="tab_item_group ' . $class . '">';
                 break;
             case "end_group":
                 $output .= '</div>';
                 break;
         }
         if ($value['type'] != "heading" && $value['type'] != "info") {
             $output .= '</div>';
             if ($value['type'] != "checkbox" && $value['type'] != "editor") {
                 $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
             }
             $output .= '</div></div>' . "\n";
         }
         echo $output;
     }
     // Outputs closing div if there tabs
     if (Options_Framework_Interface::optionsframework_tabs() != '') {
         echo '</div>';
     }
 }
    /**
     * Generates the options fields that are used in the form.
     */
    static function optionsframework_fields()
    {
        global $allowedtags;
        $option_name = Options_Framework::get_option_name();
        $settings = get_option($option_name);
        $options =& Options_Framework::_optionsframework_options();
        $counter = 0;
        $menu = '';
        foreach ($options as $value) {
            $val = '';
            $select_value = '';
            $output = '';
            // Wrap all options
            if ($value['type'] != "heading" && $value['type'] != "info") {
                // Keep all ids lowercase with no spaces
                $value['id'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['id']));
                $id = 'section-' . $value['id'];
                if ($value["type"] == "widget-area") {
                    $class = 'section2';
                } else {
                    $class = 'section';
                }
                if (isset($value['type'])) {
                    $class .= ' section-' . $value['type'];
                }
                if (isset($value['class'])) {
                    $class .= ' ' . $value['class'];
                }
                $output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '">' . "\n";
                if (isset($value['name'])) {
                    $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                }
                if ($value['type'] != 'editor') {
                    $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
                } else {
                    $output .= '<div class="option">' . "\n" . '<div>' . "\n";
                }
            }
            // Set default value to $val
            if (isset($value['std'])) {
                $val = $value['std'];
            }
            // If the option is already saved, override $val
            if ($value['type'] != 'heading' && $value['type'] != 'info') {
                if (isset($settings[$value['id']])) {
                    $val = $settings[$value['id']];
                    // Striping slashes of non-array options
                    if (!is_array($val)) {
                        $val = stripslashes($val);
                    }
                }
            }
            // If there is a description save it for labels
            $explain_value = '';
            if (isset($value['desc'])) {
                $explain_value = $value['desc'];
            }
            // Set the placeholder if one exists
            $placeholder = '';
            if (isset($value['placeholder'])) {
                $placeholder = ' placeholder="' . esc_attr($value['placeholder']) . '"';
            }
            if (has_filter('optionsframework_' . $value['type'])) {
                $output .= apply_filters('optionsframework_' . $value['type'], $option_name, $value, $val);
            }
            switch ($value['type']) {
                // Basic text input
                case 'text':
                    $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '"' . $placeholder . ' />';
                    break;
                    // Password input
                // Password input
                case 'password':
                    $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="password" value="' . esc_attr($val) . '" />';
                    break;
                    // Textarea
                // Textarea
                case 'textarea':
                    $rows = '8';
                    if (isset($value['settings']['rows'])) {
                        $custom_rows = $value['settings']['rows'];
                        if (is_numeric($custom_rows)) {
                            $rows = $custom_rows;
                        }
                    }
                    $val = stripslashes($val);
                    $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" rows="' . $rows . '"' . $placeholder . '>' . esc_textarea($val) . '</textarea>';
                    break;
                    // Select Box
                // Select Box
                case 'select':
                    $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                    foreach ($value['options'] as $key => $option) {
                        $output .= '<option' . selected($val, $key, false) . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
                    }
                    $output .= '</select>';
                    break;
                    // Radio Box
                // Radio Box
                case "radio":
                    $name = $option_name . '[' . $value['id'] . ']';
                    foreach ($value['options'] as $key => $option) {
                        $id = $option_name . '-' . $value['id'] . '-' . $key;
                        $output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr($name) . '" id="' . esc_attr($id) . '" value="' . esc_attr($key) . '" ' . checked($val, $key, false) . ' /><label for="' . esc_attr($id) . '">' . esc_html($option) . '</label>';
                    }
                    break;
                    // Image Selectors
                // Image Selectors
                case "images":
                    $name = $option_name . '[' . $value['id'] . ']';
                    foreach ($value['options'] as $key => $option) {
                        $selected = '';
                        if ($val != '' && $val == $key) {
                            $selected = ' of-radio-img-selected';
                        }
                        $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . checked($val, $key, false) . ' />';
                        $output .= '<div class="of-radio-img-label">' . esc_html($key) . '</div>';
                        $output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;" />';
                    }
                    break;
                    // Checkbox
                // Checkbox
                case "checkbox":
                    $output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
                    $output .= '<label class="explain" for="' . esc_attr($value['id']) . '">' . wp_kses($explain_value, $allowedtags) . '</label>';
                    break;
                    // Multicheck
                // Multicheck
                case "multicheck":
                    foreach ($value['options'] as $key => $option) {
                        $checked = '';
                        $label = $option;
                        $option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
                        $id = $option_name . '-' . $value['id'] . '-' . $option;
                        $name = $option_name . '[' . $value['id'] . '][' . $option . ']';
                        if (isset($val[$option])) {
                            $checked = checked($val[$option], 1, false);
                        }
                        $output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . ' /><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
                    }
                    break;
                    // Color picker
                // Color picker
                case "color":
                    $default_color = '';
                    if (isset($value['std'])) {
                        if ($val != $value['std']) {
                            $default_color = ' data-default-color="' . $value['std'] . '" ';
                        }
                    }
                    $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color"  type="text" value="' . esc_attr($val) . '"' . $default_color . ' />';
                    break;
                    // Uploader
                // Uploader
                case "upload":
                    $output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
                    break;
                    // Typography
                // Typography
                case 'typography':
                    unset($font_size, $font_style, $font_face, $font_color);
                    $typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
                    $typography_stored = wp_parse_args($val, $typography_defaults);
                    $typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
                    if (isset($value['options'])) {
                        $typography_options = wp_parse_args($value['options'], $typography_options);
                    }
                    // Font Size
                    if ($typography_options['sizes']) {
                        $font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                        $sizes = $typography_options['sizes'];
                        foreach ($sizes as $i) {
                            $size = $i . 'px';
                            $font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                        }
                        $font_size .= '</select>';
                    }
                    // Font Face
                    if ($typography_options['faces']) {
                        $font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                        $faces = $typography_options['faces'];
                        foreach ($faces as $key => $face) {
                            $font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                        }
                        $font_face .= '</select>';
                    }
                    // Font Styles
                    if ($typography_options['styles']) {
                        $font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                        $styles = $typography_options['styles'];
                        foreach ($styles as $key => $style) {
                            $font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
                        }
                        $font_style .= '</select>';
                    }
                    // Font Color
                    if ($typography_options['color']) {
                        $default_color = '';
                        if (isset($value['std']['color'])) {
                            if ($val != $value['std']['color']) {
                                $default_color = ' data-default-color="' . $value['std']['color'] . '" ';
                            }
                        }
                        $font_color = '<input name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" class="of-color of-typography-color  type="text" value="' . esc_attr($typography_stored['color']) . '"' . $default_color . ' />';
                    }
                    // Allow modification/injection of typography fields
                    $typography_fields = compact('font_size', 'font_face', 'font_style', 'font_color');
                    $typography_fields = apply_filters('of_typography_fields', $typography_fields, $typography_stored, $option_name, $value);
                    $output .= implode('', $typography_fields);
                    break;
                    // Background
                // Background
                case 'background':
                    $background = $val;
                    // Background Color
                    $default_color = '';
                    if (isset($value['std']['color'])) {
                        if ($val != $value['std']['color']) {
                            $default_color = ' data-default-color="' . $value['std']['color'] . '" ';
                        }
                    }
                    $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" class="of-color of-background-color"  type="text" value="' . esc_attr($background['color']) . '"' . $default_color . ' />';
                    // Background Image
                    if (!isset($background['image'])) {
                        $background['image'] = '';
                    }
                    $output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $background['image'], null, esc_attr($option_name . '[' . $value['id'] . '][image]'));
                    $class = 'of-background-properties';
                    if ('' == $background['image']) {
                        $class .= ' hide';
                    }
                    $output .= '<div class="' . esc_attr($class) . '">';
                    // Background Repeat
                    $output .= '<select class="of-background of-background-repeat" name="' . esc_attr($option_name . '[' . $value['id'] . '][repeat]') . '" id="' . esc_attr($value['id'] . '_repeat') . '">';
                    $repeats = of_recognized_background_repeat();
                    foreach ($repeats as $key => $repeat) {
                        $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['repeat'], $key, false) . '>' . esc_html($repeat) . '</option>';
                    }
                    $output .= '</select>';
                    // Background Position
                    $output .= '<select class="of-background of-background-position" name="' . esc_attr($option_name . '[' . $value['id'] . '][position]') . '" id="' . esc_attr($value['id'] . '_position') . '">';
                    $positions = of_recognized_background_position();
                    foreach ($positions as $key => $position) {
                        $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['position'], $key, false) . '>' . esc_html($position) . '</option>';
                    }
                    $output .= '</select>';
                    // Background Attachment
                    $output .= '<select class="of-background of-background-attachment" name="' . esc_attr($option_name . '[' . $value['id'] . '][attachment]') . '" id="' . esc_attr($value['id'] . '_attachment') . '">';
                    $attachments = of_recognized_background_attachment();
                    foreach ($attachments as $key => $attachment) {
                        $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['attachment'], $key, false) . '>' . esc_html($attachment) . '</option>';
                    }
                    $output .= '</select>';
                    $output .= '</div>';
                    break;
                    // Editor
                // Editor
                case 'editor':
                    $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
                    echo $output;
                    $textarea_name = esc_attr($option_name . '[' . $value['id'] . ']');
                    $default_editor_settings = array('textarea_name' => $textarea_name, 'media_buttons' => false, 'tinymce' => array('plugins' => 'wordpress'));
                    $editor_settings = array();
                    if (isset($value['settings'])) {
                        $editor_settings = $value['settings'];
                    }
                    $editor_settings = array_merge($default_editor_settings, $editor_settings);
                    wp_editor($val, $value['id'], $editor_settings);
                    $output = '';
                    break;
                    // Info
                // Info
                case "info":
                    $id = '';
                    $class = 'section';
                    if (isset($value['id'])) {
                        $id = 'id="' . esc_attr($value['id']) . '" ';
                    }
                    if (isset($value['type'])) {
                        $class .= ' section-' . $value['type'];
                    }
                    if (isset($value['class'])) {
                        $class .= ' ' . $value['class'];
                    }
                    $output .= '<div ' . $id . 'class="' . esc_attr($class) . '">' . "\n";
                    if (isset($value['name'])) {
                        $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                    }
                    if (isset($value['desc'])) {
                        $output .= $value['desc'] . "\n";
                    }
                    $output .= '</div>' . "\n";
                    break;
                    // Heading for Navigation
                // Heading for Navigation
                case "heading":
                    $counter++;
                    if ($counter >= 2) {
                        $output .= '</div>' . "\n";
                    }
                    $class = '';
                    $class = !empty($value['id']) ? $value['id'] : $value['name'];
                    $class = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($class));
                    $output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
                    $output .= '<h3>' . esc_html($value['name']) . '</h3>' . "\n";
                    break;
                    //=custom type
                //=custom type
                case "start_group":
                    $class = '';
                    $class = !empty($value['id']) ? $value['id'] : $value['name'];
                    $output .= '<div class="tab_item_group ' . $class . '">';
                    break;
                case "end_group":
                    $output .= '</div>';
                    break;
                case "title":
                    $output .= '<div class="group_title' . $class . '"></div>';
                    break;
                case "widget-area":
                    $list_item = get_option('_cordillera_home_widget_area');
                    if ($list_item != "" || $val != "") {
                        if ($list_item == "") {
                            $list_item = $val;
                        }
                        $list_array = json_decode($list_item, true);
                        $list_item_str = '';
                        if (isset($list_array['section-widget-area-name']) && is_array($list_array['section-widget-area-name'])) {
                            $num = count($list_array['section-widget-area-name']);
                            for ($i = 0; $i < $num; $i++) {
                                $column_item = array();
                                $areaname = isset($list_array['section-widget-area-name'][$i]) ? $list_array['section-widget-area-name'][$i] : "";
                                $sanitize_areaname = sanitize_title($areaname);
                                $widget_id = isset($list_array['section-widget-id'][$i]) ? $list_array['section-widget-id'][$i] : 'home-page-section-' . $i;
                                $color = isset($list_array['list-item-color'][$i]) ? $list_array['list-item-color'][$i] : "";
                                $image = isset($list_array['list-item-image'][$i]) ? $list_array['list-item-image'][$i] : "";
                                $repeat = isset($list_array['list-item-repeat'][$i]) ? $list_array['list-item-repeat'][$i] : "";
                                $position = isset($list_array['list-item-position'][$i]) ? $list_array['list-item-position'][$i] : "";
                                $attachment = isset($list_array['list-item-attachment'][$i]) ? $list_array['list-item-attachment'][$i] : "";
                                $layout = isset($list_array['widget-area-layout'][$i]) ? $list_array['widget-area-layout'][$i] : "";
                                $padding = isset($list_array['widget-area-padding'][$i]) ? $list_array['widget-area-padding'][$i] : "";
                                $column = isset($list_array['widget-area-column'][$i]) ? $list_array['widget-area-column'][$i] : "";
                                $columns = isset($list_array['widget-area-column-item'][$widget_id]) ? $list_array['widget-area-column-item'][$widget_id] : array("12");
                                $list_item_array = array("areaname" => $areaname, "sanitize_areaname" => $sanitize_areaname, "widget_id" => $widget_id, "color" => $color, "image" => $image, "repeat" => $repeat, "position" => $position, "attachment" => $attachment, "layout" => $layout, "column" => $column, "columns" => $columns, "num" => $i, "padding" => $padding);
                                $list_item_str .= cordillera_widget_area_generator($list_item_array, false);
                            }
                        }
                    }
                    $output .= '<div id="section-widget" class="">
			   <select name="widget_layout" id="widget_layout"><option value="1">' . __("choose column", "cordillera") . '</option>
			    	<option value="1">' . __("1 column", "cordillera") . '</option>
				    <option value="2">' . __("2 columns", "cordillera") . '</option>
					<option value="3">' . __("3 columns", "cordillera") . '</option>
					<option value="4">' . __("4 columns", "cordillera") . '</option>
				</select>
           <input type="text" id="list-item-val" size="20" name="list-item-val" value="" placeholder="' . __("Widget Area Name", "cordillera") . '" />';
                    //
                    $output .= '<p style="display:block;clear: both;height:30px;"><a href="javascript:;" style="float:left;margin-right:20px;" class="button-primary" id="addItem">' . __("Add Item", "cordillera") . '</a> <span id="list-item-notice" style=" color:red;"></span></p></div>';
                    $output .= '<div id="list-widget-areas">' . $list_item_str . '</div>';
                    break;
            }
            if ($value['type'] != "heading" && $value['type'] != "info") {
                $output .= '</div>';
                if ($value['type'] != "checkbox" && $value['type'] != "editor") {
                    $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
                }
                $output .= '</div></div>' . "\n";
            }
            echo $output;
        }
        // Outputs closing div if there tabs
        if (Options_Framework_Interface::optionsframework_tabs() != '') {
            echo '</div>';
        }
    }
    /**
     * Generates the options fields that are used in the form.
     */
    static function optionsframework_fields()
    {
        global $allowedtags;
        $options_framework = new Options_Framework();
        $option_name = $options_framework->get_option_name();
        $settings = get_option($option_name);
        $options =& Options_Framework::_optionsframework_options();
        $counter = 0;
        $menu = '';
        foreach ($options as $value) {
            $val = '';
            $select_value = '';
            $output = '';
            // Wrap all options
            if ($value['type'] != "heading" && $value['type'] != "info") {
                // Keep all ids lowercase with no spaces
                $value['id'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['id']));
                $id = 'section-' . $value['id'];
                $class = 'section';
                if (isset($value['type'])) {
                    $class .= ' section-' . $value['type'];
                }
                if (isset($value['class'])) {
                    $class .= ' ' . $value['class'];
                }
                $output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '">' . "\n";
                if (isset($value['name'])) {
                    $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                }
                if ($value['type'] != 'editor') {
                    $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
                } else {
                    $output .= '<div class="option">' . "\n" . '<div>' . "\n";
                }
            }
            // Set default value to $val
            if (isset($value['std'])) {
                $val = $value['std'];
            }
            // If the option is already saved, override $val
            if ($value['type'] != 'heading' && $value['type'] != 'info') {
                if (isset($settings[$value['id']])) {
                    $val = $settings[$value['id']];
                    // Striping slashes of non-array options
                    if (!is_array($val)) {
                        $val = stripslashes($val);
                    }
                }
            }
            // If there is a description save it for labels
            $explain_value = '';
            if (isset($value['desc'])) {
                $explain_value = $value['desc'];
            }
            // Set the placeholder if one exists
            $placeholder = '';
            if (isset($value['placeholder'])) {
                $placeholder = ' placeholder="' . esc_attr($value['placeholder']) . '"';
            }
            if (has_filter('optionsframework_' . $value['type'])) {
                $output .= apply_filters('optionsframework_' . $value['type'], $option_name, $value, $val);
            }
            switch ($value['type']) {
                // Basic text input
                case 'text':
                    $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '"' . $placeholder . ' />';
                    break;
                    // Basic hidded input
                // Basic hidded input
                case 'hidden':
                    $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="hidden" value="' . esc_attr($val) . '"' . $placeholder . ' />';
                    break;
                    // Basic text input
                // Basic text input
                case 'url':
                    $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_url($val) . '"' . $placeholder . ' />';
                    break;
                    // Password input
                // Password input
                case 'password':
                    $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="password" value="' . esc_attr($val) . '" />';
                    break;
                    // Textarea
                // Textarea
                case 'textarea':
                    $rows = '14';
                    if (isset($value['settings']['rows'])) {
                        $custom_rows = $value['settings']['rows'];
                        if (is_numeric($custom_rows)) {
                            $rows = $custom_rows;
                        }
                    }
                    $val = stripslashes($val);
                    $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" rows="' . $rows . '"' . $placeholder . '>' . esc_textarea($val) . '</textarea>';
                    break;
                    // Select Box
                // Select Box
                case 'select':
                    $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                    foreach ($value['options'] as $key => $option) {
                        $output .= '<option' . selected($val, $key, false) . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
                    }
                    $output .= '</select>';
                    break;
                    // Radio Box
                // Radio Box
                case "radio":
                    $name = $option_name . '[' . $value['id'] . ']';
                    foreach ($value['options'] as $key => $option) {
                        $id = $option_name . '-' . $value['id'] . '-' . $key;
                        $output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr($name) . '" id="' . esc_attr($id) . '" value="' . esc_attr($key) . '" ' . checked($val, $key, false) . ' /><label for="' . esc_attr($id) . '">' . esc_html($option) . '</label>';
                    }
                    break;
                    // Image Selectors
                // Image Selectors
                case "images":
                    $name = $option_name . '[' . $value['id'] . ']';
                    foreach ($value['options'] as $key => $option) {
                        $selected = '';
                        if ($val != '' && $val == $key) {
                            $selected = ' of-radio-img-selected';
                        }
                        $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . checked($val, $key, false) . ' />';
                        $output .= '<div class="of-radio-img-label">' . esc_html($key) . '</div>';
                        $output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;" />';
                    }
                    break;
                    // Checkbox
                // Checkbox
                case "checkbox":
                    $output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
                    $output .= '<label class="explain" for="' . esc_attr($value['id']) . '">' . wp_kses($explain_value, $allowedtags) . '</label>';
                    break;
                    // Multicheck
                // Multicheck
                case "multicheck":
                    foreach ($value['options'] as $key => $option) {
                        $checked = '';
                        $label = $option;
                        $option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
                        $id = $option_name . '-' . $value['id'] . '-' . $option;
                        $name = $option_name . '[' . $value['id'] . '][' . $option . ']';
                        if (isset($val[$option])) {
                            $checked = checked($val[$option], 1, false);
                        }
                        $output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . ' /><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
                    }
                    break;
                    // Color picker
                // Color picker
                case "color":
                    $default_color = '';
                    if (isset($value['std'])) {
                        if ($val != $value['std']) {
                            $default_color = ' data-default-color="' . $value['std'] . '" ';
                        }
                    }
                    $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color"  type="text" value="' . esc_attr($val) . '"' . $default_color . ' />';
                    break;
                    // Uploader
                // Uploader
                case "upload":
                    $output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
                    break;
                    // Typography
                // Typography
                case 'typography':
                    unset($font_size, $font_style, $font_face, $font_color);
                    $typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
                    $typography_stored = wp_parse_args($val, $typography_defaults);
                    $typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
                    if (isset($value['options'])) {
                        $typography_options = wp_parse_args($value['options'], $typography_options);
                    }
                    // Font Size
                    if ($typography_options['sizes']) {
                        $font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                        $sizes = $typography_options['sizes'];
                        foreach ($sizes as $i) {
                            $size = $i . 'px';
                            $font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                        }
                        $font_size .= '</select>';
                    }
                    // Font Face
                    if ($typography_options['faces']) {
                        $font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                        $faces = $typography_options['faces'];
                        foreach ($faces as $key => $face) {
                            $font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                        }
                        $font_face .= '</select>';
                    }
                    // Font Styles
                    if ($typography_options['styles']) {
                        $font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                        $styles = $typography_options['styles'];
                        foreach ($styles as $key => $style) {
                            $font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
                        }
                        $font_style .= '</select>';
                    }
                    // Font Color
                    if ($typography_options['color']) {
                        $default_color = '';
                        if (isset($value['std']['color'])) {
                            if ($val != $value['std']['color']) {
                                $default_color = ' data-default-color="' . $value['std']['color'] . '" ';
                            }
                        }
                        $font_color = '<input name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" class="of-color of-typography-color  type="text" value="' . esc_attr($typography_stored['color']) . '"' . $default_color . ' />';
                    }
                    // Allow modification/injection of typography fields
                    $typography_fields = compact('font_size', 'font_face', 'font_style', 'font_color');
                    $typography_fields = apply_filters('of_typography_fields', $typography_fields, $typography_stored, $option_name, $value);
                    $output .= implode('', $typography_fields);
                    break;
                    // Background
                // Background
                case 'background':
                    $background = $val;
                    // Background Color
                    $default_color = '';
                    if (isset($value['std']['color'])) {
                        if ($val != $value['std']['color']) {
                            $default_color = ' data-default-color="' . $value['std']['color'] . '" ';
                        }
                    }
                    $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" class="of-color of-background-color"  type="text" value="' . esc_attr($background['color']) . '"' . $default_color . ' />';
                    // Background Image
                    if (!isset($background['image'])) {
                        $background['image'] = '';
                    }
                    $output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $background['image'], null, esc_attr($option_name . '[' . $value['id'] . '][image]'));
                    $class = 'of-background-properties';
                    if ('' == $background['image']) {
                        $class .= ' hide';
                    }
                    $output .= '<div class="' . esc_attr($class) . '">';
                    // Background Repeat
                    $output .= '<select class="of-background of-background-repeat" name="' . esc_attr($option_name . '[' . $value['id'] . '][repeat]') . '" id="' . esc_attr($value['id'] . '_repeat') . '">';
                    $repeats = of_recognized_background_repeat();
                    foreach ($repeats as $key => $repeat) {
                        $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['repeat'], $key, false) . '>' . esc_html($repeat) . '</option>';
                    }
                    $output .= '</select>';
                    // Background Position
                    $output .= '<select class="of-background of-background-position" name="' . esc_attr($option_name . '[' . $value['id'] . '][position]') . '" id="' . esc_attr($value['id'] . '_position') . '">';
                    $positions = of_recognized_background_position();
                    foreach ($positions as $key => $position) {
                        $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['position'], $key, false) . '>' . esc_html($position) . '</option>';
                    }
                    $output .= '</select>';
                    // Background Attachment
                    $output .= '<select class="of-background of-background-attachment" name="' . esc_attr($option_name . '[' . $value['id'] . '][attachment]') . '" id="' . esc_attr($value['id'] . '_attachment') . '">';
                    $attachments = of_recognized_background_attachment();
                    foreach ($attachments as $key => $attachment) {
                        $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['attachment'], $key, false) . '>' . esc_html($attachment) . '</option>';
                    }
                    $output .= '</select>';
                    // Background Size
                    $output .= '<select class="of-background of-background-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                    $sizes = of_recognized_background_size();
                    foreach ($sizes as $key => $size) {
                        $output .= '<option value="' . esc_attr($key) . '" ' . selected($background['size'], $key, false) . '>' . esc_html($size) . '</option>';
                    }
                    $output .= '</select>';
                    $output .= '</div>';
                    break;
                    // Editor
                // Editor
                case 'editor':
                    $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
                    echo $output;
                    $textarea_name = esc_attr($option_name . '[' . $value['id'] . ']');
                    $default_editor_settings = array('textarea_name' => $textarea_name, 'media_buttons' => false, 'tinymce' => array('plugins' => 'wordpress'));
                    $editor_settings = array();
                    if (isset($value['settings'])) {
                        $editor_settings = $value['settings'];
                    }
                    $editor_settings = array_merge($default_editor_settings, $editor_settings);
                    wp_editor($val, $value['id'], $editor_settings);
                    $output = '';
                    break;
                    // Info
                // Info
                case "info":
                    $id = '';
                    $class = 'section';
                    if (isset($value['id'])) {
                        $id = 'id="' . esc_attr($value['id']) . '" ';
                    }
                    if (isset($value['type'])) {
                        $class .= ' section-' . $value['type'];
                    }
                    if (isset($value['class'])) {
                        $class .= ' ' . $value['class'];
                    }
                    $output .= '<div ' . $id . 'class="' . esc_attr($class) . '">' . "\n";
                    if (isset($value['name'])) {
                        $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                    }
                    if (isset($value['desc'])) {
                        $output .= $value['desc'] . "\n";
                    }
                    $output .= '</div>' . "\n";
                    break;
                    // Heading for Navigation
                // Heading for Navigation
                case "heading":
                    $counter++;
                    if ($counter >= 2) {
                        $output .= '</div>' . "\n";
                    }
                    $class = '';
                    $class = !empty($value['id']) ? $value['id'] : $value['name'];
                    $class = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($class));
                    $output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
                    $output .= '<h3>' . esc_html($value['name']) . '</h3>' . "\n";
                    break;
                    // Background
                // Background
                case 'parallaxsection':
                    if (!empty($settings['parallax_section'])) {
                        foreach ($settings['parallax_section'] as $i => $ival) {
                            $background = $val;
                            $output .= '<div class="sub-option clearfix" data-id="' . $i . '"><h3 class="title">' . __('Page Title: ', 'accesspress-parallax') . '<span></span><div class="section-toggle"><i class="fa fa-chevron-down"></i>
</div></h3>';
                            $output .= '<div class="sub-option-inner" style="display:none">';
                            $output .= '<div class="inline-label">';
                            $output .= '<label>' . __('Page', 'accesspress-parallax') . '</label>';
                            $output .= '<select class="of-input ' . esc_attr($value['id'] . '_page') . '" name="' . esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][page]') . '">';
                            foreach ($value['options'] as $key => $option) {
                                $output .= '<option' . selected($background[$i]['page'], $key, false) . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
                            }
                            $output .= '</select>';
                            $output .= '</div>';
                            // Font Color
                            $default_color = '';
                            if (isset($value['std']['font_color'])) {
                                if ($val != $value['std']['font_color']) {
                                    $default_color = ' data-default-color="' . $value['std']['font_color'] . '" ';
                                }
                            }
                            $output .= '<div class="color-picker inline-label">';
                            $output .= '<label class="">' . __('Font Color', 'accesspress-parallax') . '</label>';
                            $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][font_color]') . '" class="of-color of-background-color"  type="text" value="' . esc_attr($background[$i]['font_color']) . '"' . $default_color . ' />';
                            $output .= '</div>';
                            // Background Color
                            $default_color = '';
                            if (isset($value['std']['color'])) {
                                if ($val != $value['std']['color']) {
                                    $default_color = ' data-default-color="' . $value['std']['color'] . '" ';
                                }
                            }
                            $output .= '<div class="color-picker inline-label">';
                            $output .= '<label>' . __('Background Color', 'accesspress-parallax') . '</label>';
                            $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][color]') . '" class="of-color of-background-color"  type="text" value="' . esc_attr($background[$i]['color']) . '"' . $default_color . ' />';
                            $output .= '</div>';
                            // Section Layout
                            $output .= '<div class="inline-label">';
                            $output .= '<label>' . __('Layout', 'accesspress-parallax') . '</label>';
                            $output .= '<select class="of-section of-section-layout" name="' . esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][layout]') . '">';
                            $layouts = of_recognized_layout();
                            foreach ($layouts as $key => $layout) {
                                $output .= '<option value="' . esc_attr($key) . '" ' . selected($background[$i]['layout'], $key, false) . '>' . esc_html($layout) . '</option>';
                            }
                            $output .= '</select>';
                            $output .= '</div>';
                            // Section Category
                            $output .= '<div class="inline-label toggle-category">';
                            $output .= '<label>' . __('Category', 'accesspress-parallax') . '</label>';
                            $output .= '<select class="of-input of-section-category" name="' . esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][category]') . '">';
                            foreach ($value['category'] as $key => $category) {
                                $output .= '<option' . selected($background[$i]['category'], $key, false) . ' value="' . esc_attr($key) . '">' . esc_html($category) . '</option>';
                            }
                            $output .= '</select>';
                            $output .= '</div>';
                            // Background Image
                            if (!isset($background[$i]['image'])) {
                                $background[$i]['image'] = '';
                            }
                            $output .= '<div class="inline-label">';
                            $output .= '<label class="">' . __('Background Image', 'accesspress-parallax') . '</label>';
                            $output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $background[$i]['image'], null, esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][image]'));
                            $output .= '</div>';
                            $class = 'of-background-properties';
                            if ('' == $background[$i]['image']) {
                                $class .= ' hide';
                            }
                            $output .= '<div class="inline-label ' . esc_attr($class) . '">';
                            $output .= '<label>' . __('Background Settings', 'accesspress-parallax') . '</label>';
                            // Background Repeat
                            $output .= '<div class="background-settings">';
                            $output .= '<div class="clearfix">';
                            $output .= '<select class="of-background of-background-repeat" name="' . esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][repeat]') . '">';
                            $repeats = of_recognized_background_repeat();
                            foreach ($repeats as $key => $repeat) {
                                $output .= '<option value="' . esc_attr($key) . '" ' . selected($background[$i]['repeat'], $key, false) . '>' . esc_html($repeat) . '</option>';
                            }
                            $output .= '</select>';
                            // Background Position
                            $output .= '<select class="of-background of-background-position" name="' . esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][position]') . '">';
                            $positions = of_recognized_background_position();
                            foreach ($positions as $key => $position) {
                                $output .= '<option value="' . esc_attr($key) . '" ' . selected($background[$i]['position'], $key, false) . '>' . esc_html($position) . '</option>';
                            }
                            $output .= '</select>';
                            // Background Attachment
                            $output .= '<select class="of-background of-background-attachment" name="' . esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][attachment]') . '">';
                            $attachments = of_recognized_background_attachment();
                            foreach ($attachments as $key => $attachment) {
                                $output .= '<option value="' . esc_attr($key) . '" ' . selected($background[$i]['attachment'], $key, false) . '>' . esc_html($attachment) . '</option>';
                            }
                            $output .= '</select>';
                            // Background Size
                            $output .= '<select class="of-background of-background-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][size]') . '">';
                            $sizes = of_recognized_background_size();
                            foreach ($sizes as $key => $size) {
                                $output .= '<option value="' . esc_attr($key) . '" ' . selected($background[$i]['size'], $key, false) . '>' . esc_html($size) . '</option>';
                            }
                            $output .= '</select>';
                            $output .= '</div></div>';
                            // Background Overlay
                            $output .= '<div class="color-picker inline-label">';
                            $output .= '<label>' . __('Overlay', 'accesspress-parallax') . '</label>';
                            $output .= '<select class="of-background of-background-overlay" name="' . esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][overlay]') . '">';
                            $overlays = of_recognized_background_overlay();
                            foreach ($overlays as $key => $overlay) {
                                $output .= '<option value="' . esc_attr($key) . '" ' . selected($background[$i]['overlay'], $key, false) . '>' . esc_html($overlay) . '</option>';
                            }
                            $output .= '</select>';
                            $output .= '</div>';
                            $output .= '</div>';
                            $output .= '<div class="button-primary remove-parallax">' . __('Remove', 'accesspress-parallax') . '</div></div>';
                            $output .= '</div>';
                        }
                    }
                    break;
                    // Button
                // Button
                case "button":
                    $output .= '<a id="' . esc_attr($value['id']) . '" class="button-primary" href="javascript:void(0);">' . __('Add New Section', 'accesspress-parallax') . '</a>' . "\n";
                    break;
            }
            if ($value['type'] != "heading" && $value['type'] != "info") {
                $output .= '</div>';
                if ($value['type'] != "checkbox" && $value['type'] != "editor" && $value['type'] != "parallaxsection") {
                    $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
                }
                $output .= '</div></div>' . "\n";
            }
            echo $output;
        }
        // Outputs closing div if there tabs
        if (Options_Framework_Interface::optionsframework_tabs() != '') {
            echo '</div>';
        }
    }