Exemplo n.º 1
0
/**
 * Add default options upon activation else DB does not exist
 *
 * @since 1.0.0
 */
function of_option_setup()
{
    global $of_options, $options_machine;
    of_options();
    $options_machine = new Options_Machine($of_options);
    if (!of_get_options()) {
        of_save_options($options_machine->Defaults());
    }
}
Exemplo n.º 2
0
/**
 * Create Options page
 *
 * @uses add_theme_page()
 * @uses add_action()
 *
 * @since 1.0.0
 */
function optionsframework_add_admin()
{
    // Added by IshYoBoy
    $title = __('Theme Options', 'ishyoboy');
    if ($xml = Options_Machine::ishyoboy_get_updates()) {
        $my_theme = wp_get_theme(THEME_SLUG);
        if (version_compare($my_theme->Version, $xml->latest) == -1) {
            $title = __('Theme Options', 'ishyoboy') . ' ' . '<span class="update-plugins count-1"><span class="update-count">1</span></span>';
        }
    }
    $of_page = add_theme_page(THEMENAME, $title, 'edit_theme_options', 'optionsframework', 'optionsframework_options_page');
    // Add framework functionaily to the head individually
    add_action("admin_print_scripts-{$of_page}", 'of_load_only');
    add_action("admin_print_styles-{$of_page}", 'of_style_only');
    add_action("admin_print_styles-{$of_page}", 'optionsframework_mlu_css', 0);
    add_action("admin_print_scripts-{$of_page}", 'optionsframework_mlu_js', 0);
}
 /**
  * Process options data and build option fields
  *
  * @uses get_option()
  *
  * @access public
  * @since 1.0.0
  *
  * @return array
  */
 public static function optionsframework_machine($options)
 {
     $data = of_get_options();
     $smof_data = of_get_options();
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     foreach ($options as $value) {
         $counter++;
         $val = '';
         //create array of defaults
         if ($value['type'] == 'multicheck') {
             if (is_array($value['std'])) {
                 foreach ($value['std'] as $i => $key) {
                     $defaults[$value['id']][$key] = true;
                 }
             } else {
                 $defaults[$value['id']][$value['std']] = true;
             }
         } else {
             if (isset($value['id'])) {
                 $defaults[$value['id']] = $value['std'];
             }
         }
         //Start Heading
         if ($value['type'] != "heading") {
             $class = '';
             if (isset($value['class'])) {
                 $class = $value['class'];
             }
             //hide items in checkbox group
             $fold = '';
             if (array_key_exists("fold", $value)) {
                 if (@$smof_data[$value['fold']]) {
                     $fold = "f_" . $value['fold'] . " ";
                 } else {
                     $fold = "f_" . $value['fold'] . " temphide ";
                 }
             }
             $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
             //only show header if 'name' value exists
             if ($value['name']) {
                 $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
             }
             if ($value['type'] == 'checkbox' or $value['type'] == 'radio') {
                 $output .= '<label class="option">' . "\n" . '<div class="controls">' . "\n";
             } else {
                 $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
             }
         }
         //End Heading
         // Set default value for absent options
         if (!in_array($value['type'], array('info', 'image', 'heading', 'slider', 'sorter', 'backup', 'transfer')) and !isset($smof_data[$value['id']]) and isset($defaults[$value['id']])) {
             $smof_data[$value['id']] = $defaults[$value['id']];
         }
         //switch statement to handle various options type
         switch ($value['type']) {
             //text input
             case 'text':
                 $t_value = '';
                 $_smof_val = $t_value = isset($smof_data[$value['id']]) ? stripslashes($smof_data[$value['id']]) : '';
                 $_smof_val = $t_value = str_replace('"', '&quot;', $t_value);
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                 break;
                 //select option
             //select option
             case 'select':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select_wrapper ' . $mini . '">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 foreach ($value['options'] as $select_ID => $option) {
                     $_smof_val = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                     $output .= '<option id="' . $select_ID . '" value="' . $option . '" ' . selected($_smof_val, $option, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
                 //textarea option
             //textarea option
             case 'textarea':
                 $cols = '8';
                 $ta_value = '';
                 if (isset($value['options'])) {
                     $ta_options = $value['options'];
                     if (isset($ta_options['cols'])) {
                         $cols = $ta_options['cols'];
                     }
                 }
                 $ta_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                 break;
                 //radiobox option
             //radiobox option
             case "radio":
                 $checked = isset($smof_data[$value['id']]) ? checked($smof_data[$value['id']], $option, false) : '';
                 foreach ($value['options'] as $option => $name) {
                     $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($smof_data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                 }
                 break;
                 //checkbox option
             //checkbox option
             case 'checkbox':
                 if (!isset($smof_data[$value['id']])) {
                     $smof_data[$value['id']] = 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "fld ";
                 }
                 $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                 $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                 break;
                 //multiple checkbox option
             //multiple checkbox option
             case 'multicheck':
                 isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
                 foreach ($value['options'] as $key => $option) {
                     if (!isset($multi_stored[$key])) {
                         $multi_stored[$key] = '';
                     }
                     $of_key_string = $value['id'] . '_' . $key;
                     $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                 }
                 break;
                 //ajax image upload option
             //ajax image upload option
             case 'upload':
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                 break;
                 // native media library uploader - @uses optionsframework_media_uploader_function()
             // native media library uploader - @uses optionsframework_media_uploader_function()
             case 'media':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                 // New AJAX Uploader using Media Library
                 break;
                 //colorpicker option
             //colorpicker option
             case 'color':
                 $_color = !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $_color . '"></div></div>';
                 $output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $_color . '" />';
                 break;
                 //typography option
             //typography option
             case 'typography':
                 $typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 /* Font Size */
                 if (isset($typography_stored['size'])) {
                     $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                     $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                     for ($i = 9; $i < 20; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Line Height */
                 if (isset($typography_stored['height'])) {
                     $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                     $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                     for ($i = 20; $i < 38; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Face */
                 if (isset($typography_stored['face'])) {
                     $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                     $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                     $faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'palatino' => 'Palatino', 'helvetica' => 'Helvetica');
                     foreach ($faces as $i => $face) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Weight */
                 if (isset($typography_stored['style'])) {
                     $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                     $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Color */
                 if (isset($typography_stored['color'])) {
                     $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                 }
                 break;
                 //border option
             //border option
             case 'border':
                 /* Border Width */
                 $border_stored = $smof_data[$value['id']];
                 $output .= '<div class="select_wrapper border-width">';
                 $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                 for ($i = 0; $i < 21; $i++) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Style */
                 $output .= '<div class="select_wrapper border-style">';
                 $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                 $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                 foreach ($styles as $i => $style) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Color */
                 $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                 $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                 break;
                 //images checkbox - use image as checkboxes
             //images checkbox - use image as checkboxes
             case 'images':
                 $i = 0;
                 $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $key, false)) {
                         $checked = checked($select_value, $key, false);
                         $selected = 'of-radio-img-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                     $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                     $output .= '</span>';
                 }
                 break;
                 //info (for small intro box etc)
             //info (for small intro box etc)
             case "info":
                 $info_text = $value['std'];
                 $output .= '<div class="of-info">' . $info_text . '</div>';
                 break;
                 //display a single image
             //display a single image
             case "image":
                 $src = $value['std'];
                 $output .= '<img src="' . $src . '">';
                 break;
                 //tab heading
             //tab heading
             case 'heading':
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $header_class = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = "of-option-" . $jquery_click_hook;
                 $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                 $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                 break;
                 //drag & drop slide manager
             //drag & drop slide manager
             case 'slider':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 $output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
                 $slides = $smof_data[$value['id']];
                 $count = count($slides);
                 if ($count < 2) {
                     $oldorder = 1;
                     $order = 1;
                     $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                 } else {
                     $i = 0;
                     foreach ($slides as $slide) {
                         $oldorder = $slide['order'];
                         $i++;
                         $order = $i;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                     }
                 }
                 $output .= '</ul>';
                 $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                 break;
                 //drag & drop block manager
             //drag & drop block manager
             case 'sorter':
                 $sortlists = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 $output .= '<div id="' . $value['id'] . '" class="sorter">';
                 if ($sortlists) {
                     foreach ($sortlists as $group => $sortlist) {
                         $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                         $output .= '<h3>' . $group . '</h3>';
                         foreach ($sortlist as $key => $list) {
                             $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                             if ($key != "placebo") {
                                 $output .= '<li id="' . $key . '" class="sortee">';
                                 $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                 $output .= $list;
                                 $output .= '</li>';
                             }
                         }
                         $output .= '</ul>';
                     }
                 }
                 $output .= '</div>';
                 break;
                 //background images option
             //background images option
             case 'tiles':
                 $i = 0;
                 $select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $option, false)) {
                         $checked = checked($select_value, $option, false);
                         $selected = 'of-radio-tile-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                     $output .= '</span>';
                 }
                 break;
                 //backup and restore options data
             //backup and restore options data
             case 'backup':
                 $instructions = $value['desc'];
                 $backup = get_option(BACKUPS);
                 if (!isset($backup['backup_log'])) {
                     $log = 'No backups yet';
                 } else {
                     $log = $backup['backup_log'];
                 }
                 $output .= '<div class="backup-box">';
                 $output .= '<div class="instructions">' . $instructions . "\n";
                 $output .= '<p><strong>Last Backup : <span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                 $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
                 $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
                 $output .= '</div>';
                 break;
                 //export or import data between different installs
             //export or import data between different installs
             case 'transfer':
                 $instructions = $value['desc'];
                 $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($smof_data)) . '</textarea>' . "\n";
                 $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                 break;
                 // google font field
             // google font field
             case 'select_google_font':
                 $output .= '<div class="select_wrapper">';
                 $output .= '<select class="select of-input google_font_select" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 $output .= '<option value="none">Font not specified</option>';
                 $output .= '<optgroup label="Web safe font combinations (do not need to be loaded)">';
                 foreach ($value['options']['web_safe_fonts'] as $select_key => $option) {
                     $output .= "<option value='" . $select_key . "' " . selected(isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'], $option, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</optgroup>';
                 $output .= '<optgroup label="Custom fonts (loaded from Google Fonts)">';
                 foreach ($value['options']['google_fonts'] as $select_key => $option) {
                     $output .= '<option value="' . $select_key . '" ' . selected(isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'], $option, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</optgroup>';
                 $output .= '</select></div>';
                 if (isset($value['preview']['text'])) {
                     $g_text = $value['preview']['text'];
                 } else {
                     $g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
                 }
                 if (isset($value['preview']['size'])) {
                     $g_size = 'style="font-size: ' . $value['preview']['size'] . ';"';
                 } else {
                     $g_size = '';
                 }
                 $output .= '<p class="' . $value['id'] . '_ggf_previewer google_font_preview" ' . $g_size . '>' . $g_text . '</p>';
                 break;
                 //JQuery UI Slider
             //JQuery UI Slider
             case 'sliderui':
                 $s_val = $s_min = $s_max = $s_step = $s_edit = '';
                 //no errors, please
                 $s_val = stripslashes(@$smof_data[@$value['id']]);
                 if (!isset($value['min'])) {
                     $s_min = '0';
                 } else {
                     $s_min = $value['min'];
                 }
                 if (!isset($value['max'])) {
                     $s_max = $s_min + 1;
                 } else {
                     $s_max = $value['max'];
                 }
                 if (!isset($value['step'])) {
                     $s_step = '1';
                 } else {
                     $s_step = $value['step'];
                 }
                 if (!isset($value['edit'])) {
                     $s_edit = ' readonly="readonly"';
                 } else {
                     $s_edit = '';
                 }
                 if ($s_val == '') {
                     $s_val = $s_min;
                 }
                 //values
                 $s_data = 'data-id="' . $value['id'] . '" data-val="' . $s_val . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                 //html output
                 $output .= '<input type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $s_val . '" class="mini" ' . $s_edit . ' />';
                 $output .= '<div id="' . $value['id'] . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                 break;
                 //Switch option
             //Switch option
             case 'switch':
                 if (!isset($smof_data[$value['id']])) {
                     $smof_data[$value['id']] = 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "s_fld ";
                 }
                 $cb_enabled = $cb_disabled = '';
                 //no errors, please
                 //Get selected
                 if ($smof_data[$value['id']] == 1) {
                     $cb_enabled = ' selected';
                     $cb_disabled = '';
                 } else {
                     $cb_enabled = '';
                     $cb_disabled = ' selected';
                 }
                 //Label ON
                 if (!isset($value['on'])) {
                     $on = "On";
                 } else {
                     $on = $value['on'];
                 }
                 //Label OFF
                 if (!isset($value['off'])) {
                     $off = "Off";
                 } else {
                     $off = $value['off'];
                 }
                 $output .= '<p class="switch-options">';
                 $output .= '<label class="' . $fold . 'cb-enable' . $cb_enabled . '" data-id="' . $value['id'] . '"><span>' . $on . '</span></label>';
                 $output .= '<label class="' . $fold . 'cb-disable' . $cb_disabled . '" data-id="' . $value['id'] . '"><span>' . $off . '</span></label>';
                 $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                 $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold . 'checkbox of-input main_checkbox" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                 $output .= '</p>';
                 break;
         }
         //description of each option
         if ($value['type'] != 'heading') {
             if (!isset($value['desc'])) {
                 $explain_value = '';
             } else {
                 $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
             }
             $output .= '</div>' . $explain_value . "\n";
             if ($value['type'] == 'checkbox' or $value['type'] == 'radio') {
                 $output .= '<div class="clear"> </div></div></label>' . "\n";
             } else {
                 $output .= '<div class="clear"> </div></div></div>' . "\n";
             }
         }
     }
     $output .= '</div>';
     return array($output, $menu, $defaults);
 }
 /**
  * Process options data and build option fields
  *
  * @uses get_theme_mod()
  *
  * @access public
  * @since 1.0.0
  *
  * @return array
  */
 public static function optionsframework_machine($options)
 {
     global $smof_output, $smof_details, $smof_data;
     if (empty($options)) {
         return;
     }
     if (empty($smof_data)) {
         $smof_data = of_get_options();
     }
     $data = $smof_data;
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     $update_data = false;
     do_action('optionsframework_machine_before', array('options' => $options, 'smof_data' => $smof_data));
     if ($smof_output != "") {
         $output .= $smof_output;
         $smof_output = "";
     }
     foreach ($options as $value) {
         // sanitize option
         if ($value['type'] != "heading") {
             $value = self::sanitize_option($value);
         }
         $counter++;
         $val = '';
         //create array of defaults
         if ($value['type'] == 'multicheck') {
             if (is_array($value['std'])) {
                 foreach ($value['std'] as $i => $key) {
                     $defaults[$value['id']][$key] = true;
                 }
             } else {
                 $defaults[$value['id']][$value['std']] = true;
             }
         } else {
             if (isset($value['id'])) {
                 $defaults[$value['id']] = $value['std'];
             }
         }
         /* condition start */
         if (!empty($smof_data) || !empty($data)) {
             if (array_key_exists('id', $value) && !isset($smof_data[$value['id']])) {
                 $smof_data[$value['id']] = $value['std'];
                 if ($value['type'] == "checkbox" && $value['std'] == 0) {
                     $smof_data[$value['id']] = 0;
                 } else {
                     $update_data = true;
                 }
             }
             if (array_key_exists('id', $value) && !isset($smof_details[$value['id']])) {
                 $smof_details[$value['id']] = $smof_data[$value['id']];
             }
             //Start Heading
             if ($value['type'] != "heading") {
                 $class = '';
                 if (isset($value['class'])) {
                     $class = $value['class'];
                 }
                 //hide items in checkbox group
                 $fold = '';
                 if (array_key_exists("fold", $value)) {
                     if (isset($smof_data[$value['fold']]) && $smof_data[$value['fold']]) {
                         $fold = "f_" . $value['fold'] . " ";
                     } else {
                         $fold = "f_" . $value['fold'] . " temphide ";
                     }
                 }
                 $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
                 //only show header if 'name' value exists
                 if ($value['name']) {
                     $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
                 }
                 $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
             }
             //End Heading
             //if (!isset($smof_data[$value['id']]) && $value['type'] != "heading")
             //	continue;
             //switch statement to handle various options type
             switch ($value['type']) {
                 //text input
                 case 'text':
                     $t_value = '';
                     $t_value = stripslashes($smof_data[$value['id']]);
                     $mini = '';
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     if ($value['mod'] == 'mini') {
                         $mini = 'mini';
                     }
                     $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                     break;
                     //select option
                 //select option
                 case 'select':
                     $mini = '';
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     if ($value['mod'] == 'mini') {
                         $mini = 'mini';
                     }
                     $output .= '<div class="select_wrapper ' . $mini . '">';
                     $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                     foreach ($value['options'] as $select_ID => $option) {
                         $theValue = $option;
                         if (!is_numeric($select_ID)) {
                             $theValue = $select_ID;
                         }
                         $output .= '<option id="' . $select_ID . '" value="' . $theValue . '" ' . selected($smof_data[$value['id']], $theValue, false) . ' />' . $option . '</option>';
                     }
                     $output .= '</select></div>';
                     break;
                     //textarea option
                 //textarea option
                 case 'textarea':
                     $cols = '8';
                     $ta_value = '';
                     if (isset($value['options'])) {
                         $ta_options = $value['options'];
                         if (isset($ta_options['cols'])) {
                             $cols = $ta_options['cols'];
                         }
                     }
                     $ta_value = stripslashes($smof_data[$value['id']]);
                     $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                     break;
                     //radiobox option
                 //radiobox option
                 case "radio":
                     $checked = isset($smof_data[$value['id']]) ? checked($smof_data[$value['id']], $option, false) : '';
                     foreach ($value['options'] as $option => $name) {
                         $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($smof_data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                     }
                     break;
                     //checkbox option
                 //checkbox option
                 case 'checkbox':
                     if (!isset($smof_data[$value['id']])) {
                         $smof_data[$value['id']] = 0;
                     }
                     $fold = '';
                     if (array_key_exists("folds", $value)) {
                         $fold = "fld ";
                     }
                     $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                     $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                     break;
                     //multiple checkbox option
                 //multiple checkbox option
                 case 'multicheck':
                     isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
                     foreach ($value['options'] as $key => $option) {
                         if (!isset($multi_stored[$key])) {
                             $multi_stored[$key] = '';
                         }
                         $of_key_string = $value['id'] . '_' . $key;
                         $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                     }
                     break;
                     // Color picker
                 // Color picker
                 case "color":
                     $default_color = '';
                     if (isset($value['std'])) {
                         $default_color = ' data-default-color="' . $value['std'] . '" ';
                     }
                     $output .= '<input name="' . $value['id'] . '" id="' . $value['id'] . '" class="of-color"  type="text" value="' . $smof_data[$value['id']] . '"' . $default_color . ' />';
                     break;
                     //typography option
                 //typography option
                 case 'typography':
                     $typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                     /* Font Size */
                     if (isset($typography_stored['size'])) {
                         $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                         $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                         for ($i = 9; $i < 20; $i++) {
                             $test = $i . 'px';
                             $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                         }
                         $output .= '</select></div>';
                     }
                     /* Line Height */
                     if (isset($typography_stored['height'])) {
                         $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                         $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                         for ($i = 20; $i < 38; $i++) {
                             $test = $i . 'px';
                             $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                         }
                         $output .= '</select></div>';
                     }
                     /* Font Face */
                     if (isset($typography_stored['face'])) {
                         $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                         $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                         $faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'palatino' => 'Palatino', 'helvetica' => 'Helvetica');
                         foreach ($faces as $i => $face) {
                             $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                         }
                         $output .= '</select></div>';
                     }
                     /* Font Weight */
                     if (isset($typography_stored['style'])) {
                         $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                         $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                         $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                         foreach ($styles as $i => $style) {
                             $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                         }
                         $output .= '</select></div>';
                     }
                     /* Font Color */
                     if (isset($typography_stored['color'])) {
                         $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                         $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                     }
                     break;
                     //border option
                 //border option
                 case 'border':
                     /* Border Width */
                     $border_stored = $smof_data[$value['id']];
                     $output .= '<div class="select_wrapper border-width">';
                     $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                     for ($i = 0; $i < 21; $i++) {
                         $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                     }
                     $output .= '</select></div>';
                     /* Border Style */
                     $output .= '<div class="select_wrapper border-style">';
                     $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                     $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                     /* Border Color */
                     $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                     break;
                     //images checkbox - use image as checkboxes
                 //images checkbox - use image as checkboxes
                 case 'images':
                     $i = 0;
                     $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                     foreach ($value['options'] as $key => $option) {
                         $i++;
                         $checked = '';
                         $selected = '';
                         if (NULL != checked($select_value, $key, false)) {
                             $checked = checked($select_value, $key, false);
                             $selected = 'of-radio-img-selected';
                         }
                         $output .= '<span>';
                         $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                         $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                         $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                         $output .= '</span>';
                     }
                     break;
                     //info (for small intro box etc)
                 //info (for small intro box etc)
                 case "info":
                     $info_text = $value['std'];
                     $output .= '<div class="of-info">' . $info_text . '</div>';
                     break;
                     //display a single image
                 //display a single image
                 case "image":
                     $src = $value['std'];
                     $output .= '<img src="' . $src . '">';
                     break;
                     //tab heading
                 //tab heading
                 case 'heading':
                     if ($counter >= 2) {
                         $output .= '</div>' . "\n";
                     }
                     //custom icon
                     $icon = '';
                     if (isset($value['icon'])) {
                         $icon = ' style="background-image: url(' . $value['icon'] . ');"';
                     }
                     $header_class = str_replace(' ', '', strtolower($value['name']));
                     $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                     $jquery_click_hook = "of-option-" . trim(preg_replace('/ +/', '', preg_replace('/[^A-Za-z0-9 ]/', '', urldecode(html_entity_decode(strip_tags($jquery_click_hook))))));
                     $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '"' . $icon . '>' . $value['name'] . '</a></li>';
                     $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                     break;
                     //drag & drop slide manager
                 //drag & drop slide manager
                 case 'slider':
                     $output .= '<div class="slider"><ul id="' . $value['id'] . '">';
                     $slides = $smof_data[$value['id']];
                     $count = count($slides);
                     if ($count < 2) {
                         $oldorder = 1;
                         $order = 1;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order);
                     } else {
                         $i = 0;
                         foreach ($slides as $slide) {
                             $oldorder = $slide['order'];
                             $i++;
                             $order = $i;
                             $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order);
                         }
                     }
                     $output .= '</ul>';
                     $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                     break;
                     //drag & drop block manager
                 //drag & drop block manager
                 case 'sorter':
                     // Make sure to get list of all the default blocks first
                     $all_blocks = $value['std'];
                     $temp = array();
                     // holds default blocks
                     $temp2 = array();
                     // holds saved blocks
                     foreach ($all_blocks as $blocks) {
                         $temp = array_merge($temp, $blocks);
                     }
                     $sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                     foreach ($sortlists as $sortlist) {
                         $temp2 = array_merge($temp2, $sortlist);
                     }
                     // now let's compare if we have anything missing
                     foreach ($temp as $k => $v) {
                         if (!array_key_exists($k, $temp2)) {
                             $sortlists['disabled'][$k] = $v;
                         }
                     }
                     // now check if saved blocks has blocks not registered under default blocks
                     foreach ($sortlists as $key => $sortlist) {
                         foreach ($sortlist as $k => $v) {
                             if (!array_key_exists($k, $temp)) {
                                 unset($sortlist[$k]);
                             }
                         }
                         $sortlists[$key] = $sortlist;
                     }
                     // assuming all sync'ed, now get the correct naming for each block
                     foreach ($sortlists as $key => $sortlist) {
                         foreach ($sortlist as $k => $v) {
                             $sortlist[$k] = $temp[$k];
                         }
                         $sortlists[$key] = $sortlist;
                     }
                     $output .= '<div id="' . $value['id'] . '" class="sorter">';
                     if ($sortlists) {
                         foreach ($sortlists as $group => $sortlist) {
                             $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                             $output .= '<h3>' . $group . '</h3>';
                             foreach ($sortlist as $key => $list) {
                                 $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                                 if ($key != "placebo") {
                                     $output .= '<li id="' . $key . '" class="sortee">';
                                     $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                     $output .= $list;
                                     $output .= '</li>';
                                 }
                             }
                             $output .= '</ul>';
                         }
                     }
                     $output .= '</div>';
                     break;
                     //background images option
                 //background images option
                 case 'tiles':
                     $i = 0;
                     $select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                     if (is_array($value['options'])) {
                         foreach ($value['options'] as $key => $option) {
                             $i++;
                             $checked = '';
                             $selected = '';
                             if (NULL != checked($select_value, $option, false)) {
                                 $checked = checked($select_value, $option, false);
                                 $selected = 'of-radio-tile-selected';
                             }
                             $output .= '<span>';
                             $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                             $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                             $output .= '</span>';
                         }
                     }
                     break;
                     //backup and restore options data
                 //backup and restore options data
                 case 'backup':
                     $instructions = $value['desc'];
                     $backup = of_get_options(BACKUPS);
                     $init = of_get_options('smof_init');
                     if (!isset($backup['backup_log'])) {
                         $log = 'No backups yet';
                     } else {
                         $log = $backup['backup_log'];
                     }
                     $output .= '<div class="backup-box">';
                     $output .= '<div class="instructions">' . $instructions . "\n";
                     $output .= '<p><strong>' . __('Last Backup : ', 'calm') . '<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                     $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
                     $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
                     $output .= '</div>';
                     break;
                     //export or import data between different installs
                 //export or import data between different installs
                 case 'transfer':
                     $instructions = $value['desc'];
                     $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($smof_data)) . '</textarea>' . "\n";
                     $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                     break;
                     // google font field
                 // google font field
                 case 'select_google_font':
                     $output .= '<div class="select_wrapper">';
                     $output .= '<select class="select of-input google_font_select" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                     foreach ($value['options'] as $select_key => $option) {
                         $output .= '<option value="' . $select_key . '" ' . selected(isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : "", $option, false) . ' />' . $option . '</option>';
                     }
                     $output .= '</select></div>';
                     if (isset($value['preview']['text'])) {
                         $g_text = $value['preview']['text'];
                     } else {
                         $g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
                     }
                     if (isset($value['preview']['size'])) {
                         $g_size = 'style="font-size: ' . $value['preview']['size'] . ';"';
                     } else {
                         $g_size = '';
                     }
                     $hide = " hide";
                     if ($smof_data[$value['id']] != "none" && $smof_data[$value['id']] != "") {
                         $hide = "";
                     }
                     $output .= '<p class="' . $value['id'] . '_ggf_previewer google_font_preview' . $hide . '" ' . $g_size . '>' . $g_text . '</p>';
                     break;
                     //JQuery UI Slider
                 //JQuery UI Slider
                 case 'sliderui':
                     $s_val = $s_min = $s_max = $s_step = $s_edit = '';
                     //no errors, please
                     $s_val = stripslashes($smof_data[$value['id']]);
                     if (!isset($value['min'])) {
                         $s_min = '0';
                     } else {
                         $s_min = $value['min'];
                     }
                     if (!isset($value['max'])) {
                         $s_max = $s_min + 1;
                     } else {
                         $s_max = $value['max'];
                     }
                     if (!isset($value['step'])) {
                         $s_step = '1';
                     } else {
                         $s_step = $value['step'];
                     }
                     if (!isset($value['edit'])) {
                         $s_edit = ' readonly="readonly"';
                     } else {
                         $s_edit = '';
                     }
                     if ($s_val == '') {
                         $s_val = $s_min;
                     }
                     //values
                     $s_data = 'data-id="' . $value['id'] . '" data-val="' . $s_val . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                     //html output
                     $output .= '<input type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $s_val . '" class="mini" ' . $s_edit . ' />';
                     $output .= '<div id="' . $value['id'] . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                     break;
                     //Switch option
                 //Switch option
                 case 'switch':
                     if (!isset($smof_data[$value['id']])) {
                         $smof_data[$value['id']] = 0;
                     }
                     $fold = '';
                     if (array_key_exists("folds", $value)) {
                         $fold = "s_fld ";
                     }
                     $cb_enabled = $cb_disabled = '';
                     //no errors, please
                     //Get selected
                     if ($smof_data[$value['id']] == 1) {
                         $cb_enabled = ' selected';
                         $cb_disabled = '';
                     } else {
                         $cb_enabled = '';
                         $cb_disabled = ' selected';
                     }
                     //Label ON
                     if (!isset($value['on'])) {
                         $on = "On";
                     } else {
                         $on = $value['on'];
                     }
                     //Label OFF
                     if (!isset($value['off'])) {
                         $off = "Off";
                     } else {
                         $off = $value['off'];
                     }
                     $output .= '<p class="switch-options">';
                     $output .= '<label class="' . $fold . 'cb-enable' . $cb_enabled . '" data-id="' . $value['id'] . '"><span>' . $on . '</span></label>';
                     $output .= '<label class="' . $fold . 'cb-disable' . $cb_disabled . '" data-id="' . $value['id'] . '"><span>' . $off . '</span></label>';
                     $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                     $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold . 'checkbox of-input main_checkbox" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                     $output .= '</p>';
                     break;
                     // Uploader 3.5
                 // Uploader 3.5
                 case "upload":
                 case "media":
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     $u_val = '';
                     if ($smof_data[$value['id']]) {
                         $u_val = stripslashes($smof_data[$value['id']]);
                     }
                     $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $u_val, $value['mod']);
                     break;
             }
             do_action('optionsframework_machine_loop', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
             if ($smof_output != "") {
                 $output .= $smof_output;
                 $smof_output = "";
             }
             //description of each option
             if ($value['type'] != 'heading') {
                 if (!isset($value['desc'])) {
                     $explain_value = '';
                 } else {
                     $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
                 }
                 $output .= '</div>' . $explain_value . "\n";
                 $output .= '<div class="clear"> </div></div></div>' . "\n";
             }
         }
         /* condition empty end */
     }
     if ($update_data == true) {
         of_save_options($smof_data);
     }
     $output .= '</div>';
     do_action('optionsframework_machine_after', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
     if ($smof_output != "") {
         $output .= $smof_output;
         $smof_output = "";
     }
     return array($output, $menu, $defaults);
 }
Exemplo n.º 5
0
 /**
  * Process options data and build option fields
  *
  * @uses get_theme_mod()
  *
  * @access public
  * @since 1.0.0
  *
  * @return array
  */
 public static function optionsframework_machine($options)
 {
     global $smof_output, $smof_details, $smof_data;
     if (empty($options)) {
         return;
     }
     if (empty($smof_data)) {
         $smof_data = of_get_options();
     }
     $data = $smof_data;
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     $update_data = false;
     do_action('optionsframework_machine_before', array('options' => $options, 'smof_data' => $smof_data));
     if ($smof_output != "") {
         $output .= $smof_output;
         $smof_output = "";
     }
     foreach ($options as $value) {
         // sanitize option
         if ($value['type'] != "heading") {
             $value = self::sanitize_option($value);
         }
         $counter++;
         $val = '';
         //create array of defaults
         if ($value['type'] == 'multicheck') {
             if (is_array($value['std'])) {
                 foreach ($value['std'] as $i => $key) {
                     $defaults[$value['id']][$key] = true;
                 }
             } else {
                 $defaults[$value['id']][$value['std']] = true;
             }
         } else {
             if (isset($value['id'])) {
                 $defaults[$value['id']] = $value['std'];
             }
         }
         /* condition start */
         if (!empty($smof_data) || !empty($data)) {
             if (array_key_exists('id', $value) && !isset($smof_data[$value['id']])) {
                 $smof_data[$value['id']] = $value['std'];
                 if ($value['type'] == "checkbox" && $value['std'] == 0) {
                     $smof_data[$value['id']] = 0;
                 } else {
                     $update_data = true;
                 }
             }
             if (array_key_exists('id', $value) && !isset($smof_details[$value['id']])) {
                 $smof_details[$value['id']] = $smof_data[$value['id']];
             }
             //Start Heading
             if ($value['type'] != "heading") {
                 $class = '';
                 if (isset($value['class'])) {
                     $class = $value['class'];
                 }
                 //hide items in checkbox group
                 $fold = '';
                 if (array_key_exists("fold", $value)) {
                     if (isset($smof_data[$value['fold']]) && $smof_data[$value['fold']]) {
                         $fold = "f_" . $value['fold'] . " ";
                     } else {
                         $fold = "f_" . $value['fold'] . " temphide ";
                     }
                 }
                 $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
                 //only show header if 'name' value exists
                 if ($value['name']) {
                     $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
                 }
                 $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
             }
             //End Heading
             //if (!isset($smof_data[$value['id']]) && $value['type'] != "heading")
             //  continue;
             //switch statement to handle various options type
             switch ($value['type']) {
                 //text input
                 case 'text':
                     $t_value = '';
                     $t_value = stripslashes($smof_data[$value['id']]);
                     $mini = '';
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     if ($value['mod'] == 'mini') {
                         $mini = 'mini';
                     }
                     $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                     break;
                     //select option
                 //select option
                 case 'select':
                     $mini = '';
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     if ($value['mod'] == 'mini') {
                         $mini = 'mini';
                     }
                     $output .= '<div class="select_wrapper ' . $mini . '">';
                     $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                     foreach ($value['options'] as $select_ID => $option) {
                         $theValue = $option;
                         if (!is_numeric($select_ID)) {
                             $theValue = $select_ID;
                         }
                         $output .= '<option id="' . $select_ID . '" value="' . $theValue . '" ' . selected($smof_data[$value['id']], $theValue, false) . ' />' . $option . '</option>';
                     }
                     $output .= '</select></div>';
                     break;
                     //textarea option
                 //textarea option
                 case 'textarea':
                     $cols = '8';
                     $ta_value = '';
                     if (isset($value['options'])) {
                         $ta_options = $value['options'];
                         if (isset($ta_options['cols'])) {
                             $cols = $ta_options['cols'];
                         }
                     }
                     $ta_value = stripslashes($smof_data[$value['id']]);
                     $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                     break;
                     //radiobox option
                 //radiobox option
                 case "radio":
                     $checked = isset($smof_data[$value['id']]) ? checked($smof_data[$value['id']], $option, false) : '';
                     foreach ($value['options'] as $option => $name) {
                         $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($smof_data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                     }
                     break;
                     //checkbox option
                 //checkbox option
                 case 'checkbox':
                     if (!isset($smof_data[$value['id']])) {
                         $smof_data[$value['id']] = 0;
                     }
                     $fold = '';
                     if (array_key_exists("folds", $value)) {
                         $fold = "fld ";
                     }
                     $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                     $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                     break;
                     //multiple checkbox option
                 //multiple checkbox option
                 case 'multicheck':
                     isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
                     foreach ($value['options'] as $key => $option) {
                         if (!isset($multi_stored[$key])) {
                             $multi_stored[$key] = '';
                         }
                         $of_key_string = $value['id'] . '_' . $key;
                         $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                     }
                     break;
                     // Color picker
                 // Color picker
                 case "color":
                     $default_color = '';
                     if (isset($value['std'])) {
                         $default_color = ' data-default-color="' . $value['std'] . '" ';
                     }
                     $output .= '<input name="' . $value['id'] . '" id="' . $value['id'] . '" class="of-color"  type="text" value="' . $smof_data[$value['id']] . '"' . $default_color . ' />';
                     break;
                     //typography option
                 //typography option
                 case 'typography':
                     $typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                     /* Font Size */
                     if (isset($typography_stored['size'])) {
                         $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                         $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                         for ($i = 9; $i < 51; $i++) {
                             $test = $i . 'px';
                             $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                         }
                         $output .= '</select></div>';
                     }
                     /* Line Height */
                     if (isset($typography_stored['height'])) {
                         $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                         $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                         for ($i = 20; $i < 38; $i++) {
                             $test = $i . 'px';
                             $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                         }
                         $output .= '</select></div>';
                     }
                     /* Font Face */
                     if (isset($typography_stored['face'])) {
                         $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                         $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                         $output .= '<optgroup label="System Fonts" >';
                         $system_font_faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'palatino' => 'Palatino', 'helvetica' => 'Helvetica', "'Kozuka Mincho Pro','Kozuka Mincho Std','小塚明朝 Pro R','小塚明朝 Std R','Hiragino Mincho Pro','ヒラギノ明朝 Pro W3','MS P明朝','MS PMincho',serif" => 'Mincho');
                         foreach ($system_font_faces as $i => $system_font_face) {
                             $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $system_font_face . '</option>';
                         }
                         $output .= '</optgroup><optgroup label="Google Fonts" >';
                         $google_font_faces = array('ABeeZee' => 'ABeeZee', 'Abel' => 'Abel', 'Abril Fatface' => 'Abril Fatface', 'Aclonica' => 'Aclonica', 'Acme' => 'Acme', 'Actor' => 'Actor', 'Adamina' => 'Adamina', 'Advent Pro' => 'Advent Pro', 'Aguafina Script' => 'Aguafina Script', 'Aladin' => 'Aladin', 'Aldrich' => 'Aldrich', 'Alegreya' => 'Alegreya', 'Alegreya SC' => 'Alegreya SC', 'Alex Brush' => 'Alex Brush', 'Alfa Slab One' => 'Alfa Slab One', 'Alice' => 'Alice', 'Alike' => 'Alike', 'Alike Angular' => 'Alike Angular', 'Allan' => 'Allan', 'Allerta' => 'Allerta', 'Allerta Stencil' => 'Allerta Stencil', 'Allura' => 'Allura', 'Almendra' => 'Almendra', 'Almendra SC' => 'Almendra SC', 'Amaranth' => 'Amaranth', 'Amatic SC' => 'Amatic SC', 'Amethysta' => 'Amethysta', 'Andada' => 'Andada', 'Andika' => 'Andika', 'Angkor' => 'Angkor', 'Annie Use Your Telescope' => 'Annie Use Your Telescope', 'Anonymous Pro' => 'Anonymous Pro', 'Antic' => 'Antic', 'Antic Didone' => 'Antic Didone', 'Antic Slab' => 'Antic Slab', 'Anton' => 'Anton', 'Arapey' => 'Arapey', 'Arbutus' => 'Arbutus', 'Architects Daughter' => 'Architects Daughter', 'Arimo' => 'Arimo', 'Arizonia' => 'Arizonia', 'Armata' => 'Armata', 'Artifika' => 'Artifika', 'Arvo' => 'Arvo', 'Asap' => 'Asap', 'Asset' => 'Asset', 'Astloch' => 'Astloch', 'Asul' => 'Asul', 'Atomic Age' => 'Atomic Age', 'Aubrey' => 'Aubrey', 'Audiowide' => 'Audiowide', 'Average' => 'Average', 'Averia Gruesa Libre' => 'Averia Gruesa Libre', 'Averia Libre' => 'Averia Libre', 'Averia Sans Libre' => 'Averia Sans Libre', 'Averia Serif Libre' => 'Averia Serif Libre', 'Bad Script' => 'Bad Script', 'Balthazar' => 'Balthazar', 'Bangers' => 'Bangers', 'Basic' => 'Basic', 'Battambang' => 'Battambang', 'Baumans' => 'Baumans', 'Bayon' => 'Bayon', 'Belgrano' => 'Belgrano', 'Belleza' => 'Belleza', 'Bentham' => 'Bentham', 'Berkshire Swash' => 'Berkshire Swash', 'Bevan' => 'Bevan', 'Bigshot One' => 'Bigshot One', 'Bilbo' => 'Bilbo', 'Bilbo Swash Caps' => 'Bilbo Swash Caps', 'Bitter' => 'Bitter', 'Black Ops One' => 'Black Ops One', 'Bokor' => 'Bokor', 'Bonbon' => 'Bonbon', 'Boogaloo' => 'Boogaloo', 'Bowlby One' => 'Bowlby One', 'Bowlby One SC' => 'Bowlby One SC', 'Brawler' => 'Brawler', 'Bree Serif' => 'Bree Serif', 'Bubblegum Sans' => 'Bubblegum Sans', 'Buda' => 'Buda', 'Buenard' => 'Buenard', 'Butcherman' => 'Butcherman', 'Butterfly Kids' => 'Butterfly Kids', 'Cabin' => 'Cabin', 'Cabin Condensed' => 'Cabin Condensed', 'Cabin Sketch' => 'Cabin Sketch', 'Caesar Dressing' => 'Caesar Dressing', 'Cagliostro' => 'Cagliostro', 'Calligraffitti' => 'Calligraffitti', 'Cambo' => 'Cambo', 'Candal' => 'Candal', 'Cantarell' => 'Cantarell', 'Cantata One' => 'Cantata One', 'Cardo' => 'Cardo', 'Carme' => 'Carme', 'Carter One' => 'Carter One', 'Caudex' => 'Caudex', 'Cedarville Cursive' => 'Cedarville Cursive', 'Ceviche One' => 'Ceviche One', 'Changa One' => 'Changa One', 'Chango' => 'Chango', 'Chau Philomene One' => 'Chau Philomene One', 'Chelsea Market' => 'Chelsea Market', 'Chenla' => 'Chenla', 'Cherry Cream Soda' => 'Cherry Cream Soda', 'Chewy' => 'Chewy', 'Chicle' => 'Chicle', 'Chivo' => 'Chivo', 'Coda' => 'Coda', 'Coda Caption' => 'Coda Caption', 'Codystar' => 'Codystar', 'Comfortaa' => 'Comfortaa', 'Coming Soon' => 'Coming Soon', 'Concert One' => 'Concert One', 'Condiment' => 'Condiment', 'Content' => 'Content', 'Contrail One' => 'Contrail One', 'Convergence' => 'Convergence', 'Cookie' => 'Cookie', 'Copse' => 'Copse', 'Corben' => 'Corben', 'Cousine' => 'Cousine', 'Coustard' => 'Coustard', 'Covered By Your Grace' => 'Covered By Your Grace', 'Crafty Girls' => 'Crafty Girls', 'Creepster' => 'Creepster', 'Crete Round' => 'Crete Round', 'Crimson Text' => 'Crimson Text', 'Crushed' => 'Crushed', 'Cuprum' => 'Cuprum', 'Cutive' => 'Cutive', 'Damion' => 'Damion', 'Dancing Script' => 'Dancing Script', 'Dangrek' => 'Dangrek', 'Dawning of a New Day' => 'Dawning of a New Day', 'Days One' => 'Days One', 'Delius' => 'Delius', 'Delius Swash Caps' => 'Delius Swash Caps', 'Delius Unicase' => 'Delius Unicase', 'Della Respira' => 'Della Respira', 'Devonshire' => 'Devonshire', 'Didact Gothic' => 'Didact Gothic', 'Diplomata' => 'Diplomata', 'Diplomata SC' => 'Diplomata SC', 'Doppio One' => 'Doppio One', 'Dorsa' => 'Dorsa', 'Dosis' => 'Dosis', 'Dr Sugiyama' => 'Dr Sugiyama', 'Droid Sans' => 'Droid Sans', 'Droid Sans Mono' => 'Droid Sans Mono', 'Droid Serif' => 'Droid Serif', 'Duru Sans' => 'Duru Sans', 'Dynalight' => 'Dynalight', 'EB Garamond' => 'EB Garamond', 'Eater' => 'Eater', 'Economica' => 'Economica', 'Electrolize' => 'Electrolize', 'Emblema One' => 'Emblema One', 'Emilys Candy' => 'Emilys Candy', 'Engagement' => 'Engagement', 'Enriqueta' => 'Enriqueta', 'Erica One' => 'Erica One', 'Esteban' => 'Esteban', 'Euphoria Script' => 'Euphoria Script', 'Ewert' => 'Ewert', 'Exo' => 'Exo', 'Expletus Sans' => 'Expletus Sans', 'Fanwood Text' => 'Fanwood Text', 'Fascinate' => 'Fascinate', 'Fascinate Inline' => 'Fascinate Inline', 'Federant' => 'Federant', 'Federo' => 'Federo', 'Felipa' => 'Felipa', 'Fjord One' => 'Fjord One', 'Flamenco' => 'Flamenco', 'Flavors' => 'Flavors', 'Fondamento' => 'Fondamento', 'Fontdiner Swanky' => 'Fontdiner Swanky', 'Forum' => 'Forum', 'Francois One' => 'Francois One', 'Fredericka the Great' => 'Fredericka the Great', 'Fredoka One' => 'Fredoka One', 'Freehand' => 'Freehand', 'Fresca' => 'Fresca', 'Frijole' => 'Frijole', 'Fugaz One' => 'Fugaz One', 'GFS Didot' => 'GFS Didot', 'GFS Neohellenic' => 'GFS Neohellenic', 'Galdeano' => 'Galdeano', 'Gentium Basic' => 'Gentium Basic', 'Gentium Book Basic' => 'Gentium Book Basic', 'Geo' => 'Geo', 'Geostar' => 'Geostar', 'Geostar Fill' => 'Geostar Fill', 'Germania One' => 'Germania One', 'Give You Glory' => 'Give You Glory', 'Glass Antiqua' => 'Glass Antiqua', 'Glegoo' => 'Glegoo', 'Gloria Hallelujah' => 'Gloria Hallelujah', 'Goblin One' => 'Goblin One', 'Gochi Hand' => 'Gochi Hand', 'Gorditas' => 'Gorditas', 'Goudy Bookletter 1911' => 'Goudy Bookletter 1911', 'Graduate' => 'Graduate', 'Gravitas One' => 'Gravitas One', 'Great Vibes' => 'Great Vibes', 'Gruppo' => 'Gruppo', 'Gudea' => 'Gudea', 'Habibi' => 'Habibi', 'Hammersmith One' => 'Hammersmith One', 'Handlee' => 'Handlee', 'Hanuman' => 'Hanuman', 'Happy Monkey' => 'Happy Monkey', 'Henny Penny' => 'Henny Penny', 'Herr Von Muellerhoff' => 'Herr Von Muellerhoff', 'Holtwood One SC' => 'Holtwood One SC', 'Homemade Apple' => 'Homemade Apple', 'Homenaje' => 'Homenaje', 'IM Fell DW Pica' => 'IM Fell DW Pica', 'IM Fell DW Pica SC' => 'IM Fell DW Pica SC', 'IM Fell Double Pica' => 'IM Fell Double Pica', 'IM Fell Double Pica SC' => 'IM Fell Double Pica SC', 'IM Fell English' => 'IM Fell English', 'IM Fell English SC' => 'IM Fell English SC', 'IM Fell French Canon' => 'IM Fell French Canon', 'IM Fell French Canon SC' => 'IM Fell French Canon SC', 'IM Fell Great Primer' => 'IM Fell Great Primer', 'IM Fell Great Primer SC' => 'IM Fell Great Primer SC', 'Iceberg' => 'Iceberg', 'Iceland' => 'Iceland', 'Imprima' => 'Imprima', 'Inconsolata' => 'Inconsolata', 'Inder' => 'Inder', 'Indie Flower' => 'Indie Flower', 'Inika' => 'Inika', 'Irish Grover' => 'Irish Grover', 'Istok Web' => 'Istok Web', 'Italiana' => 'Italiana', 'Italianno' => 'Italianno', 'Jim Nightshade' => 'Jim Nightshade', 'Jockey One' => 'Jockey One', 'Jolly Lodger' => 'Jolly Lodger', 'Josefin Sans' => 'Josefin Sans', 'Josefin Slab' => 'Josefin Slab', 'Judson' => 'Judson', 'Julee' => 'Julee', 'Junge' => 'Junge', 'Jura' => 'Jura', 'Just Another Hand' => 'Just Another Hand', 'Just Me Again Down Here' => 'Just Me Again Down Here', 'Kameron' => 'Kameron', 'Karla' => 'Karla', 'Kaushan Script' => 'Kaushan Script', 'Kelly Slab' => 'Kelly Slab', 'Kenia' => 'Kenia', 'Khmer' => 'Khmer', 'Knewave' => 'Knewave', 'Kotta One' => 'Kotta One', 'Koulen' => 'Koulen', 'Kranky' => 'Kranky', 'Kreon' => 'Kreon', 'Kristi' => 'Kristi', 'Krona One' => 'Krona One', 'La Belle Aurore' => 'La Belle Aurore', 'Lancelot' => 'Lancelot', 'Lato' => 'Lato', 'League Script' => 'League Script', 'Leckerli One' => 'Leckerli One', 'Ledger' => 'Ledger', 'Lekton' => 'Lekton', 'Lemon' => 'Lemon', 'Lilita One' => 'Lilita One', 'Limelight' => 'Limelight', 'Linden Hill' => 'Linden Hill', 'Lobster' => 'Lobster', 'Lobster Two' => 'Lobster Two', 'Londrina Outline' => 'Londrina Outline', 'Londrina Shadow' => 'Londrina Shadow', 'Londrina Sketch' => 'Londrina Sketch', 'Londrina Solid' => 'Londrina Solid', 'Lora' => 'Lora', 'Love Ya Like A Sister' => 'Love Ya Like A Sister', 'Loved by the King' => 'Loved by the King', 'Lovers Quarrel' => 'Lovers Quarrel', 'Luckiest Guy' => 'Luckiest Guy', 'Lusitana' => 'Lusitana', 'Lustria' => 'Lustria', 'Macondo' => 'Macondo', 'Macondo Swash Caps' => 'Macondo Swash Caps', 'Magra' => 'Magra', 'Maiden Orange' => 'Maiden Orange', 'Mako' => 'Mako', 'Marck Script' => 'Marck Script', 'Marko One' => 'Marko One', 'Marmelad' => 'Marmelad', 'Marvel' => 'Marvel', 'Mate' => 'Mate', 'Mate SC' => 'Mate SC', 'Maven Pro' => 'Maven Pro', 'Meddon' => 'Meddon', 'MedievalSharp' => 'MedievalSharp', 'Medula One' => 'Medula One', 'Megrim' => 'Megrim', 'Merienda One' => 'Merienda One', 'Merriweather' => 'Merriweather', 'Metal' => 'Metal', 'Metamorphous' => 'Metamorphous', 'Metrophobic' => 'Metrophobic', 'Michroma' => 'Michroma', 'Miltonian' => 'Miltonian', 'Miltonian Tattoo' => 'Miltonian Tattoo', 'Miniver' => 'Miniver', 'Miss Fajardose' => 'Miss Fajardose', 'Modern Antiqua' => 'Modern Antiqua', 'Molengo' => 'Molengo', 'Monofett' => 'Monofett', 'Monoton' => 'Monoton', 'Monsieur La Doulaise' => 'Monsieur La Doulaise', 'Montaga' => 'Montaga', 'Montez' => 'Montez', 'Montserrat' => 'Montserrat', 'Moul' => 'Moul', 'Moulpali' => 'Moulpali', 'Mountains of Christmas' => 'Mountains of Christmas', 'Mr Bedfort' => 'Mr Bedfort', 'Mr Dafoe' => 'Mr Dafoe', 'Mr De Haviland' => 'Mr De Haviland', 'Mrs Saint Delafield' => 'Mrs Saint Delafield', 'Mrs Sheppards' => 'Mrs Sheppards', 'Muli' => 'Muli', 'Mystery Quest' => 'Mystery Quest', 'Neucha' => 'Neucha', 'Neuton' => 'Neuton', 'News Cycle' => 'News Cycle', 'Niconne' => 'Niconne', 'Nixie One' => 'Nixie One', 'Nobile' => 'Nobile', 'Nokora' => 'Nokora', 'Norican' => 'Norican', 'Nosifer' => 'Nosifer', 'Nothing You Could Do' => 'Nothing You Could Do', 'Noticia Text' => 'Noticia Text', 'Nova Cut' => 'Nova Cut', 'Nova Flat' => 'Nova Flat', 'Nova Mono' => 'Nova Mono', 'Nova Oval' => 'Nova Oval', 'Nova Round' => 'Nova Round', 'Nova Script' => 'Nova Script', 'Nova Slim' => 'Nova Slim', 'Nova Square' => 'Nova Square', 'Numans' => 'Numans', 'Nunito' => 'Nunito', 'Odor Mean Chey' => 'Odor Mean Chey', 'Old Standard TT' => 'Old Standard TT', 'Oldenburg' => 'Oldenburg', 'Oleo Script' => 'Oleo Script', 'Open Sans' => 'Open Sans', 'Open Sans Condensed' => 'Open Sans Condensed', 'Orbitron' => 'Orbitron', 'Original Surfer' => 'Original Surfer', 'Oswald' => 'Oswald', 'Over the Rainbow' => 'Over the Rainbow', 'Overlock' => 'Overlock', 'Overlock SC' => 'Overlock SC', 'Ovo' => 'Ovo', 'Oxygen' => 'Oxygen', 'PT Mono' => 'PT Mono', 'PT Sans' => 'PT Sans', 'PT Sans Caption' => 'PT Sans Caption', 'PT Sans Narrow' => 'PT Sans Narrow', 'PT Serif' => 'PT Serif', 'PT Serif Caption' => 'PT Serif Caption', 'Pacifico' => 'Pacifico', 'Parisienne' => 'Parisienne', 'Passero One' => 'Passero One', 'Passion One' => 'Passion One', 'Patrick Hand' => 'Patrick Hand', 'Patua One' => 'Patua One', 'Paytone One' => 'Paytone One', 'Permanent Marker' => 'Permanent Marker', 'Petrona' => 'Petrona', 'Philosopher' => 'Philosopher', 'Piedra' => 'Piedra', 'Pinyon Script' => 'Pinyon Script', 'Plaster' => 'Plaster', 'Play' => 'Play', 'Playball' => 'Playball', 'Playfair Display' => 'Playfair Display', 'Podkova' => 'Podkova', 'Poiret One' => 'Poiret One', 'Poller One' => 'Poller One', 'Poly' => 'Poly', 'Pompiere' => 'Pompiere', 'Pontano Sans' => 'Pontano Sans', 'Port Lligat Sans' => 'Port Lligat Sans', 'Port Lligat Slab' => 'Port Lligat Slab', 'Prata' => 'Prata', 'Preahvihear' => 'Preahvihear', 'Press Start 2P' => 'Press Start 2P', 'Princess Sofia' => 'Princess Sofia', 'Prociono' => 'Prociono', 'Prosto One' => 'Prosto One', 'Puritan' => 'Puritan', 'Quantico' => 'Quantico', 'Quattrocento' => 'Quattrocento', 'Quattrocento Sans' => 'Quattrocento Sans', 'Questrial' => 'Questrial', 'Quicksand' => 'Quicksand', 'Qwigley' => 'Qwigley', 'Radley' => 'Radley', 'Raleway' => 'Raleway', 'Rammetto One' => 'Rammetto One', 'Rancho' => 'Rancho', 'Rationale' => 'Rationale', 'Redressed' => 'Redressed', 'Reenie Beanie' => 'Reenie Beanie', 'Revalia' => 'Revalia', 'Ribeye' => 'Ribeye', 'Ribeye Marrow' => 'Ribeye Marrow', 'Righteous' => 'Righteous', 'Roboto' => 'Roboto', 'Roboto Condensed' => 'Roboto Condensed', 'Rochester' => 'Rochester', 'Rock Salt' => 'Rock Salt', 'Rokkitt' => 'Rokkitt', 'Ropa Sans' => 'Ropa Sans', 'Rosario' => 'Rosario', 'Rosarivo' => 'Rosarivo', 'Rouge Script' => 'Rouge Script', 'Ruda' => 'Ruda', 'Ruge Boogie' => 'Ruge Boogie', 'Ruluko' => 'Ruluko', 'Ruslan Display' => 'Ruslan Display', 'Russo One' => 'Russo One', 'Ruthie' => 'Ruthie', 'Sail' => 'Sail', 'Salsa' => 'Salsa', 'Sanchez' => 'Sanchez', 'Sancreek' => 'Sancreek', 'Sansita One' => 'Sansita One', 'Sarina' => 'Sarina', 'Satisfy' => 'Satisfy', 'Schoolbell' => 'Schoolbell', 'Seaweed Script' => 'Seaweed Script', 'Sevillana' => 'Sevillana', 'Shadows Into Light' => 'Shadows Into Light', 'Shadows Into Light Two' => 'Shadows Into Light Two', 'Shanti' => 'Shanti', 'Share' => 'Share', 'Shojumaru' => 'Shojumaru', 'Short Stack' => 'Short Stack', 'Siemreap' => 'Siemreap', 'Sigmar One' => 'Sigmar One', 'Signika' => 'Signika', 'Signika Negative' => 'Signika Negative', 'Simonetta' => 'Simonetta', 'Sirin Stencil' => 'Sirin Stencil', 'Six Caps' => 'Six Caps', 'Slackey' => 'Slackey', 'Smokum' => 'Smokum', 'Smythe' => 'Smythe', 'Sniglet' => 'Sniglet', 'Snippet' => 'Snippet', 'Sofia' => 'Sofia', 'Sonsie One' => 'Sonsie One', 'Sorts Mill Goudy' => 'Sorts Mill Goudy', 'Special Elite' => 'Special Elite', 'Spicy Rice' => 'Spicy Rice', 'Spinnaker' => 'Spinnaker', 'Spirax' => 'Spirax', 'Squada One' => 'Squada One', 'Stardos Stencil' => 'Stardos Stencil', 'Stint Ultra Condensed' => 'Stint Ultra Condensed', 'Stint Ultra Expanded' => 'Stint Ultra Expanded', 'Stoke' => 'Stoke', 'Sue Ellen Francisco' => 'Sue Ellen Francisco', 'Sunshiney' => 'Sunshiney', 'Supermercado One' => 'Supermercado One', 'Suwannaphum' => 'Suwannaphum', 'Swanky and Moo Moo' => 'Swanky and Moo Moo', 'Syncopate' => 'Syncopate', 'Tangerine' => 'Tangerine', 'Taprom' => 'Taprom', 'Telex' => 'Telex', 'Tenor Sans' => 'Tenor Sans', 'The Girl Next Door' => 'The Girl Next Door', 'Tienne' => 'Tienne', 'Tinos' => 'Tinos', 'Titan One' => 'Titan One', 'Trade Winds' => 'Trade Winds', 'Trocchi' => 'Trocchi', 'Trochut' => 'Trochut', 'Trykker' => 'Trykker', 'Tulpen One' => 'Tulpen One', 'Ubuntu' => 'Ubuntu', 'Ubuntu Condensed' => 'Ubuntu Condensed', 'Ubuntu Mono' => 'Ubuntu Mono', 'Ultra' => 'Ultra', 'Uncial Antiqua' => 'Uncial Antiqua', 'UnifrakturCook' => 'UnifrakturCook', 'UnifrakturMaguntia' => 'UnifrakturMaguntia', 'Unkempt' => 'Unkempt', 'Unlock' => 'Unlock', 'Unna' => 'Unna', 'VT323' => 'VT323', 'Varela' => 'Varela', 'Varela Round' => 'Varela Round', 'Vast Shadow' => 'Vast Shadow', 'Vibur' => 'Vibur', 'Vidaloka' => 'Vidaloka', 'Viga' => 'Viga', 'Voces' => 'Voces', 'Volkhov' => 'Volkhov', 'Vollkorn' => 'Vollkorn', 'Voltaire' => 'Voltaire', 'Waiting for the Sunrise' => 'Waiting for the Sunrise', 'Wallpoet' => 'Wallpoet', 'Walter Turncoat' => 'Walter Turncoat', 'Wellfleet' => 'Wellfleet', 'Wire One' => 'Wire One', 'Yanone Kaffeesatz' => 'Yanone Kaffeesatz', 'Yellowtail' => 'Yellowtail', 'Yeseva One' => 'Yeseva One', 'Yesteryear' => 'Yesteryear', 'Zeyada' => 'Zeyada');
                         foreach ($google_font_faces as $i => $google_font_face) {
                             $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $google_font_face . '</option>';
                         }
                         $output .= '</optgroup>';
                         $output .= '</select></div>';
                     }
                     /* Font Weight */
                     if (isset($typography_stored['style'])) {
                         $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                         $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                         $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                         foreach ($styles as $i => $style) {
                             $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                         }
                         $output .= '</select></div>';
                     }
                     /* Font Color */
                     if (isset($typography_stored['color'])) {
                         $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                         $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                     }
                     break;
                     //border option
                 //border option
                 case 'border':
                     /* Border Width */
                     $border_stored = $smof_data[$value['id']];
                     $output .= '<div class="select_wrapper border-width">';
                     $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                     for ($i = 0; $i < 21; $i++) {
                         $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                     }
                     $output .= '</select></div>';
                     /* Border Style */
                     $output .= '<div class="select_wrapper border-style">';
                     $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                     $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                     /* Border Color */
                     $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                     break;
                     //images checkbox - use image as checkboxes
                 //images checkbox - use image as checkboxes
                 case 'images':
                     $i = 0;
                     $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                     foreach ($value['options'] as $key => $option) {
                         $i++;
                         $checked = '';
                         $selected = '';
                         if (NULL != checked($select_value, $key, false)) {
                             $checked = checked($select_value, $key, false);
                             $selected = 'of-radio-img-selected';
                         }
                         $output .= '<span>';
                         $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                         $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                         $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                         $output .= '</span>';
                     }
                     break;
                     //info (for small intro box etc)
                 //info (for small intro box etc)
                 case "info":
                     $info_text = $value['std'];
                     $output .= '<div class="of-info">' . $info_text . '</div>';
                     break;
                     //display a single image
                 //display a single image
                 case "image":
                     $src = $value['std'];
                     $output .= '<img src="' . $src . '">';
                     break;
                     //tab heading
                 //tab heading
                 case 'heading':
                     if ($counter >= 2) {
                         $output .= '</div>' . "\n";
                     }
                     //custom icon
                     $icon_class = '';
                     if (isset($value['icon'])) {
                         $icon_class = ' dashicons-smof-menu dashicons-' . $value['icon'];
                     }
                     $header_class = str_replace(' ', '', strtolower($value['name']));
                     $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                     $jquery_click_hook = "of-option-" . trim(preg_replace('/ +/', '', preg_replace('/[^A-Za-z0-9 ]/', '', urldecode(html_entity_decode(strip_tags($jquery_click_hook))))));
                     $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '" class="' . $icon_class . '">' . $value['name'] . '</a></li>';
                     $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                     break;
                     //drag & drop slide manager
                 //drag & drop slide manager
                 case 'slider':
                     $output .= '<div class="slider"><ul id="' . $value['id'] . '">';
                     $slides = $smof_data[$value['id']];
                     $count = count($slides);
                     if ($count < 2) {
                         $oldorder = 1;
                         $order = 1;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order);
                     } else {
                         $i = 0;
                         foreach ($slides as $slide) {
                             $oldorder = $slide['order'];
                             $i++;
                             $order = $i;
                             $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order);
                         }
                     }
                     $output .= '</ul>';
                     $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                     break;
                     //drag & drop block manager
                 //drag & drop block manager
                 case 'sorter':
                     // Make sure to get list of all the default blocks first
                     $all_blocks = $value['std'];
                     $temp = array();
                     // holds default blocks
                     $temp2 = array();
                     // holds saved blocks
                     foreach ($all_blocks as $blocks) {
                         $temp = array_merge($temp, $blocks);
                     }
                     $sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                     foreach ($sortlists as $sortlist) {
                         $temp2 = array_merge($temp2, $sortlist);
                     }
                     // now let's compare if we have anything missing
                     foreach ($temp as $k => $v) {
                         if (!array_key_exists($k, $temp2)) {
                             $sortlists['disabled'][$k] = $v;
                         }
                     }
                     // now check if saved blocks has blocks not registered under default blocks
                     foreach ($sortlists as $key => $sortlist) {
                         foreach ($sortlist as $k => $v) {
                             if (!array_key_exists($k, $temp)) {
                                 unset($sortlist[$k]);
                             }
                         }
                         $sortlists[$key] = $sortlist;
                     }
                     // assuming all sync'ed, now get the correct naming for each block
                     foreach ($sortlists as $key => $sortlist) {
                         foreach ($sortlist as $k => $v) {
                             $sortlist[$k] = $temp[$k];
                         }
                         $sortlists[$key] = $sortlist;
                     }
                     $output .= '<div id="' . $value['id'] . '" class="sorter">';
                     if ($sortlists) {
                         foreach ($sortlists as $group => $sortlist) {
                             $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                             $output .= '<h3>' . $group . '</h3>';
                             foreach ($sortlist as $key => $list) {
                                 $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                                 if ($key != "placebo") {
                                     $output .= '<li id="' . $key . '" class="sortee">';
                                     $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                     $output .= $list;
                                     $output .= '</li>';
                                 }
                             }
                             $output .= '</ul>';
                         }
                     }
                     $output .= '</div>';
                     break;
                     //background images option
                 //background images option
                 case 'tiles':
                     $i = 0;
                     $select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                     if (is_array($value['options'])) {
                         foreach ($value['options'] as $key => $option) {
                             $i++;
                             $checked = '';
                             $selected = '';
                             if (NULL != checked($select_value, $option, false)) {
                                 $checked = checked($select_value, $option, false);
                                 $selected = 'of-radio-tile-selected';
                             }
                             $output .= '<span>';
                             $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                             $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                             $output .= '</span>';
                         }
                     }
                     break;
                     //backup and restore options data
                 //backup and restore options data
                 case 'backup':
                     $instructions = $value['desc'];
                     $backup = of_get_options(BACKUPS);
                     $init = of_get_options('smof_init');
                     if (!isset($backup['backup_log'])) {
                         $log = __('No backups yet', 'editit');
                     } else {
                         $log = $backup['backup_log'];
                     }
                     $output .= '<div class="backup-box">';
                     $output .= '<div class="instructions">' . $instructions . "\n";
                     $output .= '<p><strong>' . __('Last Backup : ', 'editit') . '<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                     $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">' . __('Backup Options', 'editit') . '</a>';
                     $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">' . __('Restore Options', 'editit') . '</a>';
                     $output .= '</div>';
                     break;
                     //export or import data between different installs
                 //export or import data between different installs
                 case 'transfer':
                     $instructions = $value['desc'];
                     $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($smof_data)) . '</textarea>' . "\n";
                     $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">' . __('Import Options', 'editit') . '</a>';
                     break;
                     // google font field
                 // google font field
                 case 'select_google_font':
                     $output .= '<div class="select_wrapper">';
                     $output .= '<select class="select of-input google_font_select" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                     foreach ($value['options'] as $select_key => $option) {
                         $output .= '<option value="' . $select_key . '" ' . selected(isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : "", $option, false) . ' />' . $option . '</option>';
                     }
                     $output .= '</select></div>';
                     if (isset($value['preview']['text'])) {
                         $g_text = $value['preview']['text'];
                     } else {
                         $g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
                     }
                     if (isset($value['preview']['size'])) {
                         $g_size = 'style="font-size: ' . $value['preview']['size'] . ';"';
                     } else {
                         $g_size = '';
                     }
                     $hide = " hide";
                     if ($smof_data[$value['id']] != "none" && $smof_data[$value['id']] != "") {
                         $hide = "";
                     }
                     $output .= '<p class="' . $value['id'] . '_ggf_previewer google_font_preview' . $hide . '" ' . $g_size . '>' . $g_text . '</p>';
                     break;
                     //JQuery UI Slider
                 //JQuery UI Slider
                 case 'sliderui':
                     $s_val = $s_min = $s_max = $s_step = $s_edit = '';
                     //no errors, please
                     $s_val = stripslashes($smof_data[$value['id']]);
                     if (!isset($value['min'])) {
                         $s_min = '0';
                     } else {
                         $s_min = $value['min'];
                     }
                     if (!isset($value['max'])) {
                         $s_max = $s_min + 1;
                     } else {
                         $s_max = $value['max'];
                     }
                     if (!isset($value['step'])) {
                         $s_step = '1';
                     } else {
                         $s_step = $value['step'];
                     }
                     if (!isset($value['edit'])) {
                         $s_edit = ' readonly="readonly"';
                     } else {
                         $s_edit = '';
                     }
                     if ($s_val == '') {
                         $s_val = $s_min;
                     }
                     //values
                     $s_data = 'data-id="' . $value['id'] . '" data-val="' . $s_val . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                     //html output
                     $output .= '<input type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $s_val . '" class="mini" ' . $s_edit . ' />';
                     $output .= '<div id="' . $value['id'] . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                     break;
                     //Switch option
                 //Switch option
                 case 'switch':
                     if (!isset($smof_data[$value['id']])) {
                         $smof_data[$value['id']] = 0;
                     }
                     $fold = '';
                     if (array_key_exists("folds", $value)) {
                         $fold = "s_fld ";
                     }
                     $cb_enabled = $cb_disabled = '';
                     //no errors, please
                     //Get selected
                     if ($smof_data[$value['id']] == 1) {
                         $cb_enabled = ' selected';
                         $cb_disabled = '';
                     } else {
                         $cb_enabled = '';
                         $cb_disabled = ' selected';
                     }
                     //Label ON
                     if (!isset($value['on'])) {
                         $on = "On";
                     } else {
                         $on = $value['on'];
                     }
                     //Label OFF
                     if (!isset($value['off'])) {
                         $off = "Off";
                     } else {
                         $off = $value['off'];
                     }
                     $output .= '<p class="switch-options">';
                     $output .= '<label class="' . $fold . 'cb-enable' . $cb_enabled . '" data-id="' . $value['id'] . '"><span>' . $on . '</span></label>';
                     $output .= '<label class="' . $fold . 'cb-disable' . $cb_disabled . '" data-id="' . $value['id'] . '"><span>' . $off . '</span></label>';
                     $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                     $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold . 'checkbox of-input main_checkbox" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                     $output .= '</p>';
                     break;
                     // Uploader 3.5
                 // Uploader 3.5
                 case "upload":
                 case "media":
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     $u_val = '';
                     if ($smof_data[$value['id']]) {
                         $u_val = stripslashes($smof_data[$value['id']]);
                     }
                     $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $u_val, $value['mod']);
                     break;
             }
             do_action('optionsframework_machine_loop', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
             if ($smof_output != "") {
                 $output .= $smof_output;
                 $smof_output = "";
             }
             //description of each option
             if ($value['type'] != 'heading') {
                 if (!isset($value['desc'])) {
                     $explain_value = '';
                 } else {
                     $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
                 }
                 $output .= '</div>' . $explain_value . "\n";
                 $output .= '<div class="clear"> </div></div></div>' . "\n";
             }
         }
         /* condition empty end */
     }
     if ($update_data == true) {
         of_save_options($smof_data);
     }
     $output .= '</div>';
     do_action('optionsframework_machine_after', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
     if ($smof_output != "") {
         $output .= $smof_output;
         $smof_output = "";
     }
     return array($output, $menu, $defaults);
 }
    /**
     * Process options data and build option fields
     *
     * @uses get_option()
     *
     * @access public
     * @since 1.0.0
     *
     * @return array
     */
    public static function optionsframework_machine($options)
    {
        $data = get_option(OPTIONS);
        $defaults = array();
        $counter = 0;
        $menu = '';
        $output = '';
        foreach ($options as $value) {
            $counter++;
            $val = '';
            //create array of defaults
            if ($value['type'] == 'multicheck') {
                if (is_array($value['std'])) {
                    foreach ($value['std'] as $i => $key) {
                        $defaults[$value['id']][$key] = true;
                    }
                } else {
                    $defaults[$value['id']][$value['std']] = true;
                }
            } else {
                if (isset($value['id'])) {
                    $defaults[$value['id']] = $value['std'];
                }
            }
            //Start Heading
            if ($value['type'] != "heading") {
                $class = '';
                if (isset($value['class'])) {
                    $class = $value['class'];
                }
                //hide items in checkbox group
                $fold = '';
                if (array_key_exists("fold", $value)) {
                    if (@$data[$value['fold']]) {
                        $fold = "f_" . $value['fold'] . " ";
                    } else {
                        $fold = "f_" . $value['fold'] . " temphide ";
                    }
                }
                if (isset($value['display'])) {
                    $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section ' . $value['display'] . ' section-' . $value['type'] . ' ' . $class . '">' . "\n";
                } else {
                    $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
                }
                //only show header if 'name' value exists
                if ($value['name']) {
                    $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
                }
                $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
            }
            //End Heading
            //switch statement to handle various options type
            switch ($value['type']) {
                //text input
                case 'text':
                    $t_value = '';
                    $t_value = stripslashes(@$data[$value['id']]);
                    $mini = '';
                    if (!isset($value['mod'])) {
                        $value['mod'] = '';
                    }
                    if ($value['mod'] == 'mini') {
                        $mini = 'mini';
                    }
                    if (!isset($value['googlefont'])) {
                        $value['googlefont'] = "";
                    }
                    if ($value['googlefont'] == 'text') {
                        $scclass = 'gfontscome ';
                    } elseif ($value['googlefont'] == 'heading') {
                        $scclass = 'gfontscomehead ';
                    } else {
                        $scclass = '';
                    }
                    $output .= '<input class="of-input ' . $scclass . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                    if ($value['googlefont'] == 'text') {
                        $output .= '<p class="gfontsview" style="font-family:\'' . str_replace('+', ' ', $t_value) . '\'">Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
								 Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, 
								 when an unknown printer took a galley of type and scrambled it to make a type 
								 specimen book. It has survived not only five centuries, but also the leap into
								 electronic typesetting, remaining essentially unchanged.</p><br><br>';
                    } elseif ($value['googlefont'] == 'heading') {
                        $output .= '<br><h1 class="gfontsviewhead" style="font-size:34px; font-family:\'' . str_replace('+', ' ', $t_value) . '\'; line-height:1.4em">Grumpy wizards make toxic brew for the evil Queen and Jack</h1><br><br><br><br><br><br>';
                    }
                    $scclass = '';
                    break;
                    //select option
                //select option
                case 'select':
                    $mini = '';
                    if (!isset($value['mod'])) {
                        $value['mod'] = '';
                    }
                    if ($value['mod'] == 'mini') {
                        $mini = 'mini';
                    }
                    $output .= '<div class="select_wrapper ' . $mini . '">';
                    $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                    foreach ($value['options'] as $select_ID => $option) {
                        $selecteds = selected(@$data[$value['id']], $option, false);
                        $output .= '<option id="' . $select_ID . '" value="' . $option . '" ' . $selecteds . ' />' . $option . '</option>';
                        if ($selecteds) {
                            $moption = $option;
                        }
                    }
                    $output .= '</select></div>';
                    if (isset($value['bgpatterns']) == 1) {
                        $output .= '<br><br><div class="bgpatterndiv" style="background:url(' . get_template_directory_uri() . '/images/bgpatterns/' . $moption . ');width:338px;border:1px solid #ccc; height:200px; float:left"></div>';
                    }
                    $moption = '';
                    break;
                    //textarea option
                //textarea option
                case 'textarea':
                    $cols = '8';
                    $ta_value = '';
                    if (isset($value['options'])) {
                        $ta_options = $value['options'];
                        if (isset($ta_options['cols'])) {
                            $cols = $ta_options['cols'];
                        }
                    }
                    $ta_value = stripslashes(@$data[$value['id']]);
                    $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                    break;
                    //radiobox option
                //radiobox option
                case "radio":
                    foreach ($value['options'] as $option => $name) {
                        $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked(@$data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                    }
                    break;
                    //checkbox option
                //checkbox option
                case 'checkbox':
                    if (!isset($data[$value['id']])) {
                        @($data[$value['id']] = 0);
                    }
                    $fold = '';
                    if (array_key_exists("folds", $value)) {
                        $fold = "fld ";
                    }
                    $output .= '<input type="hidden" class="' . $fold . 'checkbox aq-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                    $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked(@$data[$value['id']], 1, false) . ' />';
                    break;
                    //multiple checkbox option
                //multiple checkbox option
                case 'multicheck':
                    $multi_stored = @$data[$value['id']];
                    foreach ($value['options'] as $key => $option) {
                        if (!isset($multi_stored[$key])) {
                            $multi_stored[$key] = '';
                        }
                        $of_key_string = $value['id'] . '_' . $key;
                        $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                    }
                    break;
                    //ajax image upload option
                //ajax image upload option
                case 'upload':
                    if (!isset($value['mod'])) {
                        $value['mod'] = '';
                    }
                    $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                    break;
                    // native media library uploader - @uses optionsframework_media_uploader_function()
                // native media library uploader - @uses optionsframework_media_uploader_function()
                case 'media':
                    $_id = strip_tags(strtolower($value['id']));
                    $int = '';
                    $int = optionsframework_mlu_get_silentpost($_id);
                    if (!isset($value['mod'])) {
                        $value['mod'] = '';
                    }
                    $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                    // New AJAX Uploader using Media Library
                    break;
                    //colorpicker option
                //colorpicker option
                case 'color':
                    $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . @$data[$value['id']] . '"></div></div>';
                    $output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . @$data[$value['id']] . '" />';
                    break;
                    //typography option
                //typography option
                case 'typography':
                    $typography_stored = isset($data[$value['id']]) ? @$data[$value['id']] : $value['std'];
                    /* Font Size */
                    if (isset($typography_stored['size'])) {
                        $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                        $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                        if ($value['id'] == 'md_body_fontsize') {
                            $mini = '10';
                            $maxi = '21';
                        } else {
                            $mini = '28';
                            $maxi = '72';
                        }
                        for ($i = $mini; $i < $maxi; $i++) {
                            $test = $i . 'px';
                            $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                        }
                        $output .= '</select></div>';
                    }
                    /* Line Height */
                    if (isset($typography_stored['height'])) {
                        $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                        $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                        for ($i = 20; $i < 38; $i++) {
                            $test = $i . 'px';
                            $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                        }
                        $output .= '</select></div>';
                    }
                    /* Font Face */
                    if (isset($typography_stored['face'])) {
                        $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                        $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                        $faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'palatino' => 'Palatino', 'helvetica' => 'Helvetica');
                        foreach ($faces as $i => $face) {
                            $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                        }
                        $output .= '</select></div>';
                    }
                    /* Font Weight */
                    if (isset($typography_stored['style'])) {
                        $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                        $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                        $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                        foreach ($styles as $i => $style) {
                            $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                        }
                        $output .= '</select></div>';
                    }
                    /* Font Color */
                    if (isset($typography_stored['color'])) {
                        $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                        $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                    }
                    break;
                    //border option
                //border option
                case 'border':
                    /* Border Width */
                    $border_stored = @$data[$value['id']];
                    $output .= '<div class="select_wrapper border-width">';
                    $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                    for ($i = 0; $i < 21; $i++) {
                        $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                    }
                    $output .= '</select></div>';
                    /* Border Style */
                    $output .= '<div class="select_wrapper border-style">';
                    $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                    $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                    foreach ($styles as $i => $style) {
                        $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                    }
                    $output .= '</select></div>';
                    /* Border Color */
                    $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                    $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                    break;
                    //images checkbox - use image as checkboxes
                //images checkbox - use image as checkboxes
                case 'images':
                    $i = 0;
                    $select_value = @$data[$value['id']];
                    foreach ($value['options'] as $key => $option) {
                        $i++;
                        $checked = '';
                        $selected = '';
                        if (NULL != checked($select_value, $key, false)) {
                            $checked = checked($select_value, $key, false);
                            $selected = 'of-radio-img-selected';
                        }
                        $output .= '<span>';
                        $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                        $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                        $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true; checkAllFields();" />';
                        $output .= '</span>';
                    }
                    break;
                    //info (for small intro box etc)
                //info (for small intro box etc)
                case "info":
                    $info_text = $value['std'];
                    $output .= '<div class="of-info">' . $info_text . '</div>';
                    break;
                    //display a single image
                //display a single image
                case "image":
                    $src = $value['std'];
                    $output .= '<img src="' . $src . '">';
                    break;
                    //tab heading
                //tab heading
                case 'heading':
                    if ($counter >= 2) {
                        $output .= '</div>' . "\n";
                    }
                    $header_class = str_replace(' ', '', strtolower($value['name']));
                    $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                    $jquery_click_hook = "of-option-" . $jquery_click_hook;
                    $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                    $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                    break;
                    //drag & drop slide manager
                //drag & drop slide manager
                case 'slider':
                    $_id = strip_tags(strtolower($value['id']));
                    $int = '';
                    $int = optionsframework_mlu_get_silentpost($_id);
                    $output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
                    $slides = @$data[$value['id']];
                    $count = count($slides);
                    if ($count < 2) {
                        $oldorder = 1;
                        $order = 1;
                        $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                    } else {
                        $i = 0;
                        foreach ($slides as $slide) {
                            $oldorder = $slide['order'];
                            $i++;
                            $order = $i;
                            $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                        }
                    }
                    $output .= '</ul>';
                    $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                    break;
                    //drag & drop block manager
                //drag & drop block manager
                case 'sorter':
                    $sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? @$data[$value['id']] : $value['std'];
                    $output .= '<div id="' . $value['id'] . '" class="sorter">';
                    if ($sortlists) {
                        foreach ($sortlists as $group => $sortlist) {
                            $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                            $output .= '<h3>' . $group . '</h3>';
                            foreach ($sortlist as $key => $list) {
                                $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                                if ($key != "placebo") {
                                    $output .= '<li id="' . $key . '" class="sortee">';
                                    $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                    $output .= $list;
                                    $output .= '</li>';
                                }
                            }
                            $output .= '</ul>';
                        }
                    }
                    $output .= '</div>';
                    break;
                    //background images option
                //background images option
                case 'tiles':
                    $i = 0;
                    $select_value = isset($data[$value['id']]) && !empty($data[$value['id']]) ? @$data[$value['id']] : '';
                    foreach ($value['options'] as $key => $option) {
                        $i++;
                        $checked = '';
                        $selected = '';
                        if (NULL != checked($select_value, $option, false)) {
                            $checked = checked($select_value, $option, false);
                            $selected = 'of-radio-tile-selected';
                        }
                        $output .= '<span>';
                        $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                        $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                        $output .= '</span>';
                    }
                    break;
                    //backup and restore options data
                //backup and restore options data
                case 'backup':
                    $instructions = $value['desc'];
                    $backup = get_option(BACKUPS);
                    if (!isset($backup['backup_log'])) {
                        $log = 'No backups yet';
                    } else {
                        $log = $backup['backup_log'];
                    }
                    $output .= '<div class="backup-box">';
                    $output .= '<div class="instructions">' . $instructions . "\n";
                    $output .= '<p><strong>' . __('Last Backup : ', 'dronetv') . '<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                    $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
                    $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
                    $output .= '</div>';
                    break;
                    //export or import data between different installs
                //export or import data between different installs
                case 'transfer':
                    $instructions = $value['desc'];
                    $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize(@$data)) . '</textarea>' . "\n";
                    $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                    break;
                case 'migrate':
                    $output .= 'Your Previous Domain (http://localhost)<br><input type="text" id="md_migrate_old" name="md_migrate_old" value=""><br>';
                    $output .= 'Your New Domain (http://www.yournewsite.com)<br><input type="text" id="md_migrate_new" name="md_migrate_new" value=""><br><br>';
                    $output .= '<a href="#" id="of_migrate_button" class="button" title="Replace URLs">Replace URLs</a>';
                    break;
            }
            //description of each option
            if ($value['type'] != 'heading') {
                if (!isset($value['desc'])) {
                    $explain_value = '';
                } else {
                    $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
                }
                $output .= '</div>' . $explain_value . "\n";
                $output .= '<div class="clear"> </div></div></div>' . "\n";
            }
        }
        $output .= '</div>';
        return array($output, $menu, $defaults);
    }
Exemplo n.º 7
0
 public static function optionsframework_machine($options)
 {
     $pmc_data = get_option(OPTIONS);
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     foreach ($options as $value) {
         $counter++;
         $val = '';
         if (isset($value['id'])) {
             //create array of defaults
             if ($value['type'] == 'multicheck') {
                 if (is_array($value['std'])) {
                     foreach ($value['std'] as $i => $key) {
                         $defaults[$value['id']][$key] = true;
                     }
                 } else {
                     $defaults[$value['id']][$value['std']] = true;
                 }
             } else {
                 if (isset($value['id'])) {
                     $defaults[$value['id']] = $value['std'];
                 }
             }
         }
         //Start Heading
         if ($value['type'] != "heading") {
             $class = '';
             $onclick = '';
             if (isset($value['class'])) {
                 $class = $value['class'];
             }
             if (isset($value['onclick'])) {
                 $onclick = $value['onclick'];
             }
             if ($value['type'] != "innerheading") {
                 $output .= '<div class="section section-' . $value['type'] . ' ' . $class . '" onclick = "' . $onclick . '">' . "\n";
                 $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
                 $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
             }
             if ($value['type'] == "innerheading") {
                 $output .= '<div style="margin-top:30px;border-top:3px solid #E7E7E7; border-bottom:3px solid #E7E7E7; background:#E7E7E7; padding:10px 0 0 10px;" class="section section-' . $value['type'] . ' ' . $class . '" onclick = "' . $onclick . '">' . "\n";
                 $output .= '<h1>' . $value['name'] . '</h1>' . "\n";
                 $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
             }
         }
         //End Heading
         switch ($value['type']) {
             case 'innerheading':
                 $output .= '<h2 style="margin:10px 0 0 0 !important;">' . $value['name'] . '</h2>';
                 break;
             case 'text':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $textvalue = str_replace('\\', '', $pmc_data[$value['id']]);
                 $output .= '<input class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $textvalue . '" />';
                 break;
             case 'select':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $output .= '<div class="select_wrapper">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 foreach ($value['options'] as $option) {
                     $output .= '<option value="' . $option . '" ' . selected($pmc_data[$value['id']], $option, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
             case 'select2':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $output .= '<div class="select_wrapper mini">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 foreach ($value['options'] as $option => $name) {
                     $output .= '<option value="' . $option . '" ' . selected($pmc_data[$value['id']], $option, false) . ' />' . $name . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
             case 'textarea':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $cols = '8';
                 $ta_value = '';
                 if (isset($value['options'])) {
                     $ta_options = $value['options'];
                     if (isset($ta_options['cols'])) {
                         $cols = $ta_options['cols'];
                     }
                 }
                 $ta_value = str_replace('\\', '', $pmc_data[$value['id']]);
                 $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                 break;
             case "radio":
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 foreach ($value['options'] as $option => $name) {
                     $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($pmc_data[$value['id']], $option, false) . ' />' . $name . '<br/>';
                 }
                 break;
             case "slidercategory":
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $category = '';
                 $output .= '<div class="select_wrapper">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 $categories = get_terms("sliderocategory");
                 $output .= '<option value="0" ' . selected($pmc_data[$value['id']], $category->term_id, false) . ' />None</option>';
                 foreach ($categories as $category) {
                     $output .= '<option value="' . $category->term_id . '" ' . selected($pmc_data[$value['id']], $category->term_id, false) . ' />' . $category->name . '</option>';
                 }
                 $output .= '</select></div>';
                 //$output .= wp_dropdown_categories('show_option_all=Show all&hierarchical=2&name='.$value["id"].'&taxonomy=sliderocategory&selected='.selected($pmc_data[$value["id"]], $option, false).'');
                 break;
             case 'checkbox':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($pmc_data[$value['id']], true, false) . ' />';
                 break;
             case 'multicheck':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $multi_stored = $pmc_data[$value['id']];
                 foreach ($value['options'] as $key => $option) {
                     if (!isset($multi_stored[$key])) {
                         $multi_stored[$key] = '';
                     }
                     $of_key_string = $value['id'] . '_' . $key;
                     $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label for="' . $of_key_string . '">' . $option . '</label><br />';
                 }
                 break;
             case 'upload':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                 break;
             case 'media':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                 // New AJAX Uploader using Media Library
                 break;
             case 'slider':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 $output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
                 $slides = $pmc_data[$value['id']];
                 $count = count($slides);
                 if ($count < 2) {
                     $oldorder = 1;
                     $order = 1;
                     $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int, $value['descshow'], $value['team'], $value['nivo']);
                 } else {
                     $i = 0;
                     foreach ($slides as $slide) {
                         if (isset($slide['order'])) {
                             $oldorder = $slide['order'];
                         } else {
                             $oldorder = 0;
                         }
                         $i++;
                         $order = $i;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int, $value['descshow'], $value['team'], $value['nivo']);
                     }
                 }
                 $output .= '</ul>';
                 if ($value['descshow'] and !$value['team'] and !$value['nivo']) {
                     $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                 }
                 if ($value['team'] and !$value['descshow'] and !$value['nivo']) {
                     $output .= '<a href="#" class="button slide_add_button_team">Add New Team</a></div>';
                 }
                 if (!$value['team'] and !$value['descshow'] and !$value['nivo']) {
                     $output .= '<a href="#" class="button slide_add_button_desc">Add New Client</a></div>';
                 }
                 if ($value['nivo'] and !$value['ios']) {
                     $output .= '<a href="#" class="button nivo_slide_add_button">Add New Nivo Slider</a></div>';
                 }
                 if ($value['ios']) {
                     $output .= '<a href="#" class="button nivo_slide_add_button">Add New iosSlider</a></div>';
                 }
                 break;
             case 'sorter':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $sortlists = $pmc_data[$value['id']];
                 $output .= '<div id="' . $value['id'] . '" class="sorter">';
                 if ($sortlists) {
                     foreach ($sortlists as $group => $sortlist) {
                         $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                         $output .= '<h3>' . $group . '</h3>';
                         foreach ($sortlist as $key => $list) {
                             if ($key == "placebo") {
                                 $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                             } else {
                                 $output .= '<li id="' . $key . '" class="sortee">';
                                 $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                 $output .= $list;
                                 $output .= '</li>';
                             }
                         }
                         $output .= '</ul>';
                     }
                 }
                 $output .= '</div>';
                 break;
             case 'color':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $pmc_data[$value['id']] . '"></div></div>';
                 $output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $pmc_data[$value['id']] . '" />';
                 break;
             case 'colorrgb':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $pmc_data[$value['id']] . '" data-color-format="rgb"></div></div>';
                 $output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $pmc_data[$value['id']] . '" />';
                 break;
             case 'sizeColor':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = array('size' => 12, 'color' => '#000000');
                 }
                 $sizeColor = $pmc_data[$value['id']];
                 $output .= '<div class="select_wrapper typography-size">';
                 $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                 for ($i = 9; $i < 44; $i++) {
                     $test = $i . 'px';
                     $output .= '<option value="' . $i . 'px" ' . selected($sizeColor['size'], $test, false) . '>' . $i . 'px</option>';
                 }
                 $output .= '</select></div>';
                 /* Font Color */
                 $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $sizeColor['color'] . '"></div></div>';
                 $output .= '<input class="of-color of-typography of-typography-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $sizeColor['color'] . '" />';
                 break;
             case 'font':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = array('face' => 'arial');
                 }
                 $output .= '<div class="select_wrapper font">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 $faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'Helvetica Neue' => 'Helvetica Neue', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'Telex' => 'Telex', 'Droid%20Sans' => 'Droid Sans', 'Convergence' => 'Convergence', 'Oswald' => 'Oswald', 'News%20Cycle' => 'News Cycle', 'Yanone%20Kaffeesatz:300' => 'Yanone Kaffeesatz Light', 'Yanone%20Kaffeesatz:200' => 'Yanone Kaffeesatz ExtraLight', 'Yanone%20Kaffeesatz:400' => 'Yanone Kaffeesatz Regular', 'Duru%20Sans' => 'Duru Sans', 'Open%20Sans' => 'Open Sans', 'PT%20Sans%20Narrow' => 'PT Sans Narrow', 'Macondo Swash Caps' => 'Macondo Swash Caps', 'Telex' => 'Telex', 'Sirin%20Stencil' => 'Sirin Stencil', 'Actor' => 'Actor', 'Iceberg' => 'Iceberg', 'Ropa%20Sans' => 'Ropa Sans', 'Amethysta' => 'Amethysta', 'Alegreya' => 'Alegreya', 'Germania One' => 'Germania One', 'Gudea' => 'Gudea', 'Trochut' => 'Trochut', 'Ruluko' => 'Ruluko', 'Alegreya' => 'Alegreya', 'Questrial' => 'Questrial', 'Armata' => 'Armata', 'PT%20Sans' => 'PT Sans');
                 foreach ($faces as $i => $face) {
                     $output .= '<option value="' . $i . '" ' . selected($pmc_data[$value['id']], $i, false) . '>' . $face . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
             case 'typography':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = array('size' => 12, 'face' => 'arial', 'color' => '#000000', 'style' => 'normal');
                 }
                 $typography_stored = $pmc_data[$value['id']];
                 /* Font Size */
                 if (isset($typography_stored['size'])) {
                     $output .= '<div class="select_wrapper typography-size">';
                     $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                     for ($i = 9; $i < 44; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Color */
                 if (isset($typography_stored['color'])) {
                     $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-typography of-typography-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                 }
                 /* Font Face */
                 if (isset($typography_stored['face'])) {
                     $output .= '<div class="select_wrapper typography-face">';
                     $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                     $faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'Helvetica Neue' => 'Helvetica Neue', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'Telex' => 'Telex', 'Droid%20Sans' => 'Droid Sans', 'Convergence' => 'Convergence', 'Oswald' => 'Oswald', 'News%20Cycle' => 'News Cycle', 'Yanone%20Kaffeesatz:300' => 'Yanone Kaffeesatz Light', 'Yanone%20Kaffeesatz:200' => 'Yanone Kaffeesatz ExtraLight', 'Yanone%20Kaffeesatz:400' => 'Yanone Kaffeesatz Regular', 'Duru%20Sans' => 'Duru Sans', 'Open%20Sans' => 'Open Sans', 'PT%20Sans%20Narrow' => 'PT Sans Narrow', 'Macondo Swash Caps' => 'Macondo Swash Caps', 'Telex' => 'Telex', 'Sirin%20Stencil' => 'Sirin Stencil', 'Actor' => 'Actor', 'Iceberg' => 'Iceberg', 'Ropa%20Sans' => 'Ropa Sans', 'Amethysta' => 'Amethysta', 'Alegreya' => 'Alegreya', 'Germania One' => 'Germania One', 'Gudea' => 'Gudea', 'Trochut' => 'Trochut', 'Ruluko' => 'Ruluko', 'Alegreya' => 'Alegreya', 'Questrial' => 'Questrial', 'Armata' => 'Armata', 'PT%20Sans' => 'PT Sans');
                     foreach ($faces as $i => $face) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Weight */
                 if (isset($typography_stored['style'])) {
                     $output .= '<div class="select_wrapper typography-style">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                     $styles = array('normal' => 'Normal', 'bold' => 'Bold');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 break;
             case 'border':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 if (!isset($pmc_data[$value['id'] . '_width'])) {
                     $pmc_data[$value['id'] . '_width'] = '';
                 }
                 if (!isset($pmc_data[$value['id'] . '_style'])) {
                     $pmc_data[$value['id'] . '_style'] = '';
                 }
                 if (!isset($pmc_data[$value['id'] . '_color'])) {
                     $pmc_data[$value['id'] . '_color'] = '';
                 }
                 $border_stored = array('width' => $pmc_data[$value['id'] . '_width'], 'style' => $pmc_data[$value['id'] . '_style'], 'color' => $pmc_data[$value['id'] . '_color']);
                 /* Border Width */
                 $border_stored = $pmc_data[$value['id']];
                 $output .= '<div class="select_wrapper border-width">';
                 $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                 for ($i = 0; $i < 21; $i++) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Style */
                 $output .= '<div class="select_wrapper border-style">';
                 $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                 $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                 foreach ($styles as $i => $style) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Color */
                 $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                 $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                 break;
             case 'images':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $i = 0;
                 $select_value = $pmc_data[$value['id']];
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $key, false)) {
                         $checked = checked($select_value, $key, false);
                         $selected = 'of-radio-img-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                     $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                     $output .= '</span>';
                 }
                 break;
             case 'tiles':
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $i = 0;
                 if (isset($pmc_data[$value['id']])) {
                     $select_value = $pmc_data[$value['id']];
                 } else {
                     $select_value = 1;
                 }
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $option, false)) {
                         $checked = checked($select_value, $option, false);
                         $selected = 'of-radio-tile-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                     $output .= '</span>';
                 }
                 break;
             case "info":
                 if (!isset($pmc_data[$value['id']])) {
                     $pmc_data[$value['id']] = '';
                 }
                 $info_text = $value['std'];
                 $output .= '<div class="of-info">' . $info_text . '</div>';
                 break;
             case 'heading':
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $header_class = preg_replace("/[^A-Za-z0-9]/", "", strtolower($value['name']));
                 $jquery_click_hook = preg_replace("/[^A-Za-z0-9]/", "", strtolower($value['name']));
                 $jquery_click_hook = "of-option-" . $jquery_click_hook;
                 $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                 $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                 break;
                 //backup and restore options data
             //backup and restore options data
             case 'backup':
                 $instructions = $value['desc'];
                 $backup = get_option('BACKUPS');
                 if (!isset($backup['backup_log'])) {
                     $log = 'No backups yet';
                 } else {
                     $log = $backup['backup_log'];
                 }
                 $output .= '<div class="backup-box">';
                 $output .= '<div class="instructions">' . $instructions . "\n";
                 $output .= '<p><strong>Last Backup :<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                 $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
                 $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
                 $output .= '</div>';
                 break;
                 //export or import data between different installs
             //export or import data between different installs
             case 'transfer':
                 $instructions = $value['desc'];
                 $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($pmc_data)) . '</textarea>' . "\n";
                 $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                 break;
         }
         // if TYPE is an array, formatted into smaller inputs... ie smaller values
         if (is_array($value['type'])) {
             foreach ($value['type'] as $array) {
                 $id = $array['id'];
                 $std = $array['std'];
                 $saved_std = get_option($id);
                 if ($saved_std != $std) {
                     $std = $saved_std;
                 }
                 $meta = $array['meta'];
                 if ($array['type'] == 'text') {
                     // Only text at this point
                     $output .= '<input class="input-text-small of-input" name="' . $id . '" id="' . $id . '" type="text" value="' . $std . '" />';
                     $output .= '<span class="meta-two">' . $meta . '</span>';
                 }
             }
         }
         if ($value['type'] != 'heading') {
             if ($value['type'] != 'checkbox') {
                 $output .= '<br/>';
             }
             if (!isset($value['desc'])) {
                 $explain_value = '';
             } else {
                 $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
             }
             $output .= '</div>' . $explain_value . "\n";
             $output .= '<div class="clear"> </div></div></div>' . "\n";
         }
     }
     $output .= '</div>';
     return array($output, $menu, $defaults);
 }
 /**
  * Process options data and build option fields
  *
  * @uses get_option()
  *
  * @access public
  * @since 1.0.0
  *
  * @return array
  */
 public static function optionsframework_machine($options)
 {
     $data = get_option(OPTIONS);
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     foreach ($options as $value) {
         $counter++;
         $val = '';
         //create array of defaults
         if ($value['type'] == 'multicheck') {
             if (is_array($value['std'])) {
                 foreach ($value['std'] as $i => $key) {
                     $defaults[$value['id']][$key] = true;
                 }
             } else {
                 $defaults[$value['id']][$value['std']] = true;
             }
         } else {
             if (isset($value['id'])) {
                 $defaults[$value['id']] = $value['std'];
             }
         }
         //Start Heading
         if ($value['type'] != "heading") {
             $class = '';
             if (isset($value['class'])) {
                 $class = $value['class'];
             }
             //hide items in checkbox group
             $fold = '';
             if (array_key_exists("fold", $value)) {
                 if ($data[$value['fold']]) {
                     $fold = "f_" . $value['fold'] . " ";
                 } else {
                     $fold = "f_" . $value['fold'] . " temphide ";
                 }
             }
             $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
             //only show header if 'name' value exists
             if (isset($value['name'])) {
                 $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
             }
             $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
         }
         //End Heading
         //switch statement to handle various options type
         switch ($value['type']) {
             //text input
             case 'text':
                 $t_value = '';
                 $t_value = stripslashes($data[$value['id']]);
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                 break;
                 //select option
             //select option
             case 'select':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select_wrapper ' . $mini . '">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 foreach ($value['options'] as $select_ID => $option) {
                     $output .= '<option id="' . $select_ID . '" value="' . $option . '" ' . selected($data[$value['id']], $option, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
                 //textarea option
             //textarea option
             case 'textarea':
                 $cols = '8';
                 $ta_value = '';
                 if (isset($value['options'])) {
                     $ta_options = $value['options'];
                     if (isset($ta_options['cols'])) {
                         $cols = $ta_options['cols'];
                     }
                 }
                 $ta_value = stripslashes($data[$value['id']]);
                 $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                 break;
                 //radiobox option
             //radiobox option
             case "radio":
                 foreach ($value['options'] as $option => $name) {
                     $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                 }
                 break;
                 //checkbox option
             //checkbox option
             case 'checkbox':
                 if (!isset($data[$value['id']])) {
                     $data[$value['id']] = 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "fld ";
                 }
                 $output .= '<input type="hidden" class="' . $fold . 'checkbox aq-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                 $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($data[$value['id']], 1, false) . ' />';
                 break;
                 //multiple checkbox option
             //multiple checkbox option
             case 'multicheck':
                 $multi_stored = $data[$value['id']];
                 foreach ($value['options'] as $key => $option) {
                     if (!isset($multi_stored[$key])) {
                         $multi_stored[$key] = '';
                     }
                     $of_key_string = $value['id'] . '_' . $key;
                     $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                 }
                 break;
                 //ajax image upload option
             //ajax image upload option
             case 'upload':
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                 break;
                 // native media library uploader - @uses optionsframework_media_uploader_function()
             // native media library uploader - @uses optionsframework_media_uploader_function()
             case 'media':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                 // New AJAX Uploader using Media Library
                 break;
                 //colorpicker option
             //colorpicker option
             case 'color':
                 $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $data[$value['id']] . '"></div></div>';
                 $output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $data[$value['id']] . '" />';
                 break;
                 //typography option
             //typography option
             case 'typography':
                 $typography_stored = isset($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                 /* Font Size */
                 if (isset($typography_stored['size'])) {
                     $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                     $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                     for ($i = 9; $i < 35; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Line Height */
                 if (isset($typography_stored['height'])) {
                     $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                     $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                     for ($i = 20; $i < 40; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Face */
                 if (isset($typography_stored['face'])) {
                     $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                     $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                     $faces = array('lobster' => 'Lobster', 'muli' => 'Muli', 'droid sans' => 'Droid Sans', 'droid serif' => 'Droid Serif', 'cabin' => 'Cabin', 'allerta' => 'Allerta', 'crimson text' => 'Crimson Text', 'ubuntu' => 'Ubuntu', 'arvo' => 'Arvo', 'dancing script' => 'Dancing Script', 'pacifico' => 'Pacifico', 'nunito' => 'Nunito', 'hanuman' => 'Hanuman', 'josefin sans' => 'Josefin Sans', 'josefin slab' => 'Josefin Slab', 'crete round' => 'Crete Round', 'molengo' => 'Molengo', 'lekton' => 'Lekton', 'lato' => 'Lato', 'lora' => 'Lora', 'nobile' => 'Nobile', 'open sans' => 'Open Sans', 'montserrat' => 'Montserrat', 'questrial' => 'Questrial', 'francois one' => 'Francois One', 'coustard' => 'Coustard', 'trocchi' => 'Trocchi', 'cuprum' => 'Cuprum', 'oxygen' => 'Oxygen', 'oswald' => 'Oswald', 'codystar' => 'Codystar', 'imprima' => 'Imprima', 'karla' => 'Karla', 'cutive' => 'Cutive', 'glegoo' => 'Glegoo', 'asap' => 'Asap', 'telex' => 'Telex', 'belgrano' => 'Belgrano', 'rokkitt' => 'Rokkitt', 'yanone kaffeesatz' => 'Yanone Kaffeesatz', 'pt sans' => 'PT Sans', 'arimo' => 'Arimo', 'raleway' => 'Raleway', 'fredoka one' => 'Fredoka One', 'abel' => 'Abel', 'kreon' => 'Kreon', 'bitter' => 'Bitter', 'chivo' => 'Chivo', 'news cycle' => 'News Cycle', 'pontano sans' => 'Pontano Sans', 'maiden orange' => 'Maiden Orange', 'bree serif' => 'Bree Serif', 'patua one' => 'Patua One', 'montserrat alternates' => 'Montserrat Alternates', 'archivo black' => 'Archivo Black', 'arbutus slab' => 'Arbutus Slab', 'life savers' => 'Life Savers', 'della respira' => 'Della Respira', 'noticia text' => 'Noticia Text');
                     foreach ($faces as $i => $face) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Weight */
                 if (isset($typography_stored['style'])) {
                     $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                     $styles = array('300' => 'Book', '400' => 'Normal', 'italic' => 'Italic', '600' => 'Semi Bold', '700' => 'Bold', '800' => 'Extra Bold');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Color */
                 if (isset($typography_stored['color'])) {
                     $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                 }
                 break;
                 //border option
             //border option
             case 'border':
                 /* Border Width */
                 $border_stored = $data[$value['id']];
                 $output .= '<div class="select_wrapper border-width">';
                 $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                 for ($i = 0; $i < 21; $i++) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Style */
                 $output .= '<div class="select_wrapper border-style">';
                 $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                 $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                 foreach ($styles as $i => $style) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Color */
                 $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                 $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                 break;
                 //images checkbox - use image as checkboxes
             //images checkbox - use image as checkboxes
             case 'images':
                 $i = 0;
                 $select_value = $data[$value['id']];
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $key, false)) {
                         $checked = checked($select_value, $key, false);
                         $selected = 'of-radio-img-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                     $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                     $output .= '</span>';
                 }
                 break;
                 //info (for small intro box etc)
             //info (for small intro box etc)
             case "info":
                 $info_text = $value['std'];
                 $output .= '<div class="of-info">' . $info_text . '</div>';
                 break;
                 //display a single image
             //display a single image
             case "image":
                 $src = $value['std'];
                 $output .= '<img src="' . $src . '">';
                 break;
                 //tab heading
             //tab heading
             case 'heading':
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $header_class = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = "of-option-" . $jquery_click_hook;
                 $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                 $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                 break;
                 //drag & drop slide manager
             //drag & drop slide manager
             case 'slider':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 $output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
                 $slides = isset($data[$value['id']]);
                 $count = count($slides);
                 if ($count < 2) {
                     $oldorder = 1;
                     $order = 1;
                     $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                 } else {
                     $i = 0;
                     foreach ($slides as $slide) {
                         $oldorder = $slide['order'];
                         $i++;
                         $order = $i;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                     }
                 }
                 $output .= '</ul>';
                 $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                 break;
                 //drag & drop block manager
             //drag & drop block manager
             case 'sorter':
                 // Make sure to get list of all the default blocks first
                 $all_blocks = $value['std'];
                 $temp = array();
                 // holds default blocks
                 $temp2 = array();
                 // holds saved blocks
                 foreach ($all_blocks as $blocks) {
                     $temp = array_merge($temp, $blocks);
                 }
                 $sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                 foreach ($sortlists as $sortlist) {
                     $temp2 = array_merge($temp2, $sortlist);
                 }
                 // now let's compare if we have anything missing
                 foreach ($temp as $k => $v) {
                     if (!array_key_exists($k, $temp2)) {
                         $sortlists['disabled'][$k] = $v;
                     }
                 }
                 // now check if saved blocks has blocks not registered under default blocks
                 foreach ($sortlists as $key => $sortlist) {
                     foreach ($sortlist as $k => $v) {
                         if (!array_key_exists($k, $temp)) {
                             unset($sortlist[$k]);
                         }
                     }
                     $sortlists[$key] = $sortlist;
                 }
                 // assuming all sync'ed, now get the correct naming for each block
                 foreach ($sortlists as $key => $sortlist) {
                     foreach ($sortlist as $k => $v) {
                         $sortlist[$k] = $temp[$k];
                     }
                     $sortlists[$key] = $sortlist;
                 }
                 $output .= '<div id="' . $value['id'] . '" class="sorter">';
                 if ($sortlists) {
                     foreach ($sortlists as $group => $sortlist) {
                         $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                         $output .= '<h3>' . $group . '</h3>';
                         foreach ($sortlist as $key => $list) {
                             $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                             if ($key != "placebo") {
                                 $output .= '<li id="' . $key . '" class="sortee">';
                                 $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                 $output .= $list;
                                 $output .= '</li>';
                             }
                         }
                         $output .= '</ul>';
                     }
                 }
                 $output .= '</div>';
                 break;
                 //background images option
             //background images option
             case 'tiles':
                 $i = 0;
                 $select_value = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : '';
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $option, false)) {
                         $checked = checked($select_value, $option, false);
                         $selected = 'of-radio-tile-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                     $output .= '</span>';
                 }
                 break;
                 //backup and restore options data
             //backup and restore options data
             case 'backup':
                 $instructions = $value['desc'];
                 $backup = get_option(BACKUPS);
                 if (!isset($backup['backup_log'])) {
                     $log = 'No backups yet';
                 } else {
                     $log = $backup['backup_log'];
                 }
                 $output .= '<div class="backup-box">';
                 $output .= '<div class="instructions">' . $instructions . "\n";
                 $output .= '<p><strong>' . __('Last Backup :', 'golden') . '<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                 $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
                 $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
                 $output .= '</div>';
                 break;
                 //export or import data between different installs
             //export or import data between different installs
             case 'transfer':
                 $instructions = $value['desc'];
                 $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($data)) . '</textarea>' . "\n";
                 $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                 break;
         }
         //description of each option
         if ($value['type'] != 'heading') {
             if (!isset($value['desc'])) {
                 $explain_value = '';
             } else {
                 $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
             }
             $output .= '</div>' . $explain_value . "\n";
             $output .= '<div class="clear"> </div></div></div>' . "\n";
         }
     }
     $output .= '</div>';
     return array($output, $menu, $defaults);
 }
Exemplo n.º 9
0
    /**
     * Process options data and build option fields
     *
     * @uses get_option()
     *
     * @access public
     * @since 1.0.0
     *
     * @return array
     */
    public static function optionsframework_machine($options)
    {
        $smof_data = get_option(OPTIONS);
        $defaults = array();
        $counter = 0;
        $menu = '';
        $output = '';
        foreach ($options as $value) {
            $counter++;
            $val = '';
            //create array of defaults
            if ($value['type'] == 'multicheck') {
                if (is_array($value['std'])) {
                    foreach ($value['std'] as $i => $key) {
                        $defaults[$value['id']][$key] = true;
                    }
                } else {
                    $defaults[$value['id']][$value['std']] = true;
                }
            } else {
                if (isset($value['id'])) {
                    $defaults[$value['id']] = $value['std'];
                }
            }
            //Start Heading
            if ($value['type'] != "heading") {
                $class = '';
                if (isset($value['class'])) {
                    $class = $value['class'];
                }
                //hide items in checkbox group
                $fold = '';
                if (array_key_exists("fold", $value)) {
                    if ($smof_data[$value['fold']]) {
                        $fold = "f_" . $value['fold'] . " ";
                    } else {
                        $fold = "f_" . $value['fold'] . " temphide ";
                    }
                }
                $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
                //only show header if 'name' value exists
                if ($value['name']) {
                    $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
                }
                $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
            }
            //End Heading
            //switch statement to handle various options type
            switch ($value['type']) {
                //text input
                case 'text':
                    $t_value = '';
                    $t_value = stripslashes($smof_data[$value['id']]);
                    $mini = '';
                    if (!isset($value['mod'])) {
                        $value['mod'] = '';
                    }
                    if ($value['mod'] == 'mini') {
                        $mini = 'mini';
                    }
                    $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                    break;
                    //backup and restore options data
                //backup and restore options data
                case 'import-demo-data':
                    $install_url = admin_url('admin.php?import_data_content=true');
                    $output .= '<div class="backup-box">';
                    $output .= '<div class="instructions"></div>' . "\n";
                    $output .= '<a onclick="return confirm(\'Import data now ?\')" href="' . $install_url . '" class="button" title="Import Demo Data">Import Demo Data</a>';
                    $output .= '</div>';
                    break;
                    //select option
                //select option
                case 'select':
                    $mini = '';
                    if (!isset($value['mod'])) {
                        $value['mod'] = '';
                    }
                    if ($value['mod'] == 'mini') {
                        $mini = 'mini';
                    }
                    $output .= '<div class="select_wrapper ' . $mini . '">';
                    $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                    foreach ($value['options'] as $select_ID => $option) {
                        $output .= '<option id="' . $select_ID . '" value="' . $option . '" ' . selected($smof_data[$value['id']], $option, false) . ' />' . $option . '</option>';
                    }
                    $output .= '</select></div>';
                    break;
                case 'select2':
                    $mini = '';
                    if (!isset($value['mod'])) {
                        $value['mod'] = '';
                    }
                    if ($value['mod'] == 'mini') {
                        $mini = 'mini';
                    }
                    $output .= '<div class="select_wrapper ' . $mini . '">';
                    $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                    foreach ($value['options'] as $select_ID => $option) {
                        $output .= '<option id="' . $select_ID . '" value="' . $select_ID . '" ' . selected($smof_data[$value['id']], $select_ID, false) . ' />' . $option . '</option>';
                    }
                    $output .= '</select></div>';
                    break;
                case "content":
                    /* default data */
                    $content_select = array('latest' => 'Latest Post', 'category' => 'Category', 'tag' => 'Tag');
                    $select_content_id = $value['id'] . '-content';
                    $output .= '<div class="select_wrapper">';
                    $output .= '<select class="select of-input" name="' . $value['id'] . '[content]" id="' . $select_content_id . '">';
                    foreach ($content_select as $select_ID => $option) {
                        $id_select = isset($smof_data[$value['id']]['content']) ? $smof_data[$value['id']]['content'] : '0';
                        $output .= '<option id="' . $select_ID . '" value="' . $select_ID . '" ' . selected($id_select, $select_ID, false) . ' />' . $option . '</option>';
                    }
                    $output .= '</select></div>';
                    /* control */
                    $output .= '<div class="controls" id="' . $value['id'] . '-child">';
                    /* Categori */
                    $cate_select = isset($smof_data[$value['id']]['content']) ? $smof_data[$value['id']]['content'] : '0';
                    $output .= '<div class="' . ('category' == $cate_select ? '' : 'hide ') . 'block-child content-category"><label for="">Category</label><br /><select class="select of-input" name="' . $value['id'] . '[category]">';
                    foreach ($value['cate'] as $select_ID => $option) {
                        $id_select = isset($smof_data[$value['id']]['category']) ? $smof_data[$value['id']]['category'] : '0';
                        $output .= '<option id="' . $select_ID . '" value="' . $select_ID . '" ' . selected($id_select, $select_ID, false) . ' />' . $option . '</option>';
                    }
                    $output .= '</select></div>';
                    /* Tag */
                    $tag_selected = isset($smof_data[$value['id']]['content']) ? $smof_data[$value['id']]['content'] : '0';
                    $tag_value = isset($smof_data[$value['id']]['tag']) ? $smof_data[$value['id']]['tag'] : '';
                    $output .= '<div class="' . ('tag' == $tag_selected ? '' : 'hide ') . 'block-child content-tag">
							<label for="">Tags <small style="color:#999999">Separate tags with commas</small></label>
							<input class="of-input" value="' . $tag_value . '" type="text" name="' . $value['id'] . '[tag]" />
							
						</div>';
                    $output .= '</div>';
                    /* end control */
                    /* javascript to handler */
                    $output .= '<script>
					jQuery(document).ready(function($){
						$(\'#' . $select_content_id . '\').change(function(){
							var select = $(this).val();
							$(\'#' . $value['id'] . '-child\').find(\'div.block-child\').hide(\'fast\');
							if(select ==\'category\'){
								$(\'#' . $value['id'] . '-child\').find(\'div.content-category\').show(\'fast\');
							}
							else if(select ==\'tag\'){
								$(\'#' . $value['id'] . '-child\').find(\'div.content-tag\').show(\'fast\');
							}
						});
					}); </script> ';
                    break;
                case 'select_news_box':
                    $i = 0;
                    $child_op = '';
                    $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                    foreach ($value['options'] as $key => $option) {
                        $i++;
                        $checked = '';
                        $selected = '';
                        $hide_child_op = ' class="hide" ';
                        $op = isset($select_value['op']) ? $select_value['op'] : '';
                        if (NULL != checked($op, $key, false)) {
                            $checked = checked($op, $key, false);
                            $selected = 'of-radio-img-selected';
                            $hide_child_op = ' ';
                        }
                        $output .= '<span>';
                        $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '[op]" ' . $checked . ' />';
                        $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                        $output .= '<img 
							src="' . $option . '" 
							data-show="of-list-banner-' . $value['id'] . $i . '"
							alt="" 
							class="of-op-news-' . $value['id'] . ' of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                        $output .= '</span>';
                        if ('list' == $key) {
                            $child_op .= '<div ' . $hide_child_op . ' id="of-list-banner-' . $value['id'] . $i . '">';
                            $child_op .= '<select class="select of-input" name="' . $value['id'] . '[list][]">';
                            foreach ($value['cate'] as $select_ID => $option) {
                                if (is_array($select_value)) {
                                    $id_select = isset($select_value['list'][0]) ? $select_value['list'][0] : '0';
                                } else {
                                    $id_select = 0;
                                }
                                $child_op .= '<option id="' . $select_ID . '" value="' . $select_ID . '" ' . selected($id_select, $select_ID, false) . ' />' . $option . '</option>';
                            }
                            $child_op .= '</select>';
                            $child_op .= '<select class="select of-input" name="' . $value['id'] . '[list][]">';
                            foreach ($value['cate'] as $select_ID => $option) {
                                $id_select = isset($select_value['list'][1]) ? $select_value['list'][1] : '0';
                                $child_op .= '<option id="' . $select_ID . '" value="' . $select_ID . '" ' . selected($id_select, $select_ID, false) . ' />' . $option . '</option>';
                            }
                            $child_op .= '</select>';
                            $child_op .= '</div>';
                        } else {
                            if ('block' == $key) {
                                $child_op .= '<div  ' . $hide_child_op . ' id="of-list-banner-' . $value['id'] . $i . '">';
                                $child_op .= '<select class="select of-input" name="' . $value['id'] . '[block][]">';
                                foreach ($value['cate'] as $select_ID => $option) {
                                    if (is_array($select_value)) {
                                        $id_select = isset($select_value['block'][0]) ? $select_value['block'][0] : '0';
                                    } else {
                                        $id_select = 0;
                                    }
                                    $child_op .= '<option id="' . $select_ID . '" value="' . $select_ID . '" ' . selected($id_select, $select_ID, false) . ' />' . $option . '</option>';
                                }
                                $child_op .= '</select>';
                                $child_op .= '</div>';
                            } else {
                                if ('feed' == $key) {
                                    $feed_value = '';
                                    $feed_capvalue = '';
                                    $feed_value = stripslashes($smof_data[$value['id']]['feed']);
                                    $feed_capvalue = stripslashes($smof_data[$value['id']]['cap']);
                                    $child_op .= '<div  ' . $hide_child_op . ' id="of-list-banner-' . $value['id'] . $i . '">';
                                    $child_op .= '<label>feed url</label> <input type="text" value="' . $feed_value . '"  name="' . $value['id'] . '[feed]" class="of-input ">';
                                    $child_op .= '<label>feed caption</label> <input type="text" value="' . $feed_capvalue . '"  name="' . $value['id'] . '[cap]" class="of-input ">';
                                    $child_op .= '</div>';
                                } else {
                                    if ('shortcode' == $key) {
                                        $shortcode_value = '';
                                        $shortcode_capvalue = '';
                                        $shortcode_value = stripslashes($smof_data[$value['id']]['shortcode']);
                                        $shortcode_capvalue = stripslashes($smof_data[$value['id']]['sccap']);
                                        $child_op .= '<div  ' . $hide_child_op . ' id="of-list-banner-' . $value['id'] . $i . '">';
                                        $child_op .= '<label>shortcode</label> <textarea type="text" name="' . $value['id'] . '[shortcode]" class="of-input ">' . $shortcode_value . '</textarea>';
                                        $child_op .= '<label>shortcode caption</label> <input type="text" value="' . $shortcode_capvalue . '"  name="' . $value['id'] . '[sccap]" class="of-input ">';
                                        $child_op .= '</div>';
                                    }
                                }
                            }
                        }
                    }
                    $output .= '<div class="controls" id="news_box_' . $value['id'] . '">' . $child_op . '</div>';
                    /* javascript to handler */
                    $output .= '<script>
					jQuery(document).ready(function($){
						$(\'.of-op-news-' . $value['id'] . '\').click(function(){
							$(\'#news_box_' . $value['id'] . ' div\').hide();
							var show_op = $(this).attr(\'data-show\');
							$(\'#\'+show_op).show();
						});
						}); </script> ';
                    break;
                    //textarea option
                //textarea option
                case 'textarea':
                    $cols = '8';
                    $ta_value = '';
                    if (isset($value['options'])) {
                        $ta_options = $value['options'];
                        if (isset($ta_options['cols'])) {
                            $cols = $ta_options['cols'];
                        }
                    }
                    $ta_value = stripslashes($smof_data[$value['id']]);
                    $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                    break;
                    //radiobox option
                //radiobox option
                case "radio":
                    $checked = isset($smof_data[$value['id']]) ? checked($smof_data[$value['id']], $option, false) : '';
                    foreach ($value['options'] as $option => $name) {
                        $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($smof_data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                    }
                    break;
                    //checkbox option
                //checkbox option
                case 'checkbox':
                    if (!isset($smof_data[$value['id']])) {
                        $smof_data[$value['id']] = 0;
                    }
                    $fold = '';
                    if (array_key_exists("folds", $value)) {
                        $fold = "fld ";
                    }
                    $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                    $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                    break;
                    //multiple checkbox option
                //multiple checkbox option
                case 'multicheck':
                    isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
                    foreach ($value['options'] as $key => $option) {
                        if (!isset($multi_stored[$key])) {
                            $multi_stored[$key] = '';
                        }
                        $of_key_string = $value['id'] . '_' . $key;
                        $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                    }
                    break;
                    //ajax image upload option
                //ajax image upload option
                case 'upload':
                    if (!isset($value['mod'])) {
                        $value['mod'] = '';
                    }
                    $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                    break;
                    // native media library uploader - @uses optionsframework_media_uploader_function()
                // native media library uploader - @uses optionsframework_media_uploader_function()
                case 'media':
                    $_id = strip_tags(strtolower($value['id']));
                    $int = '';
                    $int = optionsframework_mlu_get_silentpost($_id);
                    if (!isset($value['mod'])) {
                        $value['mod'] = '';
                    }
                    $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                    // New AJAX Uploader using Media Library
                    break;
                    //colorpicker option
                //colorpicker option
                case 'color':
                    $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $smof_data[$value['id']] . '"></div></div>';
                    $output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $smof_data[$value['id']] . '" />';
                    break;
                    //typography option
                //typography option
                case 'typography':
                    $typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                    /* Font Size */
                    if (isset($typography_stored['size'])) {
                        $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                        $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                        for ($i = 9; $i <= 72; $i++) {
                            $test = $i . 'px';
                            $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                        }
                        $output .= '</select></div>';
                    }
                    /* Line Height */
                    if (isset($typography_stored['height'])) {
                        $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                        $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                        for ($i = 20; $i < 38; $i++) {
                            $test = $i . 'px';
                            $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                        }
                        $output .= '</select></div>';
                    }
                    /* Font Face */
                    if (isset($typography_stored['face'])) {
                        $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                        $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                        $faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'metrophobic' => 'metrophobic', 'helvetica' => 'Helvetica');
                        foreach ($faces as $i => $face) {
                            $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                        }
                        $output .= '</select></div>';
                    }
                    /* Font Face2 */
                    /*den set gfont face2 to typography*/
                    if (isset($typography_stored['face2'])) {
                        $output .= '<div id="' . $value['id'] . '" class="select_wrapper typography-face section-select_google_font" original-title="Font family">';
                        //den set default face;
                        $faces = $value['options'];
                        $output .= '<select class="of-typography of-typography-face2 select google_font_select" name="' . $value['id'] . '[face2]" id="' . $value['id'] . '_face2">';
                        foreach ($faces as $i => $face2) {
                            $output .= '<option value="' . $i . '" ' . selected($typography_stored['face2'], $i, false) . '>' . $face2 . '</option>';
                        }
                        $output .= '</select></div>';
                        if (isset($value['preview']['text'])) {
                            $g_text = $value['preview']['text'];
                        } else {
                            $g_text = 'Grumpy wizards make toxic brew for the evil Queen and Jack.';
                        }
                        if (isset($value['preview']['size'])) {
                            $g_size = 'style="font-size: ' . $value['preview']['size'] . ';"';
                        } else {
                            $g_size = '';
                        }
                        //	$g_size = '';
                        //	$g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
                    }
                    /* Font Weight */
                    if (isset($typography_stored['style'])) {
                        $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                        $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                        $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                        foreach ($styles as $i => $style) {
                            $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                        }
                        $output .= '</select></div>';
                    }
                    /* Font Color */
                    if (isset($typography_stored['color'])) {
                        $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                        $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                    }
                    if (isset($typography_stored['face2'])) {
                        //den set di smof.js
                        $output .= '<span id="show_' . $value['id'] . '" class="button typoshow" rel="">Show</span>';
                        $output .= '<p class="' . $value['id'] . '_face2_ggf_previewer _previewer google_font_preview ihide" ' . $g_size . '>' . $g_text . '</p>';
                    }
                    break;
                    //border option
                //border option
                case 'border':
                    /* Border Width */
                    $border_stored = $smof_data[$value['id']];
                    $output .= '<div class="select_wrapper border-width">';
                    $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                    for ($i = 0; $i < 21; $i++) {
                        $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                    }
                    $output .= '</select></div>';
                    /* Border Style */
                    $output .= '<div class="select_wrapper border-style">';
                    $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                    $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                    foreach ($styles as $i => $style) {
                        $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                    }
                    $output .= '</select></div>';
                    /* Border Color */
                    $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                    $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                    break;
                    //images checkbox - use image as checkboxes
                //images checkbox - use image as checkboxes
                case 'images':
                    $i = 0;
                    $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                    foreach ($value['options'] as $key => $option) {
                        $i++;
                        $checked = '';
                        $selected = '';
                        if (NULL != checked($select_value, $key, false)) {
                            $checked = checked($select_value, $key, false);
                            $selected = 'of-radio-img-selected';
                        }
                        $output .= '<span>';
                        $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                        $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                        $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                        $output .= '</span>';
                    }
                    break;
                    //info (for small intro box etc)
                //info (for small intro box etc)
                case "info":
                    $info_text = $value['std'];
                    $output .= '<div class="of-info">' . $info_text . '</div>';
                    break;
                    //display a single image
                //display a single image
                case "image":
                    $src = $value['std'];
                    $output .= '<img src="' . $src . '">';
                    break;
                    //tab heading
                //tab heading
                case 'heading':
                    if ($counter >= 2) {
                        $output .= '</div>' . "\n";
                    }
                    $header_class = str_replace(' ', '', strtolower($value['name']));
                    $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                    $jquery_click_hook = "of-option-" . $jquery_click_hook;
                    $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                    $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                    break;
                    //drag & drop slide manager
                //drag & drop slide manager
                case 'slider':
                    $_id = strip_tags(strtolower($value['id']));
                    $int = '';
                    $int = optionsframework_mlu_get_silentpost($_id);
                    $output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
                    $slides = $smof_data[$value['id']];
                    $count = count($slides);
                    if ($count < 2) {
                        $oldorder = 1;
                        $order = 1;
                        $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                    } else {
                        $i = 0;
                        foreach ($slides as $slide) {
                            $oldorder = $slide['order'];
                            $i++;
                            $order = $i;
                            $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                        }
                    }
                    $output .= '</ul>';
                    $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                    break;
                    //drag & drop block manager
                //drag & drop block manager
                case 'sorter':
                    $sortlists = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                    $output .= '<div id="' . $value['id'] . '" class="sorter">';
                    if ($sortlists) {
                        foreach ($sortlists as $group => $sortlist) {
                            $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                            $output .= '<h3>' . $group . '</h3>';
                            foreach ($sortlist as $key => $list) {
                                $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                                if ($key != "placebo") {
                                    $output .= '<li id="' . $key . '" class="sortee">';
                                    $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                    $output .= $list;
                                    $output .= '</li>';
                                }
                            }
                            $output .= '</ul>';
                        }
                    }
                    $output .= '</div>';
                    break;
                    //background images option
                //background images option
                case 'tiles':
                    $i = 0;
                    $select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                    foreach ($value['options'] as $key => $option) {
                        $i++;
                        $checked = '';
                        $selected = '';
                        if (NULL != checked($select_value, $option, false)) {
                            $checked = checked($select_value, $option, false);
                            $selected = 'of-radio-tile-selected';
                        }
                        $output .= '<span>';
                        $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                        $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                        $output .= '</span>';
                    }
                    break;
                    //backup and restore options data
                //backup and restore options data
                case 'backup':
                    $instructions = $value['desc'];
                    $backup = get_option(BACKUPS);
                    if (!isset($backup['backup_log'])) {
                        $log = 'No backups yet';
                    } else {
                        $log = $backup['backup_log'];
                    }
                    $output .= '<div class="backup-box">';
                    $output .= '<div class="instructions">' . $instructions . "\n";
                    $output .= '<p><strong>' . __('Last Backup :', 'mtcframework') . '<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                    $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
                    $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
                    $output .= '</div>';
                    break;
                    //export or import data between different installs
                //export or import data between different installs
                case 'transfer':
                    $instructions = $value['desc'];
                    $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($smof_data)) . '</textarea>' . "\n";
                    $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                    break;
                    // google font field
                // google font field
                case 'select_google_font':
                    $output .= '<div class="select_wrapper">';
                    $output .= '<select class="select of-input google_font_select" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                    foreach ($value['options'] as $select_key => $option) {
                        $output .= '<option value="' . $select_key . '" ' . selected(isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : "", $option, false) . ' />' . $option . '</option>';
                    }
                    $output .= '</select></div>';
                    if (isset($value['preview']['text'])) {
                        $g_text = $value['preview']['text'];
                    } else {
                        $g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
                    }
                    if (isset($value['preview']['size'])) {
                        $g_size = 'style="font-size: ' . $value['preview']['size'] . ';"';
                    } else {
                        $g_size = '';
                    }
                    $output .= '<p class="' . $value['id'] . '_ggf_previewer google_font_preview" ' . $g_size . '>' . $g_text . '</p>';
                    break;
                    //JQuery UI Slider
                //JQuery UI Slider
                case 'sliderui':
                    $s_val = $s_min = $s_max = $s_step = $s_edit = '';
                    //no errors, please
                    $s_val = stripslashes($smof_data[$value['id']]);
                    if (!isset($value['min'])) {
                        $s_min = '0';
                    } else {
                        $s_min = $value['min'];
                    }
                    if (!isset($value['max'])) {
                        $s_max = $s_min + 1;
                    } else {
                        $s_max = $value['max'];
                    }
                    if (!isset($value['step'])) {
                        $s_step = '1';
                    } else {
                        $s_step = $value['step'];
                    }
                    if (!isset($value['edit'])) {
                        $s_edit = ' readonly="readonly"';
                    } else {
                        $s_edit = '';
                    }
                    if ($s_val == '') {
                        $s_val = $s_min;
                    }
                    //values
                    $s_data = 'data-id="' . $value['id'] . '" data-val="' . $s_val . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                    //html output
                    $output .= '<input type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $s_val . '" class="mini" ' . $s_edit . ' />';
                    $output .= '<div id="' . $value['id'] . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                    break;
                    //Switch option
                //Switch option
                case 'switch':
                    if (!isset($smof_data[$value['id']])) {
                        $smof_data[$value['id']] = 0;
                    }
                    $fold = '';
                    if (array_key_exists("folds", $value)) {
                        $fold = "s_fld ";
                    }
                    $cb_enabled = $cb_disabled = '';
                    //no errors, please
                    //Get selected
                    if ($smof_data[$value['id']] == 1) {
                        $cb_enabled = ' selected';
                        $cb_disabled = '';
                    } else {
                        $cb_enabled = '';
                        $cb_disabled = ' selected';
                    }
                    //Label ON
                    if (!isset($value['on'])) {
                        $on = "On";
                    } else {
                        $on = $value['on'];
                    }
                    //Label OFF
                    if (!isset($value['off'])) {
                        $off = "Off";
                    } else {
                        $off = $value['off'];
                    }
                    $output .= '<p class="switch-options">';
                    $output .= '<label class="' . $fold . 'cb-enable' . $cb_enabled . '" data-id="' . $value['id'] . '"><span>' . $on . '</span></label>';
                    $output .= '<label class="' . $fold . 'cb-disable' . $cb_disabled . '" data-id="' . $value['id'] . '"><span>' . $off . '</span></label>';
                    $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                    $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold . 'checkbox of-input main_checkbox" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                    $output .= '</p>';
                    break;
                    //den add multiselect
                //den add multiselect
                case 'multiselect':
                    $mini = isset($value['mini']) ? 'mini' : '';
                    $selected_data = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : array();
                    $output .= '<div class="multiselect_wrapper ' . $mini . '">';
                    $output .= '<select multiple="multiple" class="e1 select of-input" name="' . $value['id'] . '[]" id="' . $value['id'] . '">';
                    foreach ($value['options'] as $select_ID => $option) {
                        $selected = in_array($select_ID, $selected_data) ? 'selected="selected"' : '';
                        $output .= '<option id="' . $select_ID . '" value="' . $select_ID . '" ' . $selected . ' />' . $option . '</option>';
                    }
                    $output .= '</select></div>';
                    break;
                    /*
                    				 			
                    					(isset($smof_data[$value['id']]))? $multi_stored = $smof_data[$value['id']] : $multi_stored="";
                    								
                    					foreach ($value['options'] as $key => $option) {
                    						if (!isset($multi_stored[$key])) {$multi_stored[$key] = '';}
                    						$of_key_string = $value['id'] . '_' . $key;
                    						$output .= '<input type="checkbox" class="checkbox of-input" name="'.$value['id'].'['.$key.']'.'" id="'. $of_key_string .'" value="1" '. checked($multi_stored[$key], 1, false) .' /><label class="multicheck" for="'. $of_key_string .'">'. $option .'</label><br />';								
                    					}			 
                    */
            }
            //description of each option
            if ($value['type'] != 'heading') {
                if (!isset($value['desc'])) {
                    $explain_value = '';
                } else {
                    $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
                }
                $output .= '</div>' . $explain_value . "\n";
                $output .= '<div class="clear"> </div></div></div>' . "\n";
            }
        }
        $output .= '</div>';
        return array($output, $menu, $defaults);
    }
Exemplo n.º 10
0
 /**
  * Process options data and build option fields
  *
  * @uses get_option()
  *
  * @access public
  * @since 1.0.0
  *
  * @return array
  */
 public static function optionsframework_machine($options)
 {
     $data = get_option(OPTIONS);
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     foreach ($options as $value) {
         $counter++;
         $val = '';
         //create array of defaults
         if ($value['type'] == 'multicheck') {
             if (is_array($value['std'])) {
                 foreach ($value['std'] as $i => $key) {
                     $defaults[$value['id']][$key] = true;
                 }
             } else {
                 $defaults[$value['id']][$value['std']] = true;
             }
         } else {
             if (isset($value['id'])) {
                 $defaults[$value['id']] = $value['std'];
             }
         }
         //Start Heading
         if ($value['type'] != "heading") {
             $class = '';
             if (isset($value['class'])) {
                 $class = $value['class'];
             }
             //hide items in checkbox group
             $fold = '';
             if (array_key_exists("fold", $value)) {
                 if ($data[$value['fold']]) {
                     $fold = "f_" . $value['fold'] . " ";
                 } else {
                     $fold = "f_" . $value['fold'] . " temphide ";
                 }
             }
             $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
             //only show header if 'name' value exists
             if ($value['name']) {
                 $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
             }
             $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
         }
         //End Heading
         //switch statement to handle various options type
         switch ($value['type']) {
             //text input
             case 'text':
                 $t_value = '';
                 $t_value = stripslashes($data[$value['id']]);
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                 break;
                 //select option
             //select option
             case 'select':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select_wrapper ' . $mini . '">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 foreach ($value['options'] as $select_ID => $option) {
                     $output .= '<option id="' . $select_ID . '" value="' . $select_ID . '" ' . selected($data[$value['id']], $select_ID, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
                 //textarea option
             //textarea option
             case 'textarea':
                 $cols = '8';
                 $ta_value = '';
                 if (isset($value['options'])) {
                     $ta_options = $value['options'];
                     if (isset($ta_options['cols'])) {
                         $cols = $ta_options['cols'];
                     }
                 }
                 $ta_value = stripslashes($data[$value['id']]);
                 $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                 break;
                 //radiobox option
             //radiobox option
             case "radio":
                 foreach ($value['options'] as $option => $name) {
                     $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label>';
                 }
                 break;
                 //checkbox option
             //checkbox option
             case 'checkbox':
                 if (!isset($data[$value['id']])) {
                     $data[$value['id']] = 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "fld ";
                 }
                 $output .= '<input type="hidden" class="' . $fold . 'checkbox aq-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                 $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($data[$value['id']], 1, false) . ' />';
                 break;
                 //multiple checkbox option
             //multiple checkbox option
             case 'multicheck':
                 $multi_stored = $data[$value['id']];
                 foreach ($value['options'] as $key => $option) {
                     if (!isset($multi_stored[$key])) {
                         $multi_stored[$key] = '';
                     }
                     $of_key_string = $value['id'] . '_' . $key;
                     $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                 }
                 break;
                 //multiple checkbox option
             //multiple checkbox option
             case 'sidebar':
                 break;
                 //ajax image upload option
             //ajax image upload option
             case 'upload':
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                 break;
                 // native media library uploader - @uses optionsframework_media_uploader_function()
             // native media library uploader - @uses optionsframework_media_uploader_function()
             case 'media':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                 // New AJAX Uploader using Media Library
                 break;
                 //colorpicker option
             //colorpicker option
             case 'color':
                 $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $data[$value['id']] . '"></div></div>';
                 $output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $data[$value['id']] . '" />';
                 break;
                 //typography option
             //typography option
             case 'typography':
                 $typography_stored = isset($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                 /* Font Size */
                 if (isset($typography_stored['size'])) {
                     $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                     $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                     for ($i = 8; $i < 50; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Line Height */
                 if (isset($typography_stored['height'])) {
                     $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                     $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                     for ($i = 20; $i < 38; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Face */
                 if (isset($typography_stored['face'])) {
                     $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                     $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                     $faces = array('default' => 'default', 'arial' => 'Arial', 'verdana' => 'Verdana', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma', 'palatino' => 'Palatino', 'helvetica' => 'Helvetica', 'Capriola' => 'Capriola', 'Open Sans' => 'Open Sans', 'Arvo' => 'Arvo', 'Bitter' => 'Bitter', 'ABeeZee' => 'ABeeZee', 'Lato' => 'Lato', 'Arvo' => 'Arvo', 'Vollkorn' => 'Vollkorn', 'Abril Fatface' => 'Abril Fatface', 'Ubuntu' => 'Ubuntu', 'PT Sans' => 'PT Sans', 'Droid Sans' => 'Droid Sans', 'Old Standard TT' => 'Old Standard TT', 'Arvo' => 'Arvo', 'Abel' => 'Abel', 'Abril Fatface' => 'Abril Fatface', 'Aclonica' => 'Aclonica', 'Acme' => 'Acme', 'Actor' => 'Actor', 'Adamina' => 'Adamina', 'Advent Pro' => 'Advent Pro', 'Aguafina Script' => 'Aguafina Script', 'Aladin' => 'Aladin', 'Aldrich' => 'Aldrich', 'Alex Brush' => 'Alex Brush', 'Alfa Slab One' => 'Alfa Slab One', 'Alice' => 'Alice', 'Alike Angular' => 'Alike Angular', 'Alike' => 'Alike', 'Allan' => 'Allan', 'Allerta Stencil' => 'Allerta Stencil', 'Allerta' => 'Allerta', 'Allura' => 'Allura', 'Almendra SC' => 'Almendra SC', 'Almendra' => 'Almendra', 'Amaranth' => 'Amaranth', 'Amarante' => 'Amarante', 'Amatic SC' => 'Amatic SC', 'Amethysta' => 'Amethysta', 'Andada' => 'Andada', 'Andika' => 'Andika', 'Annie Use Your Telescope' => 'Annie Use Your Telescope', 'Anonymous Pro' => 'Anonymous Pro', 'Antic Didone' => 'Antic Didone', 'Antic Slab' => 'Antic Slab', 'Antic' => 'Antic', 'Anton' => 'Anton', 'Arapey' => 'Arapey', 'Arbutus' => 'Arbutus', 'Architects Daughter' => 'Architects Daughter', 'Arimo' => 'Arimo', 'Arizonia' => 'Arizonia', 'Armata' => 'Armata', 'Artifika' => 'Artifika', 'Arvo' => 'Arvo', 'Asap' => 'Asap', 'Asset' => 'Asset', 'Astloch' => 'Astloch', 'Asul' => 'Asul', 'Atomic Age' => 'Atomic Age', 'Aubrey' => 'Aubrey', 'Audiowide' => 'Audiowide', 'Average' => 'Average', 'Averia Gruesa Libre' => 'Averia Gruesa Libre', 'Averia Libre' => 'Averia Libre', 'Averia Sans Libre' => 'Averia Sans Libre', 'Averia Serif Libre' => 'Averia Serif Libre', 'Bad Script' => 'Bad Script', 'Balthazar' => 'Balthazar', 'Bangers' => 'Bangers', 'Basic' => 'Basic', 'Baumans' => 'Baumans', 'Belgrano' => 'Belgrano', 'Belleza' => 'Belleza', 'Bentham' => 'Bentham', 'Berkshire Swash' => 'Berkshire Swash', 'Bevan' => 'Bevan', 'Bigshot One' => 'Bigshot One', 'Bilbo Swash Caps' => 'Bilbo Swash Caps', 'Bilbo' => 'Bilbo', 'Bitter' => 'Bitter', 'Black Ops One' => 'Black Ops One', 'Bonbon' => 'Bonbon', 'Boogaloo' => 'Boogaloo', 'Bowlby One SC' => 'Bowlby One SC', 'Bowlby One' => 'Bowlby One', 'Brawler' => 'Brawler', 'Bree Serif' => 'Bree Serif', 'Bubblegum Sans' => 'Bubblegum Sans', 'Buenard' => 'Buenard', 'Butcherman' => 'Butcherman', 'Butterfly Kids' => 'Butterfly Kids', 'Cabin Condensed' => 'Cabin Condensed', 'Cabin Sketch' => 'Cabin Sketch', 'Cabin Sketch bold' => 'Cabin Sketch Bold', 'Cabin' => 'Cabin', 'Caesar Dressing' => 'Caesar Dressing', 'Cagliostro' => 'Cagliostro', 'Calligraffitti' => 'Calligraffitti', 'Cambo' => 'Cambo', 'Candal' => 'Candal', 'Cantarell' => 'Cantarell', 'Cantata One' => 'Cantata One', 'Capriola' => 'Capriola', 'Cardo' => 'Cardo', 'Carme' => 'Carme', 'Carter One' => 'Carter One', 'Caudex' => 'Caudex', 'Cedarville Cursive' => 'Cedarville Cursive', 'Ceviche One' => 'Ceviche One', 'Changa One' => 'Changa One', 'Chango' => 'Chango', 'Chau Philomene One' => 'Chau Philomene One', 'Chelsea Market' => 'Chelsea Market', 'Cherry Cream Soda' => 'Cherry Cream Soda', 'Chewy' => 'Chewy', 'Chicle' => 'Chicle', 'Chivo' => 'Chivo', 'Coda' => 'Coda', 'Codystar' => 'Codystar', 'Comfortaa' => 'Comfortaa', 'Coming Soon' => 'Coming Soon', 'Concert One' => 'Concert One', 'Condiment' => 'Condiment', 'Contrail One' => 'Contrail One', 'Convergence' => 'Convergence', 'Cookie' => 'Cookie', 'Copse' => 'Copse', 'Corben' => 'Corben', 'Corben bold' => 'Corben Bold', 'Courgette' => 'Courgette', 'Cousine' => 'Cousine', 'Coustard' => 'Coustard', 'Covered By Your Grace' => 'Covered By Your Grace', 'Crafty Girls' => 'Crafty Girls', 'Creepster' => 'Creepster', 'Crete Round' => 'Crete Round', 'Crimson Text' => 'Crimson Text', 'Crushed' => 'Crushed', 'Cuprum' => 'Cuprum', 'Cutive' => 'Cutive', 'Damion' => 'Damion', 'Dancing Script' => 'Dancing Script', 'Dawning of a New Day' => 'Dawning of a New Day', 'Days One' => 'Days One', 'Delius Swash Caps' => 'Delius Swash Caps', 'Delius Unicase' => 'Delius Unicase', 'Delius' => 'Delius', 'Della Respira' => 'Della Respira', 'Devonshire' => 'Devonshire', 'Didact Gothic' => 'Didact Gothic', 'Diplomata SC' => 'Diplomata SC', 'Diplomata' => 'Diplomata', 'Doppio One' => 'Doppio One', 'Dorsa' => 'Dorsa', 'Dosis' => 'Dosis', 'Dr Sugiyama' => 'Dr Sugiyama', 'Droid Sans Mono' => 'Droid Sans Mono', 'Droid Sans' => 'Droid Sans', 'Droid Serif' => 'Droid Serif', 'Duru Sans' => 'Duru Sans', 'Dynalight' => 'Dynalight', 'EB Garamond' => 'EB Garamond', 'Eagle Lake' => 'Eagle Lake', 'Eater' => 'Eater', 'Economica' => 'Economica', 'Electrolize' => 'Electrolize', 'Emblema One' => 'Emblema One', 'Emilys Candy' => 'Emilys Candy', 'Engagement' => 'Engagement', 'Enriqueta' => 'Enriqueta', 'Erica One' => 'Erica One', 'Esteban' => 'Esteban', 'Euphoria Script' => 'Euphoria Script', 'Ewert' => 'Ewert', 'Exo' => 'Exo', 'Expletus Sans' => 'Expletus Sans', 'Fanwood Text' => 'Fanwood Text', 'Fascinate Inline' => 'Fascinate Inline', 'Fascinate' => 'Fascinate', 'Fasthand' => 'Fasthand', 'Federant' => 'Federant', 'Federo' => 'Federo', 'Felipa' => 'Felipa', 'Fjord One' => 'Fjord One', 'Flamenco' => 'Flamenco', 'Flavors' => 'Flavors', 'Fondamento' => 'Fondamento', 'Fontdiner Swanky' => 'Fontdiner Swanky', 'Forum' => 'Forum', 'Francois One' => 'Francois One', 'Fredoka One' => 'Fredoka One', 'Fresca' => 'Fresca', 'Frijole' => 'Frijole', 'Fugaz One' => 'Fugaz One', 'Galdeano' => 'Galdeano', 'Galindo' => 'Galindo', 'Gentium Basic' => 'Gentium Basic', 'Gentium Book Basic' => 'Gentium Book Basic', 'Geo' => 'Geo', 'Geostar Fill' => 'Geostar Fill', 'Geostar' => 'Geostar', 'Germania One' => 'Germania One', 'Give You Glory' => 'Give You Glory', 'Glass Antiqua' => 'Glass Antiqua', 'Glegoo' => 'Glegoo', 'Gloria Hallelujah' => 'Gloria Hallelujah', 'Goblin One' => 'Goblin One', 'Gochi Hand' => 'Gochi Hand', 'Gorditas' => 'Gorditas', 'Goudy Bookletter 1911' => 'Goudy Bookletter 1911', 'Graduate' => 'Graduate', 'Gravitas One' => 'Gravitas One', 'Great Vibes' => 'Great Vibes', 'Gruppo' => 'Gruppo', 'Gudea' => 'Gudea', 'Habibi' => 'Habibi', 'Hammersmith One' => 'Hammersmith One', 'Handlee' => 'Handlee', 'Happy Monkey' => 'Happy Monkey', 'Henny Penny' => 'Henny Penny', 'Herr Von Muellerhoff' => 'Herr Von Muellerhoff', 'Holtwood One SC' => 'Holtwood One SC', 'Homemade Apple' => 'Homemade Apple', 'Homenaje' => 'Homenaje', 'IM Fell DW Pica SC' => 'IM Fell DW Pica SC', 'IM Fell DW Pica' => 'IM Fell DW Pica', 'IM Fell Double Pica SC' => 'IM Fell Double Pica SC', 'IM Fell Double Pica' => 'IM Fell Double Pica', 'IM Fell English SC' => 'IM Fell English SC', 'IM Fell English' => 'IM Fell English', 'IM Fell French Canon SC' => 'IM Fell French Canon SC', 'IM Fell French Canon' => 'IM Fell French Canon', 'IM Fell Great Primer SC' => 'IM Fell Great Primer SC', 'IM Fell Great Primer' => 'IM Fell Great Primer', 'Iceberg' => 'Iceberg', 'Iceland' => 'Iceland', 'Imprima' => 'Imprima', 'Inconsolata' => 'Inconsolata', 'Inder' => 'Inder', 'Indie Flower' => 'Indie Flower', 'Inika' => 'Inika', 'Irish Grover' => 'Irish Grover', 'Irish Growler' => 'Irish Growler', 'Istok Web' => 'Istok Web', 'Italiana' => 'Italiana', 'Italianno' => 'Italianno', 'Jim Nightshade' => 'Jim Nightshade', 'Jockey One' => 'Jockey One', 'Jolly Lodger' => 'Jolly Lodger', 'Josefin Sans' => 'Josefin Sans Regular', 'Josefin Slab' => 'Josefin Slab Regular', 'Judson' => 'Judson', 'Julee' => 'Julee', 'Junge' => 'Junge', 'Jura' => ' Jura Regular', 'Just Another Hand' => 'Just Another Hand', 'Just Me Again Down Here' => 'Just Me Again Down Here', 'Kameron' => 'Kameron', 'Karla' => 'Karla', 'Kaushan Script' => 'Kaushan Script', 'Kelly Slab' => 'Kelly Slab', 'Kenia' => 'Kenia', 'Knewave' => 'Knewave', 'Kotta One' => 'Kotta One', 'Kranky' => 'Kranky', 'Kreon' => 'Kreon', 'Kristi' => 'Kristi', 'Krona One' => 'Krona One', 'La Belle Aurore' => 'La Belle Aurore', 'Lancelot' => 'Lancelot', 'Lato' => 'Lato', 'League Script' => 'League Script', 'Leckerli One' => 'Leckerli One', 'Ledger' => 'Ledger', 'Lekton' => ' Lekton', 'Lemon' => 'Lemon', 'Life Savers' => 'Life Savers', 'Lilita One' => 'Lilita One', 'Limelight' => ' Limelight', 'Linden Hill' => 'Linden Hill', 'Lobster Two' => 'Lobster Two', 'Lobster' => 'Lobster', 'Londrina Outline' => 'Londrina Outline', 'Londrina Shadow' => 'Londrina Shadow', 'Londrina Sketch' => 'Londrina Sketch', 'Londrina Solid' => 'Londrina Solid', 'Lora' => 'Lora', 'Love Ya Like A Sister' => 'Love Ya Like A Sister', 'Lovers Quarrel' => 'Lovers Quarrel', 'Loved by the King' => 'Loved by the King', 'Luckiest Guy' => 'Luckiest Guy', 'Lusitana' => 'Lusitana', 'Lustria' => 'Lustria', 'Macondo Swash Caps' => 'Macondo Swash Caps', 'Macondo' => 'Macondo', 'Magra' => 'Magra', 'Maiden Orange' => 'Maiden Orange', 'Mako' => 'Mako', 'Marck Script' => 'Marck Script', 'Marko One' => 'Marko One', 'Marmelad' => 'Marmelad', 'Marvel' => 'Marvel', 'Mate SC' => 'Mate SC', 'Mate' => 'Mate', 'Maven Pro' => ' Maven Pro', 'McLaren' => 'McLaren', 'Meddon' => 'Meddon', 'MedievalSharp' => 'MedievalSharp', 'Medula One' => 'Medula One', 'Megrim' => 'Megrim', 'Merienda One' => 'Merienda One', 'Merriweather' => 'Merriweather', 'Metamorphous' => 'Metamorphous', 'Metrophobic' => 'Metrophobic', 'Metal Mania' => 'Metal Mania', 'Michroma' => 'Michroma', 'Miltonian Tattoo' => 'Miltonian Tattoo', 'Miltonian' => 'Miltonian', 'Miniver' => 'Miniver', 'Miss Fajardose' => 'Miss Fajardose', 'Miss Saint Delafield' => 'Miss Saint Delafield', 'Modern Antiqua' => 'Modern Antiqua', 'Molengo' => 'Molengo', 'Monofett' => 'Monofett', 'Monoton' => 'Monoton', 'Monsieur La Doulaise' => 'Monsieur La Doulaise', 'Montaga' => 'Montaga', 'Montez' => 'Montez', 'Montserrat' => 'Montserrat', 'Mountains of Christmas' => 'Mountains of Christmas', 'Mr Bedford' => 'Mr Bedford', 'Mr Dafoe' => 'Mr Dafoe', 'Mr De Haviland' => 'Mr De Haviland', 'Mrs Saint Delafield' => 'Mrs Saint Delafield', 'Mrs Sheppards' => 'Mrs Sheppards', 'Muli' => 'Muli', 'Mystery Quest' => 'Mystery Quest', 'Neucha' => 'Neucha', 'Neuton' => 'Neuton', 'News Cycle' => 'News Cycle', 'Niconne' => 'Niconne', 'Nixie One' => 'Nixie One', 'Nobile' => 'Nobile', 'Nokora' => 'Nokora', 'Norican' => 'Norican', 'Nosifer' => 'Nosifer', 'Noticia Text' => 'Noticia Text', 'Nova Cut' => 'Nova Cut', 'Nova Flat' => 'Nova Flat', 'Nova Mono' => 'Nova Mono', 'Nova Oval' => 'Nova Oval', 'Nova Round' => 'Nova Round', 'Nova Script' => 'Nova Script', 'Nova Slim' => 'Nova Slim', 'Nova Square' => 'Nova Square', 'Numans' => 'Numans', 'Nunito' => ' Nunito Regular', 'OFL Sorts Mill Goudy TT' => 'OFL Sorts Mill Goudy TT', 'Old Standard TT' => 'Old Standard TT', 'Oldenburg' => 'Oldenburg', 'Oleo Script' => 'Oleo Script', 'Open Sans Condensed' => 'Open Sans Condensed', 'Open Sans regular' => 'Open Sans regular', 'Orbitron' => 'Orbitron', 'Oregano' => 'Oregano', 'Original Surfer' => 'Original Surfer', 'Oswald' => 'Oswald', 'Over the Rainbow' => 'Over the Rainbow', 'Overlock SC' => 'Overlock SC', 'Overlock' => 'Overlock', 'Ovo' => 'Ovo', 'Oxygen' => 'Oxygen', 'PT Mono' => 'PT Mono', 'PT Sans Caption' => 'PT Sans Caption', 'PT Sans Narrow' => 'PT Sans Narrow', 'PT Sans' => 'PT Sans', 'PT Serif Caption' => 'PT Serif Caption', 'PT Serif' => 'PT Serif', 'Pacifico' => 'Pacifico', 'Parisienne' => 'Parisienne', 'Passero One' => 'Passero One', 'Passion One' => 'Passion One', 'Patrick Hand' => 'Patrick Hand', 'Patua One' => 'Patua One', 'Paytone One' => 'Paytone One', 'Peralta' => 'Peralta', 'Permanent Marker' => 'Permanent Marker', 'Petrona' => 'Petrona', 'Philosopher' => 'Philosopher', 'Piedra' => 'Piedra', 'Pinyon Script' => 'Pinyon Script', 'Plaster' => 'Plaster', 'Play' => 'Play', 'Playball' => 'Playball', 'Playfair Display' => ' Playfair Display', 'Podkova' => ' Podkova', 'Poiret One' => 'Poiret One', 'Poller One' => 'Poller One', 'Poly' => 'Poly', 'Pompiere' => 'Pompiere', 'Pontano Sans' => 'Pontano Sans', 'Port Lligat Sans' => 'Port Lligat Sans', 'Port Lligat Slab' => 'Port Lligat Slab', 'Prata' => 'Prata', 'Press Start 2P' => 'Press Start 2P', 'Princess Sofia' => 'Princess Sofia', 'Prociono' => 'Prociono', 'Prosto One' => 'Prosto One', 'Puritan' => 'Puritan', 'Quando' => 'Quando', 'Quantico' => 'Quantico', 'Quattrocento Sans' => 'Quattrocento Sans', 'Quattrocento' => 'Quattrocento', 'Questrial' => 'Questrial', 'Quicksand' => 'Quicksand', 'Qwigley' => 'Qwigley', 'Racing Sans One' => 'Racing Sans One', 'Radley' => 'Radley', 'Rammetto One' => 'Rammetto One', 'Rancho' => 'Rancho', 'Rationale' => 'Rationale', 'Redressed' => 'Redressed', 'Reenie Beanie' => 'Reenie Beanie', 'Revalia' => 'Revalia', 'Ribeye Marrow' => 'Ribeye Marrow', 'Ribeye' => 'Ribeye', 'Righteous' => 'Righteous', 'Rochester' => 'Rochester', 'Rock Salt' => 'Rock Salt', 'Rokkitt' => 'Rokkitt', 'Romanesco' => 'Romanesco', 'Ropa Sans' => 'Ropa Sans', 'Rosario' => 'Rosario', 'Rouge Script' => 'Rouge Script', 'Ruda' => 'Ruda', 'Ruge Boogie' => 'Ruge Boogie', 'Ruluko' => 'Ruluko', 'Ruslan Display' => 'Ruslan Display', 'Russo One' => 'Russo One', 'Ruthie' => 'Ruthie', 'Sail' => 'Sail', 'Salsa' => 'Salsa', 'Sancreek' => 'Sancreek', 'Sansita One' => 'Sansita One', 'Sarina' => 'Sarina', 'Satisfy' => 'Satisfy', 'Schoolbell' => 'Schoolbell', 'Seaweed Script' => 'Seaweed Script', 'Sevillana' => 'Sevillana', 'Shadows Into Light Two' => 'Shadows Into Light Two', 'Shadows Into Light' => 'Shadows Into Light', 'Shanti' => 'Shanti', 'Share' => 'Share', 'Shojumaru' => 'Shojumaru', 'Short Stack' => 'Short Stack', 'Sigmar One' => 'Sigmar One', 'Signika Negative' => 'Signika Negative', 'Signika' => 'Signika', 'Simonetta' => 'Simonetta', 'Sirin Stencil' => 'Sirin Stencil', 'Six Caps' => 'Six Caps', 'Slackey' => 'Slackey', 'Smokum' => 'Smokum', 'Smythe' => 'Smythe', 'Sniglet' => 'Sniglet', 'Snippet' => 'Snippet', 'Sofia' => 'Sofia', 'Sonsie One' => 'Sonsie One', 'Sorts Mill Goudy' => 'Sorts Mill Goudy', 'Source Sans Pro' => 'Source Sans Pro', 'Special Elite' => 'Special Elite', 'Spicy Rice' => 'Spicy Rice', 'Spinnaker' => 'Spinnaker', 'Spirax' => 'Spirax', 'Squada One' => 'Squada One', 'Stardos Stencil' => 'Stardos Stencil', 'Stint Ultra Condensed' => 'Stint Ultra Condensed', 'Stint Ultra Expanded' => 'Stint Ultra Expanded', 'Stoke' => 'Stoke', 'Sue Ellen Francisco' => 'Sue Ellen Francisco', 'Sunshiney' => 'Sunshiney', 'Supermercado One' => 'Supermercado One', 'Swanky and Moo Moo' => 'Swanky and Moo Moo', 'Syncopate' => 'Syncopate', 'Tangerine' => 'Tangerine', 'Telex' => 'Telex', 'Tenor Sans' => ' Tenor Sans', 'Terminal Dosis' => 'Terminal Dosis', 'The Girl Next Door' => 'The Girl Next Door', 'Tinos' => 'Tinos', 'Titan One' => 'Titan One', 'Trade Winds' => 'Trade Winds', 'Trocchi' => 'Trocchi', 'Trochut' => 'Trochut', 'Trykker' => 'Trykker', 'Tulpen One' => 'Tulpen One', 'Ubuntu Condensed' => 'Ubuntu Condensed', 'Ubuntu Mono' => 'Ubuntu Mono', 'Ubuntu' => 'Ubuntu', 'Ultra' => 'Ultra', 'Uncial Antiqua' => 'Uncial Antiqua', 'UnifrakturCook' => 'UnifrakturCook', 'UnifrakturMaguntia' => 'UnifrakturMaguntia', 'Unkempt' => 'Unkempt', 'Unlock' => 'Unlock', 'Unna' => 'Unna', 'VT323' => 'VT323', 'Varela Round' => 'Varela Round', 'Varela' => 'Varela', 'Vast Shadow' => 'Vast Shadow', 'Vibur' => 'Vibur', 'Vidaloka' => 'Vidaloka', 'Viga' => 'Viga', 'Voces' => 'Voces', 'Volkhov' => 'Volkhov', 'Vollkorn' => 'Vollkorn', 'Voltaire' => 'Voltaire', 'Waiting for the Sunrise' => 'Waiting for the Sunrise', 'Wallpoet' => 'Wallpoet', 'Walter Turncoat' => 'Walter Turncoat', 'Wellfleet' => 'Wellfleet', 'Wire One' => 'Wire One', 'Yanone Kaffeesatz' => 'Yanone Kaffeesatz', 'Yellowtail' => 'Yellowtail', 'Yeseva One' => 'Yeseva One', 'Yesteryear' => 'Yesteryear', 'Zeyada' => 'Zeyada');
                     foreach ($faces as $i => $face) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Weight */
                 if (isset($typography_stored['style'])) {
                     $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                     $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Color */
                 if (isset($typography_stored['color'])) {
                     $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                 }
                 break;
                 //border option
             //border option
             case 'border':
                 /* Border Width */
                 $border_stored = $data[$value['id']];
                 $output .= '<div class="select_wrapper border-width">';
                 $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                 for ($i = 0; $i < 21; $i++) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Style */
                 $output .= '<div class="select_wrapper border-style">';
                 $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                 $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                 foreach ($styles as $i => $style) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Color */
                 $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                 $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                 break;
                 //images checkbox - use image as checkboxes
             //images checkbox - use image as checkboxes
             case 'images':
                 $i = 0;
                 $select_value = $data[$value['id']];
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $key, false)) {
                         $checked = checked($select_value, $key, false);
                         $selected = 'of-radio-img-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                     $output .= '<img src="' . $option . '" title="' . $key . '" alt="" class=" of-radio-img-img ' . $key . ' ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                     $output .= '</span>';
                 }
                 break;
                 //info (for small intro box etc)
             //info (for small intro box etc)
             case "info":
                 $info_text = $value['std'];
                 $output .= '<div class="of-info">' . $info_text . '</div>';
                 break;
                 //display a single image
             //display a single image
             case "image":
                 $src = $value['std'];
                 $output .= '<img src="' . $src . '">';
                 break;
                 //tab heading
             //tab heading
             case 'heading':
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $header_class = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = "of-option-" . $jquery_click_hook;
                 $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                 $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                 break;
                 //drag & drop slide manager
             //drag & drop slide manager
             case 'slider':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 $output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
                 $slides = $data[$value['id']];
                 $count = count($slides);
                 if ($count < 2) {
                     $oldorder = 1;
                     $order = 1;
                     $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                 } else {
                     $i = 0;
                     foreach ($slides as $slide) {
                         $oldorder = $slide['order'];
                         $i++;
                         $order = $i;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                     }
                 }
                 $output .= '</ul>';
                 $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                 break;
                 //drag & drop block manager
             //drag & drop block manager
             case 'sorter':
                 $sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                 $output .= '<div id="' . $value['id'] . '" class="sorter">';
                 if ($sortlists) {
                     foreach ($sortlists as $group => $sortlist) {
                         $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                         $output .= '<h3>' . $group . '</h3>';
                         foreach ($sortlist as $key => $list) {
                             $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                             if ($key != "placebo") {
                                 $output .= '<li id="' . $key . '" class="sortee">';
                                 $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                 $output .= $list;
                                 $output .= '</li>';
                             }
                         }
                         $output .= '</ul>';
                     }
                 }
                 $output .= '</div>';
                 break;
                 //background images option
             //background images option
             case 'tiles':
                 $i = 0;
                 $select_value = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : '';
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $option, false)) {
                         $checked = checked($select_value, $option, false);
                         $selected = 'of-radio-tile-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                     $output .= '</span>';
                 }
                 break;
                 //backup and restore options data
             //backup and restore options data
             case 'backup':
                 $instructions = $value['desc'];
                 $backup = get_option(BACKUPS);
                 if (!isset($backup['backup_log'])) {
                     $log = 'No backups yet';
                 } else {
                     $log = $backup['backup_log'];
                 }
                 $output .= '<div class="backup-box">';
                 $output .= '<div class="instructions">' . $instructions . "\n";
                 $output .= '<p><strong>' . __('Last Backup : ', 'ThemePacific') . '<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                 $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
                 $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
                 $output .= '</div>';
                 break;
                 //export or import data between different installs
             //export or import data between different installs
             case 'transfer':
                 $instructions = $value['desc'];
                 $output .= '<textarea id="export_data" rows="8">' . serialize($data) . '</textarea>' . "\n";
                 $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                 break;
         }
         //description of each option
         if ($value['type'] != 'heading') {
             if (!isset($value['desc'])) {
                 $explain_value = '';
             } else {
                 $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
             }
             $output .= '</div>' . $explain_value . "\n";
             $output .= '<div class="clear"> </div></div></div>' . "\n";
         }
     }
     $output .= '</div>';
     return array($output, $menu, $defaults);
 }
Exemplo n.º 11
0
 /**
  * Process options data and build option fields
  *
  * @uses get_theme_mod()
  *
  * @access public
  * @since 1.0.0
  *
  * @return array
  */
 public static function optionsframework_machine($options)
 {
     global $smof_output;
     $smof_data = of_get_options();
     $data = $smof_data;
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     $groups_ext = '';
     do_action('optionsframework_machine_before', array('options' => $options, 'smof_data' => $smof_data));
     $output .= $smof_output;
     foreach ($options as $value) {
         // sanitize option
         $value = self::sanitize_option($value);
         $counter++;
         $val = '';
         //create array of defaults
         if ($value['type'] == 'multicheck') {
             if (is_array($value['std'])) {
                 foreach ($value['std'] as $i => $key) {
                     $defaults[$value['id']][$key] = true;
                 }
             } else {
                 $defaults[$value['id']][$value['std']] = true;
             }
         } else {
             if (isset($value['id'])) {
                 $defaults[$value['id']] = $value['std'];
             }
         }
         /* condition start */
         if (!empty($smof_data) || !empty($data)) {
             //Start Heading
             if ($value['type'] != "heading" && $value['type'] != "group" && $value['type'] != "start_section" && $value['type'] != "end_section" && $value['type'] != 'start_min' && $value['type'] != 'end_min') {
                 $class = '';
                 if (isset($value['class'])) {
                     $class = $value['class'];
                 }
                 //hide items in checkbox group
                 $fold = '';
                 if (array_key_exists("fold", $value)) {
                     if (isset($smof_data[$value['fold']]) && $smof_data[$value['fold']]) {
                         $fold = "f_" . $value['fold'] . " ";
                     } else {
                         $fold = "f_" . $value['fold'] . " temphide ";
                     }
                 }
                 $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' group-' . $value['group'] . ' ' . $class . '">' . "\n";
                 //only show header if 'name' value exists
                 if ($value['name']) {
                     $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
                 }
                 $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
             }
             //End Heading
             $array = array('info', 'backup', 'transfer', 'group', 'start_section', 'end_section', 'start_min', 'end_min');
             if (!in_array($value['type'], $array)) {
                 if (!isset($smof_data[$value['id']]) && $value['type'] != "heading") {
                     continue;
                 }
             }
             //description of each option
             if ($value['type'] != 'heading' && $value['type'] != 'group' && $value['type'] != 'start_section' && $value['type'] != 'end_section' && $value['type'] != 'start_min' && $value['type'] != 'end_min') {
                 if (!isset($value['desc'])) {
                     $explain_value = '';
                 } else {
                     $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
                 }
                 $output .= $explain_value . "\n";
             }
             //switch statement to handle various options type
             switch ($value['type']) {
                 //text input
                 case 'text':
                     $t_value = '';
                     $t_value = stripslashes($smof_data[$value['id']]);
                     $mini = '';
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     if ($value['mod'] == 'mini') {
                         $mini = 'mini';
                     }
                     $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                     break;
                     //select option
                 //select option
                 case 'select':
                     $mini = '';
                     $values = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     if ($value['mod'] == 'mini') {
                         $mini = 'mini';
                     }
                     $output .= '<div class="select_wrapper ' . $mini . '">';
                     $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                     foreach ($value['options'] as $select_ID => $option) {
                         $output .= '<option id="' . $select_ID . '" value="' . $select_ID . '" ' . selected($values, $select_ID, false) . ' />' . $option . '</option>';
                     }
                     $output .= '</select></div>';
                     break;
                     //textarea option
                 //textarea option
                 case 'textarea':
                     $cols = '8';
                     $ta_value = '';
                     if (isset($value['options'])) {
                         $ta_options = $value['options'];
                         if (isset($ta_options['cols'])) {
                             $cols = $ta_options['cols'];
                         }
                     }
                     $ta_value = stripslashes($smof_data[$value['id']]);
                     $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                     break;
                     //radiobox option
                 //radiobox option
                 case "radio":
                     $checked = isset($smof_data[$value['id']]) ? checked($smof_data[$value['id']], $option, false) : '';
                     foreach ($value['options'] as $option => $name) {
                         $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($smof_data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                     }
                     break;
                     //checkbox option
                 //checkbox option
                 case 'checkbox':
                     if (!isset($smof_data[$value['id']])) {
                         $smof_data[$value['id']] = 0;
                     }
                     $fold = '';
                     if (array_key_exists("folds", $value)) {
                         $fold = "fld ";
                     }
                     $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                     $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                     break;
                     //multiple checkbox option
                 //multiple checkbox option
                 case 'multicheck':
                     isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
                     foreach ($value['options'] as $key => $option) {
                         if (!isset($multi_stored[$key])) {
                             $multi_stored[$key] = '';
                         }
                         $of_key_string = $value['id'] . '_' . $key;
                         $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                     }
                     break;
                     // Color picker
                 // Color picker
                 case "color":
                     $default_color = '';
                     if (isset($value['std'])) {
                         if ($smof_data[$value['id']] != $value['std']) {
                             $default_color = ' data-default-color="' . $value['std'] . '" ';
                         }
                     }
                     $output .= '<input name="' . $value['id'] . '" id="' . $value['id'] . '" class="of-color"  type="text" value="' . $smof_data[$value['id']] . '"' . $default_color . ' />';
                     break;
                     //typography option
                 //typography option
                 case 'typography':
                     $fonts = array("ABeeZee" => "ABeeZee", "Abel" => "Abel", "Abril Fatface" => "Abril Fatface", "Aclonica" => "Aclonica", "Acme" => "Acme", "Actor" => "Actor", "Adamina" => "Adamina", "Advent Pro" => "Advent Pro", "Aguafina Script" => "Aguafina Script", "Akronim" => "Akronim", "Aladin" => "Aladin", "Aldrich" => "Aldrich", "Alegreya" => "Alegreya", "Alegreya SC" => "Alegreya SC", "Alex Brush" => "Alex Brush", "Alfa Slab One" => "Alfa Slab One", "Alice" => "Alice", "Alike" => "Alike", "Alike Angular" => "Alike Angular", "Allan" => "Allan", "Allerta" => "Allerta", "Allerta Stencil" => "Allerta Stencil", "Allura" => "Allura", "Almendra" => "Almendra", "Almendra Display" => "Almendra Display", "Almendra SC" => "Almendra SC", "Amarante" => "Amarante", "Amaranth" => "Amaranth", "Amatic SC" => "Amatic SC", "Amethysta" => "Amethysta", "Anaheim" => "Anaheim", "Andada" => "Andada", "Andika" => "Andika", "Angkor" => "Angkor", "Annie Use Your Telescope" => "Annie Use Your Telescope", "Anonymous Pro" => "Anonymous Pro", "Antic" => "Antic", "Antic Didone" => "Antic Didone", "Antic Slab" => "Antic Slab", "Anton" => "Anton", "Arapey" => "Arapey", "Arbutus" => "Arbutus", "Arbutus Slab" => "Arbutus Slab", "Architects Daughter" => "Architects Daughter", "Archivo Black" => "Archivo Black", "Archivo Narrow" => "Archivo Narrow", "Arimo" => "Arimo", "Arizonia" => "Arizonia", "Armata" => "Armata", "Artifika" => "Artifika", "Arvo" => "Arvo", "Asap" => "Asap", "Asset" => "Asset", "Astloch" => "Astloch", "Asul" => "Asul", "Atomic Age" => "Atomic Age", "Aubrey" => "Aubrey", "Audiowide" => "Audiowide", "Autour One" => "Autour One", "Average" => "Average", "Average Sans" => "Average Sans", "Averia Gruesa Libre" => "Averia Gruesa Libre", "Averia Libre" => "Averia Libre", "Averia Sans Libre" => "Averia Sans Libre", "Averia Serif Libre" => "Averia Serif Libre", "Bad Script" => "Bad Script", "Balthazar" => "Balthazar", "Bangers" => "Bangers", "Basic" => "Basic", "Battambang" => "Battambang", "Baumans" => "Baumans", "Bayon" => "Bayon", "Belgrano" => "Belgrano", "Belleza" => "Belleza", "BenchNine" => "BenchNine", "Bentham" => "Bentham", "Berkshire Swash" => "Berkshire Swash", "Bevan" => "Bevan", "Bigelow Rules" => "Bigelow Rules", "Bigshot One" => "Bigshot One", "Bilbo" => "Bilbo", "Bilbo Swash Caps" => "Bilbo Swash Caps", "Bitter" => "Bitter", "Black Ops One" => "Black Ops One", "Bokor" => "Bokor", "Bonbon" => "Bonbon", "Boogaloo" => "Boogaloo", "Bowlby One" => "Bowlby One", "Bowlby One SC" => "Bowlby One SC", "Brawler" => "Brawler", "Bree Serif" => "Bree Serif", "Bubblegum Sans" => "Bubblegum Sans", "Bubbler One" => "Bubbler One", "Buda" => "Buda", "Buenard" => "Buenard", "Butcherman" => "Butcherman", "Butterfly Kids" => "Butterfly Kids", "Cabin" => "Cabin", "Cabin Condensed" => "Cabin Condensed", "Cabin Sketch" => "Cabin Sketch", "Caesar Dressing" => "Caesar Dressing", "Cagliostro" => "Cagliostro", "Calligraffitti" => "Calligraffitti", "Cambo" => "Cambo", "Candal" => "Candal", "Cantarell" => "Cantarell", "Cantata One" => "Cantata One", "Cantora One" => "Cantora One", "Capriola" => "Capriola", "Cardo" => "Cardo", "Carme" => "Carme", "Carrois Gothic" => "Carrois Gothic", "Carrois Gothic SC" => "Carrois Gothic SC", "Carter One" => "Carter One", "Caudex" => "Caudex", "Cedarville Cursive" => "Cedarville Cursive", "Ceviche One" => "Ceviche One", "Changa One" => "Changa One", "Chango" => "Chango", "Chau Philomene One" => "Chau Philomene One", "Chela One" => "Chela One", "Chelsea Market" => "Chelsea Market", "Chenla" => "Chenla", "Cherry Cream Soda" => "Cherry Cream Soda", "Cherry Swash" => "Cherry Swash", "Chewy" => "Chewy", "Chicle" => "Chicle", "Chivo" => "Chivo", "Cinzel" => "Cinzel", "Cinzel Decorative" => "Cinzel Decorative", "Clicker Script" => "Clicker Script", "Coda" => "Coda", "Coda Caption" => "Coda Caption", "Codystar" => "Codystar", "Combo" => "Combo", "Comfortaa" => "Comfortaa", "Coming Soon" => "Coming Soon", "Concert One" => "Concert One", "Condiment" => "Condiment", "Content" => "Content", "Contrail One" => "Contrail One", "Convergence" => "Convergence", "Cookie" => "Cookie", "Copse" => "Copse", "Corben" => "Corben", "Courgette" => "Courgette", "Cousine" => "Cousine", "Coustard" => "Coustard", "Covered By Your Grace" => "Covered By Your Grace", "Crafty Girls" => "Crafty Girls", "Creepster" => "Creepster", "Crete Round" => "Crete Round", "Crimson Text" => "Crimson Text", "Croissant One" => "Croissant One", "Crushed" => "Crushed", "Cuprum" => "Cuprum", "Cutive" => "Cutive", "Cutive Mono" => "Cutive Mono", "Damion" => "Damion", "Dancing Script" => "Dancing Script", "Dangrek" => "Dangrek", "Dawning of a New Day" => "Dawning of a New Day", "Days One" => "Days One", "Delius" => "Delius", "Delius Swash Caps" => "Delius Swash Caps", "Delius Unicase" => "Delius Unicase", "Della Respira" => "Della Respira", "Denk One" => "Denk One", "Devonshire" => "Devonshire", "Didact Gothic" => "Didact Gothic", "Diplomata" => "Diplomata", "Diplomata SC" => "Diplomata SC", "Domine" => "Domine", "Donegal One" => "Donegal One", "Doppio One" => "Doppio One", "Dorsa" => "Dorsa", "Dosis" => "Dosis", "Dr Sugiyama" => "Dr Sugiyama", "Droid Sans" => "Droid Sans", "Droid Sans Mono" => "Droid Sans Mono", "Droid Serif" => "Droid Serif", "Duru Sans" => "Duru Sans", "Dynalight" => "Dynalight", "EB Garamond" => "EB Garamond", "Eagle Lake" => "Eagle Lake", "Eater" => "Eater", "Economica" => "Economica", "Electrolize" => "Electrolize", "Elsie" => "Elsie", "Elsie Swash Caps" => "Elsie Swash Caps", "Emblema One" => "Emblema One", "Emilys Candy" => "Emilys Candy", "Engagement" => "Engagement", "Englebert" => "Englebert", "Enriqueta" => "Enriqueta", "Erica One" => "Erica One", "Esteban" => "Esteban", "Euphoria Script" => "Euphoria Script", "Ewert" => "Ewert", "Exo" => "Exo", "Expletus Sans" => "Expletus Sans", "Fanwood Text" => "Fanwood Text", "Fascinate" => "Fascinate", "Fascinate Inline" => "Fascinate Inline", "Faster One" => "Faster One", "Fasthand" => "Fasthand", "Federant" => "Federant", "Federo" => "Federo", "Felipa" => "Felipa", "Fenix" => "Fenix", "Finger Paint" => "Finger Paint", "Fjalla One" => "Fjalla One", "Fjord One" => "Fjord One", "Flamenco" => "Flamenco", "Flavors" => "Flavors", "Fondamento" => "Fondamento", "Fontdiner Swanky" => "Fontdiner Swanky", "Forum" => "Forum", "Francois One" => "Francois One", "Freckle Face" => "Freckle Face", "Fredericka the Great" => "Fredericka the Great", "Fredoka One" => "Fredoka One", "Freehand" => "Freehand", "Fresca" => "Fresca", "Frijole" => "Frijole", "Fruktur" => "Fruktur", "Fugaz One" => "Fugaz One", "GFS Didot" => "GFS Didot", "GFS Neohellenic" => "GFS Neohellenic", "Gabriela" => "Gabriela", "Gafata" => "Gafata", "Galdeano" => "Galdeano", "Galindo" => "Galindo", "Gentium Basic" => "Gentium Basic", "Gentium Book Basic" => "Gentium Book Basic", "Geo" => "Geo", "Geostar" => "Geostar", "Geostar Fill" => "Geostar Fill", "Germania One" => "Germania One", "Gilda Display" => "Gilda Display", "Give You Glory" => "Give You Glory", "Glass Antiqua" => "Glass Antiqua", "Glegoo" => "Glegoo", "Gloria Hallelujah" => "Gloria Hallelujah", "Goblin One" => "Goblin One", "Gochi Hand" => "Gochi Hand", "Gorditas" => "Gorditas", "Goudy Bookletter 1911" => "Goudy Bookletter 1911", "Graduate" => "Graduate", "Grand Hotel" => "Grand Hotel", "Gravitas One" => "Gravitas One", "Great Vibes" => "Great Vibes", "Griffy" => "Griffy", "Gruppo" => "Gruppo", "Gudea" => "Gudea", "Habibi" => "Habibi", "Hammersmith One" => "Hammersmith One", "Hanalei" => "Hanalei", "Hanalei Fill" => "Hanalei Fill", "Handlee" => "Handlee", "Hanuman" => "Hanuman", "Happy Monkey" => "Happy Monkey", "Headland One" => "Headland One", "Henny Penny" => "Henny Penny", "Herr Von Muellerhoff" => "Herr Von Muellerhoff", "Holtwood One SC" => "Holtwood One SC", "Homemade Apple" => "Homemade Apple", "Homenaje" => "Homenaje", "IM Fell DW Pica" => "IM Fell DW Pica", "IM Fell DW Pica SC" => "IM Fell DW Pica SC", "IM Fell Double Pica" => "IM Fell Double Pica", "IM Fell Double Pica SC" => "IM Fell Double Pica SC", "IM Fell English" => "IM Fell English", "IM Fell English SC" => "IM Fell English SC", "IM Fell French Canon" => "IM Fell French Canon", "IM Fell French Canon SC" => "IM Fell French Canon SC", "IM Fell Great Primer" => "IM Fell Great Primer", "IM Fell Great Primer SC" => "IM Fell Great Primer SC", "Iceberg" => "Iceberg", "Iceland" => "Iceland", "Imprima" => "Imprima", "Inconsolata" => "Inconsolata", "Inder" => "Inder", "Indie Flower" => "Indie Flower", "Inika" => "Inika", "Irish Grover" => "Irish Grover", "Istok Web" => "Istok Web", "Italiana" => "Italiana", "Italianno" => "Italianno", "Jacques Francois" => "Jacques Francois", "Jacques Francois Shadow" => "Jacques Francois Shadow", "Jim Nightshade" => "Jim Nightshade", "Jockey One" => "Jockey One", "Jolly Lodger" => "Jolly Lodger", "Josefin Sans" => "Josefin Sans", "Josefin Slab" => "Josefin Slab", "Joti One" => "Joti One", "Judson" => "Judson", "Julee" => "Julee", "Julius Sans One" => "Julius Sans One", "Junge" => "Junge", "Jura" => "Jura", "Just Another Hand" => "Just Another Hand", "Just Me Again Down Here" => "Just Me Again Down Here", "Kameron" => "Kameron", "Karla" => "Karla", "Kaushan Script" => "Kaushan Script", "Kavoon" => "Kavoon", "Keania One" => "Keania One", "Kelly Slab" => "Kelly Slab", "Kenia" => "Kenia", "Khmer" => "Khmer", "Kite One" => "Kite One", "Knewave" => "Knewave", "Kotta One" => "Kotta One", "Koulen" => "Koulen", "Kranky" => "Kranky", "Kreon" => "Kreon", "Kristi" => "Kristi", "Krona One" => "Krona One", "La Belle Aurore" => "La Belle Aurore", "Lancelot" => "Lancelot", "Lato" => "Lato", "League Script" => "League Script", "Leckerli One" => "Leckerli One", "Ledger" => "Ledger", "Lekton" => "Lekton", "Lemon" => "Lemon", "Libre Baskerville" => "Libre Baskerville", "Life Savers" => "Life Savers", "Lilita One" => "Lilita One", "Limelight" => "Limelight", "Linden Hill" => "Linden Hill", "Lobster" => "Lobster", "Lobster Two" => "Lobster Two", "Londrina Outline" => "Londrina Outline", "Londrina Shadow" => "Londrina Shadow", "Londrina Sketch" => "Londrina Sketch", "Londrina Solid" => "Londrina Solid", "Lora" => "Lora", "Love Ya Like A Sister" => "Love Ya Like A Sister", "Loved by the King" => "Loved by the King", "Lovers Quarrel" => "Lovers Quarrel", "Luckiest Guy" => "Luckiest Guy", "Lusitana" => "Lusitana", "Lustria" => "Lustria", "Macondo" => "Macondo", "Macondo Swash Caps" => "Macondo Swash Caps", "Magra" => "Magra", "Maiden Orange" => "Maiden Orange", "Mako" => "Mako", "Marcellus" => "Marcellus", "Marcellus SC" => "Marcellus SC", "Marck Script" => "Marck Script", "Margarine" => "Margarine", "Marko One" => "Marko One", "Marmelad" => "Marmelad", "Marvel" => "Marvel", "Mate" => "Mate", "Mate SC" => "Mate SC", "Maven Pro" => "Maven Pro", "McLaren" => "McLaren", "Meddon" => "Meddon", "MedievalSharp" => "MedievalSharp", "Medula One" => "Medula One", "Megrim" => "Megrim", "Meie Script" => "Meie Script", "Merienda" => "Merienda", "Merienda One" => "Merienda One", "Merriweather" => "Merriweather", "Merriweather Sans" => "Merriweather Sans", "Metal" => "Metal", "Metal Mania" => "Metal Mania", "Metamorphous" => "Metamorphous", "Metrophobic" => "Metrophobic", "Michroma" => "Michroma", "Milonga" => "Milonga", "Miltonian" => "Miltonian", "Miltonian Tattoo" => "Miltonian Tattoo", "Miniver" => "Miniver", "Miss Fajardose" => "Miss Fajardose", "Modern Antiqua" => "Modern Antiqua", "Molengo" => "Molengo", "Molle" => "Molle", "Monda" => "Monda", "Monofett" => "Monofett", "Monoton" => "Monoton", "Monsieur La Doulaise" => "Monsieur La Doulaise", "Montaga" => "Montaga", "Montez" => "Montez", "Montserrat" => "Montserrat", "Montserrat Alternates" => "Montserrat Alternates", "Montserrat Subrayada" => "Montserrat Subrayada", "Moul" => "Moul", "Moulpali" => "Moulpali", "Mountains of Christmas" => "Mountains of Christmas", "Mouse Memoirs" => "Mouse Memoirs", "Mr Bedfort" => "Mr Bedfort", "Mr Dafoe" => "Mr Dafoe", "Mr De Haviland" => "Mr De Haviland", "Mrs Saint Delafield" => "Mrs Saint Delafield", "Mrs Sheppards" => "Mrs Sheppards", "Muli" => "Muli", "Mystery Quest" => "Mystery Quest", "Neucha" => "Neucha", "Neuton" => "Neuton", "New Rocker" => "New Rocker", "News Cycle" => "News Cycle", "Niconne" => "Niconne", "Nixie One" => "Nixie One", "Nobile" => "Nobile", "Nokora" => "Nokora", "Norican" => "Norican", "Nosifer" => "Nosifer", "Nothing You Could Do" => "Nothing You Could Do", "Noticia Text" => "Noticia Text", "Nova Cut" => "Nova Cut", "Nova Flat" => "Nova Flat", "Nova Mono" => "Nova Mono", "Nova Oval" => "Nova Oval", "Nova Round" => "Nova Round", "Nova Script" => "Nova Script", "Nova Slim" => "Nova Slim", "Nova Square" => "Nova Square", "Numans" => "Numans", "Nunito" => "Nunito", "Odor Mean Chey" => "Odor Mean Chey", "Offside" => "Offside", "Old Standard TT" => "Old Standard TT", "Oldenburg" => "Oldenburg", "Oleo Script" => "Oleo Script", "Oleo Script Swash Caps" => "Oleo Script Swash Caps", "Open Sans" => "Open Sans", "Open Sans Condensed" => "Open Sans Condensed", "Oranienbaum" => "Oranienbaum", "Orbitron" => "Orbitron", "Oregano" => "Oregano", "Orienta" => "Orienta", "Original Surfer" => "Original Surfer", "Oswald" => "Oswald", "Over the Rainbow" => "Over the Rainbow", "Overlock" => "Overlock", "Overlock SC" => "Overlock SC", "Ovo" => "Ovo", "Oxygen" => "Oxygen", "Oxygen Mono" => "Oxygen Mono", "PT Mono" => "PT Mono", "PT Sans" => "PT Sans", "PT Sans Caption" => "PT Sans Caption", "PT Sans Narrow" => "PT Sans Narrow", "PT Serif" => "PT Serif", "PT Serif Caption" => "PT Serif Caption", "Pacifico" => "Pacifico", "Paprika" => "Paprika", "Parisienne" => "Parisienne", "Passero One" => "Passero One", "Passion One" => "Passion One", "Patrick Hand" => "Patrick Hand", "Patrick Hand SC" => "Patrick Hand SC", "Patua One" => "Patua One", "Paytone One" => "Paytone One", "Peralta" => "Peralta", "Permanent Marker" => "Permanent Marker", "Petit Formal Script" => "Petit Formal Script", "Petrona" => "Petrona", "Philosopher" => "Philosopher", "Piedra" => "Piedra", "Pinyon Script" => "Pinyon Script", "Pirata One" => "Pirata One", "Plaster" => "Plaster", "Play" => "Play", "Playball" => "Playball", "Playfair Display" => "Playfair Display", "Playfair Display SC" => "Playfair Display SC", "Podkova" => "Podkova", "Poiret One" => "Poiret One", "Poller One" => "Poller One", "Poly" => "Poly", "Pompiere" => "Pompiere", "Pontano Sans" => "Pontano Sans", "Port Lligat Sans" => "Port Lligat Sans", "Port Lligat Slab" => "Port Lligat Slab", "Prata" => "Prata", "Preahvihear" => "Preahvihear", "Press Start 2P" => "Press Start 2P", "Princess Sofia" => "Princess Sofia", "Prociono" => "Prociono", "Prosto One" => "Prosto One", "Puritan" => "Puritan", "Purple Purse" => "Purple Purse", "Quando" => "Quando", "Quantico" => "Quantico", "Quattrocento" => "Quattrocento", "Quattrocento Sans" => "Quattrocento Sans", "Questrial" => "Questrial", "Quicksand" => "Quicksand", "Quintessential" => "Quintessential", "Qwigley" => "Qwigley", "Racing Sans One" => "Racing Sans One", "Radley" => "Radley", "Raleway" => "Raleway", "Raleway Dots" => "Raleway Dots", "Rambla" => "Rambla", "Rammetto One" => "Rammetto One", "Ranchers" => "Ranchers", "Rancho" => "Rancho", "Rationale" => "Rationale", "Redressed" => "Redressed", "Reenie Beanie" => "Reenie Beanie", "Revalia" => "Revalia", "Ribeye" => "Ribeye", "Ribeye Marrow" => "Ribeye Marrow", "Righteous" => "Righteous", "Risque" => "Risque", "Roboto" => "Roboto", "Roboto Condensed" => "Roboto Condensed", "Rochester" => "Rochester", "Rock Salt" => "Rock Salt", "Rokkitt" => "Rokkitt", "Romanesco" => "Romanesco", "Ropa Sans" => "Ropa Sans", "Rosario" => "Rosario", "Rosarivo" => "Rosarivo", "Rouge Script" => "Rouge Script", "Ruda" => "Ruda", "Rufina" => "Rufina", "Ruge Boogie" => "Ruge Boogie", "Ruluko" => "Ruluko", "Rum Raisin" => "Rum Raisin", "Ruslan Display" => "Ruslan Display", "Russo One" => "Russo One", "Ruthie" => "Ruthie", "Rye" => "Rye", "Sacramento" => "Sacramento", "Sail" => "Sail", "Salsa" => "Salsa", "Sanchez" => "Sanchez", "Sancreek" => "Sancreek", "Sansita One" => "Sansita One", "Sarina" => "Sarina", "Satisfy" => "Satisfy", "Scada" => "Scada", "Schoolbell" => "Schoolbell", "Seaweed Script" => "Seaweed Script", "Sevillana" => "Sevillana", "Seymour One" => "Seymour One", "Shadows Into Light" => "Shadows Into Light", "Shadows Into Light Two" => "Shadows Into Light Two", "Shanti" => "Shanti", "Share" => "Share", "Share Tech" => "Share Tech", "Share Tech Mono" => "Share Tech Mono", "Shojumaru" => "Shojumaru", "Short Stack" => "Short Stack", "Siemreap" => "Siemreap", "Sigmar One" => "Sigmar One", "Signika" => "Signika", "Signika Negative" => "Signika Negative", "Simonetta" => "Simonetta", "Sintony" => "Sintony", "Sirin Stencil" => "Sirin Stencil", "Six Caps" => "Six Caps", "Skranji" => "Skranji", "Slackey" => "Slackey", "Smokum" => "Smokum", "Smythe" => "Smythe", "Sniglet" => "Sniglet", "Snippet" => "Snippet", "Snowburst One" => "Snowburst One", "Sofadi One" => "Sofadi One", "Sofia" => "Sofia", "Sonsie One" => "Sonsie One", "Sorts Mill Goudy" => "Sorts Mill Goudy", "Source Code Pro" => "Source Code Pro", "Source Sans Pro" => "Source Sans Pro", "Special Elite" => "Special Elite", "Spicy Rice" => "Spicy Rice", "Spinnaker" => "Spinnaker", "Spirax" => "Spirax", "Squada One" => "Squada One", "Stalemate" => "Stalemate", "Stalinist One" => "Stalinist One", "Stardos Stencil" => "Stardos Stencil", "Stint Ultra Condensed" => "Stint Ultra Condensed", "Stint Ultra Expanded" => "Stint Ultra Expanded", "Stoke" => "Stoke", "Strait" => "Strait", "Sue Ellen Francisco" => "Sue Ellen Francisco", "Sunshiney" => "Sunshiney", "Supermercado One" => "Supermercado One", "Suwannaphum" => "Suwannaphum", "Swanky and Moo Moo" => "Swanky and Moo Moo", "Syncopate" => "Syncopate", "Tangerine" => "Tangerine", "Taprom" => "Taprom", "Tauri" => "Tauri", "Telex" => "Telex", "Tenor Sans" => "Tenor Sans", "Text Me One" => "Text Me One", "The Girl Next Door" => "The Girl Next Door", "Tienne" => "Tienne", "Tinos" => "Tinos", "Titan One" => "Titan One", "Titillium Web" => "Titillium Web", "Trade Winds" => "Trade Winds", "Trocchi" => "Trocchi", "Trochut" => "Trochut", "Trykker" => "Trykker", "Tulpen One" => "Tulpen One", "Ubuntu" => "Ubuntu", "Ubuntu Condensed" => "Ubuntu Condensed", "Ubuntu Mono" => "Ubuntu Mono", "Ultra" => "Ultra", "Uncial Antiqua" => "Uncial Antiqua", "Underdog" => "Underdog", "Unica One" => "Unica One", "UnifrakturCook" => "UnifrakturCook", "UnifrakturMaguntia" => "UnifrakturMaguntia", "Unkempt" => "Unkempt", "Unlock" => "Unlock", "Unna" => "Unna", "VT323" => "VT323", "Vampiro One" => "Vampiro One", "Varela" => "Varela", "Varela Round" => "Varela Round", "Vast Shadow" => "Vast Shadow", "Vibur" => "Vibur", "Vidaloka" => "Vidaloka", "Viga" => "Viga", "Voces" => "Voces", "Volkhov" => "Volkhov", "Vollkorn" => "Vollkorn", "Voltaire" => "Voltaire", "Waiting for the Sunrise" => "Waiting for the Sunrise", "Wallpoet" => "Wallpoet", "Walter Turncoat" => "Walter Turncoat", "Warnes" => "Warnes", "Wellfleet" => "Wellfleet", "Wendy One" => "Wendy One", "Wire One" => "Wire One", "Yanone Kaffeesatz" => "Yanone Kaffeesatz", "Yellowtail" => "Yellowtail", "Yeseva One" => "Yeseva One", "Yesteryear" => "Yesteryear", "Zeyada" => "Zeyada");
                     if (isset($value['options'])) {
                         $fonts = $value['options'];
                     }
                     $typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                     /*					if ( isset($smof_data[$value['id']]['face']) ) {
                     						var_dump($smof_data[$value['id']]);
                     					}
                     					else {
                     						var_dump($smof_data[$value['id']]);
                     						$curr_face = $smof_data[$value['id']];
                     						set_theme_mod($value['id'], array("face"=>$curr_face,"style"=>"normal","weight"=>"400"));
                     					}*/
                     /* Font Face */
                     if (isset($typography_stored['face']) ? $typography_stored['face'] : '') {
                         $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                         $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                         $faces = $fonts;
                         foreach ($faces as $i => $face) {
                             $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                         }
                         $output .= '</select></div>';
                     }
                     /* Font Size */
                     if (isset($typography_stored['size'])) {
                         $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                         $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                         for ($i = 12; $i < 25; $i++) {
                             $test = $i . 'px';
                             $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                         }
                         $output .= '</select></div>';
                     }
                     /* Line Height 
                     					if(isset($typography_stored['height'])) {
                     
                     						$output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                     						$output .= '<select class="of-typography of-typography-height select" name="'.$value['id'].'[height]" id="'. $value['id'].'_height">';
                     							for ($i = 20; $i < 38; $i++){ 
                     								$test = $i.'px';
                     								$output .= '<option value="'. $i .'px" ' . selected($typography_stored['height'], $test, false) . '>'. $i .'px</option>'; 
                     								}
                     
                     						$output .= '</select></div>';
                     
                     				}
                     */
                     /* Font Style */
                     if (isset($typography_stored['style']) ? $typography_stored['style'] : '') {
                         $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                         $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                         $styles = array('normal' => 'Normal', 'italic' => 'Italic');
                         foreach ($styles as $i => $style) {
                             $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                         }
                         $output .= '</select></div>';
                     }
                     /* Font Weight */
                     if (isset($typography_stored['weight']) ? $typography_stored['weight'] : '') {
                         $output .= '<div class="select_wrapper typography-weight" original-title="Font weight">';
                         $output .= '<select class="of-typography of-typography-weight select" name="' . $value['id'] . '[weight]" id="' . $value['id'] . '_weight">';
                         for ($i = 1; $i < 9; $i++) {
                             $test = $i * 100;
                             $output .= '<option value="' . $test . '" ' . selected($typography_stored['weight'], $test, false) . '>' . $test . '</option>';
                         }
                         $output .= '</select></div>';
                     }
                     break;
                     //border option
                 //border option
                 case 'border':
                     /* Border Width */
                     $border_stored = $smof_data[$value['id']];
                     $output .= '<div class="select_wrapper border-width">';
                     $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                     for ($i = 0; $i < 21; $i++) {
                         $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                     }
                     $output .= '</select></div>';
                     /* Border Style */
                     $output .= '<div class="select_wrapper border-style">';
                     $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                     $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                     /* Border Color */
                     $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                     break;
                     //images checkbox - use image as checkboxes
                 //images checkbox - use image as checkboxes
                 case 'images':
                     $i = 0;
                     $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                     foreach ($value['options'] as $key => $option) {
                         $i++;
                         $checked = '';
                         $selected = '';
                         if (NULL != checked($select_value, $key, false)) {
                             $checked = checked($select_value, $key, false);
                             $selected = 'of-radio-img-selected';
                         }
                         $output .= '<span>';
                         $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                         $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                         $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                         $output .= '</span>';
                     }
                     break;
                     //info (for small intro box etc)
                 //info (for small intro box etc)
                 case "info":
                     $info_text = $value['std'];
                     $output .= '<div class="of-info">' . $info_text . '</div>';
                     break;
                     //display a single image
                 //display a single image
                 case "image":
                     $src = $value['std'];
                     $output .= '<img src="' . $src . '">';
                     break;
                     //tab heading
                 //tab heading
                 case 'heading':
                     if ($counter >= 2) {
                         $output .= '</div>' . "\n";
                     }
                     //custom icon
                     $icon = '';
                     /*					if(isset($value['icon'])){
                     						$icon = '<i class="'.$value['icon'] .'"></i>';
                     					}*/
                     $add_responsive_classes = '';
                     if (isset($value['responsive'])) {
                         $add_responsive_classes = snpshpwp_responsive_classes($value['responsive']);
                     }
                     $add_element = '';
                     if (isset($value['element'])) {
                         $add_element = 'data-element="' . $value['element'] . '"';
                     }
                     $header_class = str_replace(' ', '', strtolower($value['name']));
                     $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                     $jquery_click_hook = "of-option-" . $jquery_click_hook;
                     $menu .= '<li class="' . $header_class . ' ' . $add_responsive_classes . '" data-group="' . $value['group'] . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $icon . ' ' . $value['name'] . '</a></li>';
                     $output .= '<div class="group" data-group="' . $value['group'] . '"' . $add_element . ' id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                     break;
                     //drag & drop slide manager
                 //drag & drop slide manager
                 case 'slider':
                     $output .= '<div class="slider"><ul id="' . $value['id'] . '">';
                     $slides = $smof_data[$value['id']];
                     $count = count($slides);
                     if ($count < 2) {
                         $oldorder = 1;
                         $order = 1;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order);
                     } else {
                         $i = 0;
                         foreach ($slides as $slide) {
                             $oldorder = $slide['order'];
                             $i++;
                             $order = $i;
                             $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order);
                         }
                     }
                     $output .= '</ul>';
                     $output .= '<a href="#" class="of-button slide_add_button">' . __('Add New Slide', 'snpshpwp') . '</a></div>';
                     break;
                     //drag & drop block manager
                 //drag & drop block manager
                 case 'sorter':
                     // Make sure to get list of all the default blocks first
                     $all_blocks = $value['std'];
                     $temp = array();
                     // holds default blocks
                     $temp2 = array();
                     // holds saved blocks
                     foreach ($all_blocks as $blocks) {
                         $temp = array_merge($temp, $blocks);
                     }
                     $sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                     foreach ($sortlists as $sortlist) {
                         $temp2 = array_merge($temp2, $sortlist);
                     }
                     // now let's compare if we have anything missing
                     foreach ($temp as $k => $v) {
                         if (!array_key_exists($k, $temp2)) {
                             $sortlists['disabled'][$k] = $v;
                         }
                     }
                     // now check if saved blocks has blocks not registered under default blocks
                     foreach ($sortlists as $key => $sortlist) {
                         foreach ($sortlist as $k => $v) {
                             if (!array_key_exists($k, $temp)) {
                                 unset($sortlist[$k]);
                             }
                         }
                         $sortlists[$key] = $sortlist;
                     }
                     // assuming all sync'ed, now get the correct naming for each block
                     foreach ($sortlists as $key => $sortlist) {
                         foreach ($sortlist as $k => $v) {
                             $sortlist[$k] = $temp[$k];
                         }
                         $sortlists[$key] = $sortlist;
                     }
                     $output .= '<div id="' . $value['id'] . '" class="sorter">';
                     if ($sortlists) {
                         foreach ($sortlists as $group => $sortlist) {
                             $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                             $output .= '<h3>' . $group . '</h3>';
                             foreach ($sortlist as $key => $list) {
                                 $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                                 if ($key != "placebo") {
                                     $output .= '<li id="' . $key . '" class="sortee">';
                                     $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                     $output .= $list;
                                     $output .= '</li>';
                                 }
                             }
                             $output .= '</ul>';
                         }
                     }
                     $output .= '</div>';
                     break;
                     //background images option
                 //background images option
                 case 'tiles':
                     $i = 0;
                     $select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                     if (is_array($value['options'])) {
                         foreach ($value['options'] as $key => $option) {
                             $i++;
                             $checked = '';
                             $selected = '';
                             if (NULL != checked($select_value, $option, false)) {
                                 $checked = checked($select_value, $option, false);
                                 $selected = 'of-radio-tile-selected';
                             }
                             $output .= '<span>';
                             $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                             $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                             $output .= '</span>';
                         }
                     }
                     break;
                     //backup and restore options data
                 //backup and restore options data
                 case 'backup':
                     $instructions = $value['desc'];
                     $backup = of_get_options(BACKUPS);
                     $init = of_get_options('smof_init');
                     if (!isset($backup['backup_log'])) {
                         $log = 'No backups yet';
                     } else {
                         $log = $backup['backup_log'];
                     }
                     $output .= '<div class="backup-box">';
                     $output .= '<div class="instructions">' . $instructions . "\n";
                     $output .= '<p><strong>' . __('Last Backup : ') . '<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                     $output .= '<a href="#" id="of_backup_button" class="of-button snpshpwp_green" title="' . __('Backup Options', 'snpshpwp') . '">' . __('Backup Options', 'snpshpwp') . '</a>';
                     $output .= '<a href="#" id="of_restore_button" class="of-button snpshpwp_blue" title="' . __('Restore Options', 'snpshpwp') . '">' . __('Restore Options', 'snpshpwp') . '</a>';
                     $output .= '</div>';
                     break;
                     //export or import data between different installs
                 //export or import data between different installs
                 case 'transfer':
                     $instructions = $value['desc'];
                     $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($smof_data)) . '</textarea>' . "\n";
                     $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                     break;
                     // google font field
                 // google font field
                 case 'select_google_font':
                     $output .= '<div class="select_wrapper">';
                     $output .= '<select class="select of-input google_font_select" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                     foreach ($value['options'] as $select_key => $option) {
                         $output .= '<option value="' . $select_key . '" ' . selected(isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : "", $option, false) . ' />' . $option . '</option>';
                     }
                     $output .= '</select></div>';
                     if (isset($value['preview']['text'])) {
                         $g_text = $value['preview']['text'];
                     } else {
                         $g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
                     }
                     if (isset($value['preview']['size'])) {
                         $g_size = 'style="font-size: ' . $value['preview']['size'] . ';"';
                     } else {
                         $g_size = '';
                     }
                     $output .= '<p class="' . $value['id'] . '_ggf_previewer google_font_preview" ' . $g_size . '>' . $g_text . '</p>';
                     break;
                     //JQuery UI Slider
                 //JQuery UI Slider
                 case 'sliderui':
                     $s_val = $s_min = $s_max = $s_step = $s_edit = '';
                     //no errors, please
                     $s_val = stripslashes($smof_data[$value['id']]);
                     if (!isset($value['min'])) {
                         $s_min = '0';
                     } else {
                         $s_min = $value['min'];
                     }
                     if (!isset($value['max'])) {
                         $s_max = $s_min + 1;
                     } else {
                         $s_max = $value['max'];
                     }
                     if (!isset($value['step'])) {
                         $s_step = '1';
                     } else {
                         $s_step = $value['step'];
                     }
                     if (isset($value['edit']) && $value['edit'] !== true) {
                         $s_edit = ' readonly="readonly"';
                     } else {
                         $s_edit = '';
                     }
                     if ($s_val == '') {
                         $s_val = $s_min;
                     }
                     //values
                     $s_data = 'data-id="' . $value['id'] . '" data-val="' . $s_val . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                     //html output
                     $output .= '<input type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $s_val . '" class="mini" ' . $s_edit . ' />';
                     $output .= '<div id="' . $value['id'] . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                     break;
                     //Switch option
                 //Switch option
                 case 'switch':
                     if (!isset($smof_data[$value['id']])) {
                         $smof_data[$value['id']] = 0;
                     }
                     $fold = '';
                     if (array_key_exists("folds", $value)) {
                         $fold = "s_fld ";
                     }
                     $cb_enabled = $cb_disabled = '';
                     //no errors, please
                     //Get selected
                     if ($smof_data[$value['id']] == 1) {
                         $cb_enabled = ' selected';
                         $cb_disabled = '';
                     } else {
                         $cb_enabled = '';
                         $cb_disabled = ' selected';
                     }
                     //Label ON
                     if (!isset($value['on'])) {
                         $on = "On";
                     } else {
                         $on = $value['on'];
                     }
                     //Label OFF
                     if (!isset($value['off'])) {
                         $off = "Off";
                     } else {
                         $off = $value['off'];
                     }
                     $output .= '<p class="switch-options">';
                     $output .= '<label class="' . $fold . 'cb-enable' . $cb_enabled . '" data-id="' . $value['id'] . '"><span>' . $on . '</span></label>';
                     $output .= '<label class="' . $fold . 'cb-disable' . $cb_disabled . '" data-id="' . $value['id'] . '"><span>' . $off . '</span></label>';
                     $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                     $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold . 'checkbox of-input main_checkbox" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                     $output .= '</p>';
                     break;
                     // Uploader 3.5
                 // Uploader 3.5
                 case "upload":
                 case "media":
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     $u_val = '';
                     if ($smof_data[$value['id']]) {
                         $u_val = stripslashes($smof_data[$value['id']]);
                     }
                     $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $u_val, $value['mod']);
                     break;
                     // br0 additional
                     //start section
                 // br0 additional
                 //start section
                 case "start_section":
                     $output .= '<div class="of-section">';
                     break;
                     //start section
                 //start section
                 case "end_section":
                     $output .= '</div>';
                     break;
                     //start section
                 //start section
                 case "start_min":
                     $output .= '<div class="of-mini-section">';
                     break;
                     //start section
                 //start section
                 case "end_min":
                     $output .= '</div>';
                     break;
                     //drag & drop sidenav icon manager
                 //drag & drop sidenav icon manager
                 case 'sidenavico':
                     $output .= '<div class="slider"><ul id="' . $value['id'] . '">';
                     $slides = $smof_data[$value['id']];
                     $count = count($slides);
                     if ($count < 2) {
                         $oldorder = 1;
                         $order = 1;
                         $output .= Options_Machine::optionsframework_sidenavico_function($value['id'], $value['std'], $oldorder, $order);
                     } else {
                         $i = 0;
                         foreach ($slides as $slide) {
                             $oldorder = $slide['order'];
                             $i++;
                             $order = $i;
                             $output .= Options_Machine::optionsframework_sidenavico_function($value['id'], $value['std'], $oldorder, $order);
                         }
                     }
                     $output .= '</ul>';
                     $output .= '<a href="#" class="of-button slide_add_button">' . __('Add New Icon', 'snpshpwp') . '</a></div>';
                     break;
                     //drag & drop sidebar manager
                 //drag & drop sidebar manager
                 case 'sidebar':
                     $output .= '<div class="slider"><ul id="' . $value['id'] . '">';
                     $slides = $smof_data[$value['id']];
                     $count = count($slides);
                     if ($count < 2) {
                         $oldorder = 1;
                         $order = 1;
                         $output .= Options_Machine::optionsframework_sidebar_function($value['id'], $value['std'], $oldorder, $order);
                     } else {
                         $i = 0;
                         foreach ($slides as $slide) {
                             $oldorder = $slide['order'];
                             $i++;
                             $order = $i;
                             $output .= Options_Machine::optionsframework_sidebar_function($value['id'], $value['std'], $oldorder, $order);
                         }
                     }
                     $output .= '</ul>';
                     $output .= '<a href="#" class="of-button slide_add_button">' . __('Add New Sidebar', 'snpshpwp') . '</a></div>';
                     break;
                     //drag & drop contact manager
                 //drag & drop contact manager
                 case 'contact':
                     $output .= '<div class="slider"><ul id="' . $value['id'] . '">';
                     $slides = $smof_data[$value['id']];
                     $count = count($slides);
                     if ($count < 2) {
                         $oldorder = 1;
                         $order = 1;
                         $output .= Options_Machine::optionsframework_contact_function($value['id'], $value['std'], $oldorder, $order);
                     } else {
                         $i = 0;
                         foreach ($slides as $slide) {
                             $oldorder = $slide['order'];
                             $i++;
                             $order = $i;
                             $output .= Options_Machine::optionsframework_contact_function($value['id'], $value['std'], $oldorder, $order);
                         }
                     }
                     $output .= '</ul>';
                     $output .= '<a href="#" class="of-button slide_add_button">' . __('Add New Contact', 'snpshpwp') . '</a></div>';
                     break;
                     //drag & drop language manager
                 //drag & drop language manager
                 case 'language':
                     $_id = strip_tags(strtolower($value['id']));
                     $output .= '<div class="slider"><ul id="' . $value['id'] . '">';
                     $slides = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                     $count = count($slides);
                     if ($count < 2) {
                         $oldorder = 1;
                         $order = 1;
                         $output .= Options_Machine::optionsframework_language_function($value['id'], $value['std'], $oldorder, $order);
                     } else {
                         $i = 0;
                         foreach ($slides as $slide) {
                             $oldorder = $slide['order'];
                             $i++;
                             $order = $i;
                             $output .= Options_Machine::optionsframework_language_function($value['id'], $value['std'], $oldorder, $order);
                         }
                     }
                     $output .= '</ul>';
                     $output .= '<a href="#" class="of-button slide_add_button">' . __('Add New Language', 'snpshpwp') . '</a></div>';
                     break;
                     //group extension
                 //group extension
                 case 'group':
                     if ($counter >= 2) {
                         $output .= '</div>' . "\n";
                         $menu .= '</ul></li>' . "\n";
                     }
                     $header_class = str_replace(' ', '', strtolower($value['name']));
                     $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                     $jquery_click_hook = "of-option-big-" . $jquery_click_hook;
                     $icon = '';
                     /*					if(isset($value['icon'])){
                     						$icon = '<i class="'.$value['icon'] .'"></i>';
                     					}*/
                     $menu .= '<li class="' . $header_class . ' parent-group" data-group="' . $value['id'] . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $icon . ' ' . $value['name'] . '</a><ul>';
                     $groups_ext .= '<button id="' . $value['id'] . '" type="button" class="of-button">' . $icon . $value['name'] . '</button>';
                     $output .= '<div class="of-big-group" data-group="' . $value['name'] . '" id="' . $jquery_click_hook . '">' . "\n";
                     break;
                 case 'demoplugins':
                     $curr_class = SNPSHPWP_FBUILDER === true ? ' snpshpwp_active' : '';
                     $output .= sprintf('<div class="of-group-demo alt-width fbuilder%1$s"><div class="snpshpwp_plugin_icon"></div><h3>Frontend Builder</h3></div>', $curr_class);
                     $curr_class = SNPSHPWP_REVSLIDER === true ? ' snpshpwp_active' : '';
                     $output .= sprintf('<div class="of-group-demo alt-width revslider%1$s"><div class="snpshpwp_plugin_icon"></div><h3>Revolution Slider</h3></div>', $curr_class);
                     $curr_class = SNPSHPWP_WOOCOMMERCE === true ? ' snpshpwp_active' : '';
                     $output .= sprintf('<div class="of-group-demo alt-width woocommerce%1$s"><div class="snpshpwp_plugin_icon"></div><h3>WooCommerce</h3></div>', $curr_class);
                     $curr_class = SNPSHPWP_PRDCTFLTR === true ? ' snpshpwp_active' : '';
                     $output .= sprintf('<div class="of-group-demo alt-width prdctfltr%1$s"><div class="snpshpwp_plugin_icon"></div><h3>WooComemrceProduct Filter</h3></div>', $curr_class);
                     $curr_class = SNPSHPWP_FBUILDER_COMMERCE === true ? ' snpshpwp_active' : '';
                     $output .= sprintf('<div class="of-group-demo alt-width fbuilder_commerce%1$s"><div class="snpshpwp_plugin_icon"></div><h3>Frontend Builder Commerce Extension</h3></div>', $curr_class);
                     if (SNPSHPWP_FBUILDER === false || SNPSHPWP_REVSLIDER === false || SNPSHPWP_WOOCOMMERCE === false || SNPSHPWP_PRDCTFLTR === false || SNPSHPWP_FBUILDER_COMMERCE === false) {
                         $url = admin_url('themes.php?page=install-required-plugins');
                         $output .= '<a href="' . $url . '" class="of-button snpshpwp_red">' . __('Your plugins are not installed or actiavated! Please install plugins.', 'snpshpwp') . '</a>';
                     } else {
                         $output .= '<span class="of-button snpshpwp_green">' . __('This step has been successfully completed!', 'snpshpwp') . '</span>';
                     }
                     break;
                 case 'democontent':
                     if (1 == 1) {
                         $snpshpwp_demos = array('snapshop' => array('name' => 'Snapshop - Default', 'url' => 'http://www.shindiristudio.com/snapshop/', 'img' => get_template_directory_uri() . '/images/demo/demo1.png'), 'snapshop-boxed' => array('name' => 'Snapshop - Boxed', 'url' => 'http://www.shindiristudio.com/snapshop/shop-boxed', 'img' => get_template_directory_uri() . '/images/demo/demo4.png'), 'snapshop-creative' => array('name' => 'Snapshop - Creative', 'url' => 'http://www.shindiristudio.com/snapshop/shop-creative', 'img' => get_template_directory_uri() . '/images/demo/demo2.png'), 'snapshop-classic' => array('name' => 'Snapshop - Classic', 'url' => 'http://www.shindiristudio.com/snapshop/shop-classic', 'img' => get_template_directory_uri() . '/images/demo/demo3.png'));
                         foreach ($snpshpwp_demos as $k => $demo) {
                             $output .= sprintf('<div class="of-group-demo"><img src="%3$s" /><h3 class="demo-installations">%1$s</h3><a href="%2$s" class="of-button snpshpwp-view-demo-layout">%4$s</a><a href="#" class="of-button snpshpwp-install-demo-layout" data-demo="%6$s">%5$s</a></div>', $demo['name'], $demo['url'], $demo['img'], __('Preview Demo', 'snpshpwp'), __('Install Demo', 'snpshpwp'), $k);
                         }
                         $output .= '<div class="clear"></div>';
                     } else {
                         $output .= __('Your Demo Content has been successfully installed!', 'snpshpwp') . ' <span class="green">' . __('OK', 'snpshpwp') . '</span>';
                     }
                     break;
             }
             do_action('optionsframework_machine_loop', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'group' => $groups_ext, 'value' => $value));
             $output .= $smof_output;
             //description of each option
             if ($value['type'] != 'heading' && $value['type'] != 'group' && $value['type'] != 'start_section' && $value['type'] != 'end_section' && $value['type'] != 'start_min' && $value['type'] != 'end_min') {
                 if (!isset($value['desc'])) {
                     $explain_value = '';
                 } else {
                     $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
                 }
                 $output .= '</div>';
                 $output .= '<div class="clear"> </div></div></div>' . "\n";
             }
         }
         /* condition empty end */
     }
     $output .= '</div>';
     do_action('optionsframework_machine_after', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'group' => $groups_ext, 'value' => $value));
     $output .= $smof_output;
     return array($output, $menu, $defaults, $groups_ext);
 }
Exemplo n.º 12
0
    /**
     * Process options data and build option fields
     *
     * @uses get_theme_mod()
     *
     * @access public
     * @since 1.0.0
     *
     * @return array
     */
    public static function optionsframework_machine($options)
    {
        global $smof_output, $smof_details, $smof_data;
        if (empty($options)) {
            return;
        }
        if (empty($smof_data)) {
            $smof_data = of_get_options();
        }
        $data = $smof_data;
        $defaults = array();
        $counter = 0;
        $menu = '';
        $output = '';
        $update_data = false;
        do_action('optionsframework_machine_before', array('options' => $options, 'smof_data' => $smof_data));
        if ($smof_output != "") {
            $output .= $smof_output;
            $smof_output = "";
        }
        foreach ($options as $value) {
            // sanitize option
            if ($value['type'] != "heading" && $value['type'] != "toggle_start" && $value['type'] != "toggle_end" && $value['type'] != "customizer_tab" && $value['type'] != "customizer_start" && $value['type'] != "customizer_end") {
                $value = self::sanitize_option($value);
            }
            $counter++;
            $val = '';
            //create array of defaults
            if ($value['type'] == 'multicheck') {
                if (is_array($value['std'])) {
                    foreach ($value['std'] as $i => $key) {
                        $defaults[$value['id']][$key] = true;
                    }
                } else {
                    $defaults[$value['id']][$value['std']] = true;
                }
            } else {
                if (isset($value['id'])) {
                    $defaults[$value['id']] = $value['std'];
                }
            }
            /* condition start */
            if (!empty($smof_data) || !empty($data)) {
                if (array_key_exists('id', $value) && !isset($smof_data[$value['id']])) {
                    $smof_data[$value['id']] = $value['std'];
                    if ($value['type'] == "checkbox" && $value['std'] == 0) {
                        $smof_data[$value['id']] = 0;
                    } else {
                        $update_data = true;
                    }
                }
                if (array_key_exists('id', $value) && !isset($smof_details[$value['id']])) {
                    $smof_details[$value['id']] = $smof_data[$value['id']];
                }
                //Start Heading
                if ($value['type'] != "heading" && $value['type'] != "customizer_tab" && $value['type'] != "toggle_start" && $value['type'] != "toggle_end" && $value['type'] != "customizer_start" && $value['type'] != "customizer_end") {
                    $class = '';
                    if (isset($value['class'])) {
                        $class = $value['class'];
                    }
                    //hide items in checkbox group
                    $fold = '';
                    if (array_key_exists("fold", $value) && !array_key_exists("folded", $value)) {
                        if (isset($smof_data[$value['fold']]) && $smof_data[$value['fold']]) {
                            $fold = "f_" . $value['fold'] . " ";
                        } else {
                            $fold = "f_" . $value['fold'] . " temphide ";
                        }
                    }
                    $folded = '';
                    if (array_key_exists("folded", $value)) {
                        $fold_class = "folded-" . $value['fold'] . " folded-" . $value['fold'] . "-" . $value['folded'] . " ";
                        $fold .= $fold_class;
                        if ($value['folded'] == "not_empty") {
                            if (array_key_exists($value['fold'], $smof_data)) {
                                if (!$smof_data[$value['fold']]) {
                                    $fold .= "temphide ";
                                }
                            }
                        } elseif ($value['folded'] != $smof_data[$value['fold']]) {
                            $fold .= "temphide ";
                        }
                    }
                    $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
                    //only show header if 'name' value exists
                    if ($value['name']) {
                        $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
                    }
                    if ($value['type'] != 'theme_preview') {
                        $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
                    } else {
                        $output .= '<div class="option">' . "\n" . '<div class="controls-full">' . "\n";
                    }
                }
                //End Heading
                //if (!isset($smof_data[$value['id']]) && $value['type'] != "heading")
                //	continue;
                //switch statement to handle various options type
                switch ($value['type']) {
                    //text input
                    case 'text':
                        $t_value = '';
                        $t_value = stripslashes($smof_data[$value['id']]);
                        $mini = '';
                        if (!isset($value['mod'])) {
                            $value['mod'] = '';
                        }
                        if ($value['mod'] == 'mini') {
                            $mini = 'mini';
                        }
                        $output .= '<input class="of-input ' . $mini . ' input-text" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                        break;
                        //select option
                    //select option
                    case 'select':
                        $mini = '';
                        if (!isset($value['mod'])) {
                            $value['mod'] = '';
                        }
                        if ($value['mod'] == 'mini') {
                            $mini = 'mini';
                        }
                        $fold = '';
                        if (array_key_exists("folds", $value)) {
                            $fold = "fld ";
                        }
                        $extra_class = '';
                        if (array_key_exists("class", $value)) {
                            $extra_class = 'select-' . $value['class'];
                        }
                        $output .= '<select class="' . $fold . ' ' . $extra_class . ' select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" data-dependency="' . $value['dep'] . '">';
                        foreach ($value['options'] as $select_ID => $option) {
                            $theValue = $option;
                            if (!is_numeric($select_ID)) {
                                $theValue = $select_ID;
                            }
                            $output .= '<option id="' . $select_ID . '" value="' . $theValue . '" ' . selected($smof_data[$value['id']], $theValue, false) . ' />' . $option . '</option>';
                        }
                        $output .= '</select>';
                        break;
                        //textarea option
                    //textarea option
                    case 'textarea':
                        $cols = '8';
                        $ta_value = '';
                        $rows = '';
                        if (isset($value['rows'])) {
                            $rows = $value['rows'];
                        }
                        if (isset($value['options'])) {
                            $ta_options = $value['options'];
                            if (isset($ta_options['cols'])) {
                                $cols = $ta_options['cols'];
                            }
                        }
                        $ta_value = stripslashes($smof_data[$value['id']]);
                        $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="' . $rows . '">' . $ta_value . '</textarea>';
                        break;
                    case 'text_separator':
                        break;
                        //radiobox option
                    //radiobox option
                    case "radio":
                        $checked = isset($smof_data[$value['id']]) ? checked($smof_data[$value['id']], $option, false) : '';
                        foreach ($value['options'] as $option => $name) {
                            $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($smof_data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                        }
                        break;
                        //checkbox option
                    //checkbox option
                    case 'checkbox':
                        if (!isset($smof_data[$value['id']])) {
                            $smof_data[$value['id']] = 0;
                        }
                        $fold = '';
                        if (array_key_exists("folds", $value)) {
                            $fold = "fld ";
                        }
                        $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                        $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                        break;
                        //multiple checkbox option
                    //multiple checkbox option
                    case 'multicheck':
                        isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
                        foreach ($value['options'] as $key => $option) {
                            if (!isset($multi_stored[$key])) {
                                $multi_stored[$key] = '';
                            }
                            $of_key_string = $value['id'] . '_' . $key;
                            $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                        }
                        break;
                        // Color picker
                    // Color picker
                    case "color":
                        $default_color = '';
                        if (isset($value['std'])) {
                            $default_color = ' data-default-color="' . $value['std'] . '" ';
                        }
                        $output .= '<input name="' . $value['id'] . '" id="' . $value['id'] . '" class="of-color" data-dependency="' . $value['dep'] . '" type="text" value="' . $smof_data[$value['id']] . '"' . $default_color . ' />';
                        break;
                        // Background color picker
                    // Background color picker
                    case "background-color":
                        $default_color = '';
                        if (isset($value['std'])) {
                            $default_color = ' data-default-color="' . $value['std'] . '" ';
                        }
                        $output .= '<input name="' . $value['id'] . '" id="' . $value['id'] . '" class="of-bg-color" data-dependency="' . $value['dep'] . '" type="text" value="' . $smof_data[$value['id']] . '"' . $default_color . ' />';
                        break;
                        // Background color picker
                    // Background color picker
                    case "border-color":
                        $default_color = '';
                        if (isset($value['std'])) {
                            $default_color = ' data-default-color="' . $value['std'] . '" ';
                        }
                        $output .= '<input name="' . $value['id'] . '" id="' . $value['id'] . '" class="of-border-color" data-dependency="' . $value['dep'] . '" type="text" value="' . $smof_data[$value['id']] . '"' . $default_color . ' />';
                        break;
                        //typography option
                    //typography option
                    case 'typography':
                        $typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                        /* Font Size */
                        if (isset($typography_stored['size'])) {
                            $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                            for ($i = 9; $i < 20; $i++) {
                                $test = $i . 'px';
                                $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                            }
                            $output .= '</select>';
                        }
                        /* Line Height */
                        if (isset($typography_stored['height'])) {
                            $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                            $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                            for ($i = 20; $i < 38; $i++) {
                                $test = $i . 'px';
                                $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                            }
                            $output .= '</select></div>';
                        }
                        /* Font Face */
                        if (isset($typography_stored['face'])) {
                            $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                            $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                            $faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'palatino' => 'Palatino', 'helvetica' => 'Helvetica');
                            foreach ($faces as $i => $face) {
                                $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                            }
                            $output .= '</select></div>';
                        }
                        /* Font Weight */
                        if (isset($typography_stored['style'])) {
                            $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                            $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                            $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                            foreach ($styles as $i => $style) {
                                $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                            }
                            $output .= '</select></div>';
                        }
                        /* Font Color */
                        if (isset($typography_stored['color'])) {
                            $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                            $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                        }
                        break;
                        //border option
                    //border option
                    case 'border':
                        /* Border Width */
                        $border_stored = $smof_data[$value['id']];
                        $output .= '<div class="select_wrapper border-width">';
                        $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                        for ($i = 0; $i < 21; $i++) {
                            $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                        }
                        $output .= '</select></div>';
                        /* Border Style */
                        $output .= '<div class="select_wrapper border-style">';
                        $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                        $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                        foreach ($styles as $i => $style) {
                            $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                        }
                        $output .= '</select></div>';
                        /* Border Color */
                        $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                        $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                        break;
                        //images checkbox - use image as checkboxes
                    //images checkbox - use image as checkboxes
                    case 'images':
                        $i = 0;
                        $fold = '';
                        if (array_key_exists("folds", $value)) {
                            $fold = "fld ";
                        }
                        $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                        foreach ($value['options'] as $key => $option) {
                            $i++;
                            $checked = '';
                            $selected = '';
                            if (NULL != checked($select_value, $key, false)) {
                                $checked = checked($select_value, $key, false);
                                $selected = 'of-radio-img-selected';
                            }
                            $output .= '<span>';
                            $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="' . $fold . ' checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                            $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                            $output .= '<img title="' . $key . '" src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                            $output .= '</span>';
                        }
                        break;
                    case 'color-blocks':
                        $i = 0;
                        $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                        foreach ($value['options'] as $key => $option) {
                            $i++;
                            $checked = '';
                            $selected = '';
                            if (NULL != checked($select_value, $key, false)) {
                                $checked = checked($select_value, $key, false);
                                $selected = 'color-block-selected';
                            }
                            $output .= '<span class="color-block-holder">';
                            $output .= '<input type="radio" id="color-block-' . $value['id'] . $i . '" class="checkbox color-block-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                            $output .= '<label for="color-block-' . $value['id'] . $i . '" class="color-block-label" style="background-color:' . $option . ';">' . $key . '</label>';
                            //$output .= '<img title="'.$key.'" src="'.$option.'" alt="" class="of-radio-img-img '. $selected .'" onClick="document.getElementById(\'of-radio-img-'. $value['id'] . $i.'\').checked = true;" />';
                            $output .= '</span>';
                        }
                        break;
                        //info (for small intro box etc)
                    //info (for small intro box etc)
                    case "info":
                        $info_text = $value['std'];
                        $output .= '<div class="of-info">' . $info_text . '</div>';
                        break;
                        //display a single image
                    //display a single image
                    case "image":
                        $src = $value['std'];
                        $output .= '<img src="' . $src . '">';
                        break;
                        //tab heading
                    //tab heading
                    case 'heading':
                        if ($counter >= 2) {
                            $output .= '</div>' . "\n";
                        }
                        $header_class = str_replace(' ', '', strtolower($value['name']));
                        $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                        $jquery_click_hook = "of-option-" . trim(preg_replace('/ +/', '', preg_replace('/[^A-Za-z0-9 ]/', '', urldecode(html_entity_decode(strip_tags($jquery_click_hook))))));
                        $icon = $visible = '';
                        if ($header_class == 'general') {
                            $header_class .= ' current';
                            $visible = 'style="display:block;"';
                        }
                        $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '"' . $icon . '><i class="fa fa-' . $value['icon'] . '"></i>' . $value['name'] . '</a></li>';
                        $output .= '<div class="group" id="' . $jquery_click_hook . '"' . $visible . '><h2>' . $value['name'] . '</h2>' . "\n";
                        break;
                        //drag & drop slide manager
                    //drag & drop slide manager
                    case 'slider':
                        $output .= '<div class="slider"><ul id="' . $value['id'] . '">';
                        $slides = $smof_data[$value['id']];
                        $count = count($slides);
                        if ($count < 1) {
                            $oldorder = 1;
                            $order = 1;
                            //$output .= Options_Machine::optionsframework_slider_function($value['id'],$value['std'],$oldorder,$order);
                        } else {
                            if ($count < 2) {
                                $oldorder = 1;
                                $order = 1;
                                $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order);
                            } else {
                                $i = 0;
                                foreach ($slides as $slide) {
                                    $oldorder = $slide['order'];
                                    $i++;
                                    $order = $i;
                                    $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order);
                                }
                            }
                        }
                        $output .= '</ul>';
                        $output .= '<a class="button slide_add_button">Add New Sidebar</a></div>';
                        break;
                    case 'socials':
                        $_id = strip_tags(strtolower($value['id']));
                        $output .= '<div class="slider"><ul id="' . $value['id'] . '">';
                        $slides = $smof_data[$value['id']];
                        $count = count($slides);
                        if ($count < 2) {
                            $oldorder = 1;
                            $order = 1;
                            $output .= Options_Machine::optionsframework_socials_function($value['id'], $value['std'], $oldorder, $order);
                        } else {
                            $i = 0;
                            foreach ($slides as $slide) {
                                $oldorder = $slide['order'];
                                $i++;
                                $order = $i;
                                $output .= Options_Machine::optionsframework_socials_function($value['id'], $value['std'], $oldorder, $order);
                            }
                        }
                        $output .= '</ul>';
                        $output .= '<a href="#" class="button socials_add_button">Add New Icon</a></div>';
                        break;
                    case 'custom_headers':
                        $_id = strip_tags(strtolower($value['id']));
                        $output .= '<div class="slider"><ul id="' . $value['id'] . '">';
                        $slides = $smof_data[$value['id']];
                        $count = count($slides);
                        if ($count < 2) {
                            $oldorder = 1;
                            $order = 1;
                            $output .= Options_Machine::optionsframework_headers_function($value['id'], $value['std'], $oldorder, $order);
                        } else {
                            $i = 0;
                            foreach ($slides as $slide) {
                                $oldorder = $slide['order'];
                                $i++;
                                $order = $i;
                                $output .= Options_Machine::optionsframework_headers_function($value['id'], $value['std'], $oldorder, $order);
                            }
                        }
                        $output .= '</ul>';
                        $output .= '<a href="#" class="button headers_add_button">Add New</a></div>';
                        break;
                        //drag & drop block manager
                    //drag & drop block manager
                    case 'sorter':
                        // Make sure to get list of all the default blocks first
                        $all_blocks = $value['std'];
                        $temp = array();
                        // holds default blocks
                        $temp2 = array();
                        // holds saved blocks
                        foreach ($all_blocks as $blocks) {
                            $temp = array_merge($temp, $blocks);
                        }
                        $sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                        foreach ($sortlists as $sortlist) {
                            $temp2 = array_merge($temp2, $sortlist);
                        }
                        // now let's compare if we have anything missing
                        foreach ($temp as $k => $v) {
                            if (!array_key_exists($k, $temp2)) {
                                $sortlists['disabled'][$k] = $v;
                            }
                        }
                        // now check if saved blocks has blocks not registered under default blocks
                        foreach ($sortlists as $key => $sortlist) {
                            foreach ($sortlist as $k => $v) {
                                if (!array_key_exists($k, $temp)) {
                                    unset($sortlist[$k]);
                                }
                            }
                            $sortlists[$key] = $sortlist;
                        }
                        // assuming all sync'ed, now get the correct naming for each block
                        foreach ($sortlists as $key => $sortlist) {
                            foreach ($sortlist as $k => $v) {
                                $sortlist[$k] = $temp[$k];
                            }
                            $sortlists[$key] = $sortlist;
                        }
                        $output .= '<div id="' . $value['id'] . '" class="sorter">';
                        if ($sortlists) {
                            foreach ($sortlists as $group => $sortlist) {
                                $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                                $output .= '<h3>' . $group . '</h3>';
                                foreach ($sortlist as $key => $list) {
                                    $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                                    if ($key != "placebo") {
                                        $output .= '<li id="' . $key . '" class="sortee">';
                                        $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                        $output .= $list;
                                        $output .= '</li>';
                                    }
                                }
                                $output .= '</ul>';
                            }
                        }
                        $output .= '</div>';
                        break;
                        //background images option
                    //background images option
                    case 'tiles':
                        $i = 0;
                        $select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                        if (is_array($value['options'])) {
                            foreach ($value['options'] as $key => $option) {
                                $i++;
                                $checked = '';
                                $selected = '';
                                if (NULL != checked($select_value, $option, false)) {
                                    $checked = checked($select_value, $option, false);
                                    $selected = 'of-radio-tile-selected';
                                }
                                $output .= '<span>';
                                $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                                $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                                $output .= '</span>';
                            }
                        }
                        break;
                        //backup and restore options data
                    //backup and restore options data
                    case 'backup':
                        $instructions = $value['desc'];
                        $backup = of_get_options(BACKUPS);
                        $init = of_get_options('smof_init');
                        if (!isset($backup['backup_log'])) {
                            $log = 'No backups yet';
                        } else {
                            $log = $backup['backup_log'];
                        }
                        $output .= '<div class="backup-box">';
                        $output .= '<div class="instructions">' . $instructions . "\n";
                        $output .= '<p><strong>' . __('Last Backup', 'veented_backend') . ': <span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                        $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
                        $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
                        $output .= '</div>';
                        break;
                        //export or import data between different installs
                    //export or import data between different installs
                    case 'transfer':
                        $instructions = $value['desc'];
                        $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($smof_data)) . '</textarea>' . "\n";
                        $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                        break;
                        // google font field
                    // google font field
                    case 'select_google_font':
                        $output .= '<select class="select of-input google_font_select" name="' . $value['id'] . '" id="' . $value['id'] . '" data-dependency=' . $value['dep'] . '>';
                        foreach ($value['options'] as $select_key => $option) {
                            $output .= '<option value="' . $select_key . '" ' . selected(isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : "", $option, false) . ' />' . $option . '</option>';
                        }
                        $output .= '</select>';
                        if (isset($value['preview']['text'])) {
                            $g_text = $value['preview']['text'];
                        } else {
                            $g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
                        }
                        if (isset($value['preview']['size'])) {
                            $g_size = 'style="font-size: ' . $value['preview']['size'] . ';"';
                        } else {
                            $g_size = '';
                        }
                        $hide = " hide";
                        if ($smof_data[$value['id']] != "none" && $smof_data[$value['id']] != "") {
                            $hide = "";
                        }
                        //$output .= '<p class="'.$value['id'].'_ggf_previewer google_font_preview'.$hide.'" '. $g_size .'>'. $g_text .'</p>';
                        break;
                        //JQuery UI Slider
                    //JQuery UI Slider
                    case 'sliderui':
                        $s_val = $s_min = $s_max = $s_step = $s_edit = '';
                        //no errors, please
                        $s_val = stripslashes($smof_data[$value['id']]);
                        if (!isset($value['min'])) {
                            $s_min = '0';
                        } else {
                            $s_min = $value['min'];
                        }
                        if (!isset($value['max'])) {
                            $s_max = $s_min + 1;
                        } else {
                            $s_max = $value['max'];
                        }
                        if (!isset($value['step'])) {
                            $s_step = '1';
                        } else {
                            $s_step = $value['step'];
                        }
                        if (!isset($value['edit'])) {
                            $s_edit = ' readonly="readonly"';
                        } else {
                            $s_edit = '';
                        }
                        if ($s_val == '') {
                            $s_val = $s_min;
                        }
                        //values
                        $s_data = 'data-id="' . $value['id'] . '" data-val="' . $s_val . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                        //html output
                        $output .= '<input type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" data-dependency="' . $value['dep'] . '" value="' . $s_val . '" class="mini" ' . $s_edit . ' />';
                        $output .= '<div id="' . $value['id'] . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                        break;
                        //text input
                    //text input
                    case 'theme_preview':
                        $t_value = '';
                        $t_value = stripslashes($smof_data[$value['id']]);
                        $mini = $boxed_styling = $topbar_disabled = '';
                        if (!isset($value['mod'])) {
                            $value['mod'] = '';
                        }
                        if ($value['mod'] == 'mini') {
                            $mini = 'mini';
                        }
                        global $smof_data;
                        if (array_key_exists('vntd_website_layout', $smof_data)) {
                            if ($smof_data['vntd_website_layout'] == 'boxed') {
                                $boxed_styling = '#theme-preview .browser-wrapper { width:85%; border-width:0 1px 0 1px; }#theme-preview .browser-wrapper > div { padding:15px 30px; }';
                            }
                        }
                        if (array_key_exists('vntd_topbar', $smof_data)) {
                            if (!$smof_data['vntd_topbar']) {
                                $topbar_disabled = 'style="display:none;"';
                            }
                        }
                        if (array_key_exists('vntd_accent_color', $smof_data)) {
                            $output .= '
					<style type="text/css">
						
						' . $boxed_styling . '
						#theme-preview .accent { color: ' . $smof_data['vntd_accent_color'] . '; }
						#theme-preview .browser-content {
							background-color: ' . $smof_data['vntd_bg_color'] . ';';
                            $output .= '
							
						}
						
						#theme-preview .header {
							background-color: ' . $smof_data['vntd_header_bg_color'] . ';';
                            $output .= '							
							
						}
						#theme-preview .preview-navigation {
							color: ' . $smof_data['vntd_header_nav_color'] . ';
							font-size: ' . $smof_data['vntd_fs_navigation'] . 'px;
							font-weight: ' . $smof_data['vntd_navigation_font_weight'] . ';
							text-transform: ' . $smof_data['vntd_navigation_font_transform'] . ';
						}
						
						#theme-preview .page-title {
							background-color: ' . $smof_data['vntd_pagetitle_bg_color'] . ';
							font-size: ' . $smof_data['vntd_fs_page_title'] . 'px;
							border-color: ' . $smof_data['vntd_pagetitle_border_color'] . ';';
                            $output .= '
							
						}
						
						#theme-preview .preview-page-title { color: ' . $smof_data['vntd_pagetitle_color'] . '; }
						#theme-preview .preview-page-tagline {
							color: ' . $smof_data['vntd_pagetitle_tagline_color'] . ';
							font-size: ' . $smof_data['vntd_fs_page_tagline'] . 'px;
						}
						#theme-preview .preview-breadcrumbs {
							color: ' . $smof_data['vntd_breadcrumbs_color'] . ';
							font-size: ' . $smof_data['vntd_fs_breadcrumbs'] . 'px;
						}
						
						#theme-preview .body {
							color: ' . $smof_data['vntd_body_color'] . ';
							font-size: ' . $smof_data['vntd_fs_body'] . 'px;';
                            $output .= '
							
						}
						
						#theme-preview .preview-heading { 
							color: ' . $smof_data['vntd_heading_color'] . '; 
							text-transform:' . $smof_data['vntd_heading_font_transform'] . '; 
							font-weight:' . $smof_data['vntd_heading_font_weight'] . '; 
						} 
						#theme-preview .body-hover-color { color: ' . $smof_data['vntd_content_hover_color'] . '; }
						
						#theme-preview .footer {
							color: ' . $smof_data['vntd_footer_color'] . ';
							background-color: ' . $smof_data['vntd_footer_bg_color'] . ';
							border-color: ' . $smof_data['vntd_footer_border_color'] . ';							
							font-size: ' . $smof_data['vntd_fs_copyright'] . 'px;
							
						}					

						#theme-preview .preview-special-heading { font-size: ' . $smof_data['vntd_fs_special'] . 'px; } 
						#theme-preview .preview-h1 { font-size: ' . $smof_data['vntd_fs_h1'] . 'px; } 
						#theme-preview .preview-h2 { font-size: ' . $smof_data['vntd_fs_h2'] . 'px; } 
						#theme-preview .preview-h3 { font-size: ' . $smof_data['vntd_fs_h3'] . 'px; } 
						#theme-preview .preview-h4 { font-size: ' . $smof_data['vntd_fs_h4'] . 'px; } 
						#theme-preview .preview-h5 { font-size: ' . $smof_data['vntd_fs_h5'] . 'px; } 
						#theme-preview .preview-h6 { font-size: ' . $smof_data['vntd_fs_h6'] . 'px; } 
					</style>';
                        }
                        $output .= '<div id="theme-preview" class="browser-window">
									
									<div class="browser-header">' . get_bloginfo('name') . '</div>
									<div class="browser-content">
									<div class="browser-wrapper">										
										<div class="header">' . get_bloginfo('name') . '											
											<div class="preview-navigation primary-font"><ul><li class="accent">Home</li><li>Blog</li><li>Contact</li></ul></div>
										</div>
										
										<div class="page-title">
											<h2 class="preview-page-title primary-font">Page Title</h2><span class="preview-breadcrumbs">back to home</span>
											<div class="preview-page-tagline">Beautiful page tagline</div>											
										</div>
										
										<div class="body">
											<div class="two-third">
											<h1 class="primary-font preview-special-heading preview-heading">Special</h1>
											<p class="body">The first parameter is a unique ID for the section that you\'ll need later (when you’re putting controls into it).</p>
											<h1 class="primary-font preview-h1 preview-heading">Heading 1</h1>
											<p class="body">The first parameter is a unique ID for the section that you\'ll need later (when you’re putting controls into it).</p>
											<h2 class="primary-font preview-h2 preview-heading">Heading 2</h2>
											<p class="body"><span class="accent">This is a link</span> and <span class="body-hover-color">this is a link hover color</span></p>
											<h3 class="primary-font preview-h3 preview-heading">Heading 3</h3>			
											
											</div>
											<div class="one-third">
												<h3 class="sidebar-heading primary-font preview-heading preview-h3">Widget Title</h3>
												<p class="widget-content body">Fusce a odio in neque congue feugiat fusce a odio in neque congue feugiat.</p>
												<h4 class="primary-font preview-h4 preview-heading">Heading 4</h4>
												<h5 class="primary-font preview-h5 preview-heading">Heading 5</h5>
												<h6 class="primary-font preview-h6 preview-heading">Heading 6</h6>												
											</div>
										</div>
										
										<div class="footer">
											2014 Your Site - All rights reserved. <span class="subfooter-link">Link</span> and <span class="subfooter-hover">Hover state</span>.
										</div>
									</div>
									</div>

							</div>';
                        break;
                        // Theme Customizer Start
                    // Theme Customizer Start
                    case 'customizer_start':
                        $output .= '<div class="theme-customizer-nav"><ul class="customizer-tabs-nav">
						<li class="tab-current"><span>General</span></li>																		
						<li><span>Header</span></li>
						<li><span>Page Title</span></li>
						<li><span>Page Content</span></li>									
						<li><span>Footer</span></li>
						<li><span>Typography</span></li>					
					</ul><div class="clear"></div></div>
					<div class="theme-customizer">								
								<div class="customizer-tabs-content" onmouseover="document.body.style.overflow=\'hidden\';" onmouseout="document.body.style.overflow=\'auto\';">';
                        break;
                        // Theme Customizer Single Tab
                    // Theme Customizer Single Tab
                    case 'customizer_tab':
                        if ($value['name'] != 'General') {
                            $output .= '</div>';
                        }
                        $output .= '<div id="customizer-tab-' . $value['name'] . '" class="customizer-tab">';
                        break;
                        // Theme Customizer End
                    // Theme Customizer End
                    case 'customizer_end':
                        $output .= '</div></div></div>';
                        break;
                        // Toggle Start
                    // Toggle Start
                    case 'toggle_start':
                        $output .= '<div class="of-toggle-wrap f_st_custom_headers"><div class="of-toggle-heading">' . $value['name'] . '<i class="icon-plus"></i></div><div class="of-toggle-content">';
                        break;
                        // Toggle End
                    // Toggle End
                    case 'toggle_end':
                        $output .= '</div></div>';
                        break;
                        //Switch option
                    //Switch option
                    case 'switch':
                        if (!isset($smof_data[$value['id']])) {
                            $smof_data[$value['id']] = 0;
                        }
                        $fold = $fold_checkbox = '';
                        if (array_key_exists("folds", $value)) {
                            $fold = "s_fld ";
                            $fold_checkbox = "fld ";
                        }
                        $cb_enabled = $cb_disabled = '';
                        //no errors, please
                        //Get selected
                        if ($smof_data[$value['id']] == 1) {
                            $cb_enabled = ' selected';
                            $cb_disabled = '';
                        } else {
                            $cb_enabled = '';
                            $cb_disabled = ' selected';
                        }
                        //Label ON
                        if (!isset($value['on'])) {
                            $on = "On";
                        } else {
                            $on = $value['on'];
                        }
                        //Label OFF
                        if (!isset($value['off'])) {
                            $off = "Off";
                        } else {
                            $off = $value['off'];
                        }
                        //$output .= '<p class="switch-options">';
                        $output .= '<p>';
                        //						$output .= '<label class="'.$fold.'cb-enable'. $cb_enabled .'" data-id="'.$value['id'].'"><span>'. $on .'</span></label>';
                        //						$output .= '<label class="'.$fold.'cb-disable'. $cb_disabled .'" data-id="'.$value['id'].'"><span>'. $off .'</span></label>';
                        //$output .= '<input type="hidden" class="'.$fold.'checkbox of-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="0"/>';
                        $output .= '<div class="toggle-checkbox"></div>';
                        $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold_checkbox . 'checkbox of-input main_checkbox hidden" data-dependency="' . $value['dep'] . '" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                        $output .= '</p>';
                        break;
                        // Uploader 3.5
                    // Uploader 3.5
                    case "upload":
                    case "media":
                        if (!isset($value['mod'])) {
                            $value['mod'] = '';
                        }
                        $u_val = '';
                        if ($smof_data[$value['id']]) {
                            $u_val = stripslashes($smof_data[$value['id']]);
                        }
                        $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $u_val, $value['mod'], $value['dep']);
                        break;
                }
                do_action('optionsframework_machine_loop', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
                if ($smof_output != "") {
                    $output .= $smof_output;
                    $smof_output = "";
                }
                //description of each option
                if ($value['type'] != 'heading' && $value['type'] != "toggle_start" && $value['type'] != "toggle_end" && $value['type'] != "customizer_tab" && $value['type'] != "customizer_start" && $value['type'] != "customizer_end") {
                    if (!isset($value['desc'])) {
                        $explain_value = '';
                    } else {
                        $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
                    }
                    $output .= '</div>' . $explain_value . "\n";
                    $output .= '<div class="clear"> </div></div></div>' . "\n";
                }
            }
            /* condition empty end */
        }
        if ($update_data == true) {
            of_save_options($smof_data);
        }
        $output .= '</div>';
        do_action('optionsframework_machine_after', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
        if ($smof_output != "") {
            $output .= $smof_output;
            $smof_output = "";
        }
        return array($output, $menu, $defaults);
    }
Exemplo n.º 13
0
 /**
  * Theme updates checker
  *
  * @access public
  * @since 1.4.4
  *
  * @return string
  */
 public static function ishyoboy_updates_available()
 {
     if ($xml = Options_Machine::ishyoboy_get_updates()) {
         $my_theme = wp_get_theme(THEME_SLUG);
         $my_version = '' != $my_theme->Version ? $my_theme->Version : '1.0';
         if (version_compare($my_version, $xml->latest) == -1) {
             return true;
         }
     }
     return false;
 }
 /**
  * Process options data and build option fields
  */
 public static function optionsframework_machine($options)
 {
     $data = get_option(OPTIONS);
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     foreach ($options as $value) {
         $counter++;
         $val = '';
         //create array of defaults
         if ($value['type'] == 'multicheck') {
             if (is_array($value['std'])) {
                 foreach ($value['std'] as $i => $key) {
                     $defaults[$value['id']][$key] = true;
                 }
             } else {
                 $defaults[$value['id']][$value['std']] = true;
             }
         } else {
             if (isset($value['id'])) {
                 $defaults[$value['id']] = $value['std'];
             }
         }
         //Start Heading
         if ($value['type'] != "heading") {
             $class = '';
             if (isset($value['class'])) {
                 $class = $value['class'];
             }
             //hide items in checkbox group
             $fold = '';
             if (array_key_exists("fold", $value)) {
                 if ($data[$value['fold']]) {
                     $fold = "f_" . $value['fold'] . " ";
                 } else {
                     $fold = "f_" . $value['fold'] . " temphide ";
                 }
             }
             $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
             //only show header if 'name' value exists
             if ($value['name']) {
                 $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
             }
             $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
         }
         //End Heading
         //switch statement to handle various options type
         switch ($value['type']) {
             //text input
             case 'text':
                 $t_value = '';
                 $t_value = stripslashes($data[$value['id']]);
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                 break;
                 //ajax image upload option
             //ajax image upload option
             case 'upload':
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                 break;
                 // native media library uploader - @uses optionsframework_media_uploader_function()
             // native media library uploader - @uses optionsframework_media_uploader_function()
             case 'media':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                 // New AJAX Uploader using Media Library
                 break;
                 //display a single image
             //display a single image
             case "image":
                 $src = $value['std'];
                 $output .= '<img src="' . $src . '">';
                 break;
                 //select option
             //select option
             case 'select':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select_wrapper ' . $mini . '">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 foreach ($value['options'] as $select_ID => $option) {
                     $output .= '<option id="' . $select_ID . '" value="' . $option . '" ' . selected($data[$value['id']], $option, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
                 //checkbox option
             //checkbox option
             case 'checkbox':
                 if (!isset($data[$value['id']])) {
                     $data[$value['id']] = 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "fld ";
                 }
                 $output .= '<input type="hidden" class="' . $fold . 'checkbox aq-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                 $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($data[$value['id']], 1, false) . ' />';
                 break;
                 //tab heading
             //tab heading
             case 'heading':
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $header_class = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = "of-option-" . $jquery_click_hook;
                 $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                 $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                 break;
                 //drag & drop slide manager
             //drag & drop slide manager
             case 'slider':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 $output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
                 $slides = $data[$value['id']];
                 $count = count($slides);
                 if ($count < 2) {
                     $oldorder = 1;
                     $order = 1;
                     $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                 } else {
                     $i = 0;
                     foreach ($slides as $slide) {
                         $oldorder = $slide['order'];
                         $i++;
                         $order = $i;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                     }
                 }
                 $output .= '</ul>';
                 $output .= '<a href="#" class="button slide_add_button">' . __('Add New Slide') . '</a></div>';
                 break;
                 //drag & drop block manager
             //drag & drop block manager
             case 'sorter':
                 $sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                 $output .= '<div id="' . $value['id'] . '" class="sorter">';
                 if ($sortlists) {
                     foreach ($sortlists as $group => $sortlist) {
                         $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                         $output .= '<h3>' . $group . '</h3>';
                         foreach ($sortlist as $key => $list) {
                             $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                             if ($key != "placebo") {
                                 $output .= '<li id="' . $key . '" class="sortee">';
                                 $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                 $output .= $list;
                                 $output .= '</li>';
                             }
                         }
                         $output .= '</ul>';
                     }
                 }
                 $output .= '</div>';
                 break;
         }
         //description of each option
         if ($value['type'] != 'heading') {
             if (!isset($value['desc'])) {
                 $explain_value = '';
             } else {
                 $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
             }
             $output .= '</div>' . $explain_value . "\n";
             $output .= '<div class="clear"> </div></div></div>' . "\n";
         }
     }
     $output .= '</div>';
     return array($output, $menu, $defaults);
 }
 /**
  * Process options data and build option fields
  *
  * @uses get_option()
  *
  * @access public
  * @since 1.0.0
  *
  * @return array
  */
 public static function optionsframework_machine($options)
 {
     $smof_data = of_get_options();
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     foreach ($options as $value) {
         $counter++;
         $val = '';
         //create array of defaults
         if ($value['type'] == 'multicheck') {
             if (is_array($value['std'])) {
                 foreach ($value['std'] as $i => $key) {
                     $defaults[$value['id']][$key] = true;
                 }
             } else {
                 $defaults[$value['id']][$value['std']] = true;
             }
         } else {
             if (isset($value['id'])) {
                 $defaults[$value['id']] = $value['std'];
             }
         }
         //Start Heading
         if ($value['type'] != "heading") {
             $class = '';
             if (isset($value['class'])) {
                 $class = $value['class'];
             }
             //hide items in checkbox group
             $fold = '';
             if (array_key_exists("fold", $value)) {
                 if ($smof_data[$value['fold']]) {
                     $fold = "f_" . $value['fold'] . " ";
                 } else {
                     $fold = "f_" . $value['fold'] . " temphide ";
                 }
             }
             $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
             //only show header if 'name' value exists
             if ($value['name']) {
                 $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
             }
             $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
         }
         //End Heading
         //switch statement to handle various options type
         switch ($value['type']) {
             //text input
             case 'text':
                 $t_value = '';
                 $t_value = stripslashes($smof_data[$value['id']]);
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                 break;
                 //select option
             //select option
             case 'select':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select_wrapper ' . $mini . '">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 foreach ($value['options'] as $select_ID => $option) {
                     $output .= '<option id="' . $select_ID . '" value="' . $option . '" ' . selected($smof_data[$value['id']], $option, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
                 //textarea option
             //textarea option
             case 'textarea':
                 $cols = '8';
                 $ta_value = '';
                 if (isset($value['options'])) {
                     $ta_options = $value['options'];
                     if (isset($ta_options['cols'])) {
                         $cols = $ta_options['cols'];
                     }
                 }
                 $ta_value = stripslashes($smof_data[$value['id']]);
                 $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                 break;
                 //radiobox option
             //radiobox option
             case "radio":
                 $checked = isset($smof_data[$value['id']]) ? checked($smof_data[$value['id']], $option, false) : '';
                 foreach ($value['options'] as $option => $name) {
                     $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($smof_data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                 }
                 break;
                 //checkbox option
             //checkbox option
             case 'checkbox':
                 if (!isset($smof_data[$value['id']])) {
                     $smof_data[$value['id']] = 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "fld ";
                 }
                 $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                 $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                 break;
                 //multiple checkbox option
             //multiple checkbox option
             case 'multicheck':
                 isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
                 foreach ($value['options'] as $key => $option) {
                     if (!isset($multi_stored[$key])) {
                         $multi_stored[$key] = '';
                     }
                     $of_key_string = $value['id'] . '_' . $key;
                     $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                 }
                 break;
                 //ajax image upload option
             //ajax image upload option
             case 'upload':
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                 break;
                 // native media library uploader - @uses optionsframework_media_uploader_function()
             // native media library uploader - @uses optionsframework_media_uploader_function()
             case 'media':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                 // New AJAX Uploader using Media Library
                 break;
                 //colorpicker option
             //colorpicker option
             case 'color':
                 $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $smof_data[$value['id']] . '"></div></div>';
                 $output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $smof_data[$value['id']] . '" />';
                 break;
                 //typography option
             //typography option
             case 'typography':
                 $typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 /* Font Size */
                 if (isset($typography_stored['size'])) {
                     $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                     $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                     for ($i = 9; $i < 101; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Line Height */
                 if (isset($typography_stored['height'])) {
                     $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                     $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                     for ($i = 20; $i < 38; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Face */
                 if (isset($typography_stored['face'])) {
                     $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                     $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                     $faces = array("default", "Arial", "Georgia", "Courier New", "Helvetica", "Tahoma", "Times New Roman", "Trebuchet MS", "Verdana", "Abel", "Abril Fatface", "Aclonica", "Acme", "Actor", "Adamina", "Advent Pro", "Aguafina Script", "Aladin", "Aldrich", "Alegreya", "Alegreya SC", "Alex Brush", "Alfa Slab One", "Alice", "Alike", "Alike Angular", "Allan", "Allerta", "Allerta Stencil", "Allura", "Almendra", "Almendra SC", "Amarante", "Amaranth", "Amatic SC", "Amethysta", "Andada", "Andika", "Angkor", "Annie Use Your Telescope", "Anonymous Pro", "Antic", "Antic Didone", "Antic Slab", "Anton", "Arapey", "Arbutus", "Architects Daughter", "Arimo", "Arizonia", "Armata", "Artifika", "Arvo", "Asap", "Asset", "Astloch", "Asul", "Atomic Age", "Aubrey", "Audiowide", "Average", "Averia Gruesa Libre", "Averia Libre", "Averia Sans Libre", "Averia Serif Libre", "Bad Script", "Balthazar", "Bangers", "Basic", "Battambang", "Baumans", "Bayon", "Belgrano", "Belleza", "Bentham", "Berkshire Swash", "Bevan", "Bigshot One", "Bilbo", "Bilbo Swash Caps", "Bitter", "Black Ops One", "Bokor", "Bonbon", "Boogaloo", "Bowlby One", "Bowlby One SC", "Brawler", "Bree Serif", "Bubblegum Sans", "Buda", "Buenard", "Butcherman", "Butterfly Kids", "Cabin", "Cabin Condensed", "Cabin Sketch", "Caesar Dressing", "Cagliostro", "Calligraffitti", "Cambo", "Candal", "Cantarell", "Cantata One", "Cantora One", "Capriola", "Cardo", "Carme", "Carter One", "Caudex", "Cedarville Cursive", "Ceviche One", "Changa One", "Chango", "Chau Philomene One", "Chelsea Market", "Chenla", "Cherry Cream Soda", "Chewy", "Chicle", "Chivo", "Coda", "Coda Caption", "Codystar", "Comfortaa", "Coming Soon", "Concert One", "Condiment", "Content", "Contrail One", "Convergence", "Cookie", "Copse", "Corben", "Courgette", "Cousine", "Coustard", "Covered By Your Grace", "Crafty Girls", "Creepster", "Crete Round", "Crimson Text", "Crushed", "Cuprum", "Cutive", "Damion", "Dancing Script", "Dangrek", "Dawning of a New Day", "Days One", "Delius", "Delius Swash Caps", "Delius Unicase", "Della Respira", "Devonshire", "Didact Gothic", "Diplomata", "Diplomata SC", "Doppio One", "Dorsa", "Dosis", "Dr Sugiyama", "Droid Sans", "Droid Sans Mono", "Droid Serif", "Duru Sans", "Dynalight", "Eagle Lake", "Eater", "EB Garamond", "Economica", "Electrolize", "Emblema One", "Emilys Candy", "Engagement", "Enriqueta", "Erica One", "Esteban", "Euphoria Script", "Ewert", "Exo", "Expletus Sans", "Fanwood Text", "Fascinate", "Fascinate Inline", "Fasthand", "Federant", "Federo", "Felipa", "Fjord One", "Flamenco", "Flavors", "Fondamento", "Fontdiner Swanky", "Forum", "Francois One", "Fredericka the Great", "Fredoka One", "Freehand", "Fresca", "Frijole", "Fugaz One", "Galdeano", "Galindo", "Gentium Basic", "Gentium Book Basic", "Geo", "Geostar", "Geostar Fill", "Germania One", "GFS Didot", "GFS Neohellenic", "Give You Glory", "Glass Antiqua", "Glegoo", "Gloria Hallelujah", "Goblin One", "Gochi Hand", "Gorditas", "Goudy Bookletter 1911", "Graduate", "Gravitas One", "Great Vibes", "Gruppo", "Gudea", "Habibi", "Hammersmith One", "Handlee", "Hanuman", "Happy Monkey", "Headland One", "Henny Penny", "Herr Von Muellerhoff", "Holtwood One SC", "Homemade Apple", "Homenaje", "Iceberg", "Iceland", "IM Fell Double Pica", "IM Fell Double Pica SC", "IM Fell DW Pica", "IM Fell DW Pica SC", "IM Fell English", "IM Fell English SC", "IM Fell French Canon", "IM Fell French Canon SC", "IM Fell Great Primer", "IM Fell Great Primer SC", "Imprima", "Inconsolata", "Inder", "Indie Flower", "Inika", "Irish Grover", "Istok Web", "Italiana", "Italianno", "Jim Nightshade", "Jockey One", "Jolly Lodger", "Josefin Sans", "Josefin Slab", "Judson", "Julee", "Junge", "Jura", "Just Another Hand", "Just Me Again Down Here", "Kameron", "Karla", "Kaushan Script", "Kelly Slab", "Kenia", "Khmer", "Knewave", "Kotta One", "Koulen", "Kranky", "Kreon", "Kristi", "Krona One", "La Belle Aurore", "Lancelot", "Lato", "League Script", "Leckerli One", "Ledger", "Lekton", "Lemon", "Life Savers", "Lilita One", "Limelight", "Linden Hill", "Lobster", "Lobster Two", "Londrina Outline", "Londrina Shadow", "Londrina Sketch", "Londrina Solid", "Lora", "Love Ya Like A Sister", "Loved by the King", "Lovers Quarrel", "Luckiest Guy", "Lusitana", "Lustria", "Macondo", "Macondo Swash Caps", "Magra", "Maiden Orange", "Mako", "Marck Script", "Marko One", "Marmelad", "Marvel", "Mate", "Mate SC", "Maven Pro", "McLaren", "Meddon", "MedievalSharp", "Medula One", "Megrim", "Meie Script", "Merienda One", "Merriweather", "Metal", "Metal Mania", "Metamorphous", "Metrophobic", "Michroma", "Miltonian", "Miltonian Tattoo", "Miniver", "Miss Fajardose", "Modern Antiqua", "Molengo", "Monofett", "Monoton", "Monsieur La Doulaise", "Montaga", "Montez", "Montserrat", "Moul", "Moulpali", "Mountains of Christmas", "Mr Bedfort", "Mr Dafoe", "Mr De Haviland", "Mrs Saint Delafield", "Mrs Sheppards", "Muli", "Mystery Quest", "Neucha", "Neuton", "News Cycle", "Niconne", "Nixie One", "Nobile", "Nokora", "Norican", "Nosifer", "Nothing You Could Do", "Noticia Text", "Nova Cut", "Nova Flat", "Nova Mono", "Nova Oval", "Nova Round", "Nova Script", "Nova Slim", "Nova Square", "Numans", "Nunito", "Odor Mean Chey", "Old Standard TT", "Oldenburg", "Oleo Script", "Open Sans", "Open Sans Condensed", "Oranienbaum", "Orbitron", "Oregano", "Original Surfer", "Oswald", "Over the Rainbow", "Overlock", "Overlock SC", "Ovo", "Oxygen", "Pacifico", "Parisienne", "Passero One", "Passion One", "Patrick Hand", "Patua One", "Paytone One", "Peralta", "Permanent Marker", "Petrona", "Philosopher", "Piedra", "Pinyon Script", "Plaster", "Play", "Playball", "Playfair Display", "Podkova", "Poiret One", "Poller One", "Poly", "Pompiere", "Pontano Sans", "Port Lligat Sans", "Port Lligat Slab", "Prata", "Preahvihear", "Press Start 2P", "Princess Sofia", "Prociono", "Prosto One", "PT Mono", "PT Sans", "PT Sans Caption", "PT Sans Narrow", "PT Serif", "PT Serif Caption", "Puritan", "Quando", "Quantico", "Quattrocento", "Quattrocento Sans", "Questrial", "Quicksand", "Qwigley", "Racing Sans One", "Radley", "Raleway", "Rammetto One", "Rancho", "Rationale", "Redressed", "Reenie Beanie", "Revalia", "Ribeye", "Ribeye Marrow", "Righteous", "Rochester", "Rock Salt", "Rokkitt", "Romanesco", "Ropa Sans", "Rosario", "Rosarivo", "Rouge Script", "Ruda", "Ruge Boogie", "Ruluko", "Ruslan Display", "Russo One", "Ruthie", "Rye", "Sail", "Salsa", "Sancreek", "Sansita One", "Sarina", "Satisfy", "Schoolbell", "Seaweed Script", "Sevillana", "Shadows Into Light", "Shadows Into Light Two", "Shanti", "Share", "Shojumaru", "Short Stack", "Siemreap", "Sigmar One", "Signika", "Signika Negative", "Simonetta", "Sirin Stencil", "Six Caps", "Skranji", "Slackey", "Smokum", "Smythe", "Sniglet", "Snippet", "Sofia", "Sonsie One", "Sorts Mill Goudy", "Source Sans Pro", "Special Elite", "Spicy Rice", "Spinnaker", "Spirax", "Squada One", "Stardos Stencil", "Stint Ultra Condensed", "Stint Ultra Expanded", "Stoke", "Sue Ellen Francisco", "Sunshiney", "Supermercado One", "Suwannaphum", "Swanky and Moo Moo", "Syncopate", "Tangerine", "Taprom", "Telex", "Tenor Sans", "The Girl Next Door", "Tienne", "Tinos", "Titan One", "Trade Winds", "Trocchi", "Trochut", "Trykker", "Tulpen One", "Ubuntu", "Ubuntu Condensed", "Ubuntu Mono", "Ultra", "Uncial Antiqua", "UnifrakturCook", "UnifrakturMaguntia", "Unkempt", "Unlock", "Unna", "Varela", "Varela Round", "Vast Shadow", "Vibur", "Vidaloka", "Viga", "Voces", "Volkhov", "Vollkorn", "Voltaire", "VT323", "Waiting for the Sunrise", "Wallpoet", "Walter Turncoat", "Wellfleet", "Wire One", "Yanone Kaffeesatz", "Yellowtail", "Yeseva One", "Yesteryear", "Zeyada");
                     foreach ($faces as $face) {
                         $output .= '<option value="' . $face . '" ' . selected($typography_stored['face'], $face, false) . '>' . $face . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Weight */
                 if (isset($typography_stored['style'])) {
                     $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                     $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Color */
                 if (isset($typography_stored['color'])) {
                     $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                 }
                 break;
                 //border option
             //border option
             case 'border':
                 /* Border Width */
                 $border_stored = $smof_data[$value['id']];
                 $output .= '<div class="select_wrapper border-width">';
                 $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                 for ($i = 0; $i < 21; $i++) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Style */
                 $output .= '<div class="select_wrapper border-style">';
                 $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                 $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                 foreach ($styles as $i => $style) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Color */
                 $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                 $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                 break;
                 //images checkbox - use image as checkboxes
             //images checkbox - use image as checkboxes
             case 'images':
                 $i = 0;
                 $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $key, false)) {
                         $checked = checked($select_value, $key, false);
                         $selected = 'of-radio-img-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                     $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                     $output .= '</span>';
                 }
                 break;
                 //info (for small intro box etc)
             //info (for small intro box etc)
             case "info":
                 $info_text = $value['std'];
                 $output .= '<div class="of-info">' . $info_text . '</div>';
                 break;
                 //display a single image
             //display a single image
             case "image":
                 $src = $value['std'];
                 $output .= '<img src="' . $src . '">';
                 break;
                 //tab heading
             //tab heading
             case 'heading':
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $header_class = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = "of-option-" . $jquery_click_hook;
                 $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                 $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                 break;
                 //drag & drop slide manager
             //drag & drop slide manager
             case 'slider':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 $output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
                 $slides = $smof_data[$value['id']];
                 $count = count($slides);
                 if ($count < 2) {
                     $oldorder = 1;
                     $order = 1;
                     $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                 } else {
                     $i = 0;
                     foreach ($slides as $slide) {
                         $oldorder = $slide['order'];
                         $i++;
                         $order = $i;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                     }
                 }
                 $output .= '</ul>';
                 $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                 break;
                 //drag & drop block manager
             //drag & drop block manager
             case 'sorter':
                 $sortlists = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 $output .= '<div id="' . $value['id'] . '" class="sorter">';
                 if ($sortlists) {
                     foreach ($sortlists as $group => $sortlist) {
                         $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                         $output .= '<h3>' . $group . '</h3>';
                         foreach ($sortlist as $key => $list) {
                             $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                             if ($key != "placebo") {
                                 $output .= '<li id="' . $key . '" class="sortee">';
                                 $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                 $output .= $list;
                                 $output .= '</li>';
                             }
                         }
                         $output .= '</ul>';
                     }
                 }
                 $output .= '</div>';
                 break;
                 //background images option
             //background images option
             case 'tiles':
                 $i = 0;
                 $select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $option, false)) {
                         $checked = checked($select_value, $option, false);
                         $selected = 'of-radio-tile-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                     $output .= '</span>';
                 }
                 break;
                 //backup and restore options data
             //backup and restore options data
             case 'backup':
                 $instructions = $value['desc'];
                 $backup = get_option(BACKUPS);
                 if (!isset($backup['backup_log'])) {
                     $log = 'No backups yet';
                 } else {
                     $log = $backup['backup_log'];
                 }
                 $output .= '<div class="backup-box">';
                 $output .= '<div class="instructions">' . $instructions . "\n";
                 $output .= '<p><strong>' . __('Last Backup : ', 'designesia') . '<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                 $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
                 $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
                 $output .= '</div>';
                 break;
                 //export or import data between different installs
             //export or import data between different installs
             case 'transfer':
                 $instructions = $value['desc'];
                 $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($smof_data)) . '</textarea>' . "\n";
                 $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                 break;
                 // google font field
             // google font field
             case 'select_google_font':
                 $output .= '<div class="select_wrapper">';
                 $output .= '<select class="select of-input google_font_select" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 foreach ($value['options'] as $select_key => $option) {
                     $output .= '<option value="' . $select_key . '" ' . selected(isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : "", $option, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 if (isset($value['preview']['text'])) {
                     $g_text = $value['preview']['text'];
                 } else {
                     $g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
                 }
                 if (isset($value['preview']['size'])) {
                     $g_size = 'style="font-size: ' . $value['preview']['size'] . ';"';
                 } else {
                     $g_size = '';
                 }
                 $output .= '<p class="' . $value['id'] . '_ggf_previewer google_font_preview" ' . $g_size . '>' . $g_text . '</p>';
                 break;
                 //JQuery UI Slider
             //JQuery UI Slider
             case 'sliderui':
                 $s_val = $s_min = $s_max = $s_step = $s_edit = '';
                 //no errors, please
                 $s_val = stripslashes($smof_data[$value['id']]);
                 if (!isset($value['min'])) {
                     $s_min = '0';
                 } else {
                     $s_min = $value['min'];
                 }
                 if (!isset($value['max'])) {
                     $s_max = $s_min + 1;
                 } else {
                     $s_max = $value['max'];
                 }
                 if (!isset($value['step'])) {
                     $s_step = '1';
                 } else {
                     $s_step = $value['step'];
                 }
                 if (!isset($value['edit'])) {
                     $s_edit = ' readonly="readonly"';
                 } else {
                     $s_edit = '';
                 }
                 if ($s_val == '') {
                     $s_val = $s_min;
                 }
                 //values
                 $s_data = 'data-id="' . $value['id'] . '" data-val="' . $s_val . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                 //html output
                 $output .= '<input type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $s_val . '" class="mini" ' . $s_edit . ' />';
                 $output .= '<div id="' . $value['id'] . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                 break;
                 //Switch option
             //Switch option
             case 'switch':
                 if (!isset($smof_data[$value['id']])) {
                     $smof_data[$value['id']] = 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "s_fld ";
                 }
                 $cb_enabled = $cb_disabled = '';
                 //no errors, please
                 //Get selected
                 if ($smof_data[$value['id']] == 1) {
                     $cb_enabled = ' selected';
                     $cb_disabled = '';
                 } else {
                     $cb_enabled = '';
                     $cb_disabled = ' selected';
                 }
                 //Label ON
                 if (!isset($value['on'])) {
                     $on = "On";
                 } else {
                     $on = $value['on'];
                 }
                 //Label OFF
                 if (!isset($value['off'])) {
                     $off = "Off";
                 } else {
                     $off = $value['off'];
                 }
                 $output .= '<p class="switch-options">';
                 $output .= '<label class="' . $fold . 'cb-enable' . $cb_enabled . '" data-id="' . $value['id'] . '"><span>' . $on . '</span></label>';
                 $output .= '<label class="' . $fold . 'cb-disable' . $cb_disabled . '" data-id="' . $value['id'] . '"><span>' . $off . '</span></label>';
                 $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                 $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold . 'checkbox of-input main_checkbox" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                 $output .= '</p>';
                 break;
         }
         //description of each option
         if ($value['type'] != 'heading') {
             if (!isset($value['desc'])) {
                 $explain_value = '';
             } else {
                 $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
             }
             $output .= '</div>' . $explain_value . "\n";
             $output .= '<div class="clear"> </div></div></div>' . "\n";
         }
     }
     $output .= '</div>';
     return array($output, $menu, $defaults);
 }
Exemplo n.º 16
0
	public static function undsgn_machine($options) {

		$data = get_option(OPTIONS);

		$defaults = array();
		$counter = 0;
		$menu = '';
		$output = '';
		foreach ($options as $value) {

			$counter++;
			$val = '';

			//create array of defaults
			if ($value['type'] == 'multicheck'){
				if (is_array($value['std'])){
					foreach($value['std'] as $i=>$key){
						$defaults[$value['id']][$key] = true;
					}
				} else {
					$defaults[$value['id']][$value['std']] = true;
				}
			} else {
				if (isset($value['id'])) {
					if (isset($value['std'])) $defaults[$value['id']] = $value['std'];
				}
			}


			//Start Heading
			if ( $value['type'] != "heading" )
			{
				$class = ''; if(isset( $value['class'] )) { $class = $value['class']; }

				$fold='';
				$unfold='';
				//hide items in checkbox-group
				if (array_key_exists("fold",$value)) {
					if ($data[$value['fold']]) {
						$fold="f_".$value['fold']." ";
					} else {
						$fold="f_".$value['fold']." temphide ";
					}
				}

				if (array_key_exists("unfold",$value)) {
					if ($data[$value['unfold']]) {
						$unfold="u_".$value['unfold']." temphide ";
					} else {

						$unfold="u_".$value['unfold']." ";
					}
				}

				$output .= '<div id="section-'.$value['id'].'" class="'.$fold.$unfold.'section section-'.$value['type'].' '. $class .'">'."\n";
				if ($value['name']) $output .= '<h3 class="heading">'. $value['name'] .'</h3>'."\n";
				$output .= '<div class="option">'."\n" . '<div class="controls">'."\n";

			}
			//End Heading

			switch ( $value['type'] ) {

			case 'text':
				$t_value = '';

				if (isset($data[$value['id']]) && $data[$value['id']]) $t_value = stripslashes($data[$value['id']]);

				$mini ='';
				if(!isset($value['mod'])) $value['mod'] = '';
				if($value['mod'] == 'mini') { $mini = 'mini';}

				$output .= '<input class="undsgn-input '.$mini.'" name="'.$value['id'].'" id="'. $value['id'] .'" type="'. $value['type'] .'" value="'. $t_value .'" />';
				break;
			case 'select':
				$mini ='';
				if(!isset($value['mod'])) $value['mod'] = '';
				if($value['mod'] == 'mini') { $mini = 'mini';}
				$output .= '<div class="select_wrapper ' . $mini . '">';
				$output .= '<select class="select undsgn-input" name="'.$value['id'].'" id="'. $value['id'] .'">';
				foreach ($value['options'] as $select_ID => $option) {
					$output .= '<option id="' . $select_ID . '" value="'.$option.'" ' . selected($data[$value['id']], $option, false) . ' />'.$option.'</option>';
				}
				$output .= '</select></div>';
				break;
			case 'select2':
				$mini ='';
				if(!isset($value['mod'])) $value['mod'] = '';
				if($value['mod'] == 'mini') { $mini = 'mini';}
				$output .= '<div class="select_wrapper ' . $mini . '">';
				$output .= '<select class="select undsgn-input" name="'.$value['id'].'" id="'. $value['id'] .'">';
				foreach ($value['options'] as $select_ID => $option) {
					$std = (isset($data[$value['id']])) ? $data[$value['id']] : $value['std'];
					$output .= '<option id="' . $select_ID . '" value="'.$select_ID.'" ' . selected($std, $select_ID, false) . ' />'.$option.'</option>';
				}
				$output .= '</select></div>';
				break;
			case 'textarea':
				$cols = '8';
				$ta_value = '';

				if(isset($value['options'])){
					$ta_options = $value['options'];
					if(isset($ta_options['cols'])){
						$cols = $ta_options['cols'];
					}
				}

				if (isset($data[$value['id']]) && $data[$value['id']]) $ta_value = stripslashes($data[$value['id']]);
				$output .= '<textarea class="undsgn-input" name="'.$value['id'].'" id="'. $value['id'] .'" cols="'. $cols .'" rows="8">'.$ta_value.'</textarea>';
				break;
			case "radio":
				foreach($value['options'] as $option=>$name) {
					$std = (isset($data[$value['id']])) ? $data[$value['id']] : $value['std'];
					$output .= '<input class="undsgn-input undsgn-radio" name="'.$value['id'].'" type="radio" value="'.$option.'" ' . checked($std, $option, false) . ' /><label class="radio">'.$name.'</label><br/>';
				}
				break;
			case 'checkbox':
				if (!isset($data[$value['id']])) {
					$data[$value['id']] = 0;
				}

				if (array_key_exists("folds",$value)) {
					$fold="fld ";
				}

				$output .= '<input type="hidden" class="'.$fold.'checkbox aq-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="0"/>';
				$output .= '<input type="checkbox" class="'.$fold.'checkbox undsgn-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="1" '. checked($data[$value['id']], 1, false) .' />';
				break;
			case 'multicheck':
				$multi_stored = $data[$value['id']];

				foreach ($value['options'] as $key => $option) {
					if (!isset($multi_stored[$key])) {$multi_stored[$key] = '';}
					$undsgn_key_string = $value['id'] . '_' . $key;
					$output .= '<input type="checkbox" class="checkbox undsgn-input" name="'.$value['id'].'['.$key.']'.'" id="'. $undsgn_key_string .'" value="1" '. checked($multi_stored[$key], 1, false) .' /><label class="multicheck" for="'. $undsgn_key_string .'">'. $option .'</label><br />';
				}
				break;
			case 'upload':
				if(!isset($value['mod'])) $value['mod'] = '';
				$output .= Options_Machine::undsgn_uploader_function($value['id'],$value['std'],$value['mod']);
				break;
			case 'media':
				$_id = strip_tags( strtolower($value['id']) );
				$int = '';
				$int = undsgn_mlu_get_silentpost( $_id );
				if(!isset($value['mod'])) $value['mod'] = '';
				$output .= Options_Machine::undsgn_media_uploader_function( $value['id'], $value['std'], $int, $value['mod'] ); // New AJAX Uploader using Media Library
				break;
			case 'color':
				$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: '.$data[$value['id']].'"></div></div>';
				$output .= '<input class="undsgn-color" name="'.$value['id'].'" id="'. $value['id'] .'" type="text" value="'. $data[$value['id']] .'" />';
				break;
			case 'typography':

				$typography_stored = isset($data[$value['id']]) ? $data[$value['id']] : $value['std'];

				/* Font Size */

				if(isset($typography_stored['size'])) {
					$output .= '<div class="select_wrapper typography-size" original-title="Font size">';
					$output .= '<select class="undsgn-typography undsgn-typography-size select" name="'.$value['id'].'[size]" id="'. $value['id'].'_size">';
					for ($i = 9; $i < 20; $i++){
						$test = $i.'px';
						$output .= '<option value="'. $i .'px" ' . selected($typography_stored['size'], $test, false) . '>'. $i .'px</option>';
					}

					$output .= '</select></div>';

				}

				/* Line Height */

				if(isset($typography_stored['height'])) {

					$output .= '<div class="select_wrapper typography-height" original-title="Line height">';
					$output .= '<select class="undsgn-typography undsgn-typography-height select" name="'.$value['id'].'[height]" id="'. $value['id'].'_height">';
					for ($i = 20; $i < 38; $i++){
						$test = $i.'px';
						$output .= '<option value="'. $i .'px" ' . selected($typography_stored['height'], $test, false) . '>'. $i .'px</option>';
					}

					$output .= '</select></div>';

				}

				/* Font Face */

				if(isset($typography_stored['face'])) {

					$output .= '<div class="select_wrapper typography-face" original-title="Font family">';
					$output .= '<select class="undsgn-typography undsgn-typography-face select" name="'.$value['id'].'[face]" id="'. $value['id'].'_face">';

					$faces = array('arial'=>'Arial',
						'verdana'=>'Verdana, Geneva',
						'trebuchet'=>'Trebuchet',
						'georgia' =>'Georgia',
						'times'=>'Times New Roman',
						'tahoma'=>'Tahoma, Geneva',
						'palatino'=>'Palatino',
						'helvetica'=>'Helvetica' );
					foreach ($faces as $i=>$face) {
						$output .= '<option value="'. $i .'" ' . selected($typography_stored['face'], $i, false) . '>'. $face .'</option>';
					}

					$output .= '</select></div>';

				}

				/* Font Weight */

				if(isset($typography_stored['style'])) {

					$output .= '<div class="select_wrapper typography-style" original-title="Font style">';
					$output .= '<select class="undsgn-typography undsgn-typography-style select" name="'.$value['id'].'[style]" id="'. $value['id'].'_style">';
					$styles = array('normal'=>'Normal',
						'italic'=>'Italic',
						'bold'=>'Bold',
						'bold italic'=>'Bold Italic');

					foreach ($styles as $i=>$style){

						$output .= '<option value="'. $i .'" ' . selected($typography_stored['style'], $i, false) . '>'. $style .'</option>';
					}
					$output .= '</select></div>';

				}

				/* Font Color */

				if(isset($typography_stored['color'])) {

					$output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: '.$typography_stored['color'].'"></div></div>';
					$output .= '<input class="undsgn-color undsgn-typography undsgn-typography-color" original-title="Font color" name="'.$value['id'].'[color]" id="'. $value['id'] .'_color" type="text" value="'. $typography_stored['color'] .'" />';

				}

				break;
			case 'border':

				/* Border Width */
				$border_stored = $data[$value['id']];

				$output .= '<div class="select_wrapper border-width">';
				$output .= '<select class="undsgn-border undsgn-border-width select" name="'.$value['id'].'[width]" id="'. $value['id'].'_width">';
				for ($i = 0; $i < 21; $i++){
					$output .= '<option value="'. $i .'" ' . selected($border_stored['width'], $i, false) . '>'. $i .'</option>';     }
				$output .= '</select></div>';

				/* Border Style */
				$output .= '<div class="select_wrapper border-style">';
				$output .= '<select class="undsgn-border undsgn-border-style select" name="'.$value['id'].'[style]" id="'. $value['id'].'_style">';

				$styles = array('none'=>'None',
					'solid'=>'Solid',
					'dashed'=>'Dashed',
					'dotted'=>'Dotted');

				foreach ($styles as $i=>$style){
					$output .= '<option value="'. $i .'" ' . selected($border_stored['style'], $i, false) . '>'. $style .'</option>';
				}

				$output .= '</select></div>';

				/* Border Color */
				$output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: '.$border_stored['color'].'"></div></div>';
				$output .= '<input class="undsgn-color undsgn-border undsgn-border-color" name="'.$value['id'].'[color]" id="'. $value['id'] .'_color" type="text" value="'. $border_stored['color'] .'" />';

				break;
			case 'images':

				$i = 0;

				$select_value = $data[$value['id']];

				foreach ($value['options'] as $key => $option)
				{
					$i++;

					$checked = '';
					$selected = '';
					if(NULL!=checked($select_value, $key, false)) {
						$checked = checked($select_value, $key, false);
						$selected = 'undsgn-radio-img-selected';
					}
					$output .= '<span>';
					$output .= '<input type="radio" id="undsgn-radio-img-' . $value['id'] . $i . '" class="checkbox undsgn-radio-img-radio" value="'.$key.'" name="'.$value['id'].'" '.$checked.' />';
					$output .= '<div class="undsgn-radio-img-label">'. $key .'</div>';
					$output .= '<img src="'.$option.'" alt="" class="undsgn-radio-img-img '. $selected .'" onClick="document.getElementById(\'undsgn-radio-img-'. $value['id'] . $i.'\').checked = true;" />';
					$output .= '</span>';
				}

				break;
			case "info":
				$info_text = $value['std'];
				$output .= '<div class="undsgn-info">'.$info_text.'</div>';
				break;
			case "image":
				$src = $value['std'];
				$output .= '<img src="'.$src.'">';
				break;
			case 'heading':
				if($counter >= 2){
					$output .= '</div>'."\n";
				}
				$header_class = ereg_replace("[^A-Za-z0-9]", "", strtolower($value['name']) );
				$jquery_click_hook = ereg_replace("[^A-Za-z0-9]", "", strtolower($value['name']) );
				$jquery_click_hook = "undsgn-option-" . $jquery_click_hook;
				$menu .= '<li class="'. $header_class .'"><a title="'.  $value['name'] .'" href="#'.  $jquery_click_hook  .'">'.  $value['name'] .'</a></li>';
				$output .= '<div class="group" id="'. $jquery_click_hook  .'"><h2>'.$value['name'].'</h2>'."\n";
				break;
			case 'slider':
				$_id = strip_tags( strtolower($value['id']) );
				$int = '';
				$int = undsgn_mlu_get_silentpost( $_id );
				$output .= '<div class="slider"><ul id="'.$value['id'].'" rel="'.$int.'">';
				if (isset($data[$value['id']]) && $data[$value['id']]) {
					$slides = $data[$value['id']];
					$count = count($slides);
					if ($count < 2) {
						$oldorder = 1;
						$order = 1;
						$output .= Options_Machine::undsgn_slider_function($value['id'],$value['std'],$oldorder,$order,$int);
					} else {
						$i = 0;
						foreach ($slides as $slide) {
							$oldorder = $slide['order'];
							$i++;
							$order = $i;
							$output .= Options_Machine::undsgn_slider_function($value['id'],$value['std'],$oldorder,$order,$int);
						}
					}
				}
				$output .= '</ul>';
				$output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';

				break;
			case 'frontpage':
				$_id = strip_tags( strtolower($value['id']) );
				$int = '';
				$int = undsgn_mlu_get_silentpost( $_id );
				$output .= '<div class="slider"><input type="checkbox" class="toggleIncluded" /><ul id="'.$value['id'].'" class="frontpagelist" rel="'.$int.'">';
				if (isset($data[$value['id']]) && $data[$value['id']]) {
					$slides = $data[$value['id']];
					$count = count($slides);
					if ($count < 2) {
						$oldorder = 1;
						$order = 1;
						$output .= Options_Machine::undsgn_frontpage_function($value['id'],$value['std'],$oldorder,$order,$int);
					} else {
						$i = 0;
						foreach ($slides as $slide) {
							$oldorder = $slide['order'];
							$i++;
							$order = $i;
							$output .= Options_Machine::undsgn_frontpage_function($value['id'],$value['std'],$oldorder,$order,$int);
						}
					}
				}
				$output .= '</ul>';
				$output .= '<a href="#" class="button front_add_content">Load content</a></div>';

				break;
			case 'dynalist':
				$_id = strip_tags( strtolower($value['id']) );
				$int = '';
				$int = undsgn_mlu_get_silentpost( $_id );
				$output .= '<div class="slider"><ul id="'.$value['id'].'" rel="'.$int.'">';
				if (isset($data[$value['id']]) && $data[$value['id']]) {
					$slides = $data[$value['id']];
					$count = count($slides);
					if ($count < 2) {
						$oldorder = 1;
						$order = 1;
						$output .= Options_Machine::undsgn_dynalist_function($value['id'],$value['std'],$oldorder,$order,$int);
					} else {
						$i = 0;
						foreach ($slides as $slide) {
							$oldorder = $slide['order'];
							$i++;
							$order = $i;
							$output .= Options_Machine::undsgn_dynalist_function($value['id'],$value['std'],$oldorder,$order,$int);
						}
					}
				}
				$output .= '</ul>';
				$output .= '<a href="#" class="button list_add_button">Add New Detail</a></div>';

				break;
			case 'sorter':

				$sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];

				$output .= '<div id="'.$value['id'].'" class="sorter">';


				if ($sortlists) {

					foreach ($sortlists as $group=>$sortlist) {

						$output .= '<ul id="'.$value['id'].'_'.$group.'" class="sortlist_'.$value['id'].'">';
						$output .= '<h3>'.$group.'</h3>';

						foreach ($sortlist as $key => $list) {

							$output .= '<input class="sorter-placebo" type="hidden" name="'.$value['id'].'['.$group.'][placebo]" value="placebo">';

							if ($key != "placebo") {

								$output .= '<li id="'.$key.'" class="sortee">';
								$output .= '<input class="position" type="hidden" name="'.$value['id'].'['.$group.']['.$key.']" value="'.$list.'">';
								$output .= $list;
								$output .= '</li>';

							}

						}

						$output .= '</ul>';
					}
				}

				$output .= '</div>';
				break;
			case 'tiles':

				$i = 0;
				$select_value = '';
				$select_value = $data[$value['id']];

				foreach ($value['options'] as $key => $option)
				{
					$i++;

					$checked = '';
					$selected = '';
					if(NULL!=checked($select_value, $option, false)) {
						$checked = checked($select_value, $option, false);
						$selected = 'undsgn-radio-tile-selected';
					}
					$output .= '<span>';
					$output .= '<input type="radio" id="undsgn-radio-tile-' . $value['id'] . $i . '" class="checkbox undsgn-radio-tile-radio" value="'.$option.'" name="'.$value['id'].'" '.$checked.' />';
					$output .= '<div class="undsgn-radio-tile-img '. $selected .'" style="background: url('.$option.')" onClick="document.getElementById(\'undsgn-radio-tile-'. $value['id'] . $i.'\').checked = true;"></div>';
					$output .= '</span>';
				}

				break;
				// Background
			case 'background':

				$background = $data[$value['id']];

				// 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="undsgn-color undsgn-background undsgn-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 .= undsgn_medialibrary_uploader( $value['id'], $background['image'], null, '',0,'image');
				$class = 'undsgn-background-properties';
				if ( '' == $background['image'] ) {
					$class .= ' hide';
				}
				$output .= '<div class="' . esc_attr( $class ) . '">';

				// Background Repeat
				$output .= '<select class="undsgn-background undsgn-background-repeat" name="' . esc_attr( $option_name . '[' . $value['id'] . '][repeat]'  ) . '" id="' . esc_attr( $value['id'] . '_repeat' ) . '">';
				$repeats = undsgn_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="undsgn-background undsgn-background-position" name="' . esc_attr( $option_name . '[' . $value['id'] . '][position]' ) . '" id="' . esc_attr( $value['id'] . '_position' ) . '">';
				$positions = undsgn_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="undsgn-background undsgn-background-attachment" name="' . esc_attr( $option_name . '[' . $value['id'] . '][attachment]' ) . '" id="' . esc_attr( $value['id'] . '_attachment' ) . '">';
				$attachments = undsgn_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;
			case 'iconic':
				$output .= '<div class="upload_button_div">';
				$output .= '<a href="#" id="undsgn_entypo_button" class="button" title="Install Entypo">Download and Install Entypo Iconic Font</a>';
				$output .= '</div>';
				break;
			case 'backup':

				/* $instructions = $value['options']; */
				$backup = get_option(BACKUPS);

				if(!isset($backup['backup_log'])) {
					$log = 'No backups yet';
				} else {
					$log = $backup['backup_log'];
				}

				$output .= '<div class="backup-box upload_button_div"><div>';
				/* $output .= '<div class="instructions">'.$instructions."\n"; */
				$output .= '<p><strong>'. __('Last Backup : ', 'undsgnoptions' ).'<span class="backup-log">'.$log.'</span></strong></p></div>'."\n";
				$output .= '<a href="#" id="undsgn_backup_button" class="button" title="Backup Options">Backup Options</a>';
				$output .= '<a href="#" id="undsgn_restore_button" class="button" title="Restore Options">Restore Options</a>';
				$output .= '</div>';

				break;

			//export or import data between different installs
				case 'transfer':

					$instructions = $value['desc'];
					$output .= '<textarea id="export_data" rows="8">'.base64_encode(serialize($data)) /* 100% safe - ignore theme check nag */ .'</textarea>'."\n";
					$output .= '<div class="upload_button_div"><a href="#" id="undsgn_import_button" class="button" title="Restore Options">Import Options</a></div>';

				break;
			}

			// if TYPE is an array, formatted into smaller inputs... ie smaller values
			if ( is_array($value['type'])) {
				foreach($value['type'] as $array){

					$id = $array['id'];
					$std = $array['std'];
					$saved_std = get_option($id);
					if($saved_std != $std){$std = $saved_std;}
					$meta = $array['meta'];

					if($array['type'] == 'text') { // Only text at this point

						$output .= '<input class="input-text-small undsgn-input" name="'. $id .'" id="'. $id .'" type="text" value="'. $std .'" />';
						$output .= '<span class="meta-two">'.$meta.'</span>';
					}
				}
			}
			if ( $value['type'] != 'heading' ) {
				if(!isset($value['desc'])){ $explain_value = ''; } else{
					$explain_value = '<div class="explain">'. $value['desc'] .'</div>'."\n";
				}
				$output .= '</div>'.$explain_value."\n";
				$output .= '<div class="clear"> </div></div></div>'."\n";
			}

		}
		$output .= '</div>';
		return array($output,$menu,$defaults);
	}
Exemplo n.º 17
0
 /**
  * Process options data and build option fields
  *
  * @uses get_option()
  *
  * @access public
  * @since 1.0.0
  *
  * @return array
  */
 public static function Inputs()
 {
     $options = self::$Options;
     $smof_data = of_get_options();
     global $ts_all_fonts;
     $counter = 0;
     $menu = '';
     $output = '';
     foreach ($options as $value) {
         $counter++;
         $val = '';
         $output = '';
         //Start Heading
         if ($value['type'] != "heading") {
             $class = '';
             if (isset($value['class'])) {
                 $class = $value['class'];
             }
             $caption = '';
             if (isset($value['caption'])) {
                 $caption = $value['caption'];
             }
             $value['std'] = isset($value['std']) ? $value['std'] : '';
             //hide items in checkbox group
             $fold = '';
             if (array_key_exists("fold", $value)) {
                 if ($smof_data[$value['fold']]) {
                     $fold = "f_" . $value['fold'] . " ";
                 } else {
                     $fold = "f_" . $value['fold'] . " temphide ";
                 }
             }
             $output .= '<div id="section-' . esc_attr($value['id']) . '" class="' . esc_attr($fold) . 'section section-' . esc_attr($value['type']) . ' ' . esc_attr($class) . '">' . "\n";
             //only show header if 'name' value exists
             if ($value['name']) {
                 $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
             }
             //produce caption if there is one
             if (trim($caption)) {
                 $caption = '<div class="caption">' . $caption . '</div>' . "\n";
             }
             $output .= '<div class="option">' . "\n" . $caption . '<div class="controls">' . "\n";
         }
         //End Heading
         //switch statement to handle various options type
         switch ($value['type']) {
             //radiobox option
             case "hidden":
                 $t_value = '';
                 $t_value = stripslashes($smof_data[$value['id']]);
                 $output .= '<input class="of-input" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '" type="' . esc_attr($value['type']) . '" value="' . esc_attr($t_value) . '" />';
                 break;
                 //text input
             //text input
             case 'text':
                 $t_value = '';
                 $t_value = isset($smof_data[$value['id']]) ? stripslashes($smof_data[$value['id']]) : stripslashes($value['std']);
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<input class="of-input ' . esc_attr($mini) . '" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '" type="' . esc_attr($value['type']) . '" value="' . esc_attr($t_value) . '" />';
                 break;
                 //select option
             //select option
             case 'select':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select_wrapper ' . esc_attr($mini) . '">';
                 $output .= '<select class="select of-input" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '">';
                 $selected_option = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : (isset($value['std']) ? $value['std'] : "");
                 foreach ($value['options'] as $select_ID => $option) {
                     $select_ID = !isset($select_ID) ? $option : $select_ID;
                     $output .= '<option id="' . esc_attr($select_ID) . '" value="' . esc_attr($select_ID) . '" ' . selected($selected_option, $select_ID, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
                 //select option
             //select option
             case 'multiselect':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select-multiple-wrapper ' . esc_attr($mini) . '">';
                 $output .= '<select class="select-multiple of-input" name="' . esc_attr($value['id']) . '[]" id="' . esc_attr($value['id']) . '" multiple>';
                 $selected_option = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : (isset($value['std']) ? $value['std'] : "");
                 foreach ($value['options'] as $select_ID => $option) {
                     $select_ID = !isset($select_ID) ? $option : $select_ID;
                     if (is_array($selected_option)) {
                         $selected = in_array($select_ID, $selected_option) ? 'selected="selected"' : '';
                     } else {
                         $selected = selected($selected_option, $select_ID, false);
                     }
                     $output .= '<option id="' . esc_attr($select_ID) . '" value="' . esc_attr($select_ID) . '" ' . $selected . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
                 //textarea option
             //textarea option
             case 'textarea':
                 $cols = '8';
                 $rows = '8';
                 $ta_value = '';
                 if (isset($value['options'])) {
                     $ta_options = $value['options'];
                     if (isset($ta_options['cols'])) {
                         $cols = $ta_options['cols'];
                     }
                     if (isset($ta_options['rows'])) {
                         $rows = $ta_options['rows'];
                     }
                 }
                 $ta_value = isset($smof_data[$value['id']]) ? stripslashes($smof_data[$value['id']]) : stripslashes($value['std']);
                 $output .= '<textarea class="of-input" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '" cols="' . esc_attr($cols) . '" rows="' . $rows . '">' . $ta_value . '</textarea>';
                 break;
                 //radiobox option
             //radiobox option
             case "radio":
                 $checked_val = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : (isset($value['std']) ? $value['std'] : '');
                 foreach ($value['options'] as $option => $name) {
                     $output .= '<input class="of-input of-radio" name="' . esc_attr($value['id']) . '" type="radio" value="' . esc_attr($option) . '" ' . checked($checked_val, $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                 }
                 break;
                 //checkbox option
             //checkbox option
             case 'checkbox':
                 if (!isset($smof_data[$value['id']])) {
                     $smof_data[$value['id']] = isset($value['std']) ? $value['std'] : 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "fld ";
                 }
                 $output .= '<input type="hidden" class="' . esc_attr($fold) . 'checkbox of-input" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '" value="0"/>';
                 $output .= '<input type="checkbox" class="' . esc_attr($fold) . 'checkbox of-input" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                 break;
                 //multiple checkbox option
             //multiple checkbox option
             case 'multicheck':
                 //(isset($smof_data[$value['id']]))? $multi_stored = $smof_data[$value['id']] : $multi_stored="";
                 $multi_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : (isset($value['std']) ? $value['std'] : '');
                 foreach ($value['options'] as $key => $option) {
                     if (is_array($multi_stored)) {
                         if (isset($value['keyAsValue']) && $value['keyAsValue'] === true) {
                             $check_this = in_array($key, $multi_stored) ? $key : '';
                         } else {
                             $check_this = isset($multi_stored[$key]) ? $multi_stored[$key] : '';
                         }
                     } else {
                         $check_this = $multi_stored;
                     }
                     $of_key_string = $value['id'] . '_' . $key;
                     $_val = isset($value['keyAsValue']) && $value['keyAsValue'] === true ? $key : '1';
                     $output .= '<input type="checkbox" class="checkbox of-input" name="' . esc_attr($value['id']) . '[' . esc_attr($key) . ']' . '" id="' . esc_attr($of_key_string) . '" value="' . esc_attr($_val) . '" ' . checked($check_this, $_val, false) . ' /><label class="multicheck" for="' . esc_attr($of_key_string) . '">' . $option . '</label><br />';
                 }
                 //$output .= '<pre>'.print_r($multi_stored, true).'</pre>';		// debug
                 break;
                 //ajax image upload option
             //ajax image upload option
             case 'upload':
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                 break;
                 // native media library uploader - @uses optionsframework_media_uploader_function()
             // native media library uploader - @uses optionsframework_media_uploader_function()
             case 'media':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                 // New AJAX Uploader using Media Library
                 break;
                 //colorpicker option
             //colorpicker option
             case 'color':
                 $color_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 $output .= '<div id="' . esc_attr($value['id']) . '_picker" class="colorSelector"><div style="background-color: ' . esc_attr($color_stored) . '"></div></div>';
                 $output .= '<input class="of-color" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($color_stored) . '" />';
                 break;
                 //select option
             //select option
             case 'select_color_scheme':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if (!isset($value['fields']) || !is_array($value['fields'])) {
                     $value['fields'] = array();
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select_wrapper ' . esc_attr($mini) . '">';
                 $output .= '<select class="select of-input select-color-scheme" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '">';
                 $selected_option = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : (isset($value['std']) ? $value['std'] : "");
                 foreach ($value['options'] as $select_ID => $option) {
                     $select_ID = !isset($select_ID) ? $option : $select_ID;
                     $output .= '<option id="' . esc_attr($select_ID) . '" value="' . esc_attr($select_ID) . '" ' . selected($selected_option, $select_ID, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select>';
                 $output .= '<div class="color-fields-to-change" style="display:none;">';
                 $output .= json_encode($value['fields']);
                 $output .= '</div>';
                 $output .= '</div>';
                 break;
                 //typography option
             //typography option
             case 'big_typography':
             case 'typography':
                 $typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 if (is_array($value['std'])) {
                     foreach ($value['std'] as $key => $val) {
                         $typography_stored[$key] = isset($typography_stored[$key]) ? $typography_stored[$key] : $val;
                     }
                 }
                 /* Font Size */
                 if (isset($typography_stored['size']) && isset($value['std']['size'])) {
                     //if(isset($value['std']['size'])) {
                     $typography_stored['size'] = isset($typography_stored['size']) ? $typography_stored['size'] : $value['std']['size'];
                     $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                     $output .= '<select class="of-typography of-typography-size select" name="' . esc_attr($value['id']) . '[size]" id="' . esc_attr($value['id']) . '_size">';
                     $sizes = array(9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 26, 28, 30, 32, 36, 42, 48, 52, 56, 60, 64, 68, 72);
                     foreach ($sizes as $i) {
                         $test = $i . 'px';
                         $output .= '<option value="' . intval($i) . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . intval($i) . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Line Height */
                 if (isset($typography_stored['height']) && isset($value['std']['height'])) {
                     //if(isset($value['std']['height'])) {
                     $typography_stored['height'] = isset($typography_stored['height']) ? $typography_stored['height'] : $value['std']['height'];
                     $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                     $output .= '<select class="of-typography of-typography-height select" name="' . esc_attr($value['id']) . '[height]" id="' . esc_attr($value['id']) . '_height">';
                     for ($i = 20; $i < 48; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . intval($i) . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . intval($i) . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Face */
                 if (isset($typography_stored['face']) && isset($value['std']['face'])) {
                     //if(isset($value['std']['face'])) {
                     $typography_stored['face'] = isset($typography_stored['face']) ? $typography_stored['face'] : $value['std']['face'];
                     $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                     $output .= '<select class="of-typography of-typography-face select" name="' . esc_attr($value['id']) . '[face]" id="' . esc_attr($value['id']) . '_face">';
                     $faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'palatino' => 'Palatino', 'helvetica' => 'Helvetica');
                     $faces = $ts_all_fonts;
                     foreach ($faces as $i => $face) {
                         $output .= '<option value="' . esc_attr($i) . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Weight */
                 if (isset($typography_stored['style']) && isset($value['std']['style'])) {
                     //if(isset($value['std']['style'])) {
                     $typography_stored['style'] = isset($typography_stored['style']) ? $typography_stored['style'] : $value['std']['style'];
                     $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . esc_attr($value['id']) . '[style]" id="' . esc_attr($value['id']) . '_style">';
                     $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . esc_attr($i) . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Color */
                 if (isset($typography_stored['color']) && isset($value['std']['color'])) {
                     //if(isset($value['std']['color'])) {
                     $typography_stored['color'] = isset($typography_stored['color']) ? $typography_stored['color'] : $value['std']['color'];
                     $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . esc_attr($value['id']) . '[color]" id="' . esc_attr($value['id']) . '_color" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
                 }
                 break;
             case 'background_positioning':
                 $bg_pos_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 if (is_array($value['std'])) {
                     foreach ($value['std'] as $key => $val) {
                         $bg_pos_stored[$key] = isset($bg_pos_stored[$key]) ? $bg_pos_stored[$key] : $val;
                     }
                 }
                 /* Background Repeat */
                 if (isset($bg_pos_stored['repeat'])) {
                     $output .= '<div class="select_wrapper typography-style" original-title="Background Repeat">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . esc_attr($value['id']) . '[repeat]" id="' . esc_attr($value['id']) . '_repeat">';
                     foreach ($value['options']['repeat'] as $option) {
                         $output .= '<option value="' . esc_attr($option) . '" ' . selected($bg_pos_stored['repeat'], $option, false) . '>' . $option . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Background Position */
                 if (isset($bg_pos_stored['position'])) {
                     $output .= '<div class="select_wrapper typography-style" original-title="Background Position">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . esc_attr($value['id']) . '[position]" id="' . esc_attr($value['id']) . '_position">';
                     foreach ($value['options']['position'] as $option) {
                         $output .= '<option value="' . esc_attr($option) . '" ' . selected($bg_pos_stored['position'], $option, false) . '>' . $option . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Background Attachment */
                 if (isset($bg_pos_stored['attachment'])) {
                     $output .= '<div class="select_wrapper typography-style" original-title="Background Attachment">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . esc_attr($value['id']) . '[attachment]" id="' . esc_attr($value['id']) . '_attachment">';
                     foreach ($value['options']['attachment'] as $option) {
                         $output .= '<option value="' . esc_attr($option) . '" ' . selected($bg_pos_stored['attachment'], $option, false) . '>' . $option . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 break;
             case 'css_shadow':
                 $shadow_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 if (is_array($value['std'])) {
                     foreach ($value['std'] as $key => $val) {
                         $shadow_stored[$key] = isset($shadow_stored[$key]) ? $shadow_stored[$key] : $val;
                     }
                 }
                 /* X-Offset */
                 if (isset($shadow_stored['xoffset'])) {
                     $output .= '<div class="select_wrapper shadow-unit" original-title="X-Offset">';
                     $output .= '<select class="of-typography of-shadow-unit select" name="' . esc_attr($value['id']) . '[xoffset]" id="' . esc_attr($value['id']) . '_xoffset">';
                     $min = isset($value['options']['min']) ? $value['options']['min'] : '-10';
                     $max = isset($value['options']['max']) ? $value['options']['max'] : '10';
                     for ($i = $min; $i <= $max; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . intval($i) . 'px" ' . selected($shadow_stored['xoffset'], $test, false) . '>' . intval($i) . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Y-Offset */
                 if (isset($shadow_stored['yoffset'])) {
                     $output .= '<div class="select_wrapper shadow-unit" original-title="Y-Offset">';
                     $output .= '<select class="of-typography of-shadow-unit select" name="' . esc_attr($value['id']) . '[yoffset]" id="' . esc_attr($value['id']) . '_yoffset">';
                     $min = isset($value['options']['min']) ? $value['options']['min'] : '-10';
                     $max = isset($value['options']['max']) ? $value['options']['max'] : '10';
                     for ($i = $min; $i <= $max; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . intval($i) . 'px" ' . selected($shadow_stored['yoffset'], $test, false) . '>' . intval($i) . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Blur */
                 if (isset($shadow_stored['blur'])) {
                     $output .= '<div class="select_wrapper shadow-unit" original-title="Blur">';
                     $output .= '<select class="of-typography of-shadow-unit select" name="' . esc_attr($value['id']) . '[blur]" id="' . esc_attr($value['id']) . '_blur">';
                     $min = isset($value['options']['min']) ? $value['options']['min'] : '-10';
                     $max = isset($value['options']['max']) ? $value['options']['max'] : '10';
                     for ($i = $min; $i <= $max; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . intval($i) . 'px" ' . selected($shadow_stored['blur'], $test, false) . '>' . intval($i) . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Shadow Color */
                 if (isset($shadow_stored['color'])) {
                     $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . esc_attr($shadow_stored['color']) . '"></div></div>';
                     $output .= '<input class="of-color of-typography of-typography-color" original-title="Shadow Color" name="' . esc_attr($value['id']) . '[color]" id="' . esc_attr($value['id']) . '_color" type="text" value="' . esc_attr($shadow_stored['color']) . '" style="float:left" />';
                 }
                 /* Shadow Opacity */
                 if (isset($shadow_stored['opacity'])) {
                     $s_val = $s_min = $s_max = $s_step = $s_edit = '';
                     //no errors, please
                     $s_val = isset($shadow_stored['opacity']) ? stripslashes($shadow_stored['opacity']) : 100;
                     //values
                     $s_data = 'data-id="' . esc_attr($value['id']) . '_opacity" data-val="' . esc_attr($s_val) . '" data-min="1" data-max="100" data-step="1"';
                     //html output
                     $output .= '<div style="clear:left;margin-top:10px"><input type="text" name="' . esc_attr($value['id']) . '[opacity]" id="' . esc_attr($value['id']) . '_opacity" value="' . esc_attr($s_val) . '" class="mini" />';
                     $output .= '<div id="' . esc_attr($value['id']) . '-opacity-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div></div>';
                 }
                 break;
                 //border option
             //border option
             case 'border':
                 /* Border Width */
                 $border_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 if (is_array($value['std'])) {
                     foreach ($value['std'] as $key => $val) {
                         $border_stored[$key] = isset($border_stored[$key]) ? $border_stored[$key] : $val;
                     }
                 }
                 $output .= '<div class="select_wrapper border-width">';
                 $output .= '<select class="of-border of-border-width select" name="' . esc_attr($value['id']) . '[width]" id="' . esc_attr($value['id']) . '_width">';
                 for ($i = 0; $i < 21; $i++) {
                     $output .= '<option value="' . intval($i) . '" ' . selected($border_stored['width'], $i, false) . '>' . intval($i) . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Style */
                 $output .= '<div class="select_wrapper border-style">';
                 $output .= '<select class="of-border of-border-style select" name="' . esc_attr($value['id']) . '[style]" id="' . esc_attr($value['id']) . '_style">';
                 $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                 foreach ($styles as $i => $style) {
                     $output .= '<option value="' . esc_attr($i) . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Color */
                 $output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="background-color: ' . esc_attr($border_stored['color']) . '"></div></div>';
                 $output .= '<input class="of-color of-border of-border-color" name="' . esc_attr($value['id']) . '[color]" id="' . esc_attr($value['id']) . '_color" type="text" value="' . esc_attr($border_stored['color']) . '" />';
                 break;
                 //images checkbox - use image as checkboxes
             //images checkbox - use image as checkboxes
             case 'images':
                 $i = 0;
                 $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $key, false)) {
                         $checked = checked($select_value, $key, false);
                         $selected = 'of-radio-img-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-img-' . esc_attr($value['id'] . $i) . '" class="checkbox of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($value['id']) . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                     $output .= '<img src="' . esc_url($option) . '" alt="" id="of-radio-img-' . esc_attr($value['id']) . '-button" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . esc_js($value['id'] . $i) . '\').checked = true;" />';
                     $output .= '</span>';
                 }
                 break;
                 //info (for small intro box etc)
             //info (for small intro box etc)
             case "info":
                 $info_text_head = '<h3>' . $value['name'] . '</h3>';
                 $info_text_desc = '<p>' . $value['desc'] . '</p>';
                 $info_text = $info_text_head . $info_text_desc;
                 $output .= '<div class="of-info">' . $info_text . '</div>';
                 $value['desc'] = '';
                 break;
                 //display a single image
             //display a single image
             case "image":
                 $src = $value['std'];
                 $output .= '<img src="' . esc_url($src) . '">';
                 break;
                 //tab heading
             //tab heading
             case 'heading':
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $caption = isset($value['caption']) ? trim($value['caption']) : '';
                 $caption = $caption ? '<span class="caption">' . $caption . '</span>' : '';
                 $class = str_replace(' ', '', strtolower($value['name']));
                 $header_class = isset($value['class']) ? $value['class'] . ' ' . $class : $class;
                 $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = "of-option-" . $jquery_click_hook;
                 //$menu .= '<li class="'. esc_attr($header_class) .'"><a title="'. esc_attr($value['name']) .'" href="#'. $jquery_click_hook .'">'. $value['name'] .$caption .'</a></li>';
                 $output .= '<div class="group" id="' . esc_attr($jquery_click_hook) . '"><h2>' . $value['name'] . '</h2>' . "\n";
                 break;
                 //drag & drop slide manager
             //drag & drop slide manager
             case 'slider':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 $output .= '<div class="slider"><ul id="' . esc_attr($value['id']) . '" rel="' . esc_attr($int) . '">';
                 $slides = $smof_data[$value['id']];
                 $count = count($slides);
                 if ($count < 2) {
                     $oldorder = 1;
                     $order = 1;
                     $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                 } else {
                     $i = 0;
                     foreach ($slides as $slide) {
                         $oldorder = $slide['order'];
                         $i++;
                         $order = $i;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                     }
                 }
                 $output .= '</ul>';
                 $output .= '<a href="#" class="button slide_add_button">' . __('Add New Slide', 'ThemeStockyard') . '</a></div>';
                 break;
                 //drag & drop block manager
             //drag & drop block manager
             case 'sorter':
                 $sortlists = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 $output .= '<div id="' . esc_attr($value['id']) . '" class="sorter">';
                 if ($sortlists) {
                     foreach ($sortlists as $group => $sortlist) {
                         $output .= '<ul id="' . esc_attr($value['id'] . '_' . $group) . '" class="sortlist_' . esc_attr($value['id']) . '">';
                         $output .= '<h3>' . $group . '</h3>';
                         foreach ($sortlist as $key => $list) {
                             $output .= '<input class="sorter-placebo" type="hidden" name="' . esc_attr($value['id'] . '[' . $group . '][placebo]') . '" value="placebo">';
                             if ($key != "placebo") {
                                 $output .= '<li id="' . esc_attr($key) . '" class="sortee">';
                                 $output .= '<input class="position" type="hidden" name="' . esc_attr($value['id'] . '[' . $group . '][' . $key . ']') . '" value="' . esc_attr($list) . '">';
                                 $output .= $list;
                                 $output .= '</li>';
                             }
                         }
                         $output .= '</ul>';
                     }
                 }
                 $output .= '</div>';
                 break;
                 //background images option
             //background images option
             case 'tiles':
                 $i = 0;
                 $select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $option, false)) {
                         $checked = checked($select_value, $option, false);
                         $selected = 'of-radio-tile-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-tile-' . esc_attr($value['id'] . $i) . '" class="checkbox of-radio-tile-radio" value="' . esc_attr($option) . '" name="' . esc_attr($value['id']) . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-tile-img ' . esc_attr($selected) . '" style="background: url(' . esc_url($option) . ')" onClick="document.getElementById(\'of-radio-tile-' . esc_js($value['id'] . $i) . '\').checked = true;"></div>';
                     $output .= '</span>';
                 }
                 break;
                 //backup and restore options data
             //backup and restore options data
             case 'backup':
                 $instructions = $value['desc'];
                 $backup = get_option(OF_BACKUPS);
                 if (!isset($backup['backup_log'])) {
                     $log = 'No backups yet';
                 } else {
                     $log = $backup['backup_log'];
                 }
                 $output .= '<div class="backup-box">';
                 $output .= '<div class="instructions">' . $instructions . "\n";
                 $output .= '<p><strong>' . __('Last Backup : ', 'ThemeStockyard') . '<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                 $output .= '<a href="#" id="of_backup_button" class="button" title="' . __('Backup Options', 'ThemeStockyard') . '">' . __('Backup Options', 'ThemeStockyard') . '</a>';
                 $output .= '<a href="#" id="of_restore_button" class="button" title="' . __('Restore Options', 'ThemeStockyard') . '">' . __('Restore Options', 'ThemeStockyard') . '</a>';
                 $output .= '</div>';
                 break;
                 //export or import data between different installs
             //export or import data between different installs
             case 'transfer':
                 $instructions = $value['desc'];
                 $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($smof_data)) . '</textarea>' . "\n";
                 $output .= '<a href="#" id="of_import_button" class="button" title="' . __('Import Options', 'ThemeStockyard') . '">' . __('Import Options', 'ThemeStockyard') . '</a>';
                 break;
                 // google font field
             // google font field
             case 'select_google_font':
                 $output .= '<div class="select_wrapper">';
                 $output .= '<select class="select of-input google_font_select" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '">';
                 $selected_option = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : (isset($value['std']) ? $value['std'] : "");
                 /*foreach ($value['options'] as $select_key => $option) {
                 			$output .= '<option value="'.$select_key.'" ' . selected($selected_option, $option, false) . ' />'.$option.'</option>';
                 		} */
                 foreach ($value['options'] as $option) {
                     $output .= '<option value="' . esc_attr($option) . '" ' . selected($selected_option, $option, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 if (isset($value['preview']['text'])) {
                     $g_text = $value['preview']['text'];
                 } else {
                     $g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
                 }
                 if (isset($value['preview']['size'])) {
                     $g_size = 'style="font-size: ' . esc_attr($value['preview']['size']) . ';"';
                 } else {
                     $g_size = '';
                 }
                 $output .= '<p class="' . esc_attr($value['id']) . '_ggf_previewer google_font_preview" ' . $g_size . '>' . $g_text . '</p>';
                 break;
                 //JQuery UI Slider
             //JQuery UI Slider
             case 'sliderui':
                 $s_val = $s_min = $s_max = $s_step = $s_edit = '';
                 //no errors, please
                 // new-edit
                 //$s_val  = stripslashes($smof_data[$value['id']]);
                 $s_val = isset($smof_data[$value['id']]) ? stripslashes($smof_data[$value['id']]) : $value['std'];
                 if (!isset($value['min'])) {
                     $s_min = '0';
                 } else {
                     $s_min = $value['min'];
                 }
                 if (!isset($value['max'])) {
                     $s_max = $s_min + 1;
                 } else {
                     $s_max = $value['max'];
                 }
                 if (!isset($value['step'])) {
                     $s_step = '1';
                 } else {
                     $s_step = $value['step'];
                 }
                 if (!isset($value['edit'])) {
                     $s_edit = ' readonly="readonly"';
                 } else {
                     $s_edit = '';
                 }
                 if ($s_val == '') {
                     $s_val = $s_min;
                 }
                 //values
                 $s_data = 'data-id="' . esc_attr($value['id']) . '" data-val="' . esc_attr($s_val) . '" data-min="' . esc_attr($s_min) . '" data-max="' . esc_attr($s_max) . '" data-step="' . esc_attr($s_step) . '"';
                 //html output
                 $output .= '<input type="text" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '" value="' . esc_attr($s_val) . '" class="mini" ' . $s_edit . ' />';
                 $output .= '<div id="' . esc_attr($value['id']) . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                 break;
                 //Switch option
             //Switch option
             case 'switch':
                 if (!isset($smof_data[$value['id']])) {
                     $smof_data[$value['id']] = isset($value['std']) ? $value['std'] : 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "s_fld ";
                 }
                 $cb_enabled = $cb_disabled = '';
                 //no errors, please
                 //Get selected
                 //if ($smof_data[$value['id']] == 1){
                 if ($smof_data[$value['id']]) {
                     $cb_enabled = ' selected';
                     $cb_disabled = '';
                 } else {
                     $cb_enabled = '';
                     $cb_disabled = ' selected';
                 }
                 //Label ON
                 if (!isset($value['on'])) {
                     $on = "On";
                 } else {
                     $on = $value['on'];
                 }
                 //Label OFF
                 if (!isset($value['off'])) {
                     $off = "Off";
                 } else {
                     $off = $value['off'];
                 }
                 $output .= '<p class="switch-options">';
                 $output .= '<label class="' . esc_attr($fold) . 'cb-enable' . esc_attr($cb_enabled) . '" data-id="' . esc_attr($value['id']) . '"><span>' . $on . '</span></label>';
                 $output .= '<label class="' . esc_attr($fold) . 'cb-disable' . esc_attr($cb_disabled) . '" data-id="' . esc_attr($value['id']) . '"><span>' . $off . '</span></label>';
                 $output .= '<input type="hidden" class="' . esc_attr($fold) . 'checkbox of-input" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '" value="0"/>';
                 $output .= '<input type="checkbox" id="' . esc_attr($value['id']) . '" class="' . esc_attr($fold) . 'checkbox of-input main_checkbox" name="' . esc_attr($value['id']) . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                 $output .= '</p>';
                 break;
         }
         //description of each option
         if ($value['type'] != 'heading') {
             if (!isset($value['desc'])) {
                 $explain_value = '';
             } else {
                 $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
             }
             $output .= '</div>' . $explain_value . "\n";
             $output .= '<div class="clear"> </div></div></div>' . "\n";
         }
         $allowed_tags = '<div><p><ul><li><ol><span><a><strong><em><h3><h1><h2><h4><h5><h6><select><input><textarea><button><label><option><img><br>';
         echo strip_tags($output, $allowed_tags);
         // new
     }
     $output = '';
     // new
     $output .= '</div>';
     echo strip_tags($output, '<div>');
 }
 /**
  * Process options data and build option fields
  *
  * @uses get_option()
  *
  * @access public
  * @since 1.0.0
  *
  * @return array
  */
 public static function optionsframework_machine($options)
 {
     $data = get_option(OPTIONS);
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     foreach ($options as $value) {
         $counter++;
         $val = '';
         //create array of defaults
         if ($value['type'] == 'multicheck') {
             if (is_array($value['std'])) {
                 foreach ($value['std'] as $i => $key) {
                     $defaults[$value['id']][$key] = true;
                 }
             } else {
                 $defaults[$value['id']][$value['std']] = true;
             }
         } else {
             if (isset($value['id'])) {
                 $defaults[$value['id']] = $value['std'];
             }
         }
         //Start Heading
         if ($value['type'] != "heading") {
             $class = '';
             if (isset($value['class'])) {
                 $class = $value['class'];
             }
             //hide items in checkbox group
             $fold = '';
             if (array_key_exists("fold", $value)) {
                 if ($data[$value['fold']]) {
                     $fold = "f_" . $value['fold'] . " ";
                 } else {
                     $fold = "f_" . $value['fold'] . " temphide ";
                 }
             }
             $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
             //only show header if 'name' value exists
             if ($value['name']) {
                 $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
             }
             $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
         }
         //End Heading
         //switch statement to handle various options type
         switch ($value['type']) {
             //text input
             case 'text':
                 $t_value = '';
                 $t_value = stripslashes($data[$value['id']]);
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                 break;
                 //select option
             //select option
             case 'select':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select_wrapper ' . $mini . '">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 foreach ($value['options'] as $select_ID => $option) {
                     $output .= '<option id="' . $select_ID . '" value="' . $select_ID . '" ' . selected($data[$value['id']], $select_ID, false) . ' />' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
                 //textarea option
             //textarea option
             case 'textarea':
                 $cols = '8';
                 $ta_value = '';
                 if (isset($value['options'])) {
                     $ta_options = $value['options'];
                     if (isset($ta_options['cols'])) {
                         $cols = $ta_options['cols'];
                     }
                 }
                 $ta_value = stripslashes($data[$value['id']]);
                 $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                 break;
                 //radiobox option
             //radiobox option
             case "radio":
                 foreach ($value['options'] as $option => $name) {
                     $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                 }
                 break;
                 //checkbox option
             //checkbox option
             case 'checkbox':
                 if (!isset($data[$value['id']])) {
                     $data[$value['id']] = 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "fld ";
                 }
                 $output .= '<input type="hidden" class="' . $fold . 'checkbox aq-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                 $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($data[$value['id']], 1, false) . ' />';
                 break;
                 //multiple checkbox option
             //multiple checkbox option
             case 'multicheck':
                 $multi_stored = $data[$value['id']];
                 foreach ($value['options'] as $key => $option) {
                     if (!isset($multi_stored[$key])) {
                         $multi_stored[$key] = '';
                     }
                     $of_key_string = $value['id'] . '_' . $key;
                     $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                 }
                 break;
                 //ajax image upload option
             //ajax image upload option
             case 'upload':
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                 break;
                 // native media library uploader - @uses optionsframework_media_uploader_function()
             // native media library uploader - @uses optionsframework_media_uploader_function()
             case 'media':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                 // New AJAX Uploader using Media Library
                 break;
                 //colorpicker option
             //colorpicker option
             case 'color':
                 $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $data[$value['id']] . '"></div></div>';
                 $output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $data[$value['id']] . '" />';
                 break;
                 //typography option
             //typography option
             case 'typography':
                 $typography_stored = isset($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                 /* Font Size */
                 if (isset($typography_stored['size'])) {
                     $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                     $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                     for ($i = 9; $i < 20; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Line Height */
                 if (isset($typography_stored['height'])) {
                     $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                     $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                     for ($i = 20; $i < 38; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Face */
                 if (isset($typography_stored['face'])) {
                     $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                     $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                     $faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'palatino' => 'Palatino', 'helvetica' => 'Helvetica');
                     foreach ($faces as $i => $face) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Weight */
                 if (isset($typography_stored['style'])) {
                     $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                     $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Color */
                 if (isset($typography_stored['color'])) {
                     $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                 }
                 break;
                 //border option
             //border option
             case 'border':
                 /* Border Width */
                 $border_stored = $data[$value['id']];
                 $output .= '<div class="select_wrapper border-width">';
                 $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                 for ($i = 0; $i < 21; $i++) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Style */
                 $output .= '<div class="select_wrapper border-style">';
                 $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                 $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                 foreach ($styles as $i => $style) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Color */
                 $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                 $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                 break;
                 //images checkbox - use image as checkboxes
             //images checkbox - use image as checkboxes
             case 'images':
                 $i = 0;
                 $select_value = $data[$value['id']];
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $key, false)) {
                         $checked = checked($select_value, $key, false);
                         $selected = 'of-radio-img-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                     $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                     $output .= '</span>';
                 }
                 break;
                 //info (for small intro box etc)
             //info (for small intro box etc)
             case "info":
                 $info_text = $value['std'];
                 $output .= '<div class="of-info">' . $info_text . '</div>';
                 break;
                 //display a single image
             //display a single image
             case "image":
                 $src = $value['std'];
                 $output .= '<img src="' . $src . '">';
                 break;
                 //tab heading
             //tab heading
             case 'heading':
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $header_class = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = str_replace(' ', '', strtolower($value['name']));
                 $jquery_click_hook = "of-option-" . $jquery_click_hook;
                 $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                 $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                 break;
                 //drag & drop slide manager
             //drag & drop slide manager
             case 'slider':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 $output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
                 $slides = $data[$value['id']];
                 $count = count($slides);
                 if ($count < 2) {
                     $oldorder = 1;
                     $order = 1;
                     $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                 } else {
                     $i = 0;
                     foreach ($slides as $slide) {
                         $oldorder = $slide['order'];
                         $i++;
                         $order = $i;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                     }
                 }
                 $output .= '</ul>';
                 $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                 break;
                 //drag & drop block manager
             //drag & drop block manager
             case 'sorter':
                 $sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
                 $output .= '<div id="' . $value['id'] . '" class="sorter">';
                 if ($sortlists) {
                     foreach ($sortlists as $group => $sortlist) {
                         $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                         $output .= '<h3>' . $group . '</h3>';
                         foreach ($sortlist as $key => $list) {
                             $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                             if ($key != "placebo") {
                                 $output .= '<li id="' . $key . '" class="sortee">';
                                 $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                 $output .= $list;
                                 $output .= '</li>';
                             }
                         }
                         $output .= '</ul>';
                     }
                 }
                 $output .= '</div>';
                 break;
                 //background images option
             //background images option
             case 'tiles':
                 $i = 0;
                 $select_value = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : '';
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $option, false)) {
                         $checked = checked($select_value, $option, false);
                         $selected = 'of-radio-tile-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                     $output .= '</span>';
                 }
                 break;
                 //backup and restore options data
             //backup and restore options data
             case 'backup':
                 $instructions = $value['desc'];
                 $backup = get_option(BACKUPS);
                 if (!isset($backup['backup_log'])) {
                     $log = 'No backups yet';
                 } else {
                     $log = $backup['backup_log'];
                 }
                 $output .= '<div class="backup-box">';
                 $output .= '<div class="instructions">' . $instructions . "\n";
                 $output .= '<p><strong>' . __('Last Backup : ') . '<span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                 $output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
                 $output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
                 $output .= '</div>';
                 break;
                 //export or import data between different installs
             //export or import data between different installs
             case 'transfer':
                 $instructions = $value['desc'];
                 $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($data)) . '</textarea>' . "\n";
                 $output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
                 break;
         }
         //description of each option
         if ($value['type'] != 'heading') {
             if (!isset($value['desc'])) {
                 $explain_value = '';
             } else {
                 $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
             }
             $output .= '</div>' . $explain_value . "\n";
             $output .= '<div class="clear"> </div></div></div>' . "\n";
         }
     }
     $output .= '</div>';
     return array($output, $menu, $defaults);
 }
Exemplo n.º 19
0
/**
 * Ajax Save Options
 *
 * @uses get_option()
 *
 * @since 1.0.0
 */
function of_ajax_callback()
{
    global $of_options, $options_machine;
    $nonce = $_POST['security'];
    if (!wp_verify_nonce($nonce, 'of_ajax_nonce')) {
        die('-1');
    }
    //get options array from db
    $all = of_get_options();
    $save_type = $_POST['type'];
    //Uploads
    if ($save_type == 'upload') {
        $clickedID = $_POST['data'];
        // Acts as the name
        $filename = $_FILES[$clickedID];
        $filename['name'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', $filename['name']);
        $override['test_form'] = false;
        $override['action'] = 'wp_handle_upload';
        $uploaded_file = wp_handle_upload($filename, $override);
        $upload_tracking[] = $clickedID;
        //update $options array w/ image URL
        $upload_image = $all;
        //preserve current data
        $upload_image[$clickedID] = $uploaded_file['url'];
        of_save_options($upload_image);
        if (!empty($uploaded_file['error'])) {
            echo 'Upload Error: ' . esc_js($uploaded_file['error']);
        } else {
            echo esc_attr($uploaded_file['url']);
        }
        // Is the Response
    } elseif ($save_type == 'image_reset') {
        $id = $_POST['data'];
        // Acts as the name
        $delete_image = $all;
        //preserve rest of data
        $delete_image[$id] = '';
        //update array key with empty value
        of_save_options($delete_image);
    } elseif ($save_type == 'backup_options') {
        $backup = $all;
        $backup['backup_log'] = date('r');
        of_save_options($backup, OF_BACKUPS);
        die('1');
    } elseif ($save_type == 'restore_options') {
        $smof_data = get_option(OF_BACKUPS);
        update_option(OF_OPTIONS, $smof_data);
        of_save_options($smof_data);
        die('1');
    } elseif ($save_type == 'import_options') {
        $smof_data = $_POST['data'];
        $smof_data = unserialize(base64_decode($smof_data));
        //100% safe - ignore theme check nag
        of_save_options($smof_data);
        die('1');
    } elseif ($save_type == 'save') {
        wp_parse_str(stripslashes($_POST['data']), $smof_data);
        unset($smof_data['security']);
        unset($smof_data['of_save']);
        of_save_options($smof_data);
        die('1');
    } elseif ($save_type == 'reset') {
        of_options();
        $options_machine = new Options_Machine($of_options);
        of_save_options($options_machine->Defaults());
        die('1');
        //options reset
    }
    die;
}