function options_theme_customizer_register($wp_customize)
{
    /**
     * This is optional, but if you want to reuse some of the defaults
     * or values you already have built in the options panel, you
     * can load them into $options for easy reference
     */
    $options = optionsframework_options();
    /* Basic */
    $wp_customize->add_section('options_theme_customizer_basic', array('title' => __('Basic', 'options_theme_customizer'), 'priority' => 100));
    $wp_customize->add_setting('options_theme_customizer[example_text]', array('default' => $options['example_text']['std'], 'type' => 'option'));
    $wp_customize->add_control('options_theme_customizer_example_text', array('label' => $options['example_text']['name'], 'section' => 'options_theme_customizer_basic', 'settings' => 'options_theme_customizer[example_text]', 'type' => $options['example_text']['type']));
    $wp_customize->add_setting('options_theme_customizer[example_select]', array('default' => $options['example_select']['std'], 'type' => 'option'));
    $wp_customize->add_control('options_theme_customizer_example_select', array('label' => $options['example_select']['name'], 'section' => 'options_theme_customizer_basic', 'settings' => 'options_theme_customizer[example_select]', 'type' => $options['example_select']['type'], 'choices' => $options['example_select']['options']));
    $wp_customize->add_setting('options_theme_customizer[example_radio]', array('default' => $options['example_radio']['std'], 'type' => 'option'));
    $wp_customize->add_control('options_theme_customizer_example_radio', array('label' => $options['example_radio']['name'], 'section' => 'options_theme_customizer_basic', 'settings' => 'options_theme_customizer[example_radio]', 'type' => $options['example_radio']['type'], 'choices' => $options['example_radio']['options']));
    $wp_customize->add_setting('options_theme_customizer[example_checkbox]', array('default' => $options['example_checkbox']['std'], 'type' => 'option'));
    $wp_customize->add_control('options_theme_customizer_example_checkbox', array('label' => $options['example_checkbox']['name'], 'section' => 'options_theme_customizer_basic', 'settings' => 'options_theme_customizer[example_checkbox]', 'type' => $options['example_checkbox']['type']));
    /* Extended */
    $wp_customize->add_section('options_theme_customizer_extended', array('title' => __('Extended', 'options_theme_customizer'), 'priority' => 110));
    $wp_customize->add_setting('options_theme_customizer[example_uploader]', array('type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'example_uploader', array('label' => $options['example_uploader']['name'], 'section' => 'options_theme_customizer_extended', 'settings' => 'options_theme_customizer[example_uploader]')));
    $wp_customize->add_setting('options_theme_customizer[example_colorpicker]', array('default' => $options['example_colorpicker']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => $options['example_colorpicker']['name'], 'section' => 'options_theme_customizer_extended', 'settings' => 'options_theme_customizer[example_colorpicker]')));
}
Beispiel #2
0
function mdl_get_option($name, $default = false)
{
    $name = 'mdl_' . $name;
    if (false === $default) {
        $options = optionsframework_options();
        foreach ($options as $option) {
            if (isset($option['id']) && $option['id'] == $name) {
                $default = isset($option['std']) ? $option['std'] : false;
                break;
            }
        }
    }
    return of_get_option($name, $default);
}
/**
 * Generates the tabs that are used in the options menu
 */

function optionsframework_tabs() {
	$counter = 0;
	$options = optionsframework_options();
	$menu = '';

	foreach ( $options as $value ) {
		// Heading for Navigation
		if ( $value['type'] == "heading" ) {
			$counter++;
			$class = '';
			$class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
			$class = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower($class) ) . '-tab';
			$menu .= '<a id="options-group-'.  $counter . '-tab" class="nav-tab ' . $class .'" title="' . esc_attr( $value['name'] ) . '" href="' . esc_attr( '#options-group-'.  $counter ) . '">' . esc_html( $value['name'] ) . '</a>';
		}
	}

	return $menu;
}
Beispiel #4
0
function options_theme_customizer_register($wp_customize)
{
    /**
     * This is optional, but if you want to reuse some of the defaults
     * or values you already have built in the options panel, you
     * can load them into $options for easy reference
     */
    $options = optionsframework_options();
    $optionsframework_settings = get_option('optionsframework');
    $option_name = $optionsframework_settings['id'];
    /* Basic */
    $wp_customize->add_section('options_theme_customizer_theme_fonts', array('title' => __('Theme Fonts', LANGUAGE_ZONE), 'priority' => 100));
    /* Font Family */
    $wp_customize->add_setting($option_name . '[fonts-font_family]', array('default' => $options['fonts-font_family']['std'], 'type' => 'option'));
    $wp_customize->add_control($option_name . '_fonts-font_family', array('label' => $options['fonts-font_family']['desc'], 'section' => 'options_theme_customizer_theme_fonts', 'settings' => $option_name . '[fonts-font_family]', 'type' => 'select', 'choices' => $options['fonts-font_family']['options']));
    /* Web Fonts */
    $wp_customize->add_setting($option_name . '[fonts-list]', array('default' => $options['fonts-list']['std'], 'type' => 'option'));
    $wp_customize->add_control($option_name . '_fonts-list', array('label' => $options['fonts-list']['desc'], 'section' => 'options_theme_customizer_theme_fonts', 'settings' => $option_name . '[fonts-list]', 'type' => 'select', 'choices' => $options['fonts-list']['options']));
}
 /**
  * Wrapper for optionsframework_options()
  *
  * Allows for manipulating or setting options via 'of_options' filter
  * For example:
  *
  * <code>
  * add_filter( 'of_options', function( $options ) {
  *     $options[] = array(
  *         'name' => 'Input Text Mini',
  *         'desc' => 'A mini text input field.',
  *         'id' => 'example_text_mini',
  *         'std' => 'Default',
  *         'class' => 'mini',
  *         'type' => 'text'
  *     );
  *
  *     return $options;
  * });
  * </code>
  *
  * Also allows for setting options via a return statement in the
  * options.php file.  For example (in options.php):
  *
  * <code>
  * return array(...);
  * </code>
  *
  * @return array (by reference)
  */
 static function &_optionsframework_options()
 {
     static $options = null;
     if (!$options) {
         // Load options from options.php file (if it exists)
         $location = apply_filters('options_framework_location', array('admin/options.php'));
         if ($optionsfile = locate_template($location)) {
             $maybe_options = (require_once $optionsfile);
             if (is_array($maybe_options)) {
                 $options = $maybe_options;
             } else {
                 if (function_exists('optionsframework_options')) {
                     $options = optionsframework_options();
                 }
             }
         }
         // Allow setting/manipulating options via filters
         $options = apply_filters('of_options', $options);
     }
     return $options;
 }
Beispiel #6
0
/**
 * Get Default Options For Option Framework
 */
function optionsframework_defaults()
{
    $options = null;
    $location = apply_filters('options_framework_location', array(get_template_directory() . '/inc/theme/options.php'));
    if ($optionsfile = locate_template($location)) {
        $maybe_options = tokopress_require_file($optionsfile);
        if (is_array($maybe_options)) {
            $options = $maybe_options;
        } else {
            if (function_exists('optionsframework_options')) {
                $options = optionsframework_options();
            }
        }
    }
    $options = apply_filters('of_options', $options);
    $defaults = array();
    foreach ($options as $key => $value) {
        if (isset($value['id']) && isset($value['std'])) {
            $defaults[$value['id']] = $value['std'];
        }
    }
    return $defaults;
}
/**
 * Generates the options fields that are used in the form.
 */
function optionsframework_fields()
{
    global $allowedtags;
    $optionsframework_settings = get_option('optionsframework');
    // Gets the unique option id
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    $settings = get_option($option_name);
    $options = optionsframework_options();
    $counter = 0;
    $menu = '';
    $output = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        $select_value = '';
        $checked = '';
        // Wrap all options
        if ($value['type'] != "heading" && $value['type'] != "info") {
            // Keep all ids lowercase with no spaces
            $value['id'] = preg_replace('/\\W/', '', 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";
            $output .= '<h3 class="heading"> ' . esc_html($value['name']) . '</h3>' . "\n";
            $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
        }
        // Set default value to $val
        if (isset($value['std'])) {
            $val = $value['std'];
        }
        // If the option is already saved, ovveride $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);
                }
            }
        }
        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) . '" />';
                break;
                // Textarea
            // Textarea
            case 'textarea':
                $cols = '8';
                $ta_value = '';
                if (isset($value['options'])) {
                    $ta_options = $value['options'];
                    if (isset($ta_options['cols'])) {
                        $cols = $ta_options['cols'];
                    } else {
                        $cols = '8';
                    }
                }
                $val = stripslashes($val);
                $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" cols="' . esc_attr($cols) . '" rows="8">' . esc_textarea($val) . '</textarea>';
                break;
                // Select Box
            // Select Box
            case $value['type'] == 'select':
                $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                foreach ($value['options'] as $key => $option) {
                    $selected = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' selected="selected"';
                        }
                    }
                    $output .= '<option' . $selected . ' 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><br />';
                }
                break;
                // Image Selectors
            // Image Selectors
            case "images":
                $name = $option_name . '[' . $value['id'] . ']';
                foreach ($value['options'] as $key => $option) {
                    $selected = '';
                    $checked = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' of-radio-img-selected';
                            $checked = ' checked="checked"';
                        }
                    }
                    $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . $checked . ' />';
                    $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) . ' />';
                break;
                // Multicheck
            // Multicheck
            case "multicheck":
                foreach ($value['options'] as $key => $option) {
                    $checked = '';
                    $label = $option;
                    $option = preg_replace('/\\W/', '', 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><br />';
                }
                break;
                // Color picker
            // Color picker
            case "color":
                $output .= '<div id="' . esc_attr($value['id'] . '_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $val) . '"></div></div>';
                $output .= '<input class="of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($val) . '" />';
                break;
                // Uploader
            // Uploader
            case "upload":
                $output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
                // New AJAX Uploader using Media Library
                break;
                // Typography
            // Typography
            case 'typography':
                $typography_stored = $val;
                // Font Size
                $output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                for ($i = 9; $i < 71; $i++) {
                    $size = $i . 'px';
                    $output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                }
                $output .= '</select>';
                // Font Face
                $output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                $faces = of_recognized_font_faces();
                foreach ($faces as $key => $face) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                }
                $output .= '</select>';
                // Font Weight
                $output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                foreach ($styles as $key => $style) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
                }
                $output .= '</select>';
                // Font Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
                $output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
                break;
                // Typography Without Font Face
            // Typography Without Font Face
            case 'typography2':
                $typography2_stored = $val;
                // Font Size
                $output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                for ($i = 9; $i < 71; $i++) {
                    $size = $i . 'px';
                    $output .= '<option value="' . esc_attr($size) . '" ' . selected($typography2_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                }
                $output .= '</select>';
                // Font Weight
                $output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                foreach ($styles as $key => $style) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography2_stored['style'], $key, false) . '>' . $style . '</option>';
                }
                $output .= '</select>';
                // Font Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography2_stored['color']) . '"></div></div>';
                $output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography2_stored['color']) . '" />';
                break;
                // Background
            // Background
            case 'background':
                $background = $val;
                // Background Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $background['color']) . '"></div></div>';
                $output .= '<input class="of-color of-background of-background-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($background['color']) . '" />';
                // Background Image - New AJAX Uploader using Media Library
                if (!isset($background['image'])) {
                    $background['image'] = '';
                }
                $output .= optionsframework_medialibrary_uploader($value['id'], $background['image'], null, '', 0, '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;
                // Info
            // Info
            case "info":
                $class = 'section';
                if (isset($value['type'])) {
                    $class .= ' section-' . $value['type'];
                }
                if (isset($value['class'])) {
                    $class .= ' ' . $value['class'];
                }
                $output .= '<div class="' . esc_attr($class) . '">' . "\n";
                if (isset($value['name'])) {
                    $output .= '<h3 class="heading">' . esc_html($value['name']) . '</h3>' . "\n";
                }
                if ($value['desc']) {
                    $output .= '<p>' . wp_kses($value['desc'], $allowedtags) . '</p>' . "\n";
                }
                $output .= '<div class="clear"></div></div>' . "\n";
                break;
                // Heading for Navigation
            // Heading for Navigation
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $jquery_click_hook = preg_replace('/\\W/', '', strtolower($value['name']));
                $jquery_click_hook = "of-option-" . $jquery_click_hook;
                $menu .= '<li><a id="' . esc_attr($jquery_click_hook) . '-tab" title="' . esc_attr($value['name']) . '" href="' . esc_attr('#' . $jquery_click_hook) . '"><img src="' . get_template_directory_uri() . '/admin/images/' . esc_html($value['sicon']) . '" width="16" height="16" border="0" align="left"> &nbsp;' . esc_html($value['name']) . '</a></li>';
                $output .= '<div class="group" id="' . esc_attr($jquery_click_hook) . '"><h2>' . esc_html($value['name']) . '</h2>' . "\n";
                break;
        }
        if ($value['type'] != "heading" && $value['type'] != "info") {
            if ($value['type'] != "checkbox") {
                $output .= '<br/>';
            }
            $explain_value = '';
            if (isset($value['desc'])) {
                $explain_value = $value['desc'];
            }
            $output .= '</div><div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
            $output .= '<div class="clear"></div></div></div>' . "\n";
        }
    }
    $output .= '</div>';
    return array($output, $menu);
}
Beispiel #8
0
function onetone_of_get_options($default = false)
{
    //$optionsframework_settings = get_option(ONETONE_OPTIONS_PREFIXED.'optionsframework');
    // Gets the unique option id
    //$option_name = $optionsframework_settings['id'];
    $option_name = optionsframework_option_name();
    if (get_option($option_name)) {
        $options = get_option($option_name);
    } else {
        $location = apply_filters('options_framework_location', array('includes/admin-options.php'));
        if ($optionsfile = locate_template($location)) {
            $maybe_options = (require_once $optionsfile);
            if (is_array($maybe_options)) {
                $options = $maybe_options;
            } else {
                if (function_exists('optionsframework_options')) {
                    $options = optionsframework_options();
                }
            }
        }
        $options = apply_filters('of_options', $options);
        $config = $options;
        foreach ((array) $config as $option) {
            if (!isset($option['id'])) {
                continue;
            }
            if (!isset($option['std'])) {
                continue;
            }
            if (!isset($option['type'])) {
                continue;
            }
            $output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
        }
        $options = $output;
    }
    if (isset($options)) {
        return $options;
    } else {
        return $default;
    }
}
function optionsframework_validate($input)
{
    $optionsframework_settings = get_option('optionsframework');
    // Gets the unique option id
    $option_name = $optionsframework_settings['id'];
    // If the reset button was clicked
    if (!empty($_POST['reset'])) {
        // If options are deleted sucessfully update the error message
        if (delete_option($option_name)) {
            add_settings_error('options-framework', 'restore_defaults', __('Default options restored.'), 'updated fade');
        }
    } else {
        if (!empty($_POST['update'])) {
            $clean = array();
            // Get the options array we have defined in options.php
            $options = optionsframework_options();
            foreach ($options as $option) {
                // Verify that the option has an id
                if (isset($option['id'])) {
                    // Keep all ids lowercase with no spaces
                    $id = preg_replace('/\\W/', '', strtolower($option['id']));
                    // Set checkbox to false if it wasn't sent in the $_POST
                    if ('checkbox' == $option['type'] && !isset($input[$id])) {
                        $input[$id] = "0";
                    }
                    // Set each item in the multicheck to false if it wasn't sent in the $_POST
                    if ('multicheck' == $option['type'] && !isset($input[$id])) {
                        foreach ($option['options'] as $key => $value) {
                            $input[$id][$key] = "0";
                        }
                    }
                    // For a value to be submitted to database it must pass through a sanitization filter
                    if (isset($input[$id]) && has_filter('of_sanitize_' . $option['type'])) {
                        $clean[$id] = apply_filters('of_sanitize_' . $option['type'], $input[$id], $option);
                    }
                }
                // end isset $input
            }
            // end isset $id
        }
        // end foreach
        if (isset($clean)) {
            add_settings_error('options-framework', 'save_options', __('Options saved.'), 'updated fade');
            return $clean;
            // Return validated input
        }
    }
    // end $_POST['update']
}
/**
 * Generates the options fields that are used in the form.
 */
function optionsframework_fields()
{
    global $allowedtags;
    $optionsframework_settings = get_option('optionsframework');
    // Gets the unique option id
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'options_framework_theme';
    }
    $settings = get_option($option_name);
    $options = optionsframework_options();
    $counter = 0;
    $menu = '';
    foreach ($options as $value) {
        $val = '';
        $select_value = '';
        $checked = '';
        $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, ovveride $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'];
        }
        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) . '" />';
                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 . '">' . 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) {
                    $selected = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' selected="selected"';
                        }
                    }
                    $output .= '<option' . $selected . ' 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 = '';
                    $checked = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' of-radio-img-selected';
                            $checked = ' checked="checked"';
                        }
                    }
                    $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . $checked . ' />';
                    $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 .= 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 .= 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($editor_settings, $default_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 ($value['desc']) {
                    $output .= apply_filters('of_sanitize_info', $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;
        }
        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;
    }
    echo '</div>';
}
function onetone_on_switch_theme()
{
    global $onetone_options;
    $optionsframework_settings = get_option(ONETONE_OPTIONS_PREFIXED . 'optionsframework');
    if (!get_option($optionsframework_settings['id'])) {
        $config = array();
        $output = array();
        $location = apply_filters('options_framework_location', array('admin-options.php'));
        if ($optionsfile = locate_template($location)) {
            $maybe_options = (require_once $optionsfile);
            if (is_array($maybe_options)) {
                $options = $maybe_options;
            } else {
                if (function_exists('optionsframework_options')) {
                    $options = optionsframework_options();
                }
            }
        }
        if (isset($options)) {
            $options = apply_filters('of_options', $options);
            $config = $options;
            foreach ((array) $config as $option) {
                if (!isset($option['id'])) {
                    continue;
                }
                if (!isset($option['std'])) {
                    continue;
                }
                if (!isset($option['type'])) {
                    continue;
                }
                $output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
            }
        }
        add_option($optionsframework_settings['id'], $output);
    }
    $onetone_options = onetone_of_get_options();
}
Beispiel #12
0
/**
 * Format Configuration Array.
 *
 * Get an array of all default values as set in
 * options.php. The 'id','std' and 'type' keys need
 * to be defined in the configuration array. In the
 * event that these keys are not present the option
 * will not be included in this function's output.
 *
 * @return    array     Rey-keyed options configuration array.
 *
 * @access    private
 */
function of_get_default_values()
{
    $output = array();
    $config = optionsframework_options();
    foreach ((array) $config as $option) {
        if (!isset($option['id'])) {
            continue;
        }
        if (!isset($option['std'])) {
            continue;
        }
        if (!isset($option['type'])) {
            continue;
        }
        if (has_filter('of_sanitize_' . $option['type'])) {
            $output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
        }
    }
    return $output;
}
Beispiel #13
0
function optionsframework_fields()
{
    global $allowedtags;
    $optionsframework_settings = get_option('optionsframework');
    // Get the theme name so we can display it up top
    $themename = wp_get_theme(STYLESHEETPATH . '/style.css');
    $themename = $themename['Name'];
    // Gets the unique option id
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    $settings = get_option($option_name);
    $options = optionsframework_options();
    $counter = 0;
    $menu = '';
    $output = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        $select_value = '';
        $checked = '';
        // 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";
            $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
            $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
        }
        // Set default value to $val
        if (isset($value['std'])) {
            $val = $value['std'];
        }
        // If the option is already saved, ovveride $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'];
        }
        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) . '" />';
                break;
                // Textarea
            // Textarea
            case 'textarea':
                $cols = '8';
                $ta_value = '';
                if (isset($value['options'])) {
                    $ta_options = $value['options'];
                    if (isset($ta_options['cols'])) {
                        $cols = $ta_options['cols'];
                    } else {
                        $cols = '8';
                    }
                }
                $val = stripslashes($val);
                if (!isset($value['editor'])) {
                    $value['editor'] = '';
                }
                $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input ' . esc_attr($value['editor']) . '" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" cols="' . esc_attr($cols) . '" rows="8">' . esc_textarea($val) . '</textarea>';
                break;
                // Select Box
            // Select Box
            case $value['type'] == 'select':
                $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                foreach ($value['options'] as $key => $option) {
                    $selected = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' selected="selected"';
                        }
                    }
                    $output .= '<option' . $selected . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
                }
                $output .= '</select>';
                break;
                // Select Box custom taxonomies
            // Select Box custom taxonomies
            case $value['type'] == 'select_tax':
                $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                $args = array('hide_empty' => true, 'hierarchical' => true, 'orderby' => 'term_group');
                $terms = get_terms('multimedia-category', $args);
                $count = count($terms);
                if ($count > 0) {
                    foreach ($terms as $term) {
                        $selected = '';
                        if ($val != '') {
                            if ($val == $term->term_id) {
                                $selected = ' selected="selected"';
                            }
                        }
                        if ($term->parent == 0) {
                            $output .= '<option' . $selected . ' value="' . $term->term_id . '">***** ' . $term->name . ' *****</option>';
                        } else {
                            $output .= '<option' . $selected . ' value="' . $term->term_id . '">' . $term->name . '</option>';
                        }
                    }
                } else {
                    $output .= '<option selected value="0">' . esc_html__('No categories!', 'crystalskull') . '</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 = '';
                    $checked = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' of-radio-img-selected';
                            $checked = ' checked="checked"';
                        }
                    }
                    if (esc_attr($key) == 'b1') {
                        $rep = 'No repeat';
                    } elseif (esc_attr($key) == 'b2') {
                        $rep = 'Repeat vertically';
                    } elseif (esc_attr($key) == 'b3') {
                        $rep = 'Repeat horizontally ';
                    } else {
                        $rep = 'Tile';
                    }
                    $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . $checked . ' />';
                    $output .= '<div class="of-radio-img-label">' . esc_html($key) . '</div>';
                    $output .= '<a data-toggle="tooltip" data-original-title="' . $rep . '"><img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;" /></a>';
                }
                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;
                //jquery checkbox
            //jquery checkbox
            case "jqueryselect":
                ?>
