1){ $query_inner .= ' OR '; } if($option_type == 'multicheck'){ $multicount = 0; foreach($option['options'] as $option_key => $option_option){ $multicount++; if($multicount > 1){ $query_inner .= ' OR '; } $query_inner .= "option_name = '" . $option_id . "_" . $option_key . "'"; } } else if(is_array($option_type)) { $type_array_count = 0; foreach($option_type as $inner_option){ $type_array_count++; $option_id = $inner_option['id']; if($type_array_count > 1){ $query_inner .= ' OR '; } $query_inner .= "option_name = '$option_id'"; } } else { $query_inner .= "option_name = '$option_id'"; } } } //When Theme Options page is reset - Add the of_options option if($page == 'optionsframework'){ $query_inner .= " OR option_name = 'of_options'"; } //echo $query_inner; $query = "DELETE FROM $wpdb->options WHERE $query_inner"; $wpdb->query($query); } /*-----------------------------------------------------------------------------------*/ /* Build the Options Page - optionsframework_options_page */ /*-----------------------------------------------------------------------------------*/ function optionsframework_options_page(){ $options = get_option('of_template'); $themename = get_option('of_themename'); //Version in Backend Head $theme_data = get_theme_data(TEMPLATEPATH . '/style.css'); $local_version = $theme_data['Version']; ?>
Options Updated
Options Reset
'; // COLOR Picker ?> options WHERE option_name LIKE '$id'"; $wpdb->query($query); } elseif ($save_type == 'options' OR $save_type == 'framework') { $data = $_POST['data']; parse_str($data,$output); //print_r($output); //Pull options $options = get_option('of_template'); foreach($options as $option_array){ $id = $option_array['id']; $old_value = get_option($id); $new_value = ''; if(isset($output[$id])){ $new_value = $output[$option_array['id']]; } if(isset($option_array['id'])) { // Non - Headings... $type = $option_array['type']; if ( is_array($type)){ foreach($type as $array){ if($array['type'] == 'text'){ $id = $array['id']; $std = $array['std']; $new_value = $output[$id]; if($new_value == ''){ $new_value = $std; } update_option( $id, stripslashes($new_value)); } } } elseif($new_value == '' && $type == 'checkbox'){ // Checkbox Save update_option($id,'false'); } elseif ($new_value == 'true' && $type == 'checkbox'){ // Checkbox Save update_option($id,'true'); } elseif($type == 'multicheck'){ // Multi Check Save $option_options = $option_array['options']; foreach ($option_options as $options_id => $options_value){ $multicheck_id = $id . "_" . $options_id; if(!isset($output[$multicheck_id])){ update_option($multicheck_id,'false'); } else{ update_option($multicheck_id,'true'); } } } elseif($type == 'typography'){ $typography_array = array(); $typography_array['size'] = $output[$option_array['id'] . '_size']; $typography_array['face'] = stripslashes($output[$option_array['id'] . '_face']); $typography_array['style'] = $output[$option_array['id'] . '_style']; $typography_array['color'] = $output[$option_array['id'] . '_color']; update_option($id,$typography_array); } elseif($type == 'border'){ $border_array = array(); $border_array['width'] = $output[$option_array['id'] . '_width']; $border_array['style'] = $output[$option_array['id'] . '_style']; $border_array['color'] = $output[$option_array['id'] . '_color']; update_option($id,$border_array); } elseif($type != 'upload_min'){ update_option($id,stripslashes($new_value)); } } } } die(); } /*-----------------------------------------------------------------------------------*/ /* Generates The Options Within the Panel - optionsframework_machine */ /*-----------------------------------------------------------------------------------*/ function optionsframework_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 .= '
'."\n".'
'."\n"; $output .= '
'."\n"; $output .= '

'. $value['name'] .'

