Exemple #1
0
function woothemes_machine($options)
{
    $counter = 0;
    $menu = '';
    $output = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        //Start Heading
        if ($value['type'] != "heading") {
            $class = '';
            if (isset($value['class'])) {
                $class = $value['class'];
            }
            //$output .= '<div class="section section-'. $value['type'] .'">'."\n".'<div class="option-inner">'."\n";
            $output .= '<div class="section section-' . $value['type'] . ' ' . $class . '">' . "\n";
            $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
            $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
        }
        //End Heading
        $select_value = '';
        switch ($value['type']) {
            case 'text':
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                $output .= '<input class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $val . '" />';
                break;
            case 'select':
                $output .= '<select class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                $select_value = get_option($value['id']);
                foreach ($value['options'] as $option) {
                    $selected = '';
                    if ($select_value != '') {
                        if ($select_value == $option) {
                            $selected = ' selected="selected"';
                        }
                    } else {
                        if (isset($value['std'])) {
                            if ($value['std'] == $option) {
                                $selected = ' selected="selected"';
                            }
                        }
                    }
                    $output .= '<option' . $selected . '>';
                    $output .= $option;
                    $output .= '</option>';
                }
                $output .= '</select>';
                break;
            case 'select2':
                $output .= '<select class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                $select_value = get_option($value['id']);
                foreach ($value['options'] as $option => $name) {
                    $selected = '';
                    if ($select_value != '') {
                        if ($select_value == $option) {
                            $selected = ' selected="selected"';
                        }
                    } else {
                        if (isset($value['std'])) {
                            if ($value['std'] == $option) {
                                $selected = ' selected="selected"';
                            }
                        }
                    }
                    $output .= '<option' . $selected . ' value="' . $option . '">';
                    $output .= $name;
                    $output .= '</option>';
                }
                $output .= '</select>';
                break;
            case 'calendar':
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                $output .= '<input class="woo-input-calendar" type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $val . '">';
                break;
            case 'time':
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                $output .= '<input class="woo-input-time" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $val . '" />';
                break;
            case 'textarea':
                $cols = '8';
                $ta_value = '';
                if (isset($value['std'])) {
                    $ta_value = $value['std'];
                    if (isset($value['options'])) {
                        $ta_options = $value['options'];
                        if (isset($ta_options['cols'])) {
                            $cols = $ta_options['cols'];
                        } else {
                            $cols = '8';
                        }
                    }
                }
                $std = get_option($value['id']);
                if ($std != "") {
                    $ta_value = stripslashes($std);
                }
                $output .= '<textarea class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                break;
            case "radio":
                $select_value = get_option($value['id']);
                foreach ($value['options'] as $key => $option) {
                    $checked = '';
                    if ($select_value != '') {
                        if ($select_value == $key) {
                            $checked = ' checked';
                        }
                    } else {
                        if ($value['std'] == $key) {
                            $checked = ' checked';
                        }
                    }
                    $output .= '<input class="woo-input woo-radio" type="radio" name="' . $value['id'] . '" value="' . $key . '" ' . $checked . ' />' . $option . '<br />';
                }
                break;
            case "checkbox":
                $std = $value['std'];
                $saved_std = get_option($value['id']);
                $checked = '';
                if (!empty($saved_std)) {
                    if ($saved_std == 'true') {
                        $checked = 'checked="checked"';
                    } else {
                        $checked = '';
                    }
                } elseif ($std == 'true') {
                    $checked = 'checked="checked"';
                } else {
                    $checked = '';
                }
                $output .= '<input type="checkbox" class="checkbox woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="true" ' . $checked . ' />';
                break;
            case "multicheck":
                $std = $value['std'];
                foreach ($value['options'] as $key => $option) {
                    $woo_key = $value['id'] . '_' . $key;
                    $saved_std = get_option($woo_key);
                    if (!empty($saved_std)) {
                        if ($saved_std == 'true') {
                            $checked = 'checked="checked"';
                        } else {
                            $checked = '';
                        }
                    } elseif ($std == $key) {
                        $checked = 'checked="checked"';
                    } else {
                        $checked = '';
                    }
                    $output .= '<input type="checkbox" class="checkbox woo-input" name="' . $woo_key . '" id="' . $woo_key . '" value="true" ' . $checked . ' /><label for="' . $woo_key . '">' . $option . '</label><br />';
                }
                break;
            case "upload":
                $output .= woothemes_uploader_function($value['id'], $value['std'], null);
                break;
            case "upload_min":
                $output .= woothemes_uploader_function($value['id'], $value['std'], 'min');
                break;
            case "color":
                $val = $value['std'];
                $stored = get_option($value['id']);
                if ($stored != "") {
                    $val = $stored;
                }
                $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div></div></div>';
                $output .= '<input class="woo-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $val . '" />';
                break;
            case "typography":
                $default = $value['std'];
                $typography_stored = get_option($value['id']);
                /* Font Size */
                $val = $default['size'];
                if ($typography_stored['size'] != "") {
                    $val = $typography_stored['size'];
                }
                $output .= '<select class="woo-typography woo-typography-size" name="' . $value['id'] . '_size" id="' . $value['id'] . '_size">';
                for ($i = 9; $i < 71; $i++) {
                    if ($val == $i) {
                        $active = 'selected="selected"';
                    } else {
                        $active = '';
                    }
                    $output .= '<option value="' . $i . '" ' . $active . '>' . $i . 'px</option>';
                }
                $output .= '</select>';
                /* Font Unit 
                			$val = $default['unit'];
                			if ( $typography_stored['unit'] != "") { $val = $typography_stored['unit']; }
                				$em = ''; $px = '';
                			if($val == 'em'){ $em = 'selected="selected"'; }
                			if($val == 'px'){ $px = 'selected="selected"'; }
                			$output .= '<select class="woo-typography woo-typography-unit" name="'. $value['id'].'_unit" id="'. $value['id'].'_unit">';
                			$output .= '<option value="px '. $px .'">px</option>';
                			$output .= '<option value="em" '. $em .'>em</option>';
                			$output .= '</select>';
                			*/
                /* Font Face */
                /* Font Face */
                $val = $default['face'];
                if ($typography_stored['face'] != "") {
                    $val = $typography_stored['face'];
                }
                $font01 = '';
                $font02 = '';
                $font03 = '';
                $font04 = '';
                $font05 = '';
                $font06 = '';
                $font07 = '';
                $font08 = '';
                $font09 = '';
                $font10 = '';
                $font11 = '';
                $font12 = '';
                $font13 = '';
                $font14 = '';
                $font15 = '';
                if (strpos($val, 'Arial, sans-serif') !== false) {
                    $font01 = 'selected="selected"';
                }
                if (strpos($val, 'Verdana, Geneva') !== false) {
                    $font02 = 'selected="selected"';
                }
                if (strpos($val, 'Trebuchet') !== false) {
                    $font03 = 'selected="selected"';
                }
                if (strpos($val, 'Georgia') !== false) {
                    $font04 = 'selected="selected"';
                }
                if (strpos($val, 'Times New Roman') !== false) {
                    $font05 = 'selected="selected"';
                }
                if (strpos($val, 'Tahoma, Geneva') !== false) {
                    $font06 = 'selected="selected"';
                }
                if (strpos($val, 'Palatino') !== false) {
                    $font07 = 'selected="selected"';
                }
                if (strpos($val, 'Helvetica') !== false) {
                    $font08 = 'selected="selected"';
                }
                if (strpos($val, 'Calibri') !== false) {
                    $font09 = 'selected="selected"';
                }
                if (strpos($val, 'Myriad') !== false) {
                    $font10 = 'selected="selected"';
                }
                if (strpos($val, 'Lucida') !== false) {
                    $font11 = 'selected="selected"';
                }
                if (strpos($val, 'Arial Black') !== false) {
                    $font12 = 'selected="selected"';
                }
                if (strpos($val, 'Gill') !== false) {
                    $font13 = 'selected="selected"';
                }
                if (strpos($val, 'Geneva, Tahoma') !== false) {
                    $font14 = 'selected="selected"';
                }
                if (strpos($val, 'Impact') !== false) {
                    $font15 = 'selected="selected"';
                }
                $output .= '<select class="woo-typography woo-typography-face" name="' . $value['id'] . '_face" id="' . $value['id'] . '_face">';
                $output .= '<option value="Arial, sans-serif" ' . $font01 . '>Arial</option>';
                $output .= '<option value="Verdana, Geneva, sans-serif" ' . $font02 . '>Verdana</option>';
                $output .= '<option value="&quot;Trebuchet MS&quot;, Tahoma, sans-serif"' . $font03 . '>Trebuchet</option>';
                $output .= '<option value="Georgia, serif" ' . $font04 . '>Georgia</option>';
                $output .= '<option value="&quot;Times New Roman&quot;, serif"' . $font05 . '>Times New Roman</option>';
                $output .= '<option value="Tahoma, Geneva, Verdana, sans-serif"' . $font06 . '>Tahoma</option>';
                $output .= '<option value="Palatino, &quot;Palatino Linotype&quot;, serif"' . $font07 . '>Palatino</option>';
                $output .= '<option value="&quot;Helvetica Neue&quot;, Helvetica, sans-serif" ' . $font08 . '>Helvetica*</option>';
                $output .= '<option value="Calibri, Candara, Segoe, Optima, sans-serif"' . $font09 . '>Calibri*</option>';
                $output .= '<option value="&quot;Myriad Pro&quot;, Myriad, sans-serif"' . $font10 . '>Myriad Pro*</option>';
                $output .= '<option value="&quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, &quot;Lucida Sans&quot;, sans-serif"' . $font11 . '>Lucida</option>';
                $output .= '<option value="&quot;Arial Black&quot;, sans-serif" ' . $font12 . '>Arial Black</option>';
                $output .= '<option value="&quot;Gill Sans&quot;, &quot;Gill Sans MT&quot;, Calibri, sans-serif" ' . $font13 . '>Gill Sans*</option>';
                $output .= '<option value="Geneva, Tahoma, Verdana, sans-serif" ' . $font14 . '>Geneva*</option>';
                $output .= '<option value="Impact, Charcoal, sans-serif" ' . $font15 . '>Impact</option>';
                $output .= '</select>';
                /* Font Weight */
                $val = $default['style'];
                if ($typography_stored['style'] != "") {
                    $val = $typography_stored['style'];
                }
                $normal = '';
                $italic = '';
                $bold = '';
                $bolditalic = '';
                if ($val == 'normal') {
                    $normal = 'selected="selected"';
                }
                if ($val == 'italic') {
                    $italic = 'selected="selected"';
                }
                if ($val == 'bold') {
                    $bold = 'selected="selected"';
                }
                if ($val == 'bold italic') {
                    $bolditalic = 'selected="selected"';
                }
                $output .= '<select class="woo-typography woo-typography-style" name="' . $value['id'] . '_style" id="' . $value['id'] . '_style">';
                $output .= '<option value="normal" ' . $normal . '>Normal</option>';
                $output .= '<option value="italic" ' . $italic . '>Italic</option>';
                $output .= '<option value="bold" ' . $bold . '>Bold</option>';
                $output .= '<option value="bold italic" ' . $bolditalic . '>Bold/Italic</option>';
                $output .= '</select>';
                /* Font Color */
                $val = $default['color'];
                if ($typography_stored['color'] != "") {
                    $val = $typography_stored['color'];
                }
                $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div></div></div>';
                $output .= '<input class="woo-color woo-typography woo-typography-color" name="' . $value['id'] . '_color" id="' . $value['id'] . '_color" type="text" value="' . $val . '" />';
                break;
            case "border":
                $default = $value['std'];
                $border_stored = get_option($value['id']);
                /* Border Width */
                $val = $default['width'];
                if ($border_stored['width'] != "") {
                    $val = $border_stored['width'];
                }
                $output .= '<select class="woo-border woo-border-width" name="' . $value['id'] . '_width" id="' . $value['id'] . '_width">';
                for ($i = 0; $i < 21; $i++) {
                    if ($val == $i) {
                        $active = 'selected="selected"';
                    } else {
                        $active = '';
                    }
                    $output .= '<option value="' . $i . '" ' . $active . '>' . $i . 'px</option>';
                }
                $output .= '</select>';
                /* Border Style */
                $val = $default['style'];
                if ($border_stored['style'] != "") {
                    $val = $border_stored['style'];
                }
                $solid = '';
                $dashed = '';
                $dotted = '';
                if ($val == 'solid') {
                    $solid = 'selected="selected"';
                }
                if ($val == 'dashed') {
                    $dashed = 'selected="selected"';
                }
                if ($val == 'dotted') {
                    $dotted = 'selected="selected"';
                }
                $output .= '<select class="woo-border woo-border-style" name="' . $value['id'] . '_style" id="' . $value['id'] . '_style">';
                $output .= '<option value="solid" ' . $solid . '>Solid</option>';
                $output .= '<option value="dashed" ' . $dashed . '>Dashed</option>';
                $output .= '<option value="dotted" ' . $dotted . '>Dotted</option>';
                $output .= '</select>';
                /* Border Color */
                $val = $default['color'];
                if ($border_stored['color'] != "") {
                    $val = $border_stored['color'];
                }
                $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div></div></div>';
                $output .= '<input class="woo-color woo-border woo-border-color" name="' . $value['id'] . '_color" id="' . $value['id'] . '_color" type="text" value="' . $val . '" />';
                break;
            case "images":
                $i = 0;
                $select_value = get_settings($value['id']);
                foreach ($value['options'] as $key => $option) {
                    $i++;
                    $checked = '';
                    $selected = '';
                    if ($select_value != '') {
                        if ($select_value == $key) {
                            $checked = ' checked';
                            $selected = 'woo-radio-img-selected';
                        }
                    } else {
                        if ($value['std'] == $key) {
                            $checked = ' checked';
                            $selected = 'woo-radio-img-selected';
                        } elseif ($i == 1 && !isset($select_value)) {
                            $checked = ' checked';
                            $selected = 'woo-radio-img-selected';
                        } elseif ($i == 1 && $value['std'] == '') {
                            $checked = ' checked';
                            $selected = 'woo-radio-img-selected';
                        } else {
                            $checked = '';
                        }
                    }
                    $output .= '<span>';
                    $output .= '<input type="radio" id="woo-radio-img-' . $value['id'] . $i . '" class="checkbox woo-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                    $output .= '<div class="woo-radio-img-label">' . $key . '</div>';
                    $output .= '<img src="' . $option . '" alt="" class="woo-radio-img-img ' . $selected . '" onClick="document.getElementById(\'woo-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                    $output .= '</span>';
                }
                break;
            case "info":
                $default = $value['std'];
                $output .= $default;
                break;
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $jquery_click_hook = ereg_replace("[^A-Za-z0-9]", "", strtolower($value['name']));
                $jquery_click_hook = "woo-option-" . $jquery_click_hook;
                //			$jquery_click_hook = "woo-option-" . str_replace("&","",str_replace("/","",str_replace(".","",str_replace(")","",str_replace("(","",str_replace(" ","",strtolower($value['name'])))))));
                $menu .= '<li><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;
        }
        // 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 && !empty($saved_std)) {
                    $std = $saved_std;
                }
                $meta = $array['meta'];
                if ($array['type'] == 'text') {
                    // Only text at this point
                    $output .= '<input class="input-text-small woo-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 = $value['desc'];
            }
            $output .= '</div><div class="explain">' . $explain_value . '</div>' . "\n";
            $output .= '<div class="clear"> </div></div></div>' . "\n";
        }
    }
    $output .= '</div>';
    return array($output, $menu);
}
Exemple #2
0
 function woothemes_machine($options)
 {
     $counter = 0;
     $menu = '';
     $output = '';
     foreach ($options as $value) {
         $counter++;
         $val = '';
         //Start Heading
         if ($value['type'] != "heading") {
             $class = '';
             if (isset($value['class'])) {
                 $class = $value['class'];
             }
             //$output .= '<div class="section section-'. $value['type'] .'">'."\n".'<div class="option-inner">'."\n";
             $output .= '<div class="section section-' . $value['type'] . ' ' . $class . '">' . "\n";
             $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
             $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
         }
         //End Heading
         $select_value = '';
         switch ($value['type']) {
             case 'text':
                 $val = $value['std'];
                 $std = get_option($value['id']);
                 if ($std != "") {
                     $val = $std;
                 }
                 $output .= '<input class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $val . '" />';
                 break;
             case 'select':
                 $output .= '<div class="select_wrapper"><select class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 $select_value = stripslashes(get_option($value['id']));
                 foreach ($value['options'] as $option) {
                     $selected = '';
                     if ($select_value != '') {
                         if ($select_value == $option) {
                             $selected = ' selected="selected"';
                         }
                     } else {
                         if (isset($value['std'])) {
                             if ($value['std'] == $option) {
                                 $selected = ' selected="selected"';
                             }
                         }
                     }
                     $output .= '<option' . $selected . '>';
                     $output .= $option;
                     $output .= '</option>';
                 }
                 $output .= '</select></div>';
                 break;
             case 'select2':
                 $output .= '<div class="select_wrapper"><select class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 $select_value = stripslashes(get_option($value['id']));
                 foreach ($value['options'] as $option => $name) {
                     $selected = '';
                     if ($select_value != '') {
                         if ($select_value == $option) {
                             $selected = ' selected="selected"';
                         }
                     } else {
                         if (isset($value['std'])) {
                             if ($value['std'] == $option) {
                                 $selected = ' selected="selected"';
                             }
                         }
                     }
                     $output .= '<option' . $selected . ' value="' . $option . '">';
                     $output .= $name;
                     $output .= '</option>';
                 }
                 $output .= '</select></div>';
                 break;
             case 'calendar':
                 $val = $value['std'];
                 $std = get_option($value['id']);
                 if ($std != "") {
                     $val = $std;
                 }
                 $output .= '<input class="woo-input-calendar" type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $val . '">';
                 break;
             case 'time':
                 $val = $value['std'];
                 $std = get_option($value['id']);
                 if ($std != "") {
                     $val = $std;
                 }
                 $output .= '<input class="woo-input-time" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $val . '" />';
                 break;
             case 'textarea':
                 $cols = '8';
                 $ta_value = '';
                 if (isset($value['std'])) {
                     $ta_value = $value['std'];
                     if (isset($value['options'])) {
                         $ta_options = $value['options'];
                         if (isset($ta_options['cols'])) {
                             $cols = $ta_options['cols'];
                         } else {
                             $cols = '8';
                         }
                     }
                 }
                 $std = get_option($value['id']);
                 if ($std != "") {
                     $ta_value = stripslashes($std);
                 }
                 $output .= '<textarea class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                 break;
             case "radio":
                 $select_value = get_option($value['id']);
                 foreach ($value['options'] as $key => $option) {
                     $checked = '';
                     if ($select_value != '') {
                         if ($select_value == $key) {
                             $checked = ' checked';
                         }
                     } else {
                         if ($value['std'] == $key) {
                             $checked = ' checked';
                         }
                     }
                     $output .= '<input class="woo-input woo-radio" type="radio" name="' . $value['id'] . '" value="' . $key . '" ' . $checked . ' />' . $option . '<br />';
                 }
                 break;
             case "checkbox":
                 $std = $value['std'];
                 $saved_std = get_option($value['id']);
                 $checked = '';
                 if (!empty($saved_std)) {
                     if ($saved_std == 'true') {
                         $checked = 'checked="checked"';
                     } else {
                         $checked = '';
                     }
                 } elseif ($std == 'true') {
                     $checked = 'checked="checked"';
                 } else {
                     $checked = '';
                 }
                 $output .= '<input type="checkbox" class="checkbox woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="true" ' . $checked . ' />';
                 break;
             case "multicheck":
                 $std = $value['std'];
                 foreach ($value['options'] as $key => $option) {
                     $woo_key = $value['id'] . '_' . $key;
                     $saved_std = get_option($woo_key);
                     if (!empty($saved_std)) {
                         if ($saved_std == 'true') {
                             $checked = 'checked="checked"';
                         } else {
                             $checked = '';
                         }
                     } elseif ($std == $key) {
                         $checked = 'checked="checked"';
                     } else {
                         $checked = '';
                     }
                     $output .= '<input type="checkbox" class="checkbox woo-input" name="' . $woo_key . '" id="' . $woo_key . '" value="true" ' . $checked . ' /><label for="' . $woo_key . '">' . $option . '</label><br />';
                 }
                 break;
             case "multicheck2":
                 $std = explode(',', $value['std']);
                 foreach ($value['options'] as $key => $option) {
                     $woo_key = $value['id'] . '_' . $key;
                     $saved_std = get_option($woo_key);
                     if (!empty($saved_std)) {
                         if ($saved_std == 'true') {
                             $checked = 'checked="checked"';
                         } else {
                             $checked = '';
                         }
                     } elseif (in_array($key, $std)) {
                         $checked = 'checked="checked"';
                     } else {
                         $checked = '';
                     }
                     $output .= '<input type="checkbox" class="checkbox woo-input" name="' . $woo_key . '" id="' . $woo_key . '" value="true" ' . $checked . ' /><label for="' . $woo_key . '">' . $option . '</label><br />';
                 }
                 break;
             case "upload":
                 if (function_exists('woothemes_medialibrary_uploader')) {
                     $output .= woothemes_medialibrary_uploader($value['id'], $value['std'], null);
                     // New AJAX Uploader using Media Library
                 } else {
                     $output .= woothemes_uploader_function($value['id'], $value['std'], null);
                     // Original AJAX Uploader
                 }
                 // End IF Statement
                 break;
             case "upload_min":
                 if (function_exists('woothemes_medialibrary_uploader')) {
                     $output .= woothemes_medialibrary_uploader($value['id'], $value['std'], 'min');
                     // New AJAX Uploader using Media Library
                 } else {
                     $output .= woothemes_uploader_function($value['id'], $value['std'], 'min');
                     // Original AJAX Uploader
                 }
                 // End IF Statement
                 // $output .= woothemes_uploader_function($value['id'],$value['std'],'min');
                 break;
             case "color":
                 $val = $value['std'];
                 $stored = get_option($value['id']);
                 if ($stored != "") {
                     $val = $stored;
                 }
                 $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div></div></div>';
                 $output .= '<input class="woo-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $val . '" />';
                 break;
             case "typography":
                 $default = $value['std'];
                 $typography_stored = get_option($value['id']);
                 /* Font Size */
                 $val = $default['size'];
                 if ($typography_stored['size'] != "") {
                     $val = $typography_stored['size'];
                 }
                 if ($typography_stored['unit'] == 'px') {
                     $show_px = '';
                     $show_em = ' style="display:none" ';
                     $name_px = ' name="' . $value['id'] . '_size" ';
                     $name_em = '';
                 } else {
                     if ($typography_stored['unit'] == 'em') {
                         $show_em = '';
                         $show_px = 'style="display:none"';
                         $name_em = ' name="' . $value['id'] . '_size" ';
                         $name_px = '';
                     } else {
                         $show_px = '';
                         $show_em = ' style="display:none" ';
                         $name_px = ' name="' . $value['id'] . '_size" ';
                         $name_em = '';
                     }
                 }
                 $output .= '<select class="woo-typography woo-typography-size woo-typography-size-px"  id="' . $value['id'] . '_size" ' . $name_px . $show_px . '>';
                 for ($i = 9; $i < 71; $i++) {
                     if ($val == strval($i)) {
                         $active = 'selected="selected"';
                     } else {
                         $active = '';
                     }
                     $output .= '<option value="' . $i . '" ' . $active . '>' . $i . '</option>';
                 }
                 $output .= '</select>';
                 $output .= '<select class="woo-typography woo-typography-size woo-typography-size-em" id="' . $value['id'] . '_size" ' . $name_em . $show_em . '>';
                 $em = 0.5;
                 for ($i = 0; $i < 39; $i++) {
                     if ($i <= 24) {
                         // up to 2.0em in 0.1 increments
                         $em = $em + 0.1;
                     } elseif ($i >= 14 && $i <= 24) {
                         // Above 2.0em to 3.0em in 0.2 increments
                         $em = $em + 0.2;
                     } elseif ($i >= 24) {
                         // Above 3.0em in 0.5 increments
                         $em = $em + 0.5;
                     }
                     if ($val == strval($em)) {
                         $active = 'selected="selected"';
                     } else {
                         $active = '';
                     }
                     //echo ' '. $value['id'] .' val:'.floatval($val). ' -> ' . floatval($em) . ' $<br />' ;
                     $output .= '<option value="' . $em . '" ' . $active . '>' . $em . '</option>';
                 }
                 $output .= '</select>';
                 /* Font Unit */
                 $val = $default['unit'];
                 if ($typography_stored['unit'] != "") {
                     $val = $typography_stored['unit'];
                 }
                 $em = '';
                 $px = '';
                 if ($val == 'em') {
                     $em = 'selected="selected"';
                 }
                 if ($val == 'px') {
                     $px = 'selected="selected"';
                 }
                 $output .= '<select class="woo-typography woo-typography-unit" name="' . $value['id'] . '_unit" id="' . $value['id'] . '_unit">';
                 $output .= '<option value="px" ' . $px . '">px</option>';
                 $output .= '<option value="em" ' . $em . '>em</option>';
                 $output .= '</select>';
                 /* Font Face */
                 $val = $default['face'];
                 if ($typography_stored['face'] != "") {
                     $val = $typography_stored['face'];
                 }
                 $font01 = '';
                 $font02 = '';
                 $font03 = '';
                 $font04 = '';
                 $font05 = '';
                 $font06 = '';
                 $font07 = '';
                 $font08 = '';
                 $font09 = '';
                 $font10 = '';
                 $font11 = '';
                 $font12 = '';
                 $font13 = '';
                 $font14 = '';
                 $font15 = '';
                 if (strpos($val, 'Arial, sans-serif') !== false) {
                     $font01 = 'selected="selected"';
                 }
                 if (strpos($val, 'Verdana, Geneva') !== false) {
                     $font02 = 'selected="selected"';
                 }
                 if (strpos($val, 'Trebuchet') !== false) {
                     $font03 = 'selected="selected"';
                 }
                 if (strpos($val, 'Georgia') !== false) {
                     $font04 = 'selected="selected"';
                 }
                 if (strpos($val, 'Times New Roman') !== false) {
                     $font05 = 'selected="selected"';
                 }
                 if (strpos($val, 'Tahoma, Geneva') !== false) {
                     $font06 = 'selected="selected"';
                 }
                 if (strpos($val, 'Palatino') !== false) {
                     $font07 = 'selected="selected"';
                 }
                 if (strpos($val, 'Helvetica') !== false) {
                     $font08 = 'selected="selected"';
                 }
                 if (strpos($val, 'Calibri') !== false) {
                     $font09 = 'selected="selected"';
                 }
                 if (strpos($val, 'Myriad') !== false) {
                     $font10 = 'selected="selected"';
                 }
                 if (strpos($val, 'Lucida') !== false) {
                     $font11 = 'selected="selected"';
                 }
                 if (strpos($val, 'Arial Black') !== false) {
                     $font12 = 'selected="selected"';
                 }
                 if (strpos($val, 'Gill') !== false) {
                     $font13 = 'selected="selected"';
                 }
                 if (strpos($val, 'Geneva, Tahoma') !== false) {
                     $font14 = 'selected="selected"';
                 }
                 if (strpos($val, 'Impact') !== false) {
                     $font15 = 'selected="selected"';
                 }
                 $output .= '<select class="woo-typography woo-typography-face" name="' . $value['id'] . '_face" id="' . $value['id'] . '_face">';
                 $output .= '<option value="Arial, sans-serif" ' . $font01 . '>Arial</option>';
                 $output .= '<option value="Verdana, Geneva, sans-serif" ' . $font02 . '>Verdana</option>';
                 $output .= '<option value="&quot;Trebuchet MS&quot;, Tahoma, sans-serif"' . $font03 . '>Trebuchet</option>';
                 $output .= '<option value="Georgia, serif" ' . $font04 . '>Georgia</option>';
                 $output .= '<option value="&quot;Times New Roman&quot;, serif"' . $font05 . '>Times New Roman</option>';
                 $output .= '<option value="Tahoma, Geneva, Verdana, sans-serif"' . $font06 . '>Tahoma</option>';
                 $output .= '<option value="Palatino, &quot;Palatino Linotype&quot;, serif"' . $font07 . '>Palatino</option>';
                 $output .= '<option value="&quot;Helvetica Neue&quot;, Helvetica, sans-serif" ' . $font08 . '>Helvetica*</option>';
                 $output .= '<option value="Calibri, Candara, Segoe, Optima, sans-serif"' . $font09 . '>Calibri*</option>';
                 $output .= '<option value="&quot;Myriad Pro&quot;, Myriad, sans-serif"' . $font10 . '>Myriad Pro*</option>';
                 $output .= '<option value="&quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, &quot;Lucida Sans&quot;, sans-serif"' . $font11 . '>Lucida</option>';
                 $output .= '<option value="&quot;Arial Black&quot;, sans-serif" ' . $font12 . '>Arial Black</option>';
                 $output .= '<option value="&quot;Gill Sans&quot;, &quot;Gill Sans MT&quot;, Calibri, sans-serif" ' . $font13 . '>Gill Sans*</option>';
                 $output .= '<option value="Geneva, Tahoma, Verdana, sans-serif" ' . $font14 . '>Geneva*</option>';
                 $output .= '<option value="Impact, Charcoal, sans-serif" ' . $font15 . '>Impact</option>';
                 // Google webfonts
                 global $google_fonts;
                 sort($google_fonts);
                 $output .= '<option value="">-- Google Fonts --</option>';
                 foreach ($google_fonts as $key => $gfont) {
                     $font[$key] = '';
                     if ($val == $gfont['name']) {
                         $font[$key] = 'selected="selected"';
                     }
                     $name = $gfont['name'];
                     $output .= '<option value="' . $name . '" ' . $font[$key] . '>' . $name . '</option>';
                 }
                 // Custom Font stack
                 $new_stacks = get_option('framework_woo_font_stack');
                 if (!empty($new_stacks)) {
                     $output .= '<option value="">-- Custom Font Stacks --</option>';
                     foreach ($new_stacks as $name => $stack) {
                         if (strpos($val, $stack) !== false) {
                             $fontstack = 'selected="selected"';
                         } else {
                             $fontstack = '';
                         }
                         $output .= '<option value="' . stripslashes(htmlentities($stack)) . '" ' . $fontstack . '>' . str_replace('_', ' ', $name) . '</option>';
                     }
                 }
                 $output .= '</select>';
                 /* Font Weight */
                 $val = $default['style'];
                 if ($typography_stored['style'] != "") {
                     $val = $typography_stored['style'];
                 }
                 $normal = '';
                 $italic = '';
                 $bold = '';
                 $bolditalic = '';
                 if ($val == 'normal') {
                     $normal = 'selected="selected"';
                 }
                 if ($val == 'italic') {
                     $italic = 'selected="selected"';
                 }
                 if ($val == 'bold') {
                     $bold = 'selected="selected"';
                 }
                 if ($val == 'bold italic') {
                     $bolditalic = 'selected="selected"';
                 }
                 $output .= '<select class="woo-typography woo-typography-style" name="' . $value['id'] . '_style" id="' . $value['id'] . '_style">';
                 $output .= '<option value="normal" ' . $normal . '>Normal</option>';
                 $output .= '<option value="italic" ' . $italic . '>Italic</option>';
                 $output .= '<option value="bold" ' . $bold . '>Bold</option>';
                 $output .= '<option value="bold italic" ' . $bolditalic . '>Bold/Italic</option>';
                 $output .= '</select>';
                 /* Font Color */
                 $val = $default['color'];
                 if ($typography_stored['color'] != "") {
                     $val = $typography_stored['color'];
                 }
                 $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div></div></div>';
                 $output .= '<input class="woo-color woo-typography woo-typography-color" name="' . $value['id'] . '_color" id="' . $value['id'] . '_color" type="text" value="' . $val . '" />';
                 break;
             case "border":
                 $default = $value['std'];
                 $border_stored = get_option($value['id']);
                 /* Border Width */
                 $val = $default['width'];
                 if ($border_stored['width'] != "") {
                     $val = $border_stored['width'];
                 }
                 $output .= '<select class="woo-border woo-border-width" name="' . $value['id'] . '_width" id="' . $value['id'] . '_width">';
                 for ($i = 0; $i < 21; $i++) {
                     if ($val == $i) {
                         $active = 'selected="selected"';
                     } else {
                         $active = '';
                     }
                     $output .= '<option value="' . $i . '" ' . $active . '>' . $i . 'px</option>';
                 }
                 $output .= '</select>';
                 /* Border Style */
                 $val = $default['style'];
                 if ($border_stored['style'] != "") {
                     $val = $border_stored['style'];
                 }
                 $solid = '';
                 $dashed = '';
                 $dotted = '';
                 if ($val == 'solid') {
                     $solid = 'selected="selected"';
                 }
                 if ($val == 'dashed') {
                     $dashed = 'selected="selected"';
                 }
                 if ($val == 'dotted') {
                     $dotted = 'selected="selected"';
                 }
                 $output .= '<select class="woo-border woo-border-style" name="' . $value['id'] . '_style" id="' . $value['id'] . '_style">';
                 $output .= '<option value="solid" ' . $solid . '>Solid</option>';
                 $output .= '<option value="dashed" ' . $dashed . '>Dashed</option>';
                 $output .= '<option value="dotted" ' . $dotted . '>Dotted</option>';
                 $output .= '</select>';
                 /* Border Color */
                 $val = $default['color'];
                 if ($border_stored['color'] != "") {
                     $val = $border_stored['color'];
                 }
                 $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div></div></div>';
                 $output .= '<input class="woo-color woo-border woo-border-color" name="' . $value['id'] . '_color" id="' . $value['id'] . '_color" type="text" value="' . $val . '" />';
                 break;
             case "images":
                 $i = 0;
                 $select_value = get_option($value['id']);
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if ($select_value != '') {
                         if ($select_value == $key) {
                             $checked = ' checked';
                             $selected = 'woo-radio-img-selected';
                         }
                     } else {
                         if ($value['std'] == $key) {
                             $checked = ' checked';
                             $selected = 'woo-radio-img-selected';
                         } elseif ($i == 1 && !isset($select_value)) {
                             $checked = ' checked';
                             $selected = 'woo-radio-img-selected';
                         } elseif ($i == 1 && $value['std'] == '') {
                             $checked = ' checked';
                             $selected = 'woo-radio-img-selected';
                         } else {
                             $checked = '';
                         }
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="woo-radio-img-' . $value['id'] . $i . '" class="checkbox woo-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="woo-radio-img-label">' . $key . '</div>';
                     $output .= '<img src="' . $option . '" alt="" class="woo-radio-img-img ' . $selected . '" onClick="document.getElementById(\'woo-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                     $output .= '</span>';
                 }
                 break;
             case "info":
                 $default = $value['std'];
                 $output .= $default;
                 break;
             case "string_builder":
                 $desc = $value['std'];
                 $output .= '<div id="' . $value['id'] . '">';
                 $output .= 'Name<input class="woo-input woo-ignore" name="name" id="' . $value['id'] . '_name" type="text" />';
                 $output .= 'Font Stack<input class="woo-input woo-ignore" name="value" id="' . $value['id'] . '_value" type="text" />';
                 $output .= '<div class="add_button"><a class="button string_builder_add" href="#" class="string_builder" id="' . $value['id'] . '">Add</a></div>';
                 $output .= '<div id="' . $value['id'] . '_return" class="string_builder_return">';
                 $output .= '<h3>' . $desc . '</h3>';
                 $saved_data = get_option($value['id']);
                 if (!empty($saved_data)) {
                     foreach ($saved_data as $name => $data) {
                         $data = stripslashes($data);
                         $output .= '<div class="string_option" id="string_builer_option_' . str_replace(' ', '_', $name) . '"><a class="delete" rel="' . $name . '" href="#"><img src="' . get_bloginfo('template_url') . '/functions/images/ico-close.png" /></a><span>' . str_replace('_', ' ', $name) . ':</span> ' . $data . '</div>';
                     }
                 }
                 $output .= '<div style="display:none" class="string_builder_empty">Nothing added yet.</div>';
                 $output .= '</div>';
                 $output .= '</div>';
                 break;
             case "heading":
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 $jquery_click_hook = ereg_replace("[^A-Za-z0-9]", "", strtolower($value['name']));
                 $jquery_click_hook = "woo-option-" . $jquery_click_hook;
                 //			$jquery_click_hook = "woo-option-" . str_replace("&","",str_replace("/","",str_replace(".","",str_replace(")","",str_replace("(","",str_replace(" ","",strtolower($value['name'])))))));
                 $menu .= '<li class="' . $value['icon'] . '"><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;
         }
         // 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 woo-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 = $value['desc'];
             }
             $output .= '</div><div class="explain">' . $explain_value . '</div>' . "\n";
             $output .= '<div class="clear"> </div></div></div>' . "\n";
         }
     }
     //Checks if is not the Content Builder page
     if (isset($_REQUEST['page']) && $_REQUEST['page'] != 'woothemes_content_builder') {
         $output .= '</div>';
     }
     return array($output, $menu);
 }