<script type="text/javascript">
		jQuery(document).ready(function($) {
		// Start jQuery goodness
			$('#itoggle input#<?php 
                echo esc_attr($value['id']);
                ?>
').iToggle({
				easing: 'easeOutExpo',
				onClickOn: function(){
					$('#console').show().css({opacity:0}).animate({opacity:1},400);
					statusUpdate('Console on');
				},
				onClickOff: function(){
					statusUpdate('Console off');
					$('#console').animate({opacity:0},400);
				}
			});
			function statusUpdate(text){
				$('#console').prepend('<p>'+text+'</p>');
			}
		// End jQuery goodness
		});
	</script>
	<?php 
                $output .= '<div id="itoggle" class="project"><input type="checkbox" class="checkbox of-input" id="' . esc_attr($value['id']) . '" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . '  /></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":
                $output .= '<div id="' . esc_attr($value['id'] . '_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $val) . '"></div></div>';
                $output .= '<input class="of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($val) . '" />';
                break;
                // Uploader
            // Uploader
            case "upload":
                $output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
                // New AJAX Uploader using Media Library
                break;
                // Typography
            // Typography
            case 'typography':
                $typography_stored = $val;
                /*		// Font Size
                			$output .= '<select class="of-typography of-typography-size" name="' . esc_attr( $option_name . '[' . $value['id'] . '][size]' ) . '" id="' . esc_attr( $value['id'] . '_size' ) . '">';
                			for ($i = 9; $i < 71; $i++) {
                				$size = $i . 'px';
                				$output .= '<option value="' . esc_attr( $size ) . '" ' . selected( $typography_stored['size'], $size, false ) . '>' . esc_html( $size ) . '</option>';
                			}
                			$output .= '</select>';
                */
                // Font Face
                $output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                $faces = of_recognized_font_faces();
                foreach ($faces as $key => $face) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                }
                $output .= '</select>';
                /*			// Font Weight
                			$output .= '<select class="of-typography of-typography-style" name="'.$option_name.'['.$value['id'].'][style]" id="'. $value['id'].'_style">';
                */
                /* Font Style */
                /*			$styles = of_recognized_font_styles();
                			foreach ( $styles as $key => $style ) {
                				$output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $typography_stored['style'], $key, false ) . '>'. $style .'</option>';
                			}
                			$output .= '</select>';
                			// Font Color
                			$output .= '<div id="' . esc_attr( $value['id'] ) . '_color_picker" class="colorSelector"><div style="' . esc_attr( 'background-color:' . $typography_stored['color'] ) . '"></div></div>';
                			$output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr( $option_name . '[' . $value['id'] . '][color]' ) . '" id="' . esc_attr( $value['id'] . '_color' ) . '" type="text" value="' . esc_attr( $typography_stored['color'] ) . '" />';
                */
                break;
                // Background
            // Background
            case 'background':
                $background = $val;
                // Background Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $background['color']) . '"></div></div>';
                $output .= '<input class="of-color of-background of-background-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($background['color']) . '" />';
                // Background Image - New AJAX Uploader using Media Library
                if (!isset($background['image'])) {
                    $background['image'] = '';
                }
                $output .= optionsframework_medialibrary_uploader($value['id'], $background['image'], null, '', 0, '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;
                // Info
            // Info
            case "info":
                $class = 'section';
                if (isset($value['type'])) {
                    $class .= ' section-' . $value['type'];
                }
                if (isset($value['class'])) {
                    $class .= ' ' . $value['class'];
                }
                $output .= '<div class="' . esc_attr($class) . '">' . "\n";
                if (isset($value['name'])) {
                    $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                }
                if (isset($value['desc'])) {
                    $output .= apply_filters('of_sanitize_info', $value['desc']) . "\n";
                }
                $output .= '<div class="clear"></div></div>' . "\n";
                break;
                // Heading for Navigation
            // Heading for Navigation
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $jquery_click_hook = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['name']));
                $jquery_click_hook = "of-option-" . $jquery_click_hook;
                $menu .= '<a id="' . esc_attr($jquery_click_hook) . '-tab" class="nav-tab" title="' . esc_attr($value['name']) . '" href="' . esc_attr('#' . $jquery_click_hook) . '">' . esc_html($value['name']) . '</a>';
                $output .= '<div class="group" id="' . esc_attr($jquery_click_hook) . '">';
                break;
                //added by shark
            //added by shark
            case 'impbutton':
                $importer_url = get_template_directory_uri() . "/demo/import.php";
                global $wpdb;
                $count = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type='post'");
                ?>
            	<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						var whatever = "<?php 
                echo esc_url($importer_url);
                ?>
";
						var demo_stat = "<?php 
                echo esc_attr($count);
                ?>