'."\n"; $output .= '
'."\n" . '
'."\n"; } //End Heading $select_value = ''; switch ( $value['type'] ) { case 'text': $val = $value['std']; $std = get_option($value['id']); if ( $std != "") { $val = $std; } $output .= ''; break; case 'select': $output .= ''; break; case 'select2': $output .= ''; 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 .= ''; 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 .= '' . $option .'
'; } 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 .= ''; break; case "multicheck": $std = $value['std']; foreach ($value['options'] as $key => $option) { $of_key = $value['id'] . '_' . $key; $saved_std = get_option($of_key); if(!empty($saved_std)) { if($saved_std == 'true'){ $checked = 'checked="checked"'; } else{ $checked = ''; } } elseif( $std == $key) { $checked = 'checked="checked"'; } else { $checked = ''; } $output .= '
'; } break; case "upload": $output .= optionsframework_uploader_function($value['id'],$value['std'],null); break; case "upload_min": $output .= optionsframework_uploader_function($value['id'],$value['std'],'min'); break; case "color": $val = $value['std']; $stored = get_option( $value['id'] ); if ( $stored != "") { $val = $stored; } $output .= '
'; $output .= ''; 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 .= ''; /* Font Face */ $val = $default['face']; if ( $typography_stored['face'] != "") $val = $typography_stored['face']; $font01 = ''; $font02 = ''; $font03 = ''; $font04 = ''; $font05 = ''; $font06 = ''; $font07 = ''; $font08 = ''; $font09 = ''; 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"'; } $output .= ''; /* 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 .= ''; /* Font Color */ $val = $default['color']; if ( $typography_stored['color'] != "") { $val = $typography_stored['color']; } $output .= '
'; $output .= ''; 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 .= ''; /* 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 .= ''; /* Border Color */ $val = $default['color']; if ( $border_stored['color'] != "") { $val = $border_stored['color']; } $output .= '
'; $output .= ''; 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 = 'of-radio-img-selected'; } } else { if ($value['std'] == $key) { $checked = ' checked'; $selected = 'of-radio-img-selected'; } elseif ($i == 1 && !isset($select_value)) { $checked = ' checked'; $selected = 'of-radio-img-selected'; } elseif ($i == 1 && $value['std'] == '') { $checked = ' checked'; $selected = 'of-radio-img-selected'; } else { $checked = ''; } } $output .= ''; $output .= ''; $output .= '
'. $key .'
'; $output .= ''; $output .= '
'; } break; case "info": $default = $value['std']; $output .= $default; break; case "heading": if($counter >= 2){ $output .= '
'."\n"; } $jquery_click_hook = ereg_replace("[^A-Za-z0-9]", "", strtolower($value['name']) ); $jquery_click_hook = "of-option-" . $jquery_click_hook; $menu .= '
  • '. $value['name'] .'
  • '; $output .= '

    '.$value['name'].'

    '."\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 .= ''; $output .= ''.$meta.''; } } } if ( $value['type'] != "heading" ) { if ( $value['type'] != "checkbox" ) { $output .= '
    '; } if(!isset($value['desc'])){ $explain_value = ''; } else{ $explain_value = $value['desc']; } $output .= '
    '. $explain_value .'
    '."\n"; $output .= '
    '."\n"; } } $output .= '
    '; return array($output,$menu); } /*-----------------------------------------------------------------------------------*/ /* OptionsFramework Uploader - optionsframework_uploader_function */ /*-----------------------------------------------------------------------------------*/ function optionsframework_uploader_function($id,$std,$mod){ //$uploader .= ''; //$uploader .= ''; $uploader = ''; $upload = get_option($id); if($mod != 'min') { $val = $std; if ( get_option( $id ) != "") { $val = get_option($id); } $uploader .= ''; } $uploader .= '
    Upload Image'; if(!empty($upload)) {$hide = '';} else { $hide = 'hide';} $uploader .= 'Remove'; $uploader .='
    ' . "\n"; $uploader .= '
    ' . "\n"; if(!empty($upload)){ $uploader .= ''; $uploader .= ''; $uploader .= ''; } $uploader .= '
    ' . "\n"; return $uploader; } ?>