function woothemes_machine($options, $page)
{
    $counter = 0;
    foreach ($options as $value) {
        if ($page != $value['page']) {
            $counter = 0;
            //Reset the Counter once a new page settings page is selected
        } elseif ($page == $value['page']) {
            $counter++;
            $val = '';
            //Start Heading
            if ($value['type'] != "heading") {
                $output .= '<div class="option option-' . $value['type'] . '">' . "\n" . '<div class="option-inner">' . "\n";
                $output .= '<label class="titledesc">' . $value['name'] . '</label>' . "\n";
                $output .= '<div class="formcontainer">' . "\n" . '<div class="forminp">' . "\n";
            }
            //End Heading
            $select_value = '';
            switch ($value['type']) {
                case 'text':
                    $val = $value['std'];
                    if (get_settings($value['id']) != "") {
                        $val = get_settings($value['id']);
                    }
                    $output .= '<input name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $val . '" />';
                    break;
                case 'select':
                    $output .= '<select name="' . $value['id'] . '" id="' . $value['id'] . '">';
                    $select_value = get_settings($value['id']);
                    foreach ($value['options'] as $option) {
                        $selected = '';
                        if ($select_value != '') {
                            if ($select_value == $option) {
                                $selected = ' selected="selected"';
                            }
                        } else {
                            if ($value['std'] == $option) {
                                $selected = ' selected="selected"';
                            }
                        }
                        $output .= '<option' . $selected . '>';
                        $output .= $option;
                        $output .= '</option>';
                    }
                    $output .= '</select>';
                    break;
                case 'textarea':
                    $ta_options = $value['options'];
                    $ta_value = $value['std'];
                    if (get_settings($value['id']) != "") {
                        $ta_value = stripslashes(get_settings($value['id']));
                    }
                    $output .= '<textarea name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $ta_options['cols'] . '" rows="8">' . $ta_value . '</textarea>';
                    break;
                case "radio":
                    $select_value = get_settings($value['id']);
                    foreach ($value['options'] as $key => $option) {
                        $checked = '';
                        if ($select_value != '') {
                            if ($select_value == $key) {
                                $checked = ' checked';
                            }
                        } else {
                            if ($value['std'] == $key) {
                                $checked = ' checked';
                            }
                        }
                        $output .= '<input type="radio" name="' . $value['id'] . '" value="' . $key . '" ' . $checked . ' />' . $option . '<br />';
                    }
                    break;
                case "checkbox":
                    $std = $value['std'];
                    $saved_std = get_option($value['id']);
                    $checked = '';
                    if (!empty($saved_std)) {
                        if ($saved_std == 'true') {
                            $checked = 'checked="checked"';
                        } else {
                            $checked = '';
                        }
                    } elseif ($std == 'true') {
                        $checked = 'checked="checked"';
                    } else {
                        $checked = '';
                    }
                    $output .= '<input type="checkbox" class="checkbox" name="' . $value['id'] . '" id="' . $value['id'] . '" value="true" ' . $checked . ' />';
                    break;
                case "multicheck":
                    $std = $value['std'];
                    foreach ($value['options'] as $key => $option) {
                        $woo_key = $value['id'] . '_' . $key;
                        $saved_std = get_option($woo_key);
                        if (!empty($saved_std)) {
                            if ($saved_std == 'true') {
                                $checked = 'checked="checked"';
                            } else {
                                $checked = '';
                            }
                        } elseif ($std == $key) {
                            $checked = 'checked="checked"';
                        } else {
                            $checked = '';
                        }
                        $output .= '<input type="checkbox" class="checkbox" name="' . $woo_key . '" id="' . $woo_key . '" value="true" ' . $checked . ' /><label for="' . $woo_key . '">' . $option . '</label><br />';
                    }
                    break;
                case "upload":
                    $output .= woothemes_uploader_function($value['id'], $value['std'], 'options');
                    break;
                case "heading":
                    if ($counter >= 2) {
                        $output .= '</div>' . "\n";
                    }
                    $output .= '<div class="title">';
                    $output .= '<p class="submit"><input name="save" type="submit" value="Save Changes" /><input type="hidden" name="action" value="save" /></p>';
                    $output .= '<h3><span class="woo-expand">+</span>' . $value['name'] . '</h3>' . "\n";
                    $output .= '</div>' . "\n";
                    $output .= '<div class="option_content">' . "\n";
                    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 && !empty($saved_std)) {
                        $std = $saved_std;
                    }
                    $meta = $array['meta'];
                    if ($array['type'] == 'text') {
                        // Only text at this point
                        $output .= '<input class="input-text-small" 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/>';
                }
                $output .= '</div><div class="desc">' . $value['desc'] . '</div></div>' . "\n";
                $output .= '</div></div><div class="clear"></div>' . "\n";
            }
        }
    }
    $output .= '</div>';
    return $output;
}
Exemple #4
0
function woothemes_machine($options)
{
    $counter = 0;
    $menu = '';
    $output = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        //Start Heading
        if ($value['type'] != "heading") {
            $class = '';
            if (isset($value['class'])) {
                $class = $value['class'];
            }
            //$output .= '<div class="section section-'. $value['type'] .'">'."\n".'<div class="option-inner">'."\n";
            $output .= '<div class="section section-' . $value['type'] . ' ' . $class . '">' . "\n";
            $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
            $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
        }
        //End Heading
        $select_value = '';
        switch ($value['type']) {
            case 'text':
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                $output .= '<input class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $val . '" />';
                break;
            case 'select':
                $output .= '<select class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                $select_value = stripslashes(get_option($value['id']));
                foreach ($value['options'] as $option) {
                    $selected = '';
                    if ($select_value != '') {
                        if ($select_value == $option) {
                            $selected = ' selected="selected"';
                        }
                    } else {
                        if (isset($value['std'])) {
                            if ($value['std'] == $option) {
                                $selected = ' selected="selected"';
                            }
                        }
                    }
                    $output .= '<option' . $selected . '>';
                    $output .= $option;
                    $output .= '</option>';
                }
                $output .= '</select>';
                break;
            case 'select2':
                $output .= '<select class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                $select_value = stripslashes(get_option($value['id']));
                foreach ($value['options'] as $option => $name) {
                    $selected = '';
                    if ($select_value != '') {
                        if ($select_value == $option) {
                            $selected = ' selected="selected"';
                        }
                    } else {
                        if (isset($value['std'])) {
                            if ($value['std'] == $option) {
                                $selected = ' selected="selected"';
                            }
                        }
                    }
                    $output .= '<option' . $selected . ' value="' . $option . '">';
                    $output .= $name;
                    $output .= '</option>';
                }
                $output .= '</select>';
                break;
            case 'calendar':
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                $output .= '<input class="woo-input-calendar" type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $val . '">';
                break;
            case 'time':
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                $output .= '<input class="woo-input-time" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $val . '" />';
                break;
            case 'textarea':
                $cols = '8';
                $ta_value = '';
                if (isset($value['std'])) {
                    $ta_value = $value['std'];
                    if (isset($value['options'])) {
                        $ta_options = $value['options'];
                        if (isset($ta_options['cols'])) {
                            $cols = $ta_options['cols'];
                        } else {
                            $cols = '8';
                        }
                    }
                }
                $std = get_option($value['id']);
                if ($std != "") {
                    $ta_value = stripslashes($std);
                }
                $output .= '<textarea class="woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                break;
            case "radio":
                $select_value = get_option($value['id']);
                foreach ($value['options'] as $key => $option) {
                    $checked = '';
                    if ($select_value != '') {
                        if ($select_value == $key) {
                            $checked = ' checked';
                        }
                    } else {
                        if ($value['std'] == $key) {
                            $checked = ' checked';
                        }
                    }
                    $output .= '<input class="woo-input woo-radio" type="radio" name="' . $value['id'] . '" value="' . $key . '" ' . $checked . ' />' . $option . '<br />';
                }
                break;
            case "checkbox":
                $std = $value['std'];
                $saved_std = get_option($value['id']);
                $checked = '';
                if (!empty($saved_std)) {
                    if ($saved_std == 'true') {
                        $checked = 'checked="checked"';
                    } else {
                        $checked = '';
                    }
                } elseif ($std == 'true') {
                    $checked = 'checked="checked"';
                } else {
                    $checked = '';
                }
                $output .= '<input type="checkbox" class="checkbox woo-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="true" ' . $checked . ' />';
                break;
            case "multicheck":
                $std = $value['std'];
                foreach ($value['options'] as $key => $option) {
                    $woo_key = $value['id'] . '_' . $key;
                    $saved_std = get_option($woo_key);
                    if (!empty($saved_std)) {
                        if ($saved_std == 'true') {
                            $checked = 'checked="checked"';
                        } else {
                            $checked = '';
                        }
                    } elseif ($std == $key) {
                        $checked = 'checked="checked"';
                    } else {
                        $checked = '';
                    }
                    $output .= '<input type="checkbox" class="checkbox woo-input" name="' . $woo_key . '" id="' . $woo_key . '" value="true" ' . $checked . ' /><label for="' . $woo_key . '">' . $option . '</label><br />';
                }
                break;
            case "upload":
                $output .= woothemes_uploader_function($value['id'], $value['std'], null);
                break;
            case "upload_min":
                $output .= woothemes_uploader_function($value['id'], $value['std'], 'min');
                break;
            case "color":
                $val = $value['std'];
                $stored = get_option($value['id']);
                if ($stored != "") {
                    $val = $stored;
                }
                $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div></div></div>';
                $output .= '<input class="woo-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $val . '" />';
                break;
            case "typography":
                $default = $value['std'];
                $typography_stored = get_option($value['id']);
                /* Font Size */
                $val = $default['size'];
                if ($typography_stored['size'] != "") {
                    $val = $typography_stored['size'];
                }
                $output .= '<select class="woo-typography woo-typography-size" name="' . $value['id'] . '_size" id="' . $value['id'] . '_size">';
                for ($i = 9; $i < 71; $i++) {
                    if ($val == $i) {
                        $active = 'selected="selected"';
                    } else {
                        $active = '';
                    }
                    $output .= '<option value="' . $i . '" ' . $active . '>' . $i . 'px</option>';
                }
                $output .= '</select>';
                /* Font Unit 
                			$val = $default['unit'];
                			if ( $typography_stored['unit'] != "") { $val = $typography_stored['unit']; }
                				$em = ''; $px = '';
                			if($val == 'em'){ $em = 'selected="selected"'; }
                			if($val == 'px'){ $px = 'selected="selected"'; }
                			$output .= '<select class="woo-typography woo-typography-unit" name="'. $value['id'].'_unit" id="'. $value['id'].'_unit">';
                			$output .= '<option value="px '. $px .'">px</option>';
                			$output .= '<option value="em" '. $em .'>em</option>';
                			$output .= '</select>';
                			*/
                /* Font Face */
                $val = $default['face'];
                if ($typography_stored['face'] != "") {
                    $val = $typography_stored['face'];
                }
                $font01 = '';
                $font02 = '';
                $font03 = '';
                $font04 = '';
                $font05 = '';
                $font06 = '';
                $font07 = '';
                $font08 = '';
                $font09 = '';
                $font10 = '';
                $font11 = '';
                $font12 = '';
                $font13 = '';
                $font14 = '';
                $font15 = '';
                // Google webfonts
                $font16 = '';
                $font17 = '';
                $font18 = '';
                $font19 = '';
                $font20 = '';
                $font21 = '';
                $font22 = '';
                $font23 = '';
                $font24 = '';
                $font25 = '';
                $font26 = '';
                $font27 = '';
                $font28 = '';
                $font29 = '';
                $font30 = '';
                $font31 = '';
                $font32 = '';
                $font33 = '';
                $fontstack = '';
                if (strpos($val, 'Arial, sans-serif') !== false) {
                    $font01 = 'selected="selected"';
                }
                if (strpos($val, 'Verdana, Geneva') !== false) {
                    $font02 = 'selected="selected"';
                }
                if (strpos($val, 'Trebuchet') !== false) {
                    $font03 = 'selected="selected"';
                }
                if (strpos($val, 'Georgia') !== false) {
                    $font04 = 'selected="selected"';
                }
                if (strpos($val, 'Times New Roman') !== false) {
                    $font05 = 'selected="selected"';
                }
                if (strpos($val, 'Tahoma, Geneva') !== false) {
                    $font06 = 'selected="selected"';
                }
                if (strpos($val, 'Palatino') !== false) {
                    $font07 = 'selected="selected"';
                }
                if (strpos($val, 'Helvetica') !== false) {
                    $font08 = 'selected="selected"';
                }
                if (strpos($val, 'Calibri') !== false) {
                    $font09 = 'selected="selected"';
                }
                if (strpos($val, 'Myriad') !== false) {
                    $font10 = 'selected="selected"';
                }
                if (strpos($val, 'Lucida') !== false) {
                    $font11 = 'selected="selected"';
                }
                if (strpos($val, 'Arial Black') !== false) {
                    $font12 = 'selected="selected"';
                }
                if (strpos($val, 'Gill') !== false) {
                    $font13 = 'selected="selected"';
                }
                if (strpos($val, 'Geneva, Tahoma') !== false) {
                    $font14 = 'selected="selected"';
                }
                if (strpos($val, 'Impact') !== false) {
                    $font15 = 'selected="selected"';
                }
                // Google webfonts
                if (strpos($val, 'Cantarell') !== false) {
                    $font16 = 'selected="selected"';
                }
                if (strpos($val, 'Cardo') !== false) {
                    $font17 = 'selected="selected"';
                }
                if (strpos($val, 'Crimson Text') !== false) {
                    $font18 = 'selected="selected"';
                }
                if (strpos($val, 'Droid Sans') !== false) {
                    $font19 = 'selected="selected"';
                }
                if (strpos($val, 'Droid Sans Mono') !== false) {
                    $font20 = 'selected="selected"';
                }
                if (strpos($val, 'Droid Serif') !== false) {
                    $font21 = 'selected="selected"';
                }
                if (strpos($val, 'IM Fell DW Pica') !== false) {
                    $font22 = 'selected="selected"';
                }
                if (strpos($val, 'Inconsolata') !== false) {
                    $font23 = 'selected="selected"';
                }
                if (strpos($val, 'Josefin Sans Std Light') !== false) {
                    $font24 = 'selected="selected"';
                }
                if (strpos($val, 'Lobster') !== false) {
                    $font25 = 'selected="selected"';
                }
                if (strpos($val, 'Molengo') !== false) {
                    $font26 = 'selected="selected"';
                }
                if (strpos($val, 'Nobile') !== false) {
                    $font27 = 'selected="selected"';
                }
                if (strpos($val, 'OFL Sorts Mill Goudy TT') !== false) {
                    $font28 = 'selected="selected"';
                }
                if (strpos($val, 'Old Standard TT') !== false) {
                    $font29 = 'selected="selected"';
                }
                if (strpos($val, 'Reenie Beanie') !== false) {
                    $font30 = 'selected="selected"';
                }
                if (strpos($val, 'Tangerine') !== false) {
                    $font31 = 'selected="selected"';
                }
                if (strpos($val, 'Vollkorn') !== false) {
                    $font32 = 'selected="selected"';
                }
                if (strpos($val, 'Yanone Kaffeesatz') !== false) {
                    $font33 = 'selected="selected"';
                }
                $output .= '<select class="woo-typography woo-typography-face" name="' . $value['id'] . '_face" id="' . $value['id'] . '_face">';
                $output .= '<option value="Arial, sans-serif" ' . $font01 . '>Arial</option>';
                $output .= '<option value="Verdana, Geneva, sans-serif" ' . $font02 . '>Verdana</option>';
                $output .= '<option value="&quot;Trebuchet MS&quot;, Tahoma, sans-serif"' . $font03 . '>Trebuchet</option>';
                $output .= '<option value="Georgia, serif" ' . $font04 . '>Georgia</option>';
                $output .= '<option value="&quot;Times New Roman&quot;, serif"' . $font05 . '>Times New Roman</option>';
                $output .= '<option value="Tahoma, Geneva, Verdana, sans-serif"' . $font06 . '>Tahoma</option>';
                $output .= '<option value="Palatino, &quot;Palatino Linotype&quot;, serif"' . $font07 . '>Palatino</option>';
                $output .= '<option value="&quot;Helvetica Neue&quot;, Helvetica, sans-serif" ' . $font08 . '>Helvetica*</option>';
                $output .= '<option value="Calibri, Candara, Segoe, Optima, sans-serif"' . $font09 . '>Calibri*</option>';
                $output .= '<option value="&quot;Myriad Pro&quot;, Myriad, sans-serif"' . $font10 . '>Myriad Pro*</option>';
                $output .= '<option value="&quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, &quot;Lucida Sans&quot;, sans-serif"' . $font11 . '>Lucida</option>';
                $output .= '<option value="&quot;Arial Black&quot;, sans-serif" ' . $font12 . '>Arial Black</option>';
                $output .= '<option value="&quot;Gill Sans&quot;, &quot;Gill Sans MT&quot;, Calibri, sans-serif" ' . $font13 . '>Gill Sans*</option>';
                $output .= '<option value="Geneva, Tahoma, Verdana, sans-serif" ' . $font14 . '>Geneva*</option>';
                $output .= '<option value="Impact, Charcoal, sans-serif" ' . $font15 . '>Impact</option>';
                // Google webfonts
                $output .= '<option value="">-- Google Fonts --</option>';
                $output .= '<option value="Cantarell, Arial, serif" ' . $font16 . '>Cantarell</option>';
                $output .= '<option value="Cardo, Arial, serif" ' . $font17 . '>Cardo</option>';
                $output .= '<option value="Crimson Text, Arial, serif" ' . $font18 . '>Crimson Text</option>';
                $output .= '<option value="Droid Sans, Arial, serif" ' . $font19 . '>Droid Sans</option>';
                $output .= '<option value="Droid Sans Mono, Arial, serif" ' . $font20 . '>Droid Sans Mono</option>';
                $output .= '<option value="Droid Serif, Arial, serif" ' . $font21 . '>Droid Serif</option>';
                $output .= '<option value="IM Fell DW Pica, Arial, serif" ' . $font22 . '>IM Fell DW Pica</option>';
                $output .= '<option value="Inconsolata, Arial, serif" ' . $font23 . '>Inconsolata</option>';
                $output .= '<option value="Josefin Sans Std Light, Arial, serif" ' . $font24 . '>Josefin Sans Std Light</option>';
                $output .= '<option value="Lobster, Arial, serif" ' . $font25 . '>Lobster</option>';
                $output .= '<option value="Molengo, Arial, serif" ' . $font26 . '>Molengo</option>';
                $output .= '<option value="Nobile, Arial, serif" ' . $font27 . '>Nobile</option>';
                $output .= '<option value="OFL Sorts Mill Goudy TT, Arial, serif" ' . $font28 . '>OFL Sorts Mill Goudy TT</option>';
                $output .= '<option value="Old Standard TT, Arial, serif" ' . $font29 . '>Old Standard TT</option>';
                $output .= '<option value="Reenie Beanie, Arial, serif" ' . $font30 . '>Reenie Beanie</option>';
                $output .= '<option value="Tangerine, Arial, serif" ' . $font31 . '>Tangerine</option>';
                $output .= '<option value="Vollkorn, Arial, serif" ' . $font32 . '>Vollkorn</option>';
                $output .= '<option value="Yanone Kaffeesatz, Arial, serif" ' . $font33 . '>Yanone Kaffeesatz</option>';
                $new_stacks = get_option('framework_woo_font_stack');
                if (!empty($new_stacks)) {
                    $output .= '<option value="">-- Custom Font Stacks --</option>';
                    foreach ($new_stacks as $name => $stack) {
                        if (strpos($val, $stack) !== false) {
                            $fontstack = 'selected="selected"';
                        } else {
                            $fontstack = '';
                        }
                        $output .= '<option value="' . stripslashes(htmlentities($stack)) . '" ' . $fontstack . '>' . str_replace('_', ' ', $name) . '</option>';
                    }
                }
                $output .= '</select>';
                /* Font Weight */
                $val = $default['style'];
                if ($typography_stored['style'] != "") {
                    $val = $typography_stored['style'];
                }
                $normal = '';
                $italic = '';
                $bold = '';
                $bolditalic = '';
                if ($val == 'normal') {
                    $normal = 'selected="selected"';
                }
                if ($val == 'italic') {
                    $italic = 'selected="selected"';
                }
                if ($val == 'bold') {
                    $bold = 'selected="selected"';
                }
                if ($val == 'bold italic') {
                    $bolditalic = 'selected="selected"';
                }
                $output .= '<select class="woo-typography woo-typography-style" name="' . $value['id'] . '_style" id="' . $value['id'] . '_style">';
                $output .= '<option value="normal" ' . $normal . '>Normal</option>';
                $output .= '<option value="italic" ' . $italic . '>Italic</option>';
                $output .= '<option value="bold" ' . $bold . '>Bold</option>';
                $output .= '<option value="bold italic" ' . $bolditalic . '>Bold/Italic</option>';
                $output .= '</select>';
                /* Font Color */
                $val = $default['color'];
                if ($typography_stored['color'] != "") {
                    $val = $typography_stored['color'];
                }
                $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div></div></div>';
                $output .= '<input class="woo-color woo-typography woo-typography-color" name="' . $value['id'] . '_color" id="' . $value['id'] . '_color" type="text" value="' . $val . '" />';
                break;
            case "border":
                $default = $value['std'];
                $border_stored = get_option($value['id']);
                /* Border Width */
                $val = $default['width'];
                if ($border_stored['width'] != "") {
                    $val = $border_stored['width'];
                }
                $output .= '<select class="woo-border woo-border-width" name="' . $value['id'] . '_width" id="' . $value['id'] . '_width">';
                for ($i = 0; $i < 21; $i++) {
                    if ($val == $i) {
                        $active = 'selected="selected"';
                    } else {
                        $active = '';
                    }
                    $output .= '<option value="' . $i . '" ' . $active . '>' . $i . 'px</option>';
                }
                $output .= '</select>';
                /* Border Style */
                $val = $default['style'];
                if ($border_stored['style'] != "") {
                    $val = $border_stored['style'];
                }
                $solid = '';
                $dashed = '';
                $dotted = '';
                if ($val == 'solid') {
                    $solid = 'selected="selected"';
                }
                if ($val == 'dashed') {
                    $dashed = 'selected="selected"';
                }
                if ($val == 'dotted') {
                    $dotted = 'selected="selected"';
                }
                $output .= '<select class="woo-border woo-border-style" name="' . $value['id'] . '_style" id="' . $value['id'] . '_style">';
                $output .= '<option value="solid" ' . $solid . '>Solid</option>';
                $output .= '<option value="dashed" ' . $dashed . '>Dashed</option>';
                $output .= '<option value="dotted" ' . $dotted . '>Dotted</option>';
                $output .= '</select>';
                /* Border Color */
                $val = $default['color'];
                if ($border_stored['color'] != "") {
                    $val = $border_stored['color'];
                }
                $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div></div></div>';
                $output .= '<input class="woo-color woo-border woo-border-color" name="' . $value['id'] . '_color" id="' . $value['id'] . '_color" type="text" value="' . $val . '" />';
                break;
            case "images":
                $i = 0;
                $select_value = get_settings($value['id']);
                foreach ($value['options'] as $key => $option) {
                    $i++;
                    $checked = '';
                    $selected = '';
                    if ($select_value != '') {
                        if ($select_value == $key) {
                            $checked = ' checked';
                            $selected = 'woo-radio-img-selected';
                        }
                    } else {
                        if ($value['std'] == $key) {
                            $checked = ' checked';
                            $selected = 'woo-radio-img-selected';
                        } elseif ($i == 1 && !isset($select_value)) {
                            $checked = ' checked';
                            $selected = 'woo-radio-img-selected';
                        } elseif ($i == 1 && $value['std'] == '') {
                            $checked = ' checked';
                            $selected = 'woo-radio-img-selected';
                        } else {
                            $checked = '';
                        }
                    }
                    $output .= '<span>';
                    $output .= '<input type="radio" id="woo-radio-img-' . $value['id'] . $i . '" class="checkbox woo-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                    $output .= '<div class="woo-radio-img-label">' . $key . '</div>';
                    $output .= '<img src="' . $option . '" alt="" class="woo-radio-img-img ' . $selected . '" onClick="document.getElementById(\'woo-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                    $output .= '</span>';
                }
                break;
            case "info":
                $default = $value['std'];
                $output .= $default;
                break;
            case "string_builder":
                $desc = $value['std'];
                $output .= '<div id="' . $value['id'] . '">';
                $output .= 'Name<input class="woo-input woo-ignore" name="name" id="' . $value['id'] . '_name" type="text" />';
                $output .= 'Font Stack<input class="woo-input woo-ignore" name="value" id="' . $value['id'] . '_value" type="text" />';
                $output .= '<div class="add_button"><a class="button string_builder_add" href="#" class="string_builder" id="' . $value['id'] . '">Add</a></div>';
                $output .= '<div id="' . $value['id'] . '_return" class="string_builder_return">';
                $output .= '<h3>' . $desc . '</h3>';
                $saved_data = get_option($value['id']);
                if (!empty($saved_data)) {
                    foreach ($saved_data as $name => $data) {
                        $data = stripslashes($data);
                        $output .= '<div class="string_option" id="string_builer_option_' . str_replace(' ', '_', $name) . '"><a class="delete" rel="' . $name . '" href="#"><img src="' . get_bloginfo('template_url') . '/functions/images/ico-close.png" /></a><span>' . str_replace('_', ' ', $name) . ':</span> ' . $data . '</div>';
                    }
                }
                $output .= '<div style="display:none" class="string_builder_empty">Nothing added yet.</div>';
                $output .= '</div>';
                $output .= '</div>';
                break;
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $jquery_click_hook = ereg_replace("[^A-Za-z0-9]", "", strtolower($value['name']));
                $jquery_click_hook = "woo-option-" . $jquery_click_hook;
                //			$jquery_click_hook = "woo-option-" . str_replace("&","",str_replace("/","",str_replace(".","",str_replace(")","",str_replace("(","",str_replace(" ","",strtolower($value['name'])))))));
                $menu .= '<li><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;
        }
        // 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 woo-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 = $value['desc'];
            }
            $output .= '</div><div class="explain">' . $explain_value . '</div>' . "\n";
            $output .= '<div class="clear"> </div></div></div>' . "\n";
        }
    }
    $output .= '</div>';
    return array($output, $menu);
}