function options_typography_google_fonts()
 {
     global $font_array, $char_array;
     $all_google_fonts = array_keys(options_typography_get_google_fonts());
     $all_character_sets = array_keys(of_recognized_font_characters());
     // Define all the options that possibly have a unique Google font
     $h1_heading = of_get_option('h1_heading', 'Arial');
     $h2_heading = of_get_option('h2_heading', 'Arial');
     $h3_heading = of_get_option('h3_heading', 'Arial');
     $h4_heading = of_get_option('h4_heading', 'Arial');
     $h5_heading = of_get_option('h5_heading', 'Arial');
     $h6_heading = of_get_option('h6_heading', 'Arial');
     $google_mixed_3 = of_get_option('google_mixed_3', 'Rokkitt, serif');
     if (of_get_option('logo_typography')) {
         $logo_typography = of_get_option('logo_typography');
     }
     if (of_get_option('menu_typography')) {
         $menu_typography = of_get_option('menu_typography', 'Arial');
     }
     if (of_get_option('footer_menu_typography')) {
         $footer_menu_typography = of_get_option('footer_menu_typography', 'Arial');
     }
     // Get the font face for each option and put it in an array
     if (isset($h1_heading) && is_array($h1_heading)) {
         $selected_fonts['h1_heading'] = $h1_heading['face'];
     }
     if (isset($h2_heading) && is_array($h2_heading)) {
         $selected_fonts['h2_heading'] = $h2_heading['face'];
     }
     if (isset($h3_heading) && is_array($h3_heading)) {
         $selected_fonts['h3_heading'] = $h3_heading['face'];
     }
     if (isset($h4_heading) && is_array($h4_heading)) {
         $selected_fonts['h4_heading'] = $h4_heading['face'];
     }
     if (isset($h5_heading) && is_array($h5_heading)) {
         $selected_fonts['h5_heading'] = $h5_heading['face'];
     }
     if (isset($h6_heading) && is_array($h6_heading)) {
         $selected_fonts['h6_heading'] = $h6_heading['face'];
     }
     if (isset($google_mixed_3) && is_array($google_mixed_3)) {
         $selected_fonts['google_mixed_3'] = $google_mixed_3['face'];
     }
     if (isset($logo_typography) && is_array($logo_typography)) {
         $selected_fonts['logo_typography'] = $logo_typography['face'];
     }
     if (isset($menu_typography) && is_array($menu_typography)) {
         $selected_fonts['menu_typography'] = $menu_typography['face'];
     }
     if (isset($footer_menu_typography) && is_array($footer_menu_typography)) {
         $selected_fonts['footer_menu_typography'] = $footer_menu_typography['face'];
     }
     if (isset($h1_heading) && is_array($h1_heading)) {
         $selected_character['h1_heading'] = $h1_heading['character'];
     }
     if (isset($h2_heading) && is_array($h2_heading)) {
         $selected_character['h2_heading'] = $h2_heading['character'];
     }
     if (isset($h3_heading) && is_array($h3_heading)) {
         $selected_character['h3_heading'] = $h3_heading['character'];
     }
     if (isset($h4_heading) && is_array($h4_heading)) {
         $selected_character['h4_heading'] = $h4_heading['character'];
     }
     if (isset($h5_heading) && is_array($h5_heading)) {
         $selected_character['h5_heading'] = $h5_heading['character'];
     }
     if (isset($h6_heading) && is_array($h6_heading)) {
         $selected_character['h6_heading'] = $h6_heading['character'];
     }
     if (isset($google_mixed_3) && is_array($google_mixed_3)) {
         $selected_character['google_mixed_3'] = $google_mixed_3['character'];
     }
     if (isset($logo_typography) && is_array($logo_typography)) {
         $selected_character['logo_typography'] = $logo_typography['character'];
     }
     if (isset($menu_typography) && is_array($menu_typography)) {
         $selected_character['menu_typography'] = $menu_typography['character'];
     }
     if (isset($footer_menu_typography) && is_array($footer_menu_typography)) {
         $selected_character['footer_menu_typography'] = $footer_menu_typography['character'];
     }
     if (isset($selected_fonts) && !empty($selected_fonts)) {
         // Remove any duplicates in the list
         $selected_fonts = array_unique($selected_fonts);
         // Check each of the unique fonts against the defined Google fonts
         // If it is a Google font, go ahead and call the function to enqueue it
         foreach ($selected_fonts as $key => $font) {
             if (in_array($font, $all_google_fonts)) {
                 options_typography_enqueue_google_font($key, $font);
             }
         }
     }
     // $selected_character = array_unique($selected_character);
     if (isset($selected_character) && !empty($selected_character)) {
         foreach ($selected_character as $key => $character) {
             if (in_array($character, $all_character_sets)) {
                 options_typography_enqueue_google_character_set($key, $character);
             }
         }
     }
     if (isset($font_array)) {
         foreach ($font_array as $key => $value) {
             switch ($font_array[$key]) {
                 case 'Open+Sans+Condensed':
                     $font_array[$key] = $font_array[$key] . ':300';
                     break;
                 default:
                     //
                     break;
             }
             options_typography_enqueue_google_fonts($font_array[$key], $char_array[$key]);
         }
     }
 }