";
						jQuery("#close_update_nag").click(function(event)
						{
							jQuery('#import_incomp_noti').hide();
						});

						jQuery("#import_btn").click(function(event)
						{ console.log('aaaa');
							if(demo_stat > 4)
							{
								jQuery("input[id='import_btn']").prop('disabled', true);
								 jQuery('#import_incomp_noti').show();
							} else {
							jQuery.ajax(
							{
								beforeSend: function()
								{
									jQuery("input[id='import_btn']").prop('disabled', true);
									jQuery('#target').show();
								},
								complete: function()
								{
									jQuery('#target').hide();
								},

								url: whatever,
								success: function(data)
								{
								jQuery('#import_comp_noti').show();

								},
						      error: function (data, xhr, ajaxOptions, thrownError) {
						        console.log(xhr.status);
						        console.log(data);
						      }

							});
							}
						});
					});
            	</script>

        	<?php 
                import_completed_notice();
                import_incompleted_notice();
                $output .= '<input id="import_btn" class="button button-primary" type="button" value="import" rel="5">';
                $output .= '<div class="loading" id="target" style="display:none;"><div class="loading_text">' . __("Please wait, the content is importing....", "crystalskull") . '</div></div>';
                break;
        }
        if ($value['type'] != "heading" && $value['type'] != "info") {
            if ($value['type'] != "checkbox") {
                $output .= '<br/>';
            }
            $output .= '</div>';
            if ($value['type'] != "checkbox") {
                $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
            }
            $output .= '<div class="clear"></div></div></div>' . "\n";
        }
    }
    $output .= '</div>';
    return array($output, $menu);
}
Beispiel #14
0
function of_get_default($option)
{
    $defaults = optionsframework_options();
    if (isset($defaults[$option]['std'])) {
        return $defaults[$option]['std'];
    }
    return false;
    // default if no std is set
}
Beispiel #15
0
function meris_on_switch_theme()
{
    global $meris_options;
    $optionsframework_settings = get_option('optionsframework');
    if (!get_option($optionsframework_settings['id'])) {
        $config = array();
        $output = array();
        $location = apply_filters('options_framework_location', array('admin-options.php'));
        if ($optionsfile = locate_template($location)) {
            $maybe_options = (require_once $optionsfile);
            if (is_array($maybe_options)) {
                $options = $maybe_options;
            } else {
                if (function_exists('optionsframework_options')) {
                    $options = optionsframework_options();
                }
            }
        }
        if (isset($options)) {
            $options = apply_filters('of_options', $options);
            $config = $options;
            foreach ((array) $config as $option) {
                if (!isset($option['id'])) {
                    continue;
                }
                if (!isset($option['std'])) {
                    continue;
                }
                if (!isset($option['type'])) {
                    continue;
                }
                $output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
            }
        }
        add_option($optionsframework_settings['id'], $output);
    }
    //Free version home page sections
    if (!get_option('_meris_home_widget_area')) {
        $sections_json = '{"section-widget-area-name":["Home Page Secion One","Home Page Secion Two","Home Page Secion Three","Home Page Secion Four"],"list-item-color":["","","",""],"list-item-image":["","","","' . esc_url(MERIS_THEME_BASE_URL . '/images/background-1.jpg') . '"],"list-item-repeat":["","","","no-repeat"],"list-item-position":["","","",""],"list-item-attachment":["","","",""],"widget-area-layout":["boxed","full","boxed","boxed"],"widget-area-padding":["50","50","50","50"],"widget-area-column":["1","1","1","2"],"widget-area-column-item":{"home-page-secion-one":["12"],"home-page-secion-two":["12"],"home-page-secion-three":["12"],"home-page-secion-four":["6","6"]}}';
        add_option('_meris_home_widget_area', $sections_json);
    }
    $meris_options = meris_of_get_options();
}
Beispiel #16
0
 function cherry_register($wp_customize)
 {
     /**
      * This is optional, but if you want to reuse some of the defaults
      * or values you already have built in the options panel, you
      * can load them into $options for easy reference
      */
     $options = optionsframework_options();
     /*-----------------------------------------------------------------------------------*/
     /*	General
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('cherry_header', array('title' => __('General', CURRENT_THEME), 'priority' => 200));
     /* Background Image*/
     $wp_customize->add_setting('cherry[body_background][image]', array('default' => $options['body_background']['std']['image'], 'type' => 'option'));
     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'body_background_image', array('label' => 'Background Image', 'section' => 'cherry_header', 'settings' => 'cherry[body_background][image]')));
     /* Background Color*/
     $wp_customize->add_setting('cherry[body_background][color]', array('default' => $options['body_background']['std']['color'], 'type' => 'option'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'body_background', array('label' => 'Background Color', 'section' => 'cherry_header', 'settings' => 'cherry[body_background][color]')));
     /* Header Color */
     $wp_customize->add_setting('cherry[header_color]', array('default' => $options['header_color']['std'], 'type' => 'option'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_color', array('label' => $options['header_color']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[header_color]')));
     /* Body Font Face */
     $wp_customize->add_setting('cherry[google_mixed_3][face]', array('default' => $options['google_mixed_3']['std']['face'], 'type' => 'option'));
     $wp_customize->add_control('cherry_google_mixed_3', array('label' => $options['google_mixed_3']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[google_mixed_3][face]', 'type' => 'select', 'choices' => $options['google_mixed_3']['options']['faces']));
     /* Buttons and Links Color */
     $wp_customize->add_setting('cherry[links_color]', array('default' => $options['links_color']['std'], 'type' => 'option'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'links_color', array('label' => $options['links_color']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[links_color]')));
     /* H1 Heading font face */
     $wp_customize->add_setting('cherry[h1_heading][face]', array('default' => $options['h1_heading']['std']['face'], 'type' => 'option'));
     $wp_customize->add_control('cherry_h1_heading', array('label' => $options['h1_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h1_heading][face]', 'type' => 'select', 'choices' => $options['h1_heading']['options']['faces']));
     /* H2 Heading font face */
     $wp_customize->add_setting('cherry[h2_heading][face]', array('default' => $options['h2_heading']['std']['face'], 'type' => 'option'));
     $wp_customize->add_control('cherry_h2_heading', array('label' => $options['h2_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h2_heading][face]', 'type' => 'select', 'choices' => $options['h2_heading']['options']['faces']));
     /* H3 Heading font face */
     $wp_customize->add_setting('cherry[h3_heading][face]', array('default' => $options['h3_heading']['std']['face'], 'type' => 'option'));
     $wp_customize->add_control('cherry_h3_heading', array('label' => $options['h3_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h3_heading][face]', 'type' => 'select', 'choices' => $options['h3_heading']['options']['faces']));
     /* H4 Heading font face */
     $wp_customize->add_setting('cherry[h4_heading][face]', array('default' => $options['h4_heading']['std']['face'], 'type' => 'option'));
     $wp_customize->add_control('cherry_h4_heading', array('label' => $options['h4_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h4_heading][face]', 'type' => 'select', 'choices' => $options['h4_heading']['options']['faces']));
     /* H5 Heading font face */
     $wp_customize->add_setting('cherry[h5_heading][face]', array('default' => $options['h5_heading']['std']['face'], 'type' => 'option'));
     $wp_customize->add_control('cherry_h5_heading', array('label' => $options['h5_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h5_heading][face]', 'type' => 'select', 'choices' => $options['h5_heading']['options']['faces']));
     /* H6 Heading font face */
     $wp_customize->add_setting('cherry[h6_heading][face]', array('default' => $options['h6_heading']['std']['face'], 'type' => 'option'));
     $wp_customize->add_control('cherry_h6_heading', array('label' => $options['h6_heading']['name'], 'section' => 'cherry_header', 'settings' => 'cherry[h6_heading][face]', 'type' => 'select', 'choices' => $options['h6_heading']['options']['faces']));
     /*-----------------------------------------------------------------------------------*/
     /*	Logo
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('cherry_logo', array('title' => __('Logo', CURRENT_THEME), 'priority' => 201));
     /* Logo Type */
     $wp_customize->add_setting('cherry[logo_type]', array('default' => $options['logo_type']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_logo_type', array('label' => $options['logo_type']['name'], 'section' => 'cherry_logo', 'settings' => 'cherry[logo_type]', 'type' => $options['logo_type']['type'], 'choices' => $options['logo_type']['options']));
     /* Logo Path */
     $wp_customize->add_setting('cherry[logo_url]', array('type' => 'option'));
     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo_url', array('label' => $options['logo_url']['name'], 'section' => 'cherry_logo', 'settings' => 'cherry[logo_url]')));
     /*-----------------------------------------------------------------------------------*/
     /*  Slider
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('cherry_slider', array('title' => __('Slider', CURRENT_THEME), 'priority' => 202));
     /* Slider Effect */
     $wp_customize->add_setting('cherry[sl_effect]', array('default' => $options['sl_effect']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_sl_effect', array('label' => $options['sl_effect']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_effect]', 'type' => $options['sl_effect']['type'], 'choices' => $options['sl_effect']['options']));
     /* Pause time */
     $wp_customize->add_setting('cherry[sl_pausetime]', array('default' => $options['sl_pausetime']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_sl_pausetime', array('label' => $options['sl_pausetime']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_pausetime]', 'type' => $options['sl_pausetime']['type']));
     /* Animation speed */
     $wp_customize->add_setting('cherry[sl_animation_speed]', array('default' => $options['sl_animation_speed']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_sl_animation_speed', array('label' => $options['sl_animation_speed']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_animation_speed]', 'type' => $options['sl_animation_speed']['type']));
     /* Auto slideshow */
     $wp_customize->add_setting('cherry[sl_slideshow]', array('default' => $options['sl_slideshow']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_sl_slideshow', array('label' => $options['sl_slideshow']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_slideshow]', 'type' => $options['sl_slideshow']['type'], 'choices' => $options['sl_slideshow']['options']));
     /* Slide thumbnails */
     $wp_customize->add_setting('cherry[sl_thumbnails]', array('default' => $options['sl_thumbnails']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_sl_thumbnails', array('label' => $options['sl_thumbnails']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_thumbnails]', 'type' => $options['sl_thumbnails']['type'], 'choices' => $options['sl_thumbnails']['options']));
     /* Show pagination? */
     $wp_customize->add_setting('cherry[sl_control_nav]', array('default' => $options['sl_control_nav']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_sl_control_nav', array('label' => $options['sl_control_nav']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_control_nav]', 'type' => $options['sl_control_nav']['type'], 'choices' => $options['sl_control_nav']['options']));
     /* Display next & prev navigation? */
     $wp_customize->add_setting('cherry[sl_dir_nav]', array('default' => $options['sl_dir_nav']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_sl_dir_nav', array('label' => $options['sl_dir_nav']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_dir_nav]', 'type' => $options['sl_dir_nav']['type'], 'choices' => $options['sl_dir_nav']['options']));
     /* Play/Pause button */
     $wp_customize->add_setting('cherry[sl_play_pause_button]', array('default' => $options['sl_play_pause_button']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_sl_play_pause_button', array('label' => $options['sl_play_pause_button']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_play_pause_button]', 'type' => $options['sl_play_pause_button']['type'], 'choices' => $options['sl_play_pause_button']['options']));
     /* Loader */
     $wp_customize->add_setting('cherry[sl_loader]', array('default' => $options['sl_loader']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_sl_loader', array('label' => $options['sl_loader']['name'], 'section' => 'cherry_slider', 'settings' => 'cherry[sl_loader]', 'type' => $options['sl_loader']['type'], 'choices' => $options['sl_loader']['options']));
     /*-----------------------------------------------------------------------------------*/
     /*	Blog
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('cherry_blog', array('title' => __('Blog', CURRENT_THEME), 'priority' => 203));
     /* Blog image size */
     $wp_customize->add_setting('cherry[post_image_size]', array('default' => $options['post_image_size']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_post_image_size', array('label' => $options['post_image_size']['name'], 'section' => 'cherry_blog', 'settings' => 'cherry[post_image_size]', 'type' => $options['post_image_size']['type'], 'choices' => $options['post_image_size']['options']));
     /* Single post image size */
     $wp_customize->add_setting('cherry[single_image_size]', array('default' => $options['single_image_size']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_single_image_size', array('label' => $options['single_image_size']['name'], 'section' => 'cherry_blog', 'settings' => 'cherry[single_image_size]', 'type' => $options['single_image_size']['type'], 'choices' => $options['single_image_size']['options']));
     /* Post Meta */
     $wp_customize->add_setting('cherry[post_meta]', array('default' => $options['post_meta']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_post_meta', array('label' => $options['post_meta']['name'], 'section' => 'cherry_blog', 'settings' => 'cherry[post_meta]', 'type' => $options['post_meta']['type'], 'choices' => $options['post_meta']['options']));
     /* Post Excerpt */
     $wp_customize->add_setting('cherry[post_excerpt]', array('default' => $options['post_excerpt']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_post_excerpt', array('label' => $options['post_excerpt']['name'], 'section' => 'cherry_blog', 'settings' => 'cherry[post_excerpt]', 'type' => $options['post_excerpt']['type'], 'choices' => $options['post_excerpt']['options']));
     /*-----------------------------------------------------------------------------------*/
     /*	Footer
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('cherry_footer', array('title' => __('Footer', CURRENT_THEME), 'priority' => 204));
     /* Footer Copyright Text */
     $wp_customize->add_setting('cherry[footer_text]', array('default' => $options['footer_text']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_footer_text', array('label' => $options['footer_text']['name'], 'section' => 'cherry_footer', 'settings' => 'cherry[footer_text]', 'type' => 'text'));
     /* Display Footer Menu */
     $wp_customize->add_setting('cherry[footer_menu]', array('default' => $options['footer_menu']['std'], 'type' => 'option'));
     $wp_customize->add_control('cherry_footer_menu', array('label' => $options['footer_menu']['name'], 'section' => 'cherry_footer', 'settings' => 'cherry[footer_menu]', 'type' => $options['footer_menu']['type'], 'choices' => $options['footer_menu']['options']));
 }
function cordillera_admin_init()
{
    if (isset($_POST['widget-area']) && is_array($_POST['widget-area'])) {
        $cordillera_list_item = json_encode($_POST['widget-area']);
        update_option("_cordillera_home_widget_area", $cordillera_list_item);
    }
    if (isset($_POST['reset'])) {
        $output = array();
        $location = apply_filters('options_framework_location', array('admin-options.php'));
        if ($optionsfile = locate_template($location)) {
            $maybe_options = (require_once $optionsfile);
            if (is_array($maybe_options)) {
                $options = $maybe_options;
            } else {
                if (function_exists('optionsframework_options')) {
                    $options = optionsframework_options();
                }
            }
        }
        if (isset($options)) {
            $config = $options;
            foreach ((array) $config as $option) {
                if (isset($option['id']) && $option['id'] == 'home_page_sections') {
                    update_option("_cordillera_home_widget_area", $option['std']);
                }
            }
        }
    }
}
/**
 * Generates the options fields that are used in the form.
 */
function optionsframework_fields()
{
    global $allowedtags;
    $optionsframework_settings = get_option('optionsframework');
    // Get the theme name so we can display it up top
    $themename = get_theme_data(get_stylesheet_directory() . '/style.css');
    $themename = $themename['Name'];
    // Gets the unique option id
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    $settings = get_option($option_name);
    $options = optionsframework_options();
    $counter = 0;
    $menu = '';
    $output = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        $select_value = '';
        $checked = '';
        // 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";
            $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
            $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
        }
        // Set default value to $val
        if (isset($value['std'])) {
            $val = $value['std'];
        }
        // If the option is already saved, ovveride $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'];
        }
        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) . '" />';
                break;
                // Select Box
            // Select Box
            case $value['type'] == 'select':
                $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                foreach ($value['options'] as $key => $option) {
                    $selected = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' selected="selected"';
                        }
                    }
                    $output .= '<option' . $selected . ' 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 = '';
                    $checked = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' of-radio-img-selected';
                            $checked = ' checked="checked"';
                        }
                    }
                    $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . $checked . ' />';
                    $output .= '<div class="of-radio-img-label">' . esc_html($key) . '</div>';
                    $output .= '<div style="background: #f8f8f8 url(' . esc_url($option) . ') repeat; width: 40px;height:40px; display:block; float:left" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;"></div>';
                }
                break;
                // Uploader
            // Uploader
            case "upload":
                $output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
                // New AJAX Uploader using Media Library
                break;
                // Info
            // Info
            case "info":
                $class = 'section';
                if (isset($value['type'])) {
                    $class .= ' section-' . $value['type'];
                }
                if (isset($value['class'])) {
                    $class .= ' ' . $value['class'];
                }
                $output .= '<div class="' . esc_attr($class) . '">' . "\n";
                if (isset($value['name'])) {
                    $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                }
                if ($value['desc']) {
                    $output .= apply_filters('of_sanitize_info', $value['desc']) . "\n";
                }
                $output .= '<div class="clear"></div></div>' . "\n";
                break;
                // Heading for Navigation
            // Heading for Navigation
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $jquery_click_hook = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['name']));
                $jquery_click_hook = "of-option-" . $jquery_click_hook;
                $menu .= '<a id="' . esc_attr($jquery_click_hook) . '-tab" class="nav-tab" title="' . esc_attr($value['name']) . '" href="' . esc_attr('#' . $jquery_click_hook) . '">' . esc_html($value['name']) . '</a>';
                $output .= '<div class="group" id="' . esc_attr($jquery_click_hook) . '">';
                $output .= '<h3>' . esc_html($value['name']) . '</h3>' . "\n";
                break;
        }
        if ($value['type'] != "heading" && $value['type'] != "info") {
            if ($value['type'] != "checkbox") {
                $output .= '<br/>';
            }
            $output .= '</div>';
            if ($value['type'] != "checkbox") {
                $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
            }
            $output .= '<div class="clear"></div></div></div>' . "\n";
        }
    }
    $output .= '</div>';
    return array($output, $menu);
}
function onetone_of_get_options($default = false)
{
    global $options_saved, $onetone_default_options;
    $options_saved = false;
    //$optionsframework_settings = get_option(ONETONE_OPTIONS_PREFIXED.'optionsframework');
    $default_options = optionsframework_options();
    foreach ((array) $default_options as $option) {
        if (!isset($option['id'])) {
            continue;
        }
        if (!isset($option['std'])) {
            continue;
        }
        if (!isset($option['type'])) {
            continue;
        }
        $onetone_default_options[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
    }
    // Gets the unique option id
    //$option_name = $optionsframework_settings['id'];
    $option_name = optionsframework_option_name();
    if (get_option($option_name)) {
        $options = get_option($option_name);
        $options_saved = true;
    } else {
        $options = $onetone_default_options;
    }
    if (isset($options)) {
        return $options;
    } else {
        return $default;
    }
}
Beispiel #20
0
function customizer_options($skin)
{
    // Font List
    global $nv_font;
    $font_list[''] = 'Select Font Family';
    foreach ($nv_font as $font => $value) {
        $font_list[$value] = $font;
    }
    if (of_get_option("nv_font_type") != "disable" && of_get_option("nv_font_type") != "enable") {
        global $themeva_googlefont;
        $google_fonts['-'] = '----- Google Fonts -----';
        foreach ($themeva_googlefont as $font => $value) {
            $google_fonts[$font] = $font;
        }
        $font_list = $heading_font_list = array_merge($font_list, $google_fonts);
    } elseif (of_get_option("nv_font_type") == "enable") {
        global $themeva_cufonfont;
        $cufon_fonts['-'] = '----- Cufón Fonts -----';
        foreach ($themeva_cufonfont as $font => $value) {
            $cufon_fonts[$value] = $font;
        }
        $heading_font_list = array_merge($font_list, $cufon_fonts);
    } else {
        $heading_font_list = $font_list;
    }
    // Get Admin Options
    $options = optionsframework_options();
    $priority = 0;
    $options_array = array('global_header_heading' => array('name' => 'global_header_heading', 'label' => __('Global Header Settings', 'options_framework_themeva'), 'type' => 'option', 'control' => 'heading', 'section' => 'themeva_header_options', 'priority' => $priority++), 'header_height' => array('name' => 'themeva[header_height]', 'label' => __('Minimum Header Height', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '500', 'min' => '0', 'section' => 'themeva_header_options', 'css' => '#header', 'js' => 'css("min-height", to +"px")', 'live' => 'yes', 'priority' => $priority++), 'branding_disable' => array('name' => 'themeva[branding_disable]', 'label' => __('Branding Display', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => $options['branding_disable']['options'], 'section' => 'themeva_header_options', 'priority' => $priority++), 'branding_alignment' => array('name' => 'themeva[branding_alignment]', 'label' => __('Branding Alignment', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => $options['branding_alignment']['options'], 'section' => 'themeva_header_options', 'css' => '#header-logo', 'js' => 'removeClass("left right center").addClass( to )', 'live' => 'yes', 'priority' => $priority++), 'branding_margin' => array('name' => 'themeva[branding_margin]', 'label' => __('Branding Top Margin', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '500', 'min' => '-200', 'default' => '', 'section' => 'themeva_header_options', 'css' => '#primary-wrapper #header-logo', 'js' => 'css("margin-top", to +"px")', 'live' => 'yes', 'priority' => $priority++), 'menu_alignment' => array('name' => 'themeva[menu_alignment]', 'label' => __('Menu Alignment', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => $options['menu_alignment']['options'], 'section' => 'themeva_header_options', 'css' => '#nv-tabs', 'js' => 'removeClass("left right center").addClass( to )', 'live' => 'yes', 'priority' => $priority++), 'menu_margin' => array('name' => 'themeva[menu_margin]', 'label' => __('Menu Top Margin', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '500', 'min' => '-200', 'default' => '', 'section' => 'themeva_header_options', 'css' => '#nv-tabs', 'js' => 'css("margin-top", to +"px")', 'live' => 'yes', 'priority' => $priority++));
    $skin_options_array = array('branding_ver' => array('name' => 'skin_data_' . $skin . '[skin_id_branding_ver]', 'label' => __('Logo Version', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('primary' => 'Primary', 'secondary' => 'Secondary'), 'section' => 'themeva_background_1', 'priority' => $priority++), 'header_divider_shade' => array('name' => 'skin_data_' . $skin . '[skin_id_header_divider_shade]', 'label' => __('Divider Line Shade', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('' => 'Select', 'light' => 'Light', 'medium' => 'Medium', 'dark' => 'Dark', 'disabled' => 'No Line'), 'section' => 'themeva_background_1', 'live' => 'no', 'priority' => $priority++), 'header_shadow' => array('name' => 'skin_data_' . $skin . '[skin_id_header_shadow]', 'label' => __('Shadow', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('enable' => 'Enable', 'disable' => 'Disable'), 'section' => 'themeva_background_1', 'live' => 'no', 'priority' => $priority++), 'floatingheader_font_colors_heading' => array('name' => 'floatingheader_font_colors_heading', 'label' => __('Transparent Header', 'options_framework_themeva'), 'type' => 'option', 'control' => 'heading', 'section' => 'themeva_background_1', 'priority' => '900'), 'floatingheader_font_color' => array('name' => 'skin_data_' . $skin . '[skin_id_floatingheader_font_color]', 'label' => __('Font Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_1', 'css' => '.header_transparent .skinset-header.nv-skin,.header_transparent .skinset-header a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => '901'), 'transparent_branding_ver' => array('name' => 'skin_data_' . $skin . '[skin_id_transparent_branding_ver]', 'label' => __('Transparent Logo', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('' => 'Default', 'primary' => 'Primary', 'secondary' => 'Secondary'), 'section' => 'themeva_background_1', 'priority' => '902'), 'footer_divider_shade' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_divider_shade]', 'label' => __('Divider Line Shade', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('' => 'Select', 'light' => 'Light', 'medium' => 'Medium', 'dark' => 'Dark', 'disabled' => 'No Line'), 'section' => 'themeva_background_2', 'live' => 'no', 'priority' => $priority++), 'footer_shadow' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_shadow]', 'label' => __('Shadow', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('enable' => 'Enable', 'disable' => 'Disable'), 'section' => 'themeva_background_2', 'live' => 'no', 'priority' => $priority++), 'footer_form_color' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_form_color]', 'label' => __('Forms Background Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_2', 'css' => '.skinset-footer input[type=\\"text\\"],.skinset-footer input[type=\\"password\\"],.skinset-footer input[type=\\"file\\"],.skinset-footer textarea,.skinset-footer input', 'js' => 'css("background-color", to)', 'live' => 'yes', 'priority' => $priority++), 'footer_form_border_color_tl' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_form_border_color_tl]', 'label' => __('Forms Border Color ( top + left )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_2', 'css' => '.skinset-footer input[type=\\"text\\"],.skinset-footer input[type=\\"password\\"],.skinset-footer input[type=\\"file\\"],.skinset-footer textarea,.skinset-footer input', 'js' => 'css("border-top-color",to).css("border-left-color",to)', 'live' => 'yes', 'priority' => $priority++), 'footer_form_border_color_br' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_form_border_color_br]', 'label' => __('Forms Border Color ( bottom + right )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_2', 'css' => '.skinset-footer input[type=\\"text\\"],.skinset-footer input[type=\\"password\\"],.skinset-footer input[type=\\"file\\"],.skinset-footer textarea,.skinset-footer input', 'js' => 'css("border-bottom-color",to).css("border-right-color",to)', 'live' => 'yes', 'priority' => $priority++), 'submenu_color' => array('name' => 'skin_data_' . $skin . '[skin_id_menu_panel_color]', 'label' => __('Sub-Menu Background Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'nav', 'css' => '#nv-tabs ul ul', 'js' => 'css("background-color", to)', 'live' => 'yes', 'priority' => $priority++), 'submenu_border' => array('name' => 'skin_data_' . $skin . '[skin_id_menu_panel_border_color]', 'label' => __('Sub-Menu Border Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'nav', 'css' => '#nv-tabs ul ul', 'js' => 'css("border-color",to)', 'live' => 'yes', 'priority' => $priority++), 'icon_color' => array('name' => 'skin_data_' . $skin . '[skin_id_icon_color]', 'label' => __('Body Skin', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('default' => 'Default', 'light' => 'Light', 'dark' => 'Dark'), 'section' => 'themeva_background_5', 'css' => '#primary-wrapper', 'js' => 'removeClass("nv-dark nv-light").addClass( "nv-"+to )', 'live' => 'no', 'priority' => $priority++), 'frame_main' => array('name' => 'skin_data_' . $skin . '[skin_id_frame_main]', 'label' => __('Content Frame', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('enabled' => __('Enabled', 'options_framework_themeva'), 'disabled' => __('Disabled', 'options_framework_themeva')), 'section' => 'themeva_background_5', 'css' => '.skinset-main', 'live' => 'no', 'priority' => $priority++), 'main_pri_color' => array('name' => 'skin_data_' . $skin . '[skin_id_main_pri_color]', 'label' => __('Content Frame Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_5', 'css' => '.skinset-main', 'js' => 'attr("data-pri-color", to ).attr("data-sec-color", to )', 'func' => 'gradient', 'live' => 'yes', 'priority' => $priority++), 'main_pri_opac' => array('name' => 'skin_data_' . $skin . '[skin_id_main_pri_opac]', 'label' => __('Content Frame Opacity', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '100', 'min' => '0', 'default' => '100', 'section' => 'themeva_background_5', 'css' => '.skinset-main', 'js' => 'attr("data-pri-opac", to ).attr("data-sec-opac", to )', 'func' => 'gradient', 'live' => 'yes', 'priority' => $priority++), 'main_border_color' => array('name' => 'skin_data_' . $skin . '[skin_id_main_border_color]', 'label' => __('Content Frame Border Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_5', 'css' => '.skinset-main', 'js' => 'css("border-color", to)', 'live' => 'yes', 'priority' => $priority++), 'main_divider_shade' => array('name' => 'skin_data_' . $skin . '[skin_id_main_divider_shade]', 'label' => __('Divider Line Shade', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('' => 'Select', 'light' => 'Light', 'medium' => 'Medium', 'dark' => 'Dark'), 'section' => 'themeva_background_5', 'live' => 'no', 'priority' => $priority++), 'background_font' => array('name' => 'skin_data_' . $skin . '[skin_id_background_font]', 'label' => __('Font Family', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => $font_list, 'section' => 'themeva_font_settings', 'live' => 'no', 'priority' => $priority++), 'background_font_size' => array('name' => 'skin_data_' . $skin . '[skin_id_background_font_size]', 'label' => __('Font Size ( px )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_font_settings', 'live' => 'no', 'priority' => $priority++), 'background_heading_font' => array('name' => 'skin_data_' . $skin . '[skin_id_background_heading_font]', 'label' => __('Headings Font Family', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => $heading_font_list, 'section' => 'themeva_font_settings', 'live' => 'no', 'priority' => $priority++), 'background_heading_size' => array('name' => 'skin_data_' . $skin . '[skin_id_background_heading_size]', 'label' => __('Increase Heading Size By ( px )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_font_settings', 'live' => 'no', 'priority' => $priority++), 'header_font' => array('name' => 'skin_data_' . $skin . '[skin_id_header_font]', 'label' => __('Menu Font Family', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => $font_list, 'section' => 'themeva_font_settings', 'live' => 'no', 'priority' => $priority++), 'header_font_size' => array('name' => 'skin_data_' . $skin . '[skin_id_header_font_size]', 'label' => __('Menu Font Size ( px )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_font_settings', 'live' => 'no', 'priority' => $priority++), 'font_colors_heading' => array('name' => 'font_colors_heading', 'label' => __('General Font Colors', 'options_framework_themeva'), 'type' => 'option', 'control' => 'heading', 'section' => 'themeva_font_colors', 'priority' => $priority++), 'background_font_color' => array('name' => 'skin_data_' . $skin . '[skin_id_background_font_color]', 'label' => __('Font Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-background.nv-skin', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'background_link_color' => array('name' => 'skin_data_' . $skin . '[skin_id_background_link_color]', 'label' => __('Link Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-background.nv-skin a', 'js' => 'css("color", to ).parents(".skinset-background.nv-skin").find(".nv-skin.highlight,.header-infobar").css("background-color", to )', 'live' => 'yes', 'priority' => $priority++), 'background_linkhover_color' => array('name' => 'skin_data_' . $skin . '[skin_id_background_linkhover_color]', 'label' => __('Link Hover Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-background.nv-skin a:hover', 'js' => 'css("color", to )', 'live' => 'no', 'priority' => $priority++), 'background_h1_color' => array('name' => 'skin_data_' . $skin . '[skin_id_background_h1_color]', 'label' => __('H1 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-background h1, .skinset-background h1 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'background_h2_color' => array('name' => 'skin_data_' . $skin . '[skin_id_background_h2_color]', 'label' => __('H2 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-background h2, .skinset-background h2 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'background_h3_color' => array('name' => 'skin_data_' . $skin . '[skin_id_background_h3_color]', 'label' => __('h3 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-background h3, .skinset-background h3 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'background_h4_color' => array('name' => 'skin_data_' . $skin . '[skin_id_background_h4_color]', 'label' => __('h4, h5, h6 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-background h4, .skinset-background h4 a,.skinset-background h5, .skinset-background h5 a,.skinset-background h6, .skinset-background h6 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'header_font_colors_heading' => array('name' => 'header_font_colors_heading', 'label' => __('Header Font Colors', 'options_framework_themeva'), 'type' => 'option', 'control' => 'heading', 'section' => 'themeva_font_colors', 'priority' => $priority++), 'header_font_color' => array('name' => 'skin_data_' . $skin . '[skin_id_header_font_color]', 'label' => __('Font Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-header.nv-skin,.skinset-header.nv-skin span.menudesc', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'header_link_color' => array('name' => 'skin_data_' . $skin . '[skin_id_header_link_color]', 'label' => __('Link Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-header.nv-skin a', 'js' => 'css("color", to ).parents(".skinset-header.nv-skin").find(".nv-skin.highlight").css("background-color", to )', 'live' => 'yes', 'priority' => $priority++), 'header_linkhover_color' => array('name' => 'skin_data_' . $skin . '[skin_id_header_linkhover_color]', 'label' => __('Link Hover Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-header.nv-skin a:hover', 'js' => 'css("color", to )', 'live' => 'no', 'priority' => $priority++), 'header_h1_color' => array('name' => 'skin_data_' . $skin . '[skin_id_header_h1_color]', 'label' => __('H1 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-header h1, .skinset-header h1 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'header_h2_color' => array('name' => 'skin_data_' . $skin . '[skin_id_header_h2_color]', 'label' => __('H2 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-header h2, .skinset-header h2 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'header_h3_color' => array('name' => 'skin_data_' . $skin . '[skin_id_header_h3_color]', 'label' => __('h3 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-header h3, .skinset-header h3 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'header_h4_color' => array('name' => 'skin_data_' . $skin . '[skin_id_header_h4_color]', 'label' => __('h4, h5, h6 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-header h4, .skinset-header h4 a, .skinset-header h5, .skinset-header h5 a,.skinset-header h6, .skinset-header h6 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'submenu_font_colors_heading' => array('name' => 'submenu_font_colors_heading', 'label' => __('Sub-Menu Font Colors', 'options_framework_themeva'), 'type' => 'option', 'control' => 'heading', 'section' => 'themeva_font_colors', 'priority' => $priority++), 'submenu_font_color' => array('name' => 'skin_data_' . $skin . '[skin_id_menu_font_color]', 'label' => __('Font Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '#nv-tabs ul ul', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'submenu_link_color' => array('name' => 'skin_data_' . $skin . '[skin_id_menu_link_color]', 'label' => __('Link Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '#nv-tabs ul ul a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'submenu_linkhover_color' => array('name' => 'skin_data_' . $skin . '[skin_id_menu_linkhover_color]', 'label' => __('Link Hover Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'live' => 'no', 'priority' => $priority++), 'footer_font_colors_heading' => array('name' => 'footer_font_colors_heading', 'label' => __('Footer Font Colors', 'options_framework_themeva'), 'type' => 'option', 'control' => 'heading', 'section' => 'themeva_font_colors', 'priority' => $priority++), 'footer_font_color' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_font_color]', 'label' => __('Font Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-footer.nv-skin', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'footer_link_color' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_link_color]', 'label' => __('Link Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-footer.nv-skin a', 'js' => 'css("color", to ).parents(".skinset-footer.nv-skin").find(".nv-skin.highlight").css("background-color", to )', 'live' => 'yes', 'priority' => $priority++), 'footer_linkhover_color' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_linkhover_color]', 'label' => __('Link Hover Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-footer.nv-skin a:hover', 'js' => 'css("color", to )', 'live' => 'no', 'priority' => $priority++), 'footer_h1_color' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_h1_color]', 'label' => __('H1 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-footer h1, .skinset-footer h1 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'footer_h2_color' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_h2_color]', 'label' => __('H2 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-footer h2, .skinset-footer h2 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'footer_h3_color' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_h3_color]', 'label' => __('h3 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-footer h3, .skinset-footer h3 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++), 'footer_h4_color' => array('name' => 'skin_data_' . $skin . '[skin_id_footer_h4_color]', 'label' => __('h4, h5, h6 Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_font_colors', 'css' => '.skinset-footer h4, .skinset-footer h4 a,.skinset-footer h5, .skinset-footer h5 a,.skinset-footer h6, .skinset-footer h6 a', 'js' => 'css("color", to )', 'live' => 'yes', 'priority' => $priority++));
    // Add Skin Options if a Skin is selected
    if (!empty($skin)) {
        $options_array = array_merge($options_array, $skin_options_array);
    }
    /* ------------------------------------
    		
    		:: BACKGROUND LAYERS SECTION
    		
    		------------------------------------ */
    $patterns = array("" => "Select Pattern", "pattern-a" => "pattern-a", "pattern-b" => "pattern-b", "pattern-c" => "pattern-c", "pattern-d" => "pattern-d", "pattern-e" => "pattern-e", "pattern-f" => "pattern-f", "pattern-g" => "pattern-g", "pattern-h" => "pattern-h", "pattern-i" => "pattern-i", "pattern-j" => "pattern-j", "pattern-k" => "pattern-k", "pattern-l" => "pattern-l", "pattern-m" => "pattern-m", "pattern-n" => "pattern-n", "pattern-o" => "pattern-o", "pattern-p" => "pattern-p", "pattern-q" => "pattern-q", "pattern-r" => "pattern-r", "pattern-s" => "pattern-s", "pattern-t" => "pattern-t", "pattern-u" => "pattern-u");
    for ($i = 1; $i <= 5; $i++) {
        // Data Sources
        $data_sources = array('nodatasource-' . $i => 'Select', 'layer' . $i . '-data-4' => 'Slide Set', 'layer' . $i . '-data-1' => 'Attached Media', 'layer' . $i . '-data-6' => 'Portfolio Categories', 'layer' . $i . '-data-2' => 'Post Categories', 'layer' . $i . '-data-8' => 'Page / Post ID');
        // Products
        if (class_exists('WPSC_Query') || class_exists('Woocommerce')) {
            $data_sources['layer' . $i . '-data-5'] = 'Product Category / Tags';
        }
        // Flickr
        if (of_get_option('flickr_userid') != '') {
            $data_sources['layer' . $i . '-data-3'] = 'Flickr Set';
        }
        // Set Choices
        if ($i == 5) {
            $choices = array('' => 'Select Type', 'layer' . $i . '_color' => 'Color', 'layer' . $i . '_imagefull' => 'Image ( Full Screen )', 'layer' . $i . '_image' => 'Image ( Positioned )', 'layer' . $i . '_pattern' => 'Pattern', 'layer' . $i . '_video' => 'Video / Flash', 'layer' . $i . '_cycle' => 'Image / Video Cycle');
        } else {
            $choices = array('' => 'Select Type', 'layer' . $i . '_color' => 'Color', 'layer' . $i . '_image' => 'Image ( Positioned )', 'layer' . $i . '_pattern' => 'Pattern');
        }
        // Assign Sections
        if ($i == 1 || $i == 2) {
            $section = 1;
        } elseif ($i == 3 || $i == 4) {
            $section = 2;
        } else {
            $section = $i;
        }
        // Add Layer Headings
        // Assign layer numbers
        $layer = '';
        if ($i == 1 || $i == 3) {
            $layer = 1;
        }
        if ($i == 2 || $i == 4) {
            $layer = 2;
        } else {
            $layer = '';
        }
        if ($i == 1) {
            $priority = 2;
        }
        if ($i == 2) {
            $priority = 30;
        }
        if ($i == 3) {
            $priority = 3;
        }
        if ($i == 4) {
            $priority = 40;
        }
        // Header Heading
        $layers_array['layer' . $i . '_heading'] = array('name' => 'layer' . $i . '_heading', 'label' => __('Background Layer ' . $layer, 'options_framework_themeva'), 'type' => 'option', 'control' => 'heading', 'section' => 'themeva_background_' . $section, 'priority' => $priority . 0);
        // Selection
        $layers_array['layer' . $i . '_type'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_type]', 'label' => __('Select Background Type', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => $choices, 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $priority . 1);
        // COLOR: Primary Color
        $layers_array['layer' . $i . '_color_opt_pri'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_pri_color]', 'label' => __('Background Color (top)', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'js' => 'attr("data-pri-color", to )', 'func' => 'gradient', 'live' => 'yes', 'priority' => $priority . 2);
        // COLOR: Primary Opacity
        $layers_array['layer' . $i . '_color_opt_pri_opac'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_pri_opac]', 'label' => __('Background Opacity (top)', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '100', 'min' => '0', 'default' => '100', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'js' => 'attr("data-pri-opac", to )', 'func' => 'gradient', 'live' => 'yes', 'priority' => $priority . 3);
        // COLOR: Secondary Color
        $layers_array['layer' . $i . '_color_opt_sec'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_sec_color]', 'label' => __('Background Color (bottom)', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'js' => 'attr("data-sec-color", to )', 'func' => 'gradient', 'live' => 'yes', 'priority' => $priority . 4);
        // COLOR: Secondary Opacity
        $layers_array['layer' . $i . '_color_opt_sec_opac'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_sec_opac]', 'label' => __('Background Opacity (bottom)', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '100', 'min' => '0', 'default' => '100', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'js' => 'attr("data-sec-opac", to )', 'func' => 'gradient', 'live' => 'yes', 'priority' => $priority . 5);
        // IMAGEPOSITIONED: Image
        $layers_array['layer' . $i . '_image_opt'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_image]', 'label' => __('Image', 'options_framework_themeva'), 'type' => 'option', 'control' => 'image', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $priority . 10);
        // IMAGEPOSITIONED: Color
        $layers_array['layer' . $i . '_image_opt_color'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_image_color]', 'label' => __('Background Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'js' => 'css("background-color", to )', 'live' => 'yes', 'priority' => $priority . 11);
        // IMAGEPOSITIONED: Opacity
        $layers_array['layer' . $i . '_image_opt_opac'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_image_opac]', 'label' => __('Background Opacity', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '100', 'min' => '0', 'default' => '100', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'func' => 'background_opacity', 'js' => 'attr("data-pri-opac", to )', 'live' => 'yes', 'priority' => $priority . 12);
        // IMAGEPOSITIONED: Vertial Align
        $layers_array['layer' . $i . '_image_opt_valign'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_image_valign]', 'label' => __('Image Vertical Position', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('' => 'Select', 'top' => 'Top', 'bottom' => 'Bottom', 'center' => 'Center'), 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $priority . 13);
        // IMAGEPOSITIONED: Horizontal Align
        $layers_array['layer' . $i . '_image_opt_halign'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_image_halign]', 'label' => __('Image Horizontal Position', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('' => 'Select', 'left' => 'Left', 'right' => 'Right', 'center' => 'Center'), 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $priority . 14);
        // IMAGEPOSITIONED: Horizontal Align
        $layers_array['layer' . $i . '_image_opt_repeat'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_image_repeat]', 'label' => __('Image Repeat', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('' => 'Select', 'repeat' => 'Repeat', 'repeat-x' => 'Repeat X', 'repeat-y' => 'Repeat Y', 'no-repeat' => 'No Repeat'), 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $priority . 15);
        // PATTERN: Pattern Type
        $layers_array['layer' . $i . '_pattern_opt'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_pattern]', 'label' => __('Pattern Type', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => $patterns, 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'js' => 'css("background-image", "url(' . get_template_directory_uri() . '/images/" + to +".png)" )', 'live' => 'yes', 'priority' => $priority . 16);
        // PATTERN: Color
        $layers_array['layer' . $i . '_pattern_opt_color'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_pattern_color]', 'label' => __('Background Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'js' => 'css("background-color", to )', 'live' => 'yes', 'priority' => $priority . 17);
        // PATTERN: Opacity
        $layers_array['layer' . $i . '_pattern_opt_opac'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_pattern_opac]', 'label' => __('Background Opacity', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '100', 'min' => '0', 'default' => '100', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'func' => 'background_opacity', 'js' => 'attr("data-pri-opac", to )', 'live' => 'yes', 'priority' => $priority . 18);
        if ($i == '5') {
            // CYCLE: Opacity
            $layers_array['layer' . $i . '_cycle_opt_opac'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_opac]', 'label' => __('Opacity', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '100', 'min' => '0', 'default' => '100', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'func' => 'background_opacity', 'js' => 'attr("data-pri-opac", to )', 'live' => 'yes', 'priority' => $i . 23);
            // CYCLE: Color
            $layers_array['layer' . $i . '_cycle_opt_color'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_color]', 'label' => __('Background Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'js' => 'css("background-color", to )', 'live' => 'yes', 'priority' => $i . 24);
            // CYCLE: Timeout
            $layers_array['layer' . $i . '_cycle_opt_timeout'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_timeout]', 'label' => __('Slide Timeout ( Seconds )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 25);
            // CYCLE: Datasource
            $layers_array['layer' . $i . '_cycle_opt_datasource'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_datasource]', 'label' => __('Data Source', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => $data_sources, 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 26);
            // CYCLE: Attached Media
            $layers_array['layer' . $i . '-data-1'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_attached]', 'label' => __('Attached ID ( Comma Separate )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 27);
            // CYCLE: Post Categories
            $layers_array['layer' . $i . '-data-2'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_cat]', 'label' => __('Post Categories ( Comma Separate )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 28);
            // CYCLE: Gallery Media
            $layers_array['layer' . $i . '-data-6'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_mediacat]', 'label' => __('Gallery Media ( Comma Separate )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 29);
            // CYCLE: Flickr
            $layers_array['layer' . $i . '-data-3'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_flickr]', 'label' => __('Flickr Set ( Comma Separate )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 30);
            // CYCLE: SlideSet
            $layers_array['layer' . $i . '-data-4'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_slideset]', 'label' => __('SlideSet Set ( Comma Separate )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 31);
            // CYCLE: Product Category
            $layers_array['layer' . $i . '-data-5'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_prodcat]', 'label' => __('Product Categories ( Comma Separate )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 32);
            // CYCLE: Product Tags
            $layers_array['layer' . $i . '-data-5'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_prodtag]', 'label' => __('Product Tags ( Comma Separate )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 33);
            // CYCLE: Page / Post ID
            $layers_array['layer' . $i . '-data-8'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_cycle_pagepost_id]', 'label' => __('Page / Post ID ( Comma Separate )', 'options_framework_themeva'), 'type' => 'option', 'control' => 'text', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 33);
            // IMAGEFULL: Image
            $layers_array['layer' . $i . '_imagefull_opt'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_imagefull]', 'label' => __('Image', 'options_framework_themeva'), 'type' => 'option', 'control' => 'image', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 34);
            // IMAGEFULL: Color
            $layers_array['layer' . $i . '_imagefull_opt_color'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_imagefull_color]', 'label' => __('Background Color', 'options_framework_themeva'), 'type' => 'option', 'control' => 'color', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'js' => 'css("background-color", to )', 'live' => 'yes', 'priority' => $i . 35);
            // IMAGEFULL: Opacity
            $layers_array['layer' . $i . '_imagefull_opt_opac'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_imagefull_opac]', 'label' => __('Background Opacity', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '100', 'min' => '0', 'default' => '100', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i . ' img', 'func' => 'background_opacity', 'js' => 'attr("data-pri-opac", to )', 'live' => 'yes', 'priority' => $i . 36);
            // IMAGEFULL: Featured
            $layers_array['layer' . $i . '_imagefull_opt_imagefeatured'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_imagefeatured]', 'label' => __('Use Page / Post Featured Image', 'options_framework_themeva'), 'type' => 'option', 'control' => 'checkbox', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 37);
            // VIDEO: File
            $layers_array['layer' . $i . '_video_opt'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_video]', 'label' => __('Media File', 'options_framework_themeva'), 'type' => 'option', 'control' => 'media', 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 38);
            // VIDEO: Opacity
            $layers_array['layer' . $i . '_video_opt_opac'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_video_opac]', 'label' => __('Opacity', 'options_framework_themeva'), 'type' => 'option', 'control' => 'range', 'max' => '100', 'min' => '0', 'default' => '100', 'section' => 'themeva_background_' . $section, 'css' => '#custom-layer' . $i, 'func' => 'background_opacity', 'js' => 'attr("data-pri-opac", to )', 'live' => 'yes', 'priority' => $i . 39);
            // VIDEO: Type
            $layers_array['layer' . $i . '_video_opt_type'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_video_type]', 'label' => __('Media Type', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('' => 'Select', 'youtube' => 'YouTube', 'vimeo' => 'Vimeo', 'flash' => 'Flash', 'jwplayer' => 'JW Player'), 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 40);
            // VIDEO: Loop
            $layers_array['layer' . $i . '_video_opt_loop'] = array('name' => 'skin_data_' . $skin . '[skin_id_layer' . $i . '_video_loop]', 'label' => __('Video Loop', 'options_framework_themeva'), 'type' => 'option', 'control' => 'select', 'choices' => array('1' => 'Yes', '0' => 'No'), 'section' => 'themeva_background_' . $section, 'live' => 'no', 'priority' => $i . 41);
        }
    }
    // Add Layout Options if a Skin is selected
    if (!empty($skin)) {
        $options_array = array_merge($options_array, $layers_array);
    }
    return $options_array;
}
 function combined_option_array()
 {
     $child_options = optionsframework_options();
     $framework_options = framework_options();
     $add_child_array = array();
     $add_child_tabs_array = array();
     $combined_array = array();
     $old_value_array = array();
     foreach ($child_options as $value) {
         foreach ($framework_options as $key => $value_2) {
             if (array_key_exists("id", $value) && array_key_exists("id", $value_2)) {
                 if (in_array($value["id"], $value_2)) {
                     if (array_key_exists("std", $value)) {
                         $framework_options[array_search($value_2, $framework_options)]["std"] = $value["std"];
                     }
                     if (array_key_exists("disable", $value)) {
                         if ($value["disable"] == "true") {
                             unset($framework_options[$key]);
                         }
                     }
                     unset($add_to_array);
                     break;
                 } else {
                     if (array_key_exists("type", $value)) {
                         if ($value["type"] != "heading") {
                             $add_to_array = $value;
                         }
                     }
                 }
             }
         }
         if (isset($add_to_array)) {
             if (array_key_exists("type", $old_value_array)) {
                 if ($old_value_array["type"] == "heading") {
                     array_push($add_child_array, $old_value_array);
                 }
             }
             array_push($add_child_array, $add_to_array);
             unset($add_to_array);
         }
         $old_value_array = $value;
     }
     $combined_array = array_merge($framework_options, $add_child_array);
     return $combined_array;
 }
function organizedthemes_customizer_register($wp_customize)
{
    // Change section names
    $wp_customize->get_section('title_tagline')->title = __('Logo', 'organizedthemes');
    // Remove tagline field
    $wp_customize->remove_control('blogdescription');
    // Change default priority
    $wp_customize->get_section('title_tagline')->priority = 3;
    $wp_customize->get_section('nav')->priority = 5;
    /**
     * This is optional, but if you want to reuse some of the defaults
     * or values you already have built in the options panel, you
     * can load them into $options for easy reference
     */
    $options = optionsframework_options();
    // Title & Tagline
    // Logo Type
    $wp_customize->add_setting('elite[header_blog_title]', array('default' => $options['header_blog_title']['std'], 'type' => 'option'));
    $wp_customize->add_control('elite_logo_select', array('label' => $options['header_blog_title']['name'], 'section' => 'title_tagline', 'settings' => 'elite[header_blog_title]', 'type' => $options['header_blog_title']['type'], 'choices' => $options['header_blog_title']['options'], 'priority' => 1));
    $wp_customize->add_setting('elite[logo]', array('type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => $options['logo']['name'], 'section' => 'title_tagline', 'settings' => 'elite[logo]', 'priority' => 2)));
    // Title font face
    $wp_customize->add_setting('elite[site_title_font][face]', array('default' => $options['site_title_font']['std']['face'], 'type' => 'option'));
    $wp_customize->add_control('site_title_font', array('label' => $options['site_title_font']['name'], 'section' => 'title_tagline', 'settings' => 'elite[site_title_font][face]', 'type' => 'select', 'choices' => $options['site_title_font']['options']['faces'], 'priority' => 3));
    // Title Color
    $wp_customize->add_setting('elite[logo_color]', array('default' => $options['logo_color']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'logo_color', array('label' => $options['logo_color']['name'], 'section' => 'title_tagline', 'settings' => 'elite[logo_color]', 'priority' => 4)));
    // Title Color Hover
    $wp_customize->add_setting('elite[logo_color_hover]', array('default' => $options['logo_color_hover']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'logo_color_hover', array('label' => $options['logo_color_hover']['name'], 'section' => 'title_tagline', 'settings' => 'elite[logo_color_hover]', 'priority' => 5)));
    // Navigation
    // Navigation Bar Color
    $wp_customize->add_setting('elite[navigation_bar]', array('default' => $options['navigation_bar']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'navigation_bar', array('label' => $options['navigation_bar']['name'], 'section' => 'nav', 'settings' => 'elite[navigation_bar]', 'priority' => 5)));
    // Navigation font face
    $wp_customize->add_setting('elite[navigation_font][face]', array('default' => $options['navigation_font']['std']['face'], 'type' => 'option'));
    $wp_customize->add_control('navigation_font', array('label' => $options['navigation_font']['name'], 'section' => 'nav', 'settings' => 'elite[navigation_font][face]', 'type' => 'select', 'choices' => $options['navigation_font']['options']['faces'], 'priority' => 10));
    // Navigation Item Color
    $wp_customize->add_setting('elite[navigation_item]', array('default' => $options['navigation_item']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'navigation_item', array('label' => $options['navigation_item']['name'], 'section' => 'nav', 'settings' => 'elite[navigation_item]', 'priority' => 12)));
    // Navigation Item Color Hover
    $wp_customize->add_setting('elite[navigation_item_hover]', array('default' => $options['navigation_item_hover']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'navigation_item_hover', array('label' => $options['navigation_item_hover']['name'], 'section' => 'nav', 'settings' => 'elite[navigation_item_hover]', 'priority' => 13)));
    // Navigation Drop Down Background
    $wp_customize->add_setting('elite[navigation_drop_down_background]', array('default' => $options['navigation_drop_down_background']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'navigation_drop_down_background', array('label' => $options['navigation_drop_down_background']['name'], 'section' => 'nav', 'settings' => 'elite[navigation_drop_down_background]', 'priority' => 15)));
    // Navigation Drop Down Link
    $wp_customize->add_setting('elite[navigation_drop_down_color]', array('default' => $options['navigation_drop_down_color']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'navigation_drop_down_color', array('label' => $options['navigation_drop_down_color']['name'], 'section' => 'nav', 'settings' => 'elite[navigation_drop_down_color]', 'priority' => 20)));
    // Navigation Drop Down Link
    $wp_customize->add_setting('elite[navigation_drop_down_color_hover]', array('default' => $options['navigation_drop_down_color_hover']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'navigation_drop_down_color_hover', array('label' => $options['navigation_drop_down_color_hover']['name'], 'section' => 'nav', 'settings' => 'elite[navigation_drop_down_color_hover]', 'priority' => 25)));
    // Mobile Navigation Text
    $wp_customize->add_setting('elite[mobile_navigation_name]', array('default' => $options['mobile_navigation_name']['std'], 'type' => 'option'));
    $wp_customize->add_control('mobile_navigation_name', array('label' => $options['mobile_navigation_name']['name'], 'section' => 'nav', 'settings' => 'elite[mobile_navigation_name]', 'type' => $options['mobile_navigation_name']['mobile_navigation_name'], 'priority' => 30));
    // Background
    $wp_customize->add_section('organizedthemes_background', array('title' => __('Background', 'organizedthemes'), 'priority' => 15));
    // background image
    $wp_customize->add_setting('elite[background_image]', array('type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'background_image', array('label' => $options['background_image']['name'], 'section' => 'organizedthemes_background', 'settings' => 'elite[background_image]')));
    // background color
    $wp_customize->add_setting('elite[background_color]', array('default' => $options['background_color']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'background_color', array('label' => $options['background_color']['name'], 'section' => 'organizedthemes_background', 'settings' => 'elite[background_color]')));
    // background repeat
    $wp_customize->add_setting('elite[background_repeat]', array('default' => $options['background_repeat']['std'], 'type' => 'option'));
    $wp_customize->add_control('elite_repeat_select', array('label' => $options['background_repeat']['name'], 'section' => 'organizedthemes_background', 'settings' => 'elite[background_repeat]', 'type' => $options['background_repeat']['type'], 'choices' => $options['background_repeat']['options']));
    // background attachment
    $wp_customize->add_setting('elite[background_attachment]', array('default' => $options['background_attachment']['std'], 'type' => 'option'));
    $wp_customize->add_control('elite_attachment_select', array('label' => $options['background_attachment']['name'], 'section' => 'organizedthemes_background', 'settings' => 'elite[background_attachment]', 'type' => $options['background_attachment']['type'], 'choices' => $options['background_attachment']['options']));
    // background horizontal position
    $wp_customize->add_setting('elite[background_position_horizontal]', array('default' => $options['background_position_horizontal']['std'], 'type' => 'option'));
    $wp_customize->add_control('elite_horizontal_select', array('label' => $options['background_position_horizontal']['name'], 'section' => 'organizedthemes_background', 'settings' => 'elite[background_position_horizontal]', 'type' => $options['background_position_horizontal']['type'], 'choices' => $options['background_position_horizontal']['options']));
    // background vertical position
    $wp_customize->add_setting('elite[background_position_vertical]', array('default' => $options['background_position_vertical']['std'], 'type' => 'option'));
    $wp_customize->add_control('elite_vertical_select', array('label' => $options['background_position_vertical']['name'], 'section' => 'organizedthemes_background', 'settings' => 'elite[background_position_vertical]', 'type' => $options['background_position_vertical']['type'], 'choices' => $options['background_position_vertical']['options']));
    // Slideshow
    $wp_customize->add_section('organizedthemes_slideshow', array('title' => __('Hero Section', 'organizedthemes'), 'priority' => 20));
    // Automatically Play Slideshow
    $wp_customize->add_setting('elite[auto]', array('default' => $options['auto']['std'], 'type' => 'option'));
    $wp_customize->add_control('auto', array('label' => $options['auto']['name'], 'section' => 'organizedthemes_slideshow', 'settings' => 'elite[auto]', 'type' => $options['auto']['type'], 'choices' => $options['auto']['options'], 'priority' => 5));
    // Previous & Next Buttons
    $wp_customize->add_setting('elite[prev_next]', array('default' => $options['prev_next']['std'], 'type' => 'option'));
    $wp_customize->add_control('prev_next', array('label' => $options['prev_next']['name'], 'section' => 'organizedthemes_slideshow', 'settings' => 'elite[prev_next]', 'type' => $options['prev_next']['type'], 'choices' => $options['prev_next']['options'], 'priority' => 10));
    // Slide Duration
    $wp_customize->add_setting('elite[duration]', array('default' => $options['duration']['std'], 'type' => 'option'));
    $wp_customize->add_control('duration', array('label' => __('Slide Duration (milliseconds)', 'organizedthemes'), 'section' => 'organizedthemes_slideshow', 'settings' => 'elite[duration]', 'type' => $options['duration']['duration'], 'priority' => 20));
    // Slide Transition Speed
    $wp_customize->add_setting('elite[transition]', array('default' => $options['transition']['std'], 'type' => 'option'));
    $wp_customize->add_control('transition', array('label' => __('Transition Speed (milliseconds)', 'organizedthemes'), 'section' => 'organizedthemes_slideshow', 'settings' => 'elite[transition]', 'type' => $options['duration']['transition'], 'priority' => 25));
    // Hero Title Font
    $wp_customize->add_setting('elite[hero_title_font][face]', array('default' => $options['hero_title_font']['std']['face'], 'type' => 'option'));
    $wp_customize->add_control('hero_title_font', array('label' => $options['hero_title_font']['name'], 'section' => 'organizedthemes_slideshow', 'settings' => 'elite[hero_title_font][face]', 'type' => 'select', 'choices' => $options['hero_title_font']['options']['faces'], 'priority' => 30));
    // Hero Text Font
    $wp_customize->add_setting('elite[hero_text_font][face]', array('default' => $options['hero_text_font']['std']['face'], 'type' => 'option'));
    $wp_customize->add_control('hero_text_font', array('label' => $options['hero_text_font']['name'], 'section' => 'organizedthemes_slideshow', 'settings' => 'elite[hero_text_font][face]', 'type' => 'select', 'choices' => $options['hero_text_font']['options']['faces'], 'priority' => 35));
    // Home Sections
    $wp_customize->add_section('organizedthemes_home_sections', array('title' => __('Home Page', 'organizedthemes'), 'priority' => 25));
    // Home 1
    $wp_customize->add_setting('elite[home_1]', array('default' => $options['home_1']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_1', array('label' => $options['home_1']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_1]', 'priority' => 5)));
    // Home 1 Text
    $wp_customize->add_setting('elite[home_1_text]', array('default' => $options['home_1_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_1_text', array('label' => $options['home_1_text']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_1_text]', 'priority' => 7)));
    // Home 2
    $wp_customize->add_setting('elite[home_2]', array('default' => $options['home_2']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_2', array('label' => $options['home_2']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_2]', 'priority' => 10)));
    // Home 2 Text
    $wp_customize->add_setting('elite[home_2_text]', array('default' => $options['home_2_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_2_text', array('label' => $options['home_2_text']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_2_text]', 'priority' => 12)));
    // Home 3
    $wp_customize->add_setting('elite[home_3]', array('default' => $options['home_3']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_3', array('label' => $options['home_3']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_3]', 'priority' => 15)));
    // Home 3 Text
    $wp_customize->add_setting('elite[home_3_text]', array('default' => $options['home_3_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_3_text', array('label' => $options['home_3_text']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_3_text]', 'priority' => 17)));
    // Home 4
    $wp_customize->add_setting('elite[home_4]', array('default' => $options['home_4']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_4', array('label' => $options['home_4']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_4]', 'priority' => 20)));
    // Home 4 Text
    $wp_customize->add_setting('elite[home_4_text]', array('default' => $options['home_4_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_4_text', array('label' => $options['home_4_text']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_4_text]', 'priority' => 22)));
    // Home 5
    $wp_customize->add_setting('elite[home_5]', array('default' => $options['home_5']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_5', array('label' => $options['home_5']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_5]', 'priority' => 25)));
    // Home 5 Text
    $wp_customize->add_setting('elite[home_5_text]', array('default' => $options['home_5_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_5_text', array('label' => $options['home_5_text']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_5_text]', 'priority' => 27)));
    // Home 6
    $wp_customize->add_setting('elite[home_6]', array('default' => $options['home_6']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_6', array('label' => $options['home_6']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_6]', 'priority' => 30)));
    // Home 6 Text
    $wp_customize->add_setting('elite[home_6_text]', array('default' => $options['home_6_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_6_text', array('label' => $options['home_6_text']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_6_text]', 'priority' => 32)));
    // Home 7
    $wp_customize->add_setting('elite[home_7]', array('default' => $options['home_7']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_7', array('label' => $options['home_7']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_7]', 'priority' => 35)));
    // Home 7 Text
    $wp_customize->add_setting('elite[home_7_text]', array('default' => $options['home_7_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_7_text', array('label' => $options['home_7_text']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_7_text]', 'priority' => 37)));
    // Home 8
    $wp_customize->add_setting('elite[home_8]', array('default' => $options['home_8']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_8', array('label' => $options['home_8']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_8]', 'priority' => 40)));
    // Home 8 Text
    $wp_customize->add_setting('elite[home_8_text]', array('default' => $options['home_8_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_8_text', array('label' => $options['home_8_text']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_8_text]', 'priority' => 42)));
    // Home 9
    $wp_customize->add_setting('elite[home_9]', array('default' => $options['home_9']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_9', array('label' => $options['home_9']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_9]', 'priority' => 45)));
    // Home 9 Text
    $wp_customize->add_setting('elite[home_9_text]', array('default' => $options['home_9_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_9_text', array('label' => $options['home_9_text']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_9_text]', 'priority' => 47)));
    // Home 10
    $wp_customize->add_setting('elite[home_10]', array('default' => $options['home_10']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_10', array('label' => $options['home_10']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_10]', 'priority' => 50)));
    // Home 10 Text
    $wp_customize->add_setting('elite[home_10_text]', array('default' => $options['home_10_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'home_10_text', array('label' => $options['home_10_text']['name'], 'section' => 'organizedthemes_home_sections', 'settings' => 'elite[home_10_text]', 'priority' => 52)));
    // Content Colors
    $wp_customize->add_section('organizedthemes_content', array('title' => __('Main Content', 'organizedthemes'), 'priority' => 30));
    // Body Font
    $wp_customize->add_setting('elite[body_font][face]', array('default' => $options['body_font']['std']['face'], 'type' => 'option'));
    $wp_customize->add_control('body_font', array('label' => $options['body_font']['name'], 'section' => 'organizedthemes_content', 'settings' => 'elite[body_font][face]', 'type' => 'select', 'choices' => $options['body_font']['options']['faces'], 'priority' => 5));
    // Content Text Color
    $wp_customize->add_setting('elite[content_text]', array('default' => $options['content_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'content_text', array('label' => $options['content_text']['name'], 'section' => 'organizedthemes_content', 'settings' => 'elite[content_text]', 'priority' => 10)));
    // Content Background Color
    $wp_customize->add_setting('elite[content_background]', array('default' => $options['content_background']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'content_background', array('label' => $options['content_background']['name'], 'section' => 'organizedthemes_content', 'settings' => 'elite[content_background]', 'priority' => 15)));
    // Heading Font
    $wp_customize->add_setting('elite[heading_font][face]', array('default' => $options['heading_font']['std']['face'], 'type' => 'option'));
    $wp_customize->add_control('heading_font', array('label' => $options['heading_font']['name'], 'section' => 'organizedthemes_content', 'settings' => 'elite[heading_font][face]', 'type' => 'select', 'choices' => $options['heading_font']['options']['faces'], 'priority' => 20));
    // Heading Color
    $wp_customize->add_setting('elite[heading_color]', array('default' => $options['heading_color']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'heading_color', array('label' => $options['heading_color']['name'], 'section' => 'organizedthemes_content', 'settings' => 'elite[heading_color]', 'priority' => 25)));
    // Link Color
    $wp_customize->add_setting('elite[link_color]', array('default' => $options['link_color']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => $options['link_color']['name'], 'section' => 'organizedthemes_content', 'settings' => 'elite[link_color]', 'priority' => 30)));
    // Link Color Hover
    $wp_customize->add_setting('elite[link_color_hover]', array('default' => $options['link_color_hover']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color_hover', array('label' => $options['link_color_hover']['name'], 'section' => 'organizedthemes_content', 'settings' => 'elite[link_color_hover]', 'priority' => 35)));
    // Product Text
    $wp_customize->add_setting('elite[product_text]', array('default' => $options['product_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'product_text', array('label' => $options['product_text']['name'], 'section' => 'organizedthemes_content', 'settings' => 'elite[product_text]', 'priority' => 40)));
    // Product Background
    $wp_customize->add_setting('elite[product_background]', array('default' => $options['product_background']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'product_background', array('label' => $options['product_background']['name'], 'section' => 'organizedthemes_content', 'settings' => 'elite[product_background]', 'priority' => 45)));
    // Footer Colors
    $wp_customize->add_section('organizedthemes_footer', array('title' => __('Footer', 'organizedthemes'), 'priority' => 40));
    // Footer Text Left
    $wp_customize->add_setting('elite[footer_text]', array('default' => $options['footer_text']['std'], 'type' => 'option'));
    $wp_customize->add_control('footer_text', array('label' => $options['footer_text']['name'], 'section' => 'organizedthemes_footer', 'settings' => 'elite[footer_text]', 'type' => $options['footer_text']['footer_text'], 'priority' => 5));
    // Footer Text Right
    $wp_customize->add_setting('elite[footer_text_right]', array('default' => $options['footer_text_right']['std'], 'type' => 'option'));
    $wp_customize->add_control('footer_text_right', array('label' => $options['footer_text_right']['name'], 'section' => 'organizedthemes_footer', 'settings' => 'elite[footer_text_right]', 'type' => $options['footer_text_right']['footer_text'], 'priority' => 10));
    // Footer Color
    $wp_customize->add_setting('elite[footer_color]', array('default' => $options['footer_color']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_color', array('label' => $options['footer_color']['name'], 'section' => 'organizedthemes_footer', 'settings' => 'elite[footer_color]', 'priority' => 15)));
    // Footer Background Color
    $wp_customize->add_setting('elite[footer_background_color]', array('default' => $options['footer_background_color']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_background_color', array('label' => $options['footer_background_color']['name'], 'section' => 'organizedthemes_footer', 'settings' => 'elite[footer_background_color]', 'priority' => 20)));
    // Footer Link Color
    $wp_customize->add_setting('elite[footer_link_color]', array('default' => $options['footer_link_color']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_link_color', array('label' => $options['footer_link_color']['name'], 'section' => 'organizedthemes_footer', 'settings' => 'elite[footer_link_color]', 'priority' => 25)));
    // Footer Link Color Hover
    $wp_customize->add_setting('elite[footer_link_color_hover]', array('default' => $options['footer_link_color_hover']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_link_color_hover', array('label' => $options['footer_link_color_hover']['name'], 'section' => 'organizedthemes_footer', 'settings' => 'elite[footer_link_color_hover]', 'priority' => 30)));
    // Footer Line Color
    $wp_customize->add_setting('elite[footer_line]', array('default' => $options['footer_line']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_line', array('label' => $options['footer_line']['name'], 'section' => 'organizedthemes_footer', 'settings' => 'elite[footer_line]', 'priority' => 35)));
    // Widgets
    $wp_customize->add_section('organizedthemes_widget', array('title' => __('Widgets', 'organizedthemes'), 'priority' => 50));
    // Widget Title Font
    $wp_customize->add_setting('elite[widget_title_font][face]', array('default' => $options['widget_title_font']['std']['face'], 'type' => 'option'));
    $wp_customize->add_control('widget_title_font', array('label' => $options['widget_title_font']['name'], 'section' => 'organizedthemes_widget', 'settings' => 'elite[widget_title_font][face]', 'type' => 'select', 'choices' => $options['widget_title_font']['options']['faces'], 'priority' => 5));
    // Widget Title Color
    $wp_customize->add_setting('elite[widget_title]', array('default' => $options['widget_title']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'widget_title', array('label' => $options['widget_title']['name'], 'section' => 'organizedthemes_widget', 'settings' => 'elite[widget_title]', 'priority' => 10)));
    // Widget Text Color
    $wp_customize->add_setting('elite[widget_text]', array('default' => $options['widget_text']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'widget_text', array('label' => $options['widget_text']['name'], 'section' => 'organizedthemes_widget', 'settings' => 'elite[widget_text]', 'priority' => 15)));
    // Widget Background Color
    $wp_customize->add_setting('elite[widget_background]', array('default' => $options['widget_background']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'widget_background', array('label' => $options['widget_background']['name'], 'section' => 'organizedthemes_widget', 'settings' => 'elite[widget_background]', 'priority' => 20)));
    // Buttons
    $wp_customize->add_section('organizedthemes_buttons', array('title' => __('Buttons', 'organizedthemes'), 'priority' => 60));
    // Button Color
    $wp_customize->add_setting('elite[button]', array('default' => $options['button']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'button', array('label' => $options['button']['name'], 'section' => 'organizedthemes_buttons', 'settings' => 'elite[button]', 'priority' => 5)));
    // Button Background Color
    $wp_customize->add_setting('elite[button_background]', array('default' => $options['button_background']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'button_background', array('label' => $options['button_background']['name'], 'section' => 'organizedthemes_buttons', 'settings' => 'elite[button_background]', 'priority' => 10)));
    // Button Hover Color
    $wp_customize->add_setting('elite[button_hover]', array('default' => $options['button_hover']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'button_hover', array('label' => $options['button_hover']['name'], 'section' => 'organizedthemes_buttons', 'settings' => 'elite[button_hover]', 'priority' => 15)));
    // Button Background Hover Color
    $wp_customize->add_setting('elite[button_background_hover]', array('default' => $options['button_background_hover']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'button_background_hover', array('label' => $options['button_background_hover']['name'], 'section' => 'organizedthemes_buttons', 'settings' => 'elite[button_background_hover]', 'priority' => 20)));
    // Social Icons
    $wp_customize->add_section('organizedthemes_social', array('title' => __('Social Icons', 'organizedthemes'), 'priority' => 70));
    // Icon Color
    $wp_customize->add_setting('elite[social_color]', array('default' => $options['social_color']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'social_color', array('label' => $options['social_color']['name'], 'section' => 'organizedthemes_social', 'settings' => 'elite[social_color]', 'priority' => 5)));
    // Icon Color Background
    $wp_customize->add_setting('elite[social_color_background]', array('default' => $options['social_color_background']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'social_color_background', array('label' => $options['social_color_background']['name'], 'section' => 'organizedthemes_social', 'settings' => 'elite[social_color_background]', 'priority' => 10)));
    // Icon Color Hover
    $wp_customize->add_setting('elite[social_color_hover]', array('default' => $options['social_color_hover']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'social_color_hover', array('label' => $options['social_color_hover']['name'], 'section' => 'organizedthemes_social', 'settings' => 'elite[social_color_hover]', 'priority' => 15)));
    // Icon Color Background Hover
    $wp_customize->add_setting('elite[social_color_background_hover]', array('default' => $options['social_color_background_hover']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'social_color_background_hover', array('label' => $options['social_color_background_hover']['name'], 'section' => 'organizedthemes_social', 'settings' => 'elite[social_color_background_hover]', 'priority' => 20)));
}
/**
 * Generates the options fields that are used in the form.
 */
function optionsframework_fields()
{
    global $allowedtags;
    $optionsframework_settings = get_option('optionsframework');
    // Get the theme name so we can display it up top
    if (function_exists('wp_get_theme')) {
        $themename = wp_get_theme();
    } else {
        // 'get_theme_data' deprecated as of WP 3.4
        $themename = get_theme_data(get_stylesheet_directory() . '/style.css');
    }
    $themename = $themename['Name'];
    // Gets the unique option id
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    $settings = get_option($option_name);
    // pls_dump($option_name);
    // pls_dump($settings);
    $options = optionsframework_options();
    $counter = 0;
    $menu = '';
    $output = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        $select_value = '';
        $checked = '';
        // 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";
            $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
            $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
        }
        // Set default value to $val
        if (isset($value['std'])) {
            $val = $value['std'];
        }
        // If the option is already saved, ovveride $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'];
        }
        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) . '" />';
                break;
            case 'integer':
                $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '" />';
                break;
                // Textarea
            // Textarea
            case 'textarea':
                $cols = '8';
                $ta_value = '';
                if (isset($value['options'])) {
                    $ta_options = $value['options'];
                    if (isset($ta_options['cols'])) {
                        $cols = $ta_options['cols'];
                    } else {
                        $cols = '8';
                    }
                }
                $val = stripslashes($val);
                $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" cols="' . esc_attr($cols) . '" rows="8">' . esc_textarea($val) . '</textarea>';
                break;
                // Select Box
            // Select Box
            case $value['type'] == 'select':
                $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                foreach ($value['options'] as $key => $option) {
                    $selected = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' selected="selected"';
                        }
                    }
                    $output .= '<option' . $selected . ' 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 = '';
                    $checked = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' of-radio-img-selected';
                            $checked = ' checked="checked"';
                        }
                    }
                    $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . $checked . ' />';
                    $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":
                $output .= '<ul class="multicheck-list">';
                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 .= '<li>';
                    $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>';
                    $output .= '</li>';
                }
                $output .= '</ul>';
                break;
                // Color picker
            // Color picker
            case "color":
                $output .= '<div id="' . esc_attr($value['id'] . '_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $val) . '"></div></div>';
                $output .= '<input class="of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($val) . '" />';
                break;
                // Uploader
            // Uploader
            case "upload":
                $output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
                // New AJAX Uploader using Media Library
                break;
                // Typography
            // Typography
            case 'typography':
                $typography_stored = $val;
                // Check if null
                if (!isset($typography_stored['size'])) {
                    $typography_stored['size'] = '';
                }
                if (!isset($typography_stored['face'])) {
                    $typography_stored['face'] = '';
                }
                if (!isset($typography_stored['style'])) {
                    $typography_stored['style'] = '';
                }
                if (!isset($typography_stored['color'])) {
                    $typography_stored['color'] = '';
                }
                // Font Size
                $output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                for ($i = 9; $i < 71; $i++) {
                    $size = $i . 'px';
                    // Check if null
                    if (!isset($typography_stored['size'])) {
                        $typography_stored['size'] = '';
                    }
                    $output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                }
                $output .= '</select>';
                // Font Face
                $output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                $faces = of_recognized_font_faces();
                // Check if null
                if (!isset($typography_stored['face'])) {
                    $typography_stored['face'] = '';
                }
                foreach ($faces as $key => $face) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                }
                $output .= '</select>';
                // Font Weight
                $output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                /* Font Style */
                // Check if null
                if (!isset($typography_stored['style'])) {
                    $typography_stored['style'] = '';
                }
                $styles = of_recognized_font_styles();
                foreach ($styles as $key => $style) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
                }
                $output .= '</select>';
                // Font Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
                $output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
                break;
                // BG Gradient -pek
            // BG Gradient -pek
            case 'bg_gradient':
                $bggradient = $val;
                if (!isset($bggradient['color'])) {
                    $bggradient['color'] = '';
                }
                // Color (main color used for gradient manufacture)
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $bggradient['color']) . '"></div></div>';
                $output .= '<input class="of-color of-background of-background-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($bggradient['color']) . '" />';
                break;
                // Background
            // Background
            case 'background':
                // pls_dump($val);
                $background = $val;
                // Check if null
                if (!isset($background['repeat'])) {
                    $background['repeat'] = '';
                }
                if (!isset($background['position'])) {
                    $background['position'] = '';
                }
                if (!isset($background['attachment'])) {
                    $background['attachment'] = '';
                }
                if (!isset($background['image'])) {
                    $background['image'] = '';
                }
                if (!isset($background['color'])) {
                    $background['color'] = '';
                }
                // checking a new value, a checkbox, indicating desire to make gradation of color
                if (!isset($background['gradation'])) {
                    $background['gradation'] = '';
                }
                // Background Color
                // Background gradation
                $output .= '<input type="checkbox" class="checkbox of-background of-background-gradation" name="' . esc_attr($option_name . '[' . $value['id'] . '][gradation]') . '" id="' . esc_attr($value['id'] . '_gradation') . '" value="1" ' . checked($background['gradation'], 1, false) . '>Make gradation';
                $output .= "<div style='clear:left;'></div>\n";
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $background['color']) . '"></div></div>';
                $output .= '<input class="of-color of-background of-background-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($background['color']) . '" />';
                // Background Image - New AJAX Uploader using Media Library
                $output .= optionsframework_medialibrary_uploader($value['id'], $background['image'], null, '', 0, '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;
                // Info
            // Info
            case "info":
                $class = 'section';
                if (isset($value['type'])) {
                    $class .= ' section-' . $value['type'];
                }
                if (isset($value['class'])) {
                    $class .= ' ' . $value['class'];
                }
                $output .= '<div class="' . esc_attr($class) . '">' . "\n";
                if (isset($value['name'])) {
                    $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                }
                if ($value['desc']) {
                    $output .= apply_filters('of_sanitize_info', $value['desc']) . "\n";
                }
                $output .= '<div class="clear"></div></div>' . "\n";
                break;
                // Border
            // Border
            case 'border_shadow':
            case 'box_shadow':
            case 'border':
                $border_stored = $val;
                // Check if null
                if (!isset($border_stored['size'])) {
                    $border_stored['size'] = '';
                }
                if (!isset($border_stored['style'])) {
                    $border_stored['style'] = '';
                }
                if (!isset($border_stored['color'])) {
                    $border_stored['color'] = '';
                }
                // Border Size
                $output .= '<select class="of-border of-border-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                for ($i = 0; $i < 11; $i++) {
                    $size = $i . 'px';
                    // select 1px by default if empty
                    $stored_or_one = '' === $border_stored['size'] ? '1px' : $border_stored['size'] . 'px';
                    $output .= '<option value="' . esc_attr($size) . '" ' . selected($stored_or_one, $size, false) . '>' . esc_html($size) . '</option>';
                }
                $output .= '</select>';
                // Border Style
                $styles = of_recognized_border_styles();
                $output .= '<select class="of-border of-border-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                foreach ($styles as $key => $style) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($border_stored['style'], $key, false) . '>' . $style . '</option>';
                }
                $output .= '</select>';
                // Border Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $border_stored['color']) . '"></div></div>';
                $output .= '<input class="of-color of-border of-border-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($border_stored['color']) . '" />';
                break;
            case "slideshow":
                if (!isset($val['num_slides'])) {
                    $val['num_slides'] = 6;
                }
                ob_start();
                for ($i = 0; $i < $val['num_slides']; $i++) {
                    ?>
					<?php 
                    if (!isset($val[$i])) {
                        ?>
						<?php 
                        $val[$i] = array();
                        ?>
					<?php 
                    }
                    ?>
					<?php 
                    $val[$i] = wp_parse_args($val[$i], array('image' => '', 'link' => '', 'html' => '', 'type' => '', ''));
                    ?>
					<div class="featured_slideshow_options">
						<div class="featured_slide">
							<div class="featured_slide_header">
								<h2>Slide <?php 
                    echo $i + 1;
                    ?>
</h2>
								<select class="slideshow_type" name="<?php 
                    echo esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][type]');
                    ?>
" id="" >
									<option value="custom" <?php 
                    echo $val[$i]['type'] == 'custom' ? 'selected=selected' : '';
                    ?>
 >Custom Image</option>
									<option value="listing" <?php 
                    echo $val[$i]['type'] == 'listing' ? 'selected=selected' : '';
                    ?>
 >Listing</option>
								</select>
							</div>
							<div class="type_controls" id="custom_type">
								<p>Select an image for the background of the slide and enter in text or html to be displayed. </p>
								<div id="image_wrapper_<?php 
                    echo $i;
                    ?>
" class="item_row">
									<label for="">Background Image</label>
									<?php 
                    echo optionsframework_medialibrary_uploader($value['id'], $val[$i]['image'], null, '', 0, "image", $i);
                    ?>
		
								</div>
								<div class="item_row">
									<label for="">Click-to Link</label>
									<input type="text" value="<?php 
                    echo $val[$i]['link'];
                    ?>
" name="<?php 
                    echo esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][link]');
                    ?>
">
								</div>
								<div class="item_row">
									<label for="">HTML/Text Displayed</label>
									<textarea name="<?php 
                    echo esc_attr($option_name . '[' . $value['id'] . '][' . $i . '][html]');
                    ?>
" id="" cols="30" rows="10"><?php 
                    echo $val[$i]['html'];
                    ?>
</textarea>	
								</div>
							</div>
							<div class="type_controls" id="listing_type">
								<?php 
                    echo pls_generate_featured_listings_ui($value, $val[$i], $option_name, $i, $for_slideshow = true);
                    ?>
		
							</div>
						</div>						
					</div>
				<?php 
                }
                $output .= trim(ob_get_clean());
                break;
                // Featured Listing Selection
            // Featured Listing Selection
            case "featured_listing":
                $output .= pls_generate_featured_listings_ui($value, $val, $option_name);
                break;
                // Featured Listing Selection
            // Featured Listing Selection
            case "featured_neighborhoods":
                ob_start();
                ?>

			<div class="featured-listing-search" id="featured-listing-search-<?php 
                echo $value['id'];
                ?>
">

				<div class="fls-address">

          <label>Neighborhoods</label>
          <?php 
                $categories = get_categories('type=property&taxonomy=neighborhood');
                ?>
          <select name="<?php 
                echo $value['id'];
                ?>
" class="fls-address-select" id="fls-select-neighborhood">
            <?php 
                for ($i = 1; $i <= 200; $i++) {
                    if (!isset($categories[$i])) {
                        break;
                    } else {
                        echo '<option value=' . $categories[$i]->slug . '>';
                        echo $categories[$i]->name;
                        echo '</option>';
                    }
                }
                ?>
          </select>
          

					<input type="submit" name="<?php 
                echo $value['id'];
                ?>
" value="Add Neighborhood" class="fls-add-listing button" id="add-listing-<?php 
                echo $value['id'];
                ?>
">	
					<input type="hidden" value="<?php 
                echo esc_attr($option_name . '[' . $value['id'] . ']');
                ?>
" id="option-name">	

				</div>

				<h4 class="heading">Featured Neighborhoods</h4>
				<div class="fls-option">
					<div class="controls">
						<ul name="<?php 
                echo $value['id'];
                ?>
" id="fls-added-listings">
							<?php 
                if (isset($settings[$value['id']])) {
                    ?>
								<?php 
                    foreach ($settings[$value['id']] as $key => $text) {
                        ?>
									<li style='float:left; list-style-type: none;'><div id='pls-featured-text' style='width: 200px; float: left;'><?php 
                        echo $text;
                        ?>
</div><a style='float:left;' href='#' id='pls-option-remove-listing'>Remove</a><input type='hidden' name='<?php 
                        echo esc_attr($option_name . '[' . $value['id'] . '][' . $key . ']=');
                        ?>
' value='<?php 
                        echo $text;
                        ?>
' /></li>
								<?php 
                    }
                    ?>
							<?php 
                }
                ?>
						</ul>
					</div>
					<div class="clear"></div>
				</div>
			</div>


			<?php 
                $output .= trim(ob_get_clean());
                break;
                // Heading for Navigation
            // Heading for Navigation
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $jquery_click_hook = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['name']));
                $jquery_click_hook = "of-option-" . $jquery_click_hook;
                $menu .= '<li class="side-bar-nav-item"><a id="' . esc_attr($jquery_click_hook) . '-tab" class="nav-tab" title="' . esc_attr($value['name']) . '" href="' . esc_attr('#' . $jquery_click_hook) . '">' . esc_html($value['name']) . '</a></li>';
                ob_start();
                ?>

			<div class="group" id="<?php 
                echo esc_attr($jquery_click_hook);
                ?>
">
				<h3 id="optionsframework-submit-top" >
					<div>
						<span><?php 
                echo esc_html($value['name']);
                ?>
</span>
						<input type="submit" class="top-button button-primary" name="update" value="Save Options" />
					</div>	
				</h3>

			<?php 
                $output .= ob_get_clean();
                break;
        }
        if ($value['type'] != "heading" && $value['type'] != "info") {
            if ($value['type'] != "checkbox") {
                $output .= '<br/>';
            }
            $output .= '</div>';
            if ($value['type'] != "checkbox") {
                $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
            }
            $output .= '<div class="clear"></div></div></div>' . "\n";
        }
    }
    $for_slideshow = isset($for_slideshow) ? $for_slideshow : false;
    $output .= PLS_Featured_Listing_Option::load(array('value' => $value, 'val' => $val, 'option_name' => $option_name, 'iterator' => isset($iterator) ? $iterator : false, 'for_slideshow' => $for_slideshow));
    $output .= '</div>';
    return array($output, $menu);
}
/**
 * Generates the options fields that are used in the form.
 */
function optionsframework_fields()
{
    global $allowedtags;
    $optionsframework_settings = get_option('optionsframework');
    // Get the theme name so we can display it up top
    $themename = get_theme_data(STYLESHEETPATH . '/style.css');
    $themename = $themename['Name'];
    // Gets the unique option id
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    $settings = get_option($option_name);
    $options = optionsframework_options();
    $counter = 0;
    $menu = '';
    $output = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        $select_value = '';
        $checked = '';
        // Wrap all options
        if ($value['type'] != "heading" && $value['type'] != "info") {
            // Keep all ids lowercase with no spaces
            //if ( isset( $value['id'] ) ){
            $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";
            $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
            $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
        }
        // Set default value to $val
        if (isset($value['std'])) {
            $val = $value['std'];
        }
        // If the option is already saved, ovveride $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'];
        }
        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) . '" />';
                break;
                // Textarea
            // Textarea
            case 'textarea':
                $cols = '8';
                $ta_value = '';
                if (isset($value['options'])) {
                    $ta_options = $value['options'];
                    if (isset($ta_options['cols'])) {
                        $cols = $ta_options['cols'];
                    } else {
                        $cols = '8';
                    }
                }
                $val = stripslashes($val);
                $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" cols="' . esc_attr($cols) . '" rows="8">' . esc_textarea($val) . '</textarea>';
                break;
                // Select Box
            // Select Box
            case $value['type'] == 'select':
                $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                foreach ($value['options'] as $key => $option) {
                    $selected = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' selected="selected"';
                        }
                    }
                    $output .= '<option' . $selected . ' 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 = '';
                    $checked = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' of-radio-img-selected';
                            $checked = ' checked="checked"';
                        }
                    }
                    $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . $checked . ' />';
                    $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":
                $output .= '<div id="' . esc_attr($value['id'] . '_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $val) . '"></div></div>';
                $output .= '<input class="of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($val) . '" />';
                break;
                // Uploader
            // Uploader
            case "upload":
                $output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
                // New AJAX Uploader using Media Library
                break;
                // Typography
            // Typography
            case 'typography':
                $typography_stored = $val;
                // Font Size
                $output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                for ($i = 9; $i < 71; $i++) {
                    $size = $i . 'px';
                    $output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                }
                $output .= '</select>';
                // Font Face
                $output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                $faces = of_recognized_font_faces();
                foreach ($faces as $key => $face) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                }
                $output .= '</select>';
                // Font Weight
                $output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                /* Font Style */
                $styles = of_recognized_font_styles();
                foreach ($styles as $key => $style) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
                }
                $output .= '</select>';
                // Font Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
                $output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
                break;
                // WPBS Typography - removed font size from std typography set of fields
            // WPBS Typography - removed font size from std typography set of fields
            case 'wpbs_typography':
                $wpbs_typography_stored = $val;
                // Font Face
                $output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                $faces = of_recognized_font_faces();
                foreach ($faces as $key => $face) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($wpbs_typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                }
                $output .= '</select>';
                // Font Weight
                $output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                /* Font Style */
                $styles = of_recognized_font_styles();
                foreach ($styles as $key => $style) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($wpbs_typography_stored['style'], $key, false) . '>' . $style . '</option>';
                }
                $output .= '</select>';
                // Font Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $wpbs_typography_stored['color']) . '"></div></div>';
                $output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($wpbs_typography_stored['color']) . '" />';
                break;
                // Background
            // Background
            case 'background':
                $background = $val;
                // Background Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $background['color']) . '"></div></div>';
                $output .= '<input class="of-color of-background of-background-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($background['color']) . '" />';
                // Background Image - New AJAX Uploader using Media Library
                if (!isset($background['image'])) {
                    $background['image'] = '';
                }
                $output .= optionsframework_medialibrary_uploader($value['id'], $background['image'], null, '', 0, '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;
                // Info
            // Info
            case "info":
                $class = 'section';
                if (isset($value['type'])) {
                    $class .= ' section-' . $value['type'];
                }
                if (isset($value['class'])) {
                    $class .= ' ' . $value['class'];
                }
                $output .= '<div class="' . esc_attr($class) . '">' . "\n";
                if (isset($value['name'])) {
                    $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                }
                if ($value['desc']) {
                    $output .= apply_filters('of_sanitize_info', $value['desc']) . "\n";
                }
                $output .= '<div class="clear"></div></div>' . "\n";
                break;
                // Heading for Navigation
            // Heading for Navigation
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $jquery_click_hook = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['name']));
                $jquery_click_hook = "of-option-" . $jquery_click_hook;
                $menu .= '<a id="' . esc_attr($jquery_click_hook) . '-tab" class="nav-tab" title="' . esc_attr($value['name']) . '" href="' . esc_attr('#' . $jquery_click_hook) . '">' . esc_html($value['name']) . '</a>';
                $output .= '<div class="group" id="' . esc_attr($jquery_click_hook) . '">';
                $output .= '<h3>' . esc_html($value['name']) . '</h3>' . "\n";
                break;
            case "themecheck":
                $class = 'section';
                if (isset($value['type'])) {
                    $class .= ' section-' . $value['type'];
                }
                if (isset($value['class'])) {
                    $class .= ' ' . $value['class'];
                }
                $output .= '<div class="' . esc_attr($class) . '">' . "\n";
                $output .= '<a id="check-bootswatch" class="button-secondary">Refresh themes</a>';
                $output .= '<div id="check-status"></div>';
                $output .= '</div>';
                break;
        }
        if ($value['type'] != "heading" && $value['type'] != "info") {
            if ($value['type'] != "checkbox") {
                $output .= '<br/>';
            }
            $output .= '</div>';
            if ($value['type'] != "checkbox") {
                $output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
            }
            $output .= '<div class="clear"></div></div></div>' . "\n";
        }
    }
    $output .= '</div>';
    return array($output, $menu);
}
/**
 * Generates the options fields that are used in the form.
 */
function optionsframework_fields()
{
    global $allowedtags;
    $optionsframework_settings = get_option('optionsframework');
    // Gets the unique option id
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    $settings = get_option($option_name);
    $options = optionsframework_options();
    $counter = 0;
    $menu = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        $select_value = '';
        $checked = '';
        $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, ovveride $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'];
        }
        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) . '" />';
                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 . '">' . esc_attr($val) . '</textarea>';
                break;
                // Select Box
            // Select Box
            case $value['type'] == 'select':
                $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                foreach ($value['options'] as $key => $option) {
                    $selected = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' selected="selected"';
                        }
                    }
                    $output .= '<option' . $selected . ' 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 = '';
                    $checked = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' of-radio-img-selected';
                            $checked = ' checked="checked"';
                        }
                    }
                    $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . $checked . ' />';
                    $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":
                $output .= '<div id="' . esc_attr($value['id'] . '_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $val) . '"></div></div>';
                $output .= '<input class="of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($val) . '" />';
                break;
                // Uploader
            // Uploader
            case "upload":
                $output .= optionsframework_medialibrary_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']) {
                    $font_color = '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
                    $font_color .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['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
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $background['color']) . '"></div></div>';
                $output .= '<input class="of-color of-background of-background-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($background['color']) . '" />';
                // Background Image - New AJAX Uploader using Media Library
                if (!isset($background['image'])) {
                    $background['image'] = '';
                }
                $output .= optionsframework_medialibrary_uploader($value['id'], $background['image'], null, '', 0, '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($editor_settings, $default_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 ($value['desc']) {
                    $output .= apply_filters('of_sanitize_info', $value['desc']) . "\n";
                }
                $output .= '</div>' . "\n";
                break;
                // Heading for Navigation
            // Heading for Navigation
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $class = (isset($value['class']) ? $value['class'] . ' ' : '') . 'nav-tab';
                $jquery_click_hook = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['name']));
                $jquery_click_hook = "of-option-" . $jquery_click_hook;
                $menu .= '<a id="' . esc_attr($jquery_click_hook) . '-tab" class="' . $class . '" title="' . esc_attr($value['name']) . '" href="' . esc_attr('#' . $jquery_click_hook) . '">' . esc_html($value['name']) . '</a>';
                $output .= '<div class="group" id="' . esc_attr($jquery_click_hook) . '">';
                $output .= '<h3>' . esc_html($value['name']) . '</h3>' . "\n";
                break;
                /*********************************
                 *********************************
                 ** CUSTOM FIELDS ****************
                 *********************************
                 *********************************/
                // Heading Typography
            /*********************************
             *********************************
             ** CUSTOM FIELDS ****************
             *********************************
             *********************************/
            // Heading Typography
            case 'typo':
                $typo_stored = $val;
                // Font Size
                $output .= '<p><label>Font Size: </label>';
                $output .= '<select class="of-typography of-typo-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                for ($i = 9; $i < 71; $i++) {
                    $size = $i . 'px';
                    $output .= '<option value="' . esc_attr($size) . '" ' . selected($typo_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                }
                $output .= '</select></p>';
            case 'header':
                $typo_stored = $val;
                // Font Face
                $output .= '<p><label>Font Family: </label>';
                $output .= '<select class="of-typography of-typo-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                $faces = of_recognized_font_faces();
                foreach ($faces as $key => $face) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typo_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                }
                $output .= '</select></p>';
                // Font Style
                $output .= '<p><label>Font Style: </label>';
                $output .= '<select class="of-typography of-typo-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                $styles = ale_get_typo_styles();
                foreach ($styles as $key => $style) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typo_stored['style'], $key, false) . '>' . $style . '</option>';
                }
                $output .= '</select></p>';
                // Font Weight
                $output .= '<p><label>Font Weight: </label>';
                $output .= '<select class="of-typography of-typo-weight" name="' . $option_name . '[' . $value['id'] . '][weight]" id="' . $value['id'] . '_style">';
                $weights = ale_get_typo_weights();
                foreach ($weights as $key => $weight) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typo_stored['weight'], $key, false) . '>' . $weight . '</option>';
                }
                $output .= '</select></p>';
                // Font Variant
                $output .= '<p><label>Font Variant: </label>';
                $output .= '<select class="of-typography of-typo-variant" name="' . $option_name . '[' . $value['id'] . '][variant]" id="' . $value['id'] . '_style">';
                $variants = ale_get_typo_variants();
                foreach ($variants as $key => $variant) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typo_stored['variant'], $key, false) . '>' . $variant . '</option>';
                }
                $output .= '</select></p>';
                // Text Transform
                $output .= '<p><label>Text Transform: </label>';
                $output .= '<select class="of-typography of-typo-transform" name="' . $option_name . '[' . $value['id'] . '][transform]" id="' . $value['id'] . '_style">';
                $transforms = ale_get_typo_transforms();
                foreach ($transforms as $key => $transform) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typo_stored['transform'], $key, false) . '>' . $transform . '</option>';
                }
                $output .= '</select></p>';
                break;
                // Color picker
            // Color picker
            case "color_link":
                $color_stored = $val;
                if (!isset($color_stored['main'])) {
                    $color_stored['main'] = '';
                }
                if (!isset($color_stored['hover'])) {
                    $color_stored['hover'] = '';
                }
                $labels = isset($value['labels']) ? $value['labels'] : array('main' => 'Main', 'hover' => 'Hover');
                $output .= '<div class="color-wrap">';
                $output .= '<span class="color_helper">' . $labels['main'] . ':</span>';
                $output .= '<div id="' . esc_attr($value['id'] . '_main_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $color_stored['main']) . '"></div></div>';
                $output .= '<input class="of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '[main]" id="' . esc_attr($value['id']) . '_main" type="text" value="' . esc_attr($color_stored['main']) . '" />';
                $output .= '</div><div class="color-wrap">';
                $output .= '<span class="color_helper">' . $labels['hover'] . ':</span>';
                $output .= '<div id="' . esc_attr($value['id'] . '_hover_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $color_stored['hover']) . '"></div></div>';
                $output .= '<input class="of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '[hover]" id="' . esc_attr($value['id']) . '_hover" type="text" value="' . esc_attr($color_stored['hover']) . '" />';
                $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;
    }
    echo '</div>';
}
/**
 * Generates the options fields that are used in the form.
 */
function optionsframework_fields()
{
    global $allowedtags;
    $optionsframework_settings = get_option('optionsframework');
    // Gets the unique option id
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    $settings = get_option($option_name);
    $options = optionsframework_options();
    $counter = 0;
    $menu = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        $select_value = '';
        $checked = '';
        $output = '';
        // Wrap all options
        if ($value['type'] != "heading" && $value['type'] != "infotext" && $value['type'] != "info" && $value['type'] != "adstwofifty" && $value['type'] != "innertabopen" && $value['type'] != "innertabclose" && $value['type'] != "tabheading" && $value['type'] != "groupcontaineropen" && $value['type'] != "groupcontainerclose") {
            // 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, ovveride $val
        if ($value['type'] != "heading" && $value['type'] != "infotext" && $value['type'] != "info" && $value['type'] != "adstwofifty" && $value['type'] != "innertabopen" && $value['type'] != "innertabclose" && $value['type'] != "tabheading" && $value['type'] != "groupcontaineropen" && $value['type'] != "groupcontainerclose") {
            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'];
        }
        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) . '" />';
                break;
                // Upgrade to PRO
            // Upgrade to PRO
            case 'proupgrade':
                $output .= '<p class="proupgradep">Available in PRO. Upgrade now.</p>';
                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 . '">' . esc_textarea($val) . '</textarea>';
                break;
                // Select Box
            // Select Box
            case $value['type'] == 'select':
                $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                foreach ($value['options'] as $key => $option) {
                    $selected = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' selected="selected"';
                        }
                    }
                    $output .= '<option' . $selected . ' 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 = '';
                    $checked = '';
                    if ($val != '') {
                        if ($val == $key) {
                            $selected = ' of-radio-img-selected';
                            $checked = ' checked="checked"';
                        }
                    }
                    $output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . $checked . ' />';
                    $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;
                // Image Selectors
            // Image Selectors
            case "proimages":
                foreach ($value['options'] as $key => $option) {
                    $output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img-pro" />';
                }
                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":
                $output .= '<div id="' . esc_attr($value['id'] . '_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $val) . '"></div></div>';
                $output .= '<input class="of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($val) . '" />';
                break;
                // Uploader
            // Uploader
            case "upload":
                $output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
                break;
                // Typography
            // Typography
            case 'typography':
                $typography_stored = $val;
                // Font Size
                $output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
                for ($i = 9; $i < 71; $i++) {
                    $size = $i . 'px';
                    $output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
                }
                $output .= '</select>';
                // Font Face
                $output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
                $faces = of_recognized_font_faces();
                foreach ($faces as $key => $face) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
                }
                $output .= '</select>';
                // Font Weight
                $output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
                // Font Style
                $styles = of_recognized_font_styles();
                foreach ($styles as $key => $style) {
                    $output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
                }
                $output .= '</select>';
                // Font Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
                $output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
                break;
                // Background
            // Background
            case 'background':
                $background = $val;
                // Background Color
                $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $background['color']) . '"></div></div>';
                $output .= '<input class="of-color of-background of-background-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($background['color']) . '" />';
                // Background Image - New AJAX Uploader using Media Library
                if (!isset($background['image'])) {
                    $background['image'] = '';
                }
                $output .= optionsframework_medialibrary_uploader($value['id'], $background['image'], null, '', 0, '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($editor_settings, $default_editor_settings);
                wp_editor($val, $value['id'], $editor_settings);
                $output = '';
                break;
                // Info
            // Info
            case "info":
                $class = 'section';
                if (isset($value['type'])) {
                    $class .= ' section-' . $value['type'];
                }
                if (isset($value['class'])) {
                    $class .= ' ' . $value['class'];
                }
                $output .= '<div class="' . esc_attr($class) . '">' . "\n";
                if (isset($value['name'])) {
                    $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
                }
                if ($value['desc']) {
                    $output .= apply_filters('of_sanitize_info', $value['desc']) . "\n";
                }
                $output .= '</div>' . "\n";
                break;
                // Heading for Navigation
            // Heading for Navigation
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $jquery_click_hook = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['name']));
                $jquery_click_hook = "of-option-" . $jquery_click_hook;
                $menu .= '<a id="' . esc_attr($jquery_click_hook) . '-tab" class="nav-tab" title="' . esc_attr($value['name']) . '" href="' . esc_attr('#' . $jquery_click_hook) . '">' . esc_html($value['name']) . '</a>';
                $output .= '<div class="group" id="' . esc_attr($jquery_click_hook) . '">';
                break;
                // testing
            // testing
            case "tabheading":
                $output .= '<div class="tabheading"><p class="tabheadingp">' . esc_html($value['name']) . '</p></div>';
                break;
            case "infotext":
                $output .= '<div class="themenotice"><p>' . esc_html($value['desc']) . '</p></div>';
                break;
            case "innertabopen":
                $output .= '<div id="' . esc_html($value['name']) . '" class="tabcontent">';
                break;
            case "innertabclose":
                $output .= '</div>';
                break;
            case "groupcontaineropen":
                $output .= '<div class="groupcontainer"><div class="groupcontainertitle"><p class="groupcontainertitlep">' . esc_html($value['name']) . '</p></div>';
                break;
            case "groupcontainerclose":
                $output .= '</div>';
                break;
        }
        if ($value['type'] != "heading" && $value['type'] != "infotext" && $value['type'] != "info" && $value['type'] != "adstwofifty" && $value['type'] != "innertabopen" && $value['type'] != "innertabclose" && $value['type'] != "tabheading" && $value['type'] != "groupcontaineropen" && $value['type'] != "groupcontainerclose") {
            $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;
    }
    echo '</div>';
}
Beispiel #27
0
function organizedthemes_customizer_register($wp_customize)
{
    // Change section names
    $wp_customize->get_section('title_tagline')->title = __('Logo', 'simple');
    $wp_customize->get_section('colors')->title = __('Background Color', 'simple');
    // Remove tagline field
    $wp_customize->remove_control('blogdescription');
    /**
     * This is optional, but if you want to reuse some of the defaults
     * or values you already have built in the options panel, you
     * can load them into $options for easy reference
     */
    $options = optionsframework_options();
    // Title & Tagline
    $wp_customize->add_setting('simple[logo]', array('type' => 'option', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => $options['logo']['name'], 'section' => 'title_tagline', 'settings' => 'simple[logo]', 'priority' => 2)));
    // Title font face
    $wp_customize->add_setting('simple[site_title_font][face]', array('default' => $options['site_title_font']['std']['face'], 'type' => 'option', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('site_title_font', array('label' => $options['site_title_font']['name'], 'section' => 'title_tagline', 'settings' => 'simple[site_title_font][face]', 'type' => 'select', 'choices' => $options['site_title_font']['options']['faces'], 'priority' => 3));
    // Title Color
    $wp_customize->add_setting('simple[logo_color]', array('default' => $options['logo_color']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'logo_color', array('label' => $options['logo_color']['name'], 'section' => 'title_tagline', 'settings' => 'simple[logo_color]', 'priority' => 5, 'sanitize_callback' => 'sanitize_hex_color')));
    // Title Color Hover
    $wp_customize->add_setting('simple[logo_color_hover]', array('default' => $options['logo_color_hover']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'logo_color_hover', array('label' => $options['logo_color_hover']['name'], 'section' => 'title_tagline', 'settings' => 'simple[logo_color_hover]', 'priority' => 6)));
    // Content
    $wp_customize->add_section('organizedthemes_content', array('title' => __('Content', 'organizedthemes'), 'priority' => 30));
    // Body font face
    $wp_customize->add_setting('simple[body_font][face]', array('default' => $options['body_font']['std']['face'], 'type' => 'option', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('body_font', array('label' => $options['body_font']['name'], 'section' => 'organizedthemes_content', 'settings' => 'simple[body_font][face]', 'type' => 'select', 'choices' => $options['body_font']['options']['faces'], 'priority' => 5));
    // Body font color
    $wp_customize->add_setting('simple[content_text]', array('default' => $options['content_text']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'content_text', array('label' => $options['content_text']['name'], 'section' => 'organizedthemes_content', 'settings' => 'simple[content_text]', 'priority' => 7)));
    // Heading font face
    $wp_customize->add_setting('simple[heading_font][face]', array('default' => $options['heading_font']['std']['face'], 'type' => 'option', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('heading_font', array('label' => $options['heading_font']['name'], 'section' => 'organizedthemes_content', 'settings' => 'simple[heading_font][face]', 'type' => 'select', 'choices' => $options['heading_font']['options']['faces'], 'priority' => 15));
    // Heading color
    $wp_customize->add_setting('simple[heading_color]', array('default' => $options['heading_color']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'heading_color', array('label' => $options['heading_color']['name'], 'section' => 'organizedthemes_content', 'settings' => 'simple[heading_color]', 'priority' => 17)));
    // Link color
    $wp_customize->add_setting('simple[link_color]', array('default' => $options['link_color']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => $options['link_color']['name'], 'section' => 'organizedthemes_content', 'settings' => 'simple[link_color]', 'priority' => 20)));
    // Link Hover color
    $wp_customize->add_setting('simple[link_color_hover]', array('default' => $options['link_color_hover']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color_hover', array('label' => $options['link_color_hover']['name'], 'section' => 'organizedthemes_content', 'settings' => 'simple[link_color_hover]', 'priority' => 25)));
    // Content Text
    $wp_customize->add_setting('simple[content_text]', array('default' => $options['content_text']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'content_text', array('label' => $options['content_text']['name'], 'section' => 'organizedthemes_content', 'settings' => 'simple[content_text]', 'priority' => 50)));
    // Content Background
    $wp_customize->add_setting('simple[content_background]', array('default' => $options['content_background']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'content_background', array('label' => $options['content_background']['name'], 'section' => 'organizedthemes_content', 'settings' => 'simple[content_background]', 'priority' => 50)));
    // Excerpt or Content
    $wp_customize->add_setting('simple[content_excerpt]', array('default' => $options['content_excerpt']['std'], 'type' => 'option', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('simple_content_excerpt', array('label' => $options['content_excerpt']['name'], 'section' => 'organizedthemes_content', 'settings' => 'simple[content_excerpt]', 'type' => $options['content_excerpt']['type'], 'choices' => $options['content_excerpt']['options'], 'priority' => 60));
    // Buttons
    $wp_customize->add_section('organizedthemes_buttons', array('title' => __('Buttons', 'organizedthemes'), 'priority' => 35));
    // Button color
    $wp_customize->add_setting('simple[button]', array('default' => $options['button']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'button', array('label' => $options['button']['name'], 'section' => 'organizedthemes_buttons', 'settings' => 'simple[button]', 'priority' => 30)));
    // Button background
    $wp_customize->add_setting('simple[button_background]', array('default' => $options['button_background']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'button_background', array('label' => $options['button_background']['name'], 'section' => 'organizedthemes_buttons', 'settings' => 'simple[button_background]', 'priority' => 35)));
    // Button color hover
    $wp_customize->add_setting('simple[button_hover]', array('default' => $options['button_hover']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'button_hover', array('label' => $options['button_hover']['name'], 'section' => 'organizedthemes_buttons', 'settings' => 'simple[button_hover]', 'priority' => 40)));
    // Button background hover
    $wp_customize->add_setting('simple[button_background_hover]', array('default' => $options['button_background_hover']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'button_background_hover', array('label' => $options['button_background_hover']['name'], 'section' => 'organizedthemes_buttons', 'settings' => 'simple[button_background_hover]', 'priority' => 45)));
    // Widgets
    $wp_customize->add_section('organizedthemes_widgets', array('title' => __('Widgets', 'organizedthemes'), 'priority' => 40));
    // Widget Title face
    $wp_customize->add_setting('simple[widget_title_font][face]', array('default' => $options['widget_title_font']['std']['face'], 'type' => 'option', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('widget_title_font', array('label' => $options['widget_title_font']['name'], 'section' => 'organizedthemes_widgets', 'settings' => 'simple[widget_title_font][face]', 'type' => 'select', 'choices' => $options['widget_title_font']['options']['faces'], 'priority' => 1));
    // Widget Title color
    $wp_customize->add_setting('simple[widget_title]', array('default' => $options['widget_title']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'widget_title', array('label' => $options['widget_title']['name'], 'section' => 'organizedthemes_widgets', 'settings' => 'simple[widget_title]', 'priority' => 5)));
    // Widget Text
    $wp_customize->add_setting('simple[widget_text]', array('default' => $options['widget_text']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'widget_text', array('label' => $options['widget_text']['name'], 'section' => 'organizedthemes_widgets', 'settings' => 'simple[widget_text]', 'priority' => 10)));
    // Widget Background
    $wp_customize->add_setting('simple[widget_background]', array('default' => $options['widget_background']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'widget_background', array('label' => $options['widget_background']['name'], 'section' => 'organizedthemes_widgets', 'settings' => 'simple[widget_background]', 'priority' => 15)));
    // Footer
    $wp_customize->add_section('organizedthemes_footer', array('title' => __('Footer', 'organizedthemes'), 'priority' => 50));
    // Footer Text
    $wp_customize->add_setting('simple[footer_text]', array('default' => $options['footer_text']['std'], 'type' => 'option', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('footer_text', array('label' => $options['footer_text']['name'], 'section' => 'organizedthemes_footer', 'settings' => 'simple[footer_text]', 'type' => $options['footer_text']['type']));
    // Footer Color
    $wp_customize->add_setting('simple[footer_color]', array('default' => $options['footer_color']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_color', array('label' => $options['footer_color']['name'], 'section' => 'organizedthemes_footer', 'settings' => 'simple[footer_color]', 'priority' => 65)));
    // Footer Background Color
    $wp_customize->add_setting('simple[footer_background]', array('default' => $options['footer_background']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_background', array('label' => $options['footer_background']['name'], 'section' => 'organizedthemes_footer', 'settings' => 'simple[footer_background]', 'priority' => 67)));
    // Navigation
    // Nav bar color
    $wp_customize->add_setting('simple[navigation_background_color]', array('default' => $options['navigation_background_color']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'navigation_background_color', array('label' => $options['navigation_background_color']['name'], 'section' => 'nav', 'settings' => 'simple[navigation_background_color]', 'priority' => 10)));
    // Navigation item font
    $wp_customize->add_setting('simple[navigation_font][face]', array('default' => $options['navigation_font']['std']['face'], 'type' => 'option', 'sanitize_callback' => 'absint'));
    $wp_customize->add_control('navigation_font', array('label' => $options['navigation_font']['name'], 'section' => 'nav', 'settings' => 'simple[navigation_font][face]', 'type' => 'select', 'choices' => $options['navigation_font']['options']['faces'], 'priority' => 15));
    // Nav Item Color
    $wp_customize->add_setting('simple[navigation_link_color]', array('default' => $options['navigation_link_color']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'navigation_link_color', array('label' => $options['navigation_link_color']['name'], 'section' => 'nav', 'settings' => 'simple[navigation_link_color]', 'priority' => 20)));
    // Nav Item Color Hover
    $wp_customize->add_setting('simple[navigation_link_color_hover]', array('default' => $options['navigation_link_color_hover']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'navigation_link_color_hover', array('label' => $options['navigation_link_color_hover']['name'], 'section' => 'nav', 'settings' => 'simple[navigation_link_color_hover]', 'priority' => 25)));
    // Nav Item Background Color Hover
    $wp_customize->add_setting('simple[navigation_link_color_hover_background]', array('default' => $options['navigation_link_color_hover_background']['std'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'navigation_link_color_hover_background', array('label' => $options['navigation_link_color_hover_background']['name'], 'section' => 'nav', 'settings' => 'simple[navigation_link_color_hover_background]', 'priority' => 25)));
}
Beispiel #28
0
 function duena_register($wp_customize)
 {
     /**
      * This is optional, but if you want to reuse some of the defaults
      * or values you already have built in the options panel, you
      * can load them into $options for easy reference
      */
     $options = optionsframework_options();
     /*-----------------------------------------------------------------------------------*/
     /*	General
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('duena_header', array('title' => __('General', 'duena'), 'priority' => 200));
     /* Search Box */
     $wp_customize->add_setting('duena[g_search_box_id]', array('default' => $options['g_search_box_id']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_search_box_id', array('label' => $options['g_search_box_id']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_search_box_id]', 'type' => $options['g_search_box_id']['type'], 'choices' => $options['g_search_box_id']['options'], 'priority' => 11));
     /* Breadcrumbs */
     $wp_customize->add_setting('duena[g_breadcrumbs_id]', array('default' => $options['g_breadcrumbs_id']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_breadcrumbs_id', array('label' => $options['g_breadcrumbs_id']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_breadcrumbs_id]', 'type' => $options['g_breadcrumbs_id']['type'], 'choices' => $options['g_breadcrumbs_id']['options'], 'priority' => 12));
     /* Portfolio cat */
     $wp_customize->add_setting('duena[g_portfolio_cat]', array('default' => $options['g_portfolio_cat']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_portfolio_cat', array('label' => $options['g_portfolio_cat']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_portfolio_cat]', 'type' => $options['g_portfolio_cat']['type'], 'priority' => 13));
     /* g_author_bio */
     $wp_customize->add_setting('duena[g_author_bio]', array('default' => $options['g_author_bio']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_author_bio', array('label' => $options['g_author_bio']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_author_bio]', 'type' => $options['g_author_bio']['type'], 'choices' => $options['g_author_bio']['options'], 'priority' => 14));
     /* g_author_bio_title */
     $wp_customize->add_setting('duena[g_author_bio_title]', array('default' => $options['g_author_bio_title']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_author_bio_title', array('label' => $options['g_author_bio_title']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_author_bio_title]', 'type' => $options['g_author_bio_title']['type'], 'priority' => 15));
     /* g_author_bio_img */
     $wp_customize->add_setting('duena[g_author_bio_img]', array('type' => 'option'));
     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'g_author_bio_img', array('label' => $options['g_author_bio_img']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_author_bio_img]', 'priority' => 16)));
     /* g_author_bio_message */
     $wp_customize->add_setting('duena[g_author_bio_message]', array('default' => $options['g_author_bio_message']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_author_bio_message', array('label' => $options['g_author_bio_message']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_author_bio_message]', 'type' => 'text', 'priority' => 17));
     /* g_author_bio_social_twitter */
     $wp_customize->add_setting('duena[g_author_bio_social_twitter]', array('default' => $options['g_author_bio_social_twitter']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_author_bio_social_twitter', array('label' => $options['g_author_bio_social_twitter']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_author_bio_social_twitter]', 'type' => $options['g_author_bio_social_twitter']['type'], 'priority' => 18));
     /* g_author_bio_social_facebook */
     $wp_customize->add_setting('duena[g_author_bio_social_facebook]', array('default' => $options['g_author_bio_social_facebook']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_author_bio_social_facebook', array('label' => $options['g_author_bio_social_facebook']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_author_bio_social_facebook]', 'type' => $options['g_author_bio_social_facebook']['type'], 'priority' => 19));
     /* g_author_bio_social_google */
     $wp_customize->add_setting('duena[g_author_bio_social_google]', array('default' => $options['g_author_bio_social_google']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_author_bio_social_google', array('label' => $options['g_author_bio_social_google']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_author_bio_social_google]', 'type' => $options['g_author_bio_social_google']['type'], 'priority' => 20));
     /* g_author_bio_social_linked */
     $wp_customize->add_setting('duena[g_author_bio_social_linked]', array('default' => $options['g_author_bio_social_linked']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_author_bio_social_linked', array('label' => $options['g_author_bio_social_linked']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_author_bio_social_linked]', 'type' => $options['g_author_bio_social_linked']['type'], 'priority' => 21));
     /* g_author_bio_social_rss */
     $wp_customize->add_setting('duena[g_author_bio_social_rss]', array('default' => $options['g_author_bio_social_rss']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_g_author_bio_social_rss', array('label' => $options['g_author_bio_social_rss']['name'], 'section' => 'duena_header', 'settings' => 'duena[g_author_bio_social_rss]', 'type' => $options['g_author_bio_social_rss']['type'], 'priority' => 22));
     /*-----------------------------------------------------------------------------------*/
     /*	Logo
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('duena_logo', array('title' => __('Logo & Favicon', 'duena'), 'priority' => 201));
     /* Logo Type */
     $wp_customize->add_setting('duena[logo_type]', array('default' => $options['logo_type']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_logo_type', array('label' => $options['logo_type']['name'], 'section' => 'duena_logo', 'settings' => 'duena[logo_type]', 'type' => $options['logo_type']['type'], 'choices' => $options['logo_type']['options'], 'priority' => 11));
     /* Logo Path */
     $wp_customize->add_setting('duena[logo_url]', array('type' => 'option'));
     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo_url', array('label' => $options['logo_url']['name'], 'section' => 'duena_logo', 'settings' => 'duena[logo_url]', 'priority' => 12)));
     /* Favicon Path */
     $wp_customize->add_setting('duena[favicon]', array('type' => 'option'));
     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'favicon', array('label' => $options['favicon']['name'], 'section' => 'duena_logo', 'settings' => 'duena[favicon]', 'priority' => 13)));
     /*-----------------------------------------------------------------------------------*/
     /*	Navigation
     		/*-----------------------------------------------------------------------------------*/
     /* Nav Delay */
     $wp_customize->add_setting('duena[sf_delay]', array('default' => $options['sf_delay']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sf_delay', array('label' => $options['sf_delay']['name'], 'section' => 'nav', 'settings' => 'duena[sf_delay]', 'type' => $options['sf_delay']['type'], 'priority' => 11));
     /* nav_fade_in */
     $wp_customize->add_setting('duena[sf_f_animation]', array('default' => $options['sf_f_animation']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sf_f_animation', array('label' => $options['sf_f_animation']['name'], 'section' => 'nav', 'settings' => 'duena[sf_f_animation]', 'type' => $options['sf_f_animation']['type'], 'choices' => $options['sf_f_animation']['options'], 'priority' => 12));
     /* nav_slide_down */
     $wp_customize->add_setting('duena[sf_sl_animation]', array('default' => $options['sf_sl_animation']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sf_sl_animation', array('label' => $options['sf_sl_animation']['name'], 'section' => 'nav', 'settings' => 'duena[sf_sl_animation]', 'type' => $options['sf_sl_animation']['type'], 'choices' => $options['sf_sl_animation']['options'], 'priority' => 13));
     /* nav_speed */
     $wp_customize->add_setting('duena[sf_speed]', array('default' => $options['sf_speed']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sf_speed', array('label' => $options['sf_speed']['name'], 'section' => 'nav', 'settings' => 'duena[sf_speed]', 'type' => $options['sf_speed']['type'], 'choices' => $options['sf_speed']['options'], 'priority' => 14));
     /* Nav Arrows */
     $wp_customize->add_setting('duena[sf_arrows]', array('default' => $options['sf_arrows']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sf_arrows', array('label' => $options['sf_arrows']['name'], 'section' => 'nav', 'settings' => 'duena[sf_arrows]', 'type' => $options['sf_arrows']['type'], 'choices' => $options['sf_arrows']['options'], 'priority' => 15));
     /*-----------------------------------------------------------------------------------*/
     /*  Slider (visualisation)
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('duena_slider_visual', array('title' => __('Slider (visualisation)', 'duena'), 'priority' => 202));
     /* Slider Show */
     $wp_customize->add_setting('duena[sl_show]', array('default' => $options['sl_show']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_show', array('label' => $options['sl_show']['name'], 'section' => 'duena_slider_visual', 'settings' => 'duena[sl_show]', 'type' => $options['sl_show']['type'], 'choices' => $options['sl_show']['options'], 'priority' => 11));
     /* Slider Effect */
     $wp_customize->add_setting('duena[sl_effect]', array('default' => $options['sl_effect']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_effect', array('label' => $options['sl_effect']['name'], 'section' => 'duena_slider_visual', 'settings' => 'duena[sl_effect]', 'type' => $options['sl_effect']['type'], 'choices' => $options['sl_effect']['options'], 'priority' => 12));
     /* Slider Direction */
     $wp_customize->add_setting('duena[sl_direction]', array('default' => $options['sl_direction']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_direction', array('label' => $options['sl_direction']['name'], 'section' => 'duena_slider_visual', 'settings' => 'duena[sl_direction]', 'type' => $options['sl_direction']['type'], 'choices' => $options['sl_direction']['options'], 'priority' => 13));
     /* Slider Slideshow */
     $wp_customize->add_setting('duena[sl_slideshow]', array('default' => $options['sl_slideshow']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_slideshow', array('label' => $options['sl_slideshow']['name'], 'section' => 'duena_slider_visual', 'settings' => 'duena[sl_slideshow]', 'type' => $options['sl_slideshow']['type'], 'choices' => $options['sl_slideshow']['options'], 'priority' => 14));
     /* Slider Controls */
     $wp_customize->add_setting('duena[sl_control]', array('default' => $options['sl_control']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_control', array('label' => $options['sl_control']['name'], 'section' => 'duena_slider_visual', 'settings' => 'duena[sl_control]', 'type' => $options['sl_control']['type'], 'choices' => $options['sl_control']['options'], 'priority' => 15));
     /* Slider Effect */
     $wp_customize->add_setting('duena[sl_direction_nav]', array('default' => $options['sl_direction_nav']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_direction_nav', array('label' => $options['sl_direction_nav']['name'], 'section' => 'duena_slider_visual', 'settings' => 'duena[sl_direction_nav]', 'type' => $options['sl_direction_nav']['type'], 'choices' => $options['sl_direction_nav']['options'], 'priority' => 16));
     /*-----------------------------------------------------------------------------------*/
     /*  Slider (content)
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('duena_slider_content', array('title' => __('Slider (content)', 'duena'), 'priority' => 203));
     /* Slider Number */
     $wp_customize->add_setting('duena[sl_num]', array('default' => $options['sl_num']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_num', array('label' => $options['sl_num']['name'], 'section' => 'duena_slider_content', 'settings' => 'duena[sl_num]', 'type' => $options['sl_num']['type'], 'choices' => $options['sl_num']['options'], 'priority' => 11));
     /* Slider Category */
     $wp_customize->add_setting('duena[sl_category]', array('default' => $options['sl_category']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_category', array('label' => $options['sl_category']['name'], 'section' => 'duena_slider_content', 'settings' => 'duena[sl_category]', 'type' => $options['sl_category']['type'], 'priority' => 12));
     /* Slider Link */
     $wp_customize->add_setting('duena[sl_as_link]', array('default' => $options['sl_as_link']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_as_link', array('label' => $options['sl_as_link']['name'], 'section' => 'duena_slider_content', 'settings' => 'duena[sl_as_link]', 'type' => $options['sl_as_link']['type'], 'choices' => $options['sl_as_link']['options'], 'priority' => 13));
     /* Slider Caption */
     $wp_customize->add_setting('duena[sl_caption]', array('default' => $options['sl_caption']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_caption', array('label' => $options['sl_caption']['name'], 'section' => 'duena_slider_content', 'settings' => 'duena[sl_caption]', 'type' => $options['sl_caption']['type'], 'choices' => $options['sl_caption']['options'], 'priority' => 14));
     /* Slider Caption Title */
     $wp_customize->add_setting('duena[sl_capt_title]', array('default' => $options['sl_capt_title']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_capt_title', array('label' => $options['sl_capt_title']['name'], 'section' => 'duena_slider_content', 'settings' => 'duena[sl_capt_title]', 'type' => $options['sl_capt_title']['type'], 'choices' => $options['sl_capt_title']['options'], 'priority' => 15));
     /* Slider Captiopn Excerpt */
     $wp_customize->add_setting('duena[sl_capt_exc]', array('default' => $options['sl_capt_exc']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_capt_exc', array('label' => $options['sl_capt_exc']['name'], 'section' => 'duena_slider_content', 'settings' => 'duena[sl_capt_exc]', 'type' => $options['sl_capt_exc']['type'], 'choices' => $options['sl_capt_exc']['options'], 'priority' => 16));
     /* Slider Caption Excerpt Length */
     $wp_customize->add_setting('duena[sl_capt_exc_length]', array('default' => $options['sl_capt_exc_length']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_capt_exc_length', array('label' => $options['sl_capt_exc_length']['name'], 'section' => 'duena_slider_content', 'settings' => 'duena[sl_capt_exc_length]', 'type' => $options['sl_capt_exc_length']['type'], 'priority' => 17));
     /* Slider Caption Button */
     $wp_customize->add_setting('duena[sl_capt_btn]', array('default' => $options['sl_capt_btn']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_capt_btn', array('label' => $options['sl_capt_btn']['name'], 'section' => 'duena_slider_content', 'settings' => 'duena[sl_capt_btn]', 'type' => $options['sl_capt_btn']['type'], 'choices' => $options['sl_capt_btn']['options'], 'priority' => 18));
     /* Slider Caption Button Text */
     $wp_customize->add_setting('duena[sl_capt_btn_txt]', array('default' => $options['sl_capt_btn_txt']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_sl_capt_btn_txt', array('label' => $options['sl_capt_btn_txt']['name'], 'section' => 'duena_slider_content', 'settings' => 'duena[sl_capt_btn_txt]', 'type' => $options['sl_capt_btn_txt']['type'], 'priority' => 19));
     /*-----------------------------------------------------------------------------------*/
     /*	Blog
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('duena_blog', array('title' => __('Blog', 'duena'), 'priority' => 204));
     /* Blog sidebar position */
     $wp_customize->add_setting('duena[blog_sidebar_pos]', array('default' => $options['blog_sidebar_pos']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_blog_sidebar_pos', array('label' => $options['blog_sidebar_pos']['name'], 'section' => 'duena_blog', 'settings' => 'duena[blog_sidebar_pos]', 'type' => $options['blog_sidebar_pos']['type'], 'choices' => $options['blog_sidebar_pos']['options'], 'priority' => 11));
     /* Blog image size */
     $wp_customize->add_setting('duena[post_image_size]', array('default' => $options['post_image_size']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_post_image_size', array('label' => $options['post_image_size']['name'], 'section' => 'duena_blog', 'settings' => 'duena[post_image_size]', 'type' => $options['post_image_size']['type'], 'choices' => $options['post_image_size']['options'], 'priority' => 12));
     /* Single post image size */
     $wp_customize->add_setting('duena[single_image_size]', array('default' => $options['single_image_size']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_single_image_size', array('label' => $options['single_image_size']['name'], 'section' => 'duena_blog', 'settings' => 'duena[single_image_size]', 'type' => $options['single_image_size']['type'], 'choices' => $options['single_image_size']['options'], 'priority' => 13));
     /* Post Meta */
     $wp_customize->add_setting('duena[post_meta]', array('default' => $options['post_meta']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_post_meta', array('label' => $options['post_meta']['name'], 'section' => 'duena_blog', 'settings' => 'duena[post_meta]', 'type' => $options['post_meta']['type'], 'choices' => $options['post_meta']['options'], 'priority' => 14));
     /* Post Excerpt */
     $wp_customize->add_setting('duena[post_excerpt]', array('default' => $options['post_excerpt']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_post_excerpt', array('label' => $options['post_excerpt']['name'], 'section' => 'duena_blog', 'settings' => 'duena[post_excerpt]', 'type' => $options['post_excerpt']['type'], 'choices' => $options['post_excerpt']['options'], 'priority' => 15));
     /* Post Button */
     $wp_customize->add_setting('duena[post_button]', array('default' => $options['post_button']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_post_button', array('label' => $options['post_button']['name'], 'section' => 'duena_blog', 'settings' => 'duena[post_button]', 'type' => $options['post_button']['type'], 'choices' => $options['post_button']['options'], 'priority' => 16));
     /* Post Button Text */
     $wp_customize->add_setting('duena[post_button_txt]', array('default' => $options['post_button_txt']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_post_button_txt', array('label' => $options['post_button_txt']['name'], 'section' => 'duena_blog', 'settings' => 'duena[post_button_txt]', 'type' => $options['post_button_txt']['type'], 'priority' => 17));
     /* Post author */
     $wp_customize->add_setting('duena[post_author]', array('default' => $options['post_author']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_post_author', array('label' => $options['post_author']['name'], 'section' => 'duena_blog', 'settings' => 'duena[post_author]', 'type' => $options['post_author']['type'], 'choices' => $options['post_author']['options'], 'priority' => 19));
     /* Related title */
     $wp_customize->add_setting('duena[blog_related]', array('default' => $options['blog_related']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_blog_related', array('label' => $options['blog_related']['name'], 'section' => 'duena_blog', 'settings' => 'duena[blog_related]', 'type' => $options['blog_related']['type'], 'priority' => 20));
     /*-----------------------------------------------------------------------------------*/
     /*	Portfolio
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('duena_portfolio', array('title' => __('Portfolio', 'duena'), 'priority' => 205));
     /* Per page */
     $wp_customize->add_setting('duena[portfolio_per_page]', array('default' => $options['portfolio_per_page']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_portfolio_per_page', array('label' => $options['portfolio_per_page']['name'], 'section' => 'duena_portfolio', 'settings' => 'duena[portfolio_per_page]', 'type' => $options['portfolio_per_page']['type'], 'priority' => 11));
     /* Thumb */
     $wp_customize->add_setting('duena[portfolio_show_thumbnail]', array('default' => $options['portfolio_show_thumbnail']['std'], 'type' => 'option'));
     $wp_customize->add_control('portfolio_show_thumbnail', array('label' => $options['portfolio_show_thumbnail']['name'], 'section' => 'duena_portfolio', 'settings' => 'duena[portfolio_show_thumbnail]', 'type' => $options['portfolio_show_thumbnail']['type'], 'choices' => $options['portfolio_show_thumbnail']['options'], 'priority' => 12));
     /* Title */
     $wp_customize->add_setting('duena[portfolio_show_title]', array('default' => $options['portfolio_show_title']['std'], 'type' => 'option'));
     $wp_customize->add_control('portfolio_show_title', array('label' => $options['portfolio_show_title']['name'], 'section' => 'duena_portfolio', 'settings' => 'duena[portfolio_show_title]', 'type' => $options['portfolio_show_title']['type'], 'choices' => $options['portfolio_show_title']['options'], 'priority' => 13));
     /* Excerpt */
     $wp_customize->add_setting('duena[portfolio_show_excerpt]', array('default' => $options['portfolio_show_excerpt']['std'], 'type' => 'option'));
     $wp_customize->add_control('portfolio_show_excerpt', array('label' => $options['portfolio_show_excerpt']['name'], 'section' => 'duena_portfolio', 'settings' => 'duena[portfolio_show_excerpt]', 'type' => $options['portfolio_show_excerpt']['type'], 'choices' => $options['portfolio_show_excerpt']['options'], 'priority' => 14));
     /* Link */
     $wp_customize->add_setting('duena[portfolio_show_link]', array('default' => $options['portfolio_show_link']['std'], 'type' => 'option'));
     $wp_customize->add_control('portfolio_show_link', array('label' => $options['portfolio_show_link']['name'], 'section' => 'duena_portfolio', 'settings' => 'duena[portfolio_show_link]', 'type' => $options['portfolio_show_link']['type'], 'choices' => $options['portfolio_show_link']['options'], 'priority' => 15));
     /*-----------------------------------------------------------------------------------*/
     /*	Footer
     		/*-----------------------------------------------------------------------------------*/
     $wp_customize->add_section('duena_footer', array('title' => __('Footer', 'duena'), 'priority' => 206));
     /* Footer Copyright Text */
     $wp_customize->add_setting('duena[footer_text]', array('default' => $options['footer_text']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_footer_text', array('label' => $options['footer_text']['name'], 'section' => 'duena_footer', 'settings' => 'duena[footer_text]', 'type' => 'text'));
     /* Display Footer Menu */
     $wp_customize->add_setting('duena[footer_menu]', array('default' => $options['footer_menu']['std'], 'type' => 'option'));
     $wp_customize->add_control('duena_footer_menu', array('label' => $options['footer_menu']['name'], 'section' => 'duena_footer', 'settings' => 'duena[footer_menu]', 'type' => $options['footer_menu']['type'], 'choices' => $options['footer_menu']['options']));
 }
Beispiel #29
0
function edwards_customizer_register($wp_customize)
{
    // This gets the theme name from the stylesheet (lowercase and without spaces)
    $theme = wp_get_theme();
    $themename = $theme->Name;
    $themename = preg_replace("/\\W/", "", strtolower($themename));
    /**
     * This is optional, but if you want to reuse some of the defaults
     * or values you already have built in the options panel, you
     * can load them into $options for easy reference
     */
    $options = optionsframework_options();
    $wp_customize->add_section('edwards_general', array('title' => __('General', 'edwards'), 'priority' => 25));
    $wp_customize->add_setting($themename . '[logo]', array('type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => $options['logo']['name'], 'section' => 'edwards_general', 'settings' => $themename . '[logo]')));
    $wp_customize->add_setting($themename . '[edwards_favicon]', array('type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'edwards_favicon', array('label' => $options['edwards_favicon']['name'], 'section' => 'edwards_general', 'settings' => $themename . '[edwards_favicon]')));
    $wp_customize->add_setting($themename . '[edwards_home_message]', array('default' => $options['edwards_home_message']['std'], 'type' => 'option'));
    $wp_customize->add_control('edwards_customizer_home_message', array('label' => $options['edwards_home_message']['name'], 'section' => 'edwards_general', 'settings' => $themename . '[edwards_home_message]', 'type' => 'text'));
    $wp_customize->add_setting($themename . '[edwards_custom_css]', array('default' => $options['edwards_custom_css']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Textarea_Control($wp_customize, 'edwards_customizer_custom_css', array('label' => $options['edwards_custom_css']['name'], 'section' => 'edwards_general', 'settings' => $themename . '[edwards_custom_css]', 'type' => $options['edwards_custom_css']['type'])));
    /* Appearance */
    $wp_customize->add_section('edwards_appearance', array('title' => __('Appearance', 'edwards'), 'priority' => 26));
    $wp_customize->add_setting($themename . '[edwards_color_scheme]', array('default' => $options['edwards_color_scheme']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'edwards_color_scheme', array('label' => $options['edwards_color_scheme']['name'], 'section' => 'edwards_appearance', 'settings' => $themename . '[edwards_color_scheme]')));
    $wp_customize->add_setting($themename . '[edwards_color_link]', array('default' => $options['edwards_color_link']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'edwards_color_link', array('label' => $options['edwards_color_link']['name'], 'section' => 'edwards_appearance', 'settings' => $themename . '[edwards_color_link]')));
    $wp_customize->add_setting($themename . '[edwards_color_link_hover]', array('default' => $options['edwards_color_link_hover']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'edwards_color_link_hover', array('label' => $options['edwards_color_link_hover']['name'], 'section' => 'edwards_appearance', 'settings' => $themename . '[edwards_color_link_hover]')));
    /* Typography */
    $wp_customize->add_section('edwards_typography', array('title' => __('Typography', 'edwards'), 'priority' => 27));
    $wp_customize->add_setting($themename . '[edwards_heading_font]', array('default' => $options['edwards_heading_font']['std'], 'type' => 'option'));
    $wp_customize->add_control('edwards_customizer_heading_font', array('label' => $options['edwards_heading_font']['name'], 'section' => 'edwards_typography', 'settings' => $themename . '[edwards_heading_font]', 'type' => $options['edwards_heading_font']['type']));
    $wp_customize->add_setting($themename . '[edwards_body_font]', array('default' => $options['edwards_body_font']['std'], 'type' => 'option'));
    $wp_customize->add_control('edwards_customizer_body_font', array('label' => $options['edwards_body_font']['name'], 'section' => 'edwards_typography', 'settings' => $themename . '[edwards_body_font]', 'type' => $options['edwards_body_font']['type']));
    $wp_customize->add_setting($themename . '[edwards_home_message_font]', array('default' => $options['edwards_home_message_font']['std'], 'type' => 'option'));
    $wp_customize->add_control('edwards_customizer_home_message_font', array('label' => $options['edwards_home_message_font']['name'], 'section' => 'edwards_typography', 'settings' => $themename . '[edwards_home_message_font]', 'type' => $options['edwards_home_message_font']['type']));
    /* Slideshow */
    $wp_customize->add_section('edwards_slideshow', array('title' => __('Slideshow', 'edwards'), 'priority' => 28));
    $wp_customize->add_setting($themename . '[edwards_slideshow_enabled]', array('default' => $options['edwards_slideshow_enabled']['std'], 'type' => 'option'));
    $wp_customize->add_control('edwards_slideshow_enabled', array('label' => $options['edwards_slideshow_enabled']['name'], 'section' => 'edwards_slideshow', 'settings' => $themename . '[edwards_slideshow_enabled]', 'type' => $options['edwards_slideshow_enabled']['type']));
    $wp_customize->add_setting($themename . '[edwards_slideshow_delay]', array('default' => $options['edwards_slideshow_delay']['std'], 'type' => 'option'));
    $wp_customize->add_control('edwards_customizer_slideshow_delay', array('label' => $options['edwards_slideshow_delay']['name'], 'section' => 'edwards_slideshow', 'settings' => $themename . '[edwards_slideshow_delay]', 'type' => $options['edwards_slideshow_delay']['type']));
    $wp_customize->add_setting($themename . '[edwards_slideshow_effect]', array('default' => $options['edwards_slideshow_effect']['std'], 'type' => 'option'));
    $wp_customize->add_control('edwards_customizer_slideshow_effect', array('label' => $options['edwards_slideshow_effect']['name'], 'section' => 'edwards_slideshow', 'settings' => $themename . '[edwards_slideshow_effect]', 'type' => $options['edwards_slideshow_effect']['type'], 'choices' => $options['edwards_slideshow_effect']['options']));
    /* Social Links */
    $wp_customize->add_section('edwards_social', array('title' => __('Contacts', 'edwards'), 'priority' => 29));
    $wp_customize->add_setting($themename . '[edwards_address]', array('default' => $options['edwards_address']['std'], 'type' => 'option'));
    $wp_customize->add_control('edwards_address', array('label' => $options['edwards_address']['name'], 'section' => 'edwards_social', 'settings' => $themename . '[edwards_address]', 'type' => $options['edwards_address']['type']));
    $wp_customize->add_setting($themename . '[edwards_street]', array('default' => $options['edwards_street']['std'], 'type' => 'option'));
    $wp_customize->add_control('edwards_street', array('label' => $options['edwards_street']['name'], 'section' => 'edwards_social', 'settings' => $themename . '[edwards_street]', 'type' => $options['edwards_street']['type']));
    $wp_customize->add_setting($themename . '[edwards_phone]', array('default' => $options['edwards_phone']['std'], 'type' => 'option'));
    $wp_customize->add_control('edwards_phone', array('label' => $options['edwards_phone']['name'], 'section' => 'edwards_social', 'settings' => $themename . '[edwards_phone]', 'type' => $options['edwards_phone']['type']));
    $wp_customize->add_setting($themename . '[social_fb]', array('default' => $options['social_fb']['std'], 'type' => 'option'));
    $wp_customize->add_control('social_fb', array('label' => $options['social_fb']['name'], 'section' => 'edwards_social', 'settings' => $themename . '[social_fb]', 'type' => $options['social_fb']['type']));
    $wp_customize->add_setting($themename . '[social_twitter]', array('default' => $options['social_twitter']['std'], 'type' => 'option'));
    $wp_customize->add_control('social_twitter', array('label' => $options['social_twitter']['name'], 'section' => 'edwards_social', 'settings' => $themename . '[social_twitter]', 'type' => $options['social_twitter']['type']));
    $wp_customize->add_setting($themename . '[social_gplus]', array('default' => $options['social_gplus']['std'], 'type' => 'option'));
    $wp_customize->add_control('social_gplus', array('label' => $options['social_gplus']['name'], 'section' => 'edwards_social', 'settings' => $themename . '[social_gplus]', 'type' => $options['social_gplus']['type']));
    $wp_customize->add_setting($themename . '[social_email]', array('default' => $options['social_email']['std'], 'type' => 'option'));
    $wp_customize->add_control('social_email', array('label' => $options['social_email']['name'], 'section' => 'edwards_social', 'settings' => $themename . '[social_email]', 'type' => $options['social_email']['type']));
    /* Footer */
    $wp_customize->add_section('edwards_footer', array('title' => __('Footer', 'edwards'), 'priority' => 31));
    $wp_customize->add_setting($themename . '[edwards_footer_left]', array('default' => $options['edwards_footer_left']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Textarea_Control($wp_customize, 'edwards_customizer_footer_left', array('label' => $options['edwards_footer_left']['name'], 'section' => 'edwards_footer', 'settings' => $themename . '[edwards_footer_left]', 'type' => $options['edwards_footer_left']['type'])));
    $wp_customize->add_setting($themename . '[edwards_footer_right]', array('default' => $options['edwards_footer_right']['std'], 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Textarea_Control($wp_customize, 'edwards_customizer_footer_right', array('label' => $options['edwards_footer_right']['name'], 'section' => 'edwards_footer', 'settings' => $themename . '[edwards_footer_right]', 'type' => $options['edwards_footer_right']['type'])));
}
Beispiel #30
0
/**
 * Format Configuration Array.
 *
 * Get an array of all default values as set in
 * options.php. The 'id','std' and 'type' keys need
 * to be defined in the configuration array. In the
 * event that these keys are not present the option
 * will not be included in this function's output.
 *
 * @return    array     Rey-keyed options configuration array.
 *
 * @access    private
 */
function of_get_default_values($page = null)
{
    $output = $defaults_preset = $saved_options = array();
    $config = optionsframework_options();
    $known_options = get_option('optionsframework', array());
    $tmp_options = get_option($known_options['id'], array());
    $first_run = false;
    if (empty($tmp_options)) {
        $tmp_options['of-preset'] = 'blue';
        $first_run = true;
    }
    if (isset($tmp_options['of-preset'])) {
        $defaults_preset = optionsframework_presets_data($tmp_options['of-preset']);
        if ($first_run) {
            $preserve = array('of_generatortest2');
            foreach ($preserve as $pres) {
                if (isset($defaults_preset[$pres])) {
                    unset($defaults_preset[$pres]);
                }
            }
        }
    }
    if ($page) {
        $arr = array();
        $found = null;
        foreach ($config as $option) {
            if ('options-framework' == $page && null === $found) {
                $found = true;
            } elseif (isset($option['type']) && 'page' == $option['type'] && $option['menu_slug'] == $page) {
                $found = true;
                continue;
            } elseif (isset($option['type']) && 'page' == $option['type']) {
                $found = false;
            }
            if ($found) {
                $arr[] = $option;
            }
        }
        $config = $arr;
        $saved_options = $tmp_options;
    }
    foreach ((array) $config as $option) {
        if (!isset($option['id'])) {
            continue;
        }
        if (!isset($option['std'])) {
            continue;
        }
        if (!isset($option['type'])) {
            continue;
        }
        if (has_filter('of_sanitize_' . $option['type'])) {
            $value = $option['std'];
            if (isset($defaults_preset[$option['id']])) {
                $value = $defaults_preset[$option['id']];
            }
            $output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $value, $option);
        }
    }
    $output = array_merge($saved_options, $output);
    return $output;
}