'."\n" . '
'."\n";
}
//End Heading
//if (!isset($smof_data[$value['id']]) && $value['type'] != "heading")
// continue;
//switch statement to handle various options type
switch ( $value['type'] ) {
//text input
case 'text':
$t_value = '';
$t_value = stripslashes($smof_data[$value['id']]);
$mini ='';
if(!isset($value['mod'])) $value['mod'] = '';
if($value['mod'] == 'mini') { $mini = 'mini';}
$output .= '
';
break;
//select option
case 'select':
$mini ='';
if(!isset($value['mod'])) $value['mod'] = '';
if($value['mod'] == 'mini') { $mini = 'mini';}
$output .= '
';
$output .= '';
foreach ($value['options'] as $select_ID => $option) {
$theValue = $option;
if (!is_numeric($select_ID))
$theValue = $select_ID;
$output .= ' '.$option.'';
}
$output .= '
';
break;
//textarea option
case 'textarea':
$cols = '8';
$ta_value = '';
if(isset($value['options'])){
$ta_options = $value['options'];
if(isset($ta_options['cols'])){
$cols = $ta_options['cols'];
}
}
$ta_value = stripslashes($smof_data[$value['id']]);
$output .= '
';
break;
//radiobox option
case "radio":
$checked = (isset($smof_data[$value['id']])) ? checked($smof_data[$value['id']], $option, false) : '';
foreach($value['options'] as $option=>$name) {
$output .= '
'.$name.' ';
}
break;
//checkbox option
case 'checkbox':
if (!isset($smof_data[$value['id']])) {
$smof_data[$value['id']] = 0;
}
$fold = '';
if (array_key_exists("folds",$value)) $fold="fld ";
$output .= '
';
$output .= '
';
break;
//multiple checkbox option
case 'multicheck':
(isset($smof_data[$value['id']]))? $multi_stored = $smof_data[$value['id']] : $multi_stored="";
foreach ($value['options'] as $key => $option) {
if (!isset($multi_stored[$key])) {$multi_stored[$key] = '';}
$of_key_string = $value['id'] . '_' . $key;
$output .= '
'. $option .' ';
}
break;
// Color picker
case "color":
$default_color = '';
if ( isset($value['std']) ) {
$default_color = ' data-default-color="' .$value['std'] . '" ';
}
$output .= '
';
break;
//typography option
case 'typography':
$typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
/* Font Size */
if(isset($typography_stored['size'])) {
$output .= '
';
$output .= '';
for ($i = 9; $i < 20; $i++){
$test = $i.'px';
$output .= ''. $i .'px ';
}
$output .= '
';
}
/* Line Height */
if(isset($typography_stored['height'])) {
$output .= '
';
$output .= '';
for ($i = 20; $i < 38; $i++){
$test = $i.'px';
$output .= ''. $i .'px ';
}
$output .= '
';
}
/* Font Face */
if(isset($typography_stored['face'])) {
$output .= '
';
$output .= '';
$faces = array('arial'=>'Arial',
'verdana'=>'Verdana, Geneva',
'trebuchet'=>'Trebuchet',
'georgia' =>'Georgia',
'times'=>'Times New Roman',
'tahoma'=>'Tahoma, Geneva',
'palatino'=>'Palatino',
'helvetica'=>'Helvetica' );
foreach ($faces as $i=>$face) {
$output .= ''. $face .' ';
}
$output .= '
';
}
/* Font Weight */
if(isset($typography_stored['style'])) {
$output .= '
';
$output .= '';
$styles = array('normal'=>'Normal',
'italic'=>'Italic',
'bold'=>'Bold',
'bold italic'=>'Bold Italic');
foreach ($styles as $i=>$style){
$output .= ''. $style .' ';
}
$output .= '
';
}
/* Font Color */
if(isset($typography_stored['color'])) {
$output .= '
';
$output .= '
';
}
break;
//border option
case 'border':
/* Border Width */
$border_stored = $smof_data[$value['id']];
$output .= '
';
$output .= '';
for ($i = 0; $i < 21; $i++){
$output .= ''. $i .' '; }
$output .= '
';
/* Border Style */
$output .= '
';
$output .= '';
$styles = array('none'=>'None',
'solid'=>'Solid',
'dashed'=>'Dashed',
'dotted'=>'Dotted');
foreach ($styles as $i=>$style){
$output .= ''. $style .' ';
}
$output .= '
';
/* Border Color */
$output .= '
';
$output .= '
';
break;
//images checkbox - use image as checkboxes
case 'images':
$i = 0;
$select_value = (isset($smof_data[$value['id']])) ? $smof_data[$value['id']] : '';
foreach ($value['options'] as $key => $option)
{
$i++;
$checked = '';
$selected = '';
if(NULL!=checked($select_value, $key, false)) {
$checked = checked($select_value, $key, false);
$selected = 'of-radio-img-selected';
}
$output .= '
';
$output .= ' ';
$output .= ''. $key .'
';
$output .= ' ';
$output .= ' ';
}
break;
//info (for small intro box etc)
case "info":
$info_text = $value['std'];
$output .= '
'.$info_text.'
';
break;
//display a single image
case "image":
$src = $value['std'];
$output .= '
';
break;
//tab heading
case 'heading':
if($counter >= 2){
$output .= '
'."\n";
}
//custom icon
$icon = '';
if(isset($value['icon'])){
$icon = ' style="background-image: url('. $value['icon'] .');"';
}
$header_class = str_replace(' ','',strtolower($value['name']));
$jquery_click_hook = str_replace(' ', '', strtolower($value['name']) );
$jquery_click_hook = "of-option-" . trim(preg_replace('/ +/', '', preg_replace('/[^A-Za-z0-9 ]/', '', urldecode(html_entity_decode(strip_tags($jquery_click_hook))))));
$menu .= '';
$output .= '
'.$value['name'].' '."\n";
break;
//drag & drop slide manager
case 'slider':
$output .= '
';
$slides = $smof_data[$value['id']];
$count = count($slides);
if ($count < 2) {
$oldorder = 1;
$order = 1;
$output .= Options_Machine::optionsframework_slider_function($value['id'],$value['std'],$oldorder,$order);
} else {
$i = 0;
foreach ($slides as $slide) {
$oldorder = $slide['order'];
$i++;
$order = $i;
$output .= Options_Machine::optionsframework_slider_function($value['id'],$value['std'],$oldorder,$order);
}
}
$output .= ' ';
$output .= '
Add New Slide ';
break;
//drag & drop block manager
case 'sorter':
// Make sure to get list of all the default blocks first
$all_blocks = $value['std'];
$temp = array(); // holds default blocks
$temp2 = array(); // holds saved blocks
foreach($all_blocks as $blocks) {
$temp = array_merge($temp, $blocks);
}
$sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
foreach( $sortlists as $sortlist ) {
$temp2 = array_merge($temp2, $sortlist);
}
// now let's compare if we have anything missing
foreach($temp as $k => $v) {
if(!array_key_exists($k, $temp2)) {
$sortlists['disabled'][$k] = $v;
}
}
// now check if saved blocks has blocks not registered under default blocks
foreach( $sortlists as $key => $sortlist ) {
foreach($sortlist as $k => $v) {
if(!array_key_exists($k, $temp)) {
unset($sortlist[$k]);
}
}
$sortlists[$key] = $sortlist;
}
// assuming all sync'ed, now get the correct naming for each block
foreach( $sortlists as $key => $sortlist ) {
foreach($sortlist as $k => $v) {
$sortlist[$k] = $temp[$k];
}
$sortlists[$key] = $sortlist;
}
$output .= '
';
if ($sortlists) {
foreach ($sortlists as $group=>$sortlist) {
$output .= '
';
$output .= ''.$group.' ';
foreach ($sortlist as $key => $list) {
$output .= ' ';
if ($key != "placebo") {
$output .= '';
$output .= ' ';
$output .= $list;
$output .= ' ';
}
}
$output .= ' ';
}
}
$output .= '
';
break;
//background images option
case 'tiles':
$i = 0;
$select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
if (is_array($value['options'])) {
foreach ($value['options'] as $key => $option) {
$i++;
$checked = '';
$selected = '';
if(NULL!=checked($select_value, $option, false)) {
$checked = checked($select_value, $option, false);
$selected = 'of-radio-tile-selected';
}
$output .= '
';
$output .= ' ';
$output .= '
';
$output .= ' ';
}
}
break;
//backup and restore options data
case 'backup':
$instructions = $value['desc'];
$backup = of_get_options(BACKUPS);
$init = of_get_options('smof_init');
if(!isset($backup['backup_log'])) {
$log = 'No backups yet';
} else {
$log = $backup['backup_log'];
}
$output .= '
';
$output .= '
'.$instructions."\n";
$output .= '
'. 'Last Backup : '.''.$log.'
'."\n";
$output .= '
Backup Options ';
$output .= '
Restore Options ';
$output .= '
';
break;
//export or import data between different installs
case 'transfer':
$instructions = $value['desc'];
$output .= '
'."\n";
$output .= '
Import Options ';
break;
// google font field
case 'select_google_font':
$output .= '
';
$output .= '';
foreach ($value['options'] as $select_key => $option) {
$output .= ' '.$option.'';
}
$output .= '
';
if(isset($value['preview']['text'])){
$g_text = $value['preview']['text'];
} else {
$g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
}
if(isset($value['preview']['size'])) {
$g_size = 'style="font-size: '. $value['preview']['size'] .';"';
} else {
$g_size = '';
}
$hide = " hide";
if ($smof_data[$value['id']] != "none" && $smof_data[$value['id']] != "")
$hide = "";
$output .= '
'. $g_text .'
';
break;
//JQuery UI Slider
case 'sliderui':
$s_val = $s_min = $s_max = $s_step = $s_edit = '';//no errors, please
$s_val = stripslashes($smof_data[$value['id']]);
if(!isset($value['min'])){ $s_min = '0'; }else{ $s_min = $value['min']; }
if(!isset($value['max'])){ $s_max = $s_min + 1; }else{ $s_max = $value['max']; }
if(!isset($value['step'])){ $s_step = '1'; }else{ $s_step = $value['step']; }
if(!isset($value['edit'])){
$s_edit = ' readonly="readonly"';
}
else
{
$s_edit = '';
}
if ($s_val == '') $s_val = $s_min;
//values
$s_data = 'data-id="'.$value['id'].'" data-val="'.$s_val.'" data-min="'.$s_min.'" data-max="'.$s_max.'" data-step="'.$s_step.'"';
//html output
$output .= '
';
$output .= '
';
break;
//Switch option
case 'switch':
if (!isset($smof_data[$value['id']])) {
$smof_data[$value['id']] = 0;
}
$fold = '';
if (array_key_exists("folds",$value)) $fold="s_fld ";
$cb_enabled = $cb_disabled = '';//no errors, please
//Get selected
if ($smof_data[$value['id']] == 1){
$cb_enabled = ' selected';
$cb_disabled = '';
}else{
$cb_enabled = '';
$cb_disabled = ' selected';
}
//Label ON
if(!isset($value['on'])){
$on = "On";
}else{
$on = $value['on'];
}
//Label OFF
if(!isset($value['off'])){
$off = "Off";
}else{
$off = $value['off'];
}
$output .= '
';
$output .= ''. $on .' ';
$output .= ''. $off .' ';
$output .= ' ';
$output .= ' ';
$output .= '
';
break;
// Uploader 3.5
case "upload":
case "media":
if(!isset($value['mod'])) $value['mod'] = '';
$u_val = '';
if($smof_data[$value['id']]){
$u_val = stripslashes($smof_data[$value['id']]);
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'],$u_val, $value['mod']);
break;
}
do_action('optionsframework_machine_loop', array(
'options' => $options,
'smof_data' => $smof_data,
'defaults' => $defaults,
'counter' => $counter,
'menu' => $menu,
'output' => $output,
'value' => $value
));
if ($smof_output != "") {
$output .= $smof_output;
$smof_output = "";
}
//description of each option
if ( $value['type'] != 'heading') {
if(!isset($value['desc'])){ $explain_value = ''; } else{
$explain_value = '
'. $value['desc'] .'
'."\n";
}
$output .= '