/**
 * 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 = combined_option_array();
    $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 . '">' . $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 .= '<div class="img_wrapper">';
                    $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;" />';
                    if (array_key_exists('title', $value)) {
                        $output .= '<div class="img_title">' . $value['title'][$key] . '</div>';
                    }
                    $output .= '</div>';
                }
                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);
                    }
                    if ($label == "") {
                        $label = theme_locals('no_lable');
                    }
                    $output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" value="' . $option . '" 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_lineheight, $font_style, $font_face, $font_character, $font_color);
                $typography_defaults = array('size' => '', 'face' => '', 'character' => '', 'style' => '', 'lineheight' => '', 'color' => '');
                $typography_stored = wp_parse_args($val, $typography_defaults);
                $typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'characters' => of_recognized_font_characters(), 'styles' => of_recognized_font_styles(), 'lineheight' => of_recognized_font_sizes(), 'color' => true);
                if (isset($value['options'])) {
                    $typography_options = wp_parse_args($value['options'], $typography_options);
                }
                // Font Size
                if ($typography_options['sizes']) {
                    $font_size = '<div class="field"><label for="of-typography-size">' . theme_locals('font_size') . '</label>';
                    $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></div>';
                }
                // Lineheights
                if ($typography_options['lineheight']) {
                    $font_lineheight = '<div class="field"><label for="of-typography-lineheight">' . theme_locals('lineheight') . '</label>';
                    $font_lineheight .= '<select class="of-typography of-typography-lineheight" name="' . $option_name . '[' . $value['id'] . '][lineheight]" id="' . $value['id'] . '_style">';
                    $lineheights = $typography_options['lineheight'];
                    foreach ($lineheights as $i) {
                        $lineheight = $i . 'px';
                        $font_lineheight .= '<option value="' . esc_attr($lineheight) . '" ' . selected($typography_stored['lineheight'], $lineheight, false) . '>' . esc_html($lineheight) . '</option>';
                    }
                    $font_lineheight .= '</select></div>';
                }
                // Font Face
                if ($typography_options['faces']) {
                    $font_face = '<div class="field"><label for="of-typography-face">' . theme_locals('font_face') . '</label>';
                    $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></div>';
                }
                // Font Character Sets
                if ($typography_options['characters']) {
                    $font_character = '<div class="field"><label for="of-typography-character">' . theme_locals('character_sets') . '</label>';
                    $font_character .= '<select class="of-typography of-typography-character" name="' . $option_name . '[' . $value['id'] . '][character]" id="' . $value['id'] . '_character">';
                    $characters = $typography_options['characters'];
                    foreach ($characters as $key => $character) {
                        $font_character .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['character'], $key, false) . '>' . $character . '</option>';
                    }
                    $font_character .= '</select></div>';
                }
                // Font Styles
                if ($typography_options['styles']) {
                    $font_style = '<div class="field"><label for="of-typography-style">' . theme_locals('font_style') . '</label>';
                    $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></div>';
                }
                // Font Color
                if ($typography_options['color']) {
                    $font_color = '<div class="field"><label for="of-typography-color">' . theme_locals('color') . '</label>';
                    $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']) . '" /></div>';
                }
                // Allow modification/injection of typography fields
                $typography_fields = compact('font_size', 'font_lineheight', 'font_face', 'font_style', 'font_character', '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";
                }
                $jquery_click_hook = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['name']));
                $jquery_click_hook = "of-option-" . $counter;
                $menu .= '<a 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") {
            $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>';
}