| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly. |
| 4 |
} |
| 5 |
if ( !function_exists ( "vs_module_setting" )){ |
| 6 |
|
| 7 |
function vs_module_setting($value_id=false){ |
| 8 |
global $post; |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
$setting_array=array(); |
| 13 |
$vs_setting_options = array(apply_filters('vs_setting_options',$setting_array)); |
| 14 |
|
| 15 |
|
| 16 |
if(empty($value_id)){ |
| 17 |
|
| 18 |
$value_default=array(); |
| 19 |
foreach ($vs_setting_options as $setting_options): |
| 20 |
if(!empty($setting_options)): |
| 21 |
foreach ($setting_options as $option ): |
| 22 |
|
| 23 |
if(!empty($option['default']) && !empty($option['id'])){ |
| 24 |
$value_default[$option['id']] = $option['default']; |
| 25 |
} |
| 26 |
endforeach; |
| 27 |
endif; |
| 28 |
|
| 29 |
endforeach; |
| 30 |
|
| 31 |
$value_id = $value_default ; |
| 32 |
}else{ |
| 33 |
$value_id =$value_id; |
| 34 |
} |
| 35 |
//Section |
| 36 |
echo '<div class="vs_module_setting vs_global_desktop vs_options" >'; |
| 37 |
|
| 38 |
|
| 39 |
echo'<div class="vs_title_tabs">'; |
| 40 |
foreach ($vs_setting_options as $setting_options): |
| 41 |
|
| 42 |
$array_tab = vs_setting_tabs(); |
| 43 |
$count_tab=0; |
| 44 |
foreach ($array_tab as $key=> $tabs) : |
| 45 |
$count_tab++; |
| 46 |
if($count_tab==1){ |
| 47 |
$tab_active = 'vs_layout_active'; |
| 48 |
}else{ |
| 49 |
$tab_active = ''; |
| 50 |
} |
| 51 |
echo'<a class="vs_tab_'.esc_attr($key).' '.esc_attr($tab_active).'" data-id="'.esc_attr($key).'">'.esc_html($tabs).'</a>'; |
| 52 |
endforeach; |
| 53 |
|
| 54 |
endforeach; |
| 55 |
echo '</div>'; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
echo '<div class="vs_options_content">'; |
| 60 |
foreach ($vs_setting_options as $setting_options): |
| 61 |
|
| 62 |
$array_tab = vs_setting_tabs(); |
| 63 |
$count_container=0; |
| 64 |
foreach ($array_tab as $key=> $tabs): |
| 65 |
|
| 66 |
$count_container++; |
| 67 |
if($count_container==1){ |
| 68 |
$group_active = 'vs_layout_group_active'; |
| 69 |
}else{ |
| 70 |
$group_active = ''; |
| 71 |
} |
| 72 |
|
| 73 |
echo '<section class="vs_options_warp '.esc_attr($group_active).' " data-tab="'.esc_attr($key).'">'; |
| 74 |
foreach ($setting_options as $option ): |
| 75 |
$general = !empty($option['group']) ? sanitize_title($option['group']):sanitize_title(esc_html__('General','visual-slider')); |
| 76 |
if($key == $general ){ |
| 77 |
if(!empty($option['name']) && !empty($option['id']) && !empty($option['type'])){ |
| 78 |
$data_options = !empty( $option['options'] ) ? $option['options'] : null; |
| 79 |
$desc = !empty( $option['desc'] ) ? $option['desc'] : null; |
| 80 |
$placeholder = !empty( $option['placeholder'] ) ? $option['placeholder'] : null; |
| 81 |
$fold = !empty( $option['fold'] ) ? $option['fold'] : null; |
| 82 |
$unit = !empty( $option['unit'] ) ? $option['unit'] : null; |
| 83 |
$min = !empty( $option['min'] ) ? $option['min'] : null; |
| 84 |
$max = !empty( $option['max'] ) ? $option['max'] : null; |
| 85 |
$step = !empty( $option['step'] ) ? $option['step'] : null; |
| 86 |
$width = !empty( $option['width'] ) ? $option['width'] : null; |
| 87 |
$responsive = !empty( $option['responsive'] ) ? $option['responsive'] : null; |
| 88 |
$warp_width = !empty( $option['warp_width'] ) ? $option['warp_width'] : null; |
| 89 |
$value =!empty($value_id[$option['id']])?$value_id[$option['id']]:''; |
| 90 |
vs_options_function($value, $option['name'],'vs_setting['.$option['id'].']',$option['type'],$data_options,$desc,$placeholder,$fold,'setting_'.$option['id'],$unit,'',$min,$max,$step,$width,$responsive,$warp_width ); |
| 91 |
} |
| 92 |
} |
| 93 |
endforeach; |
| 94 |
echo '</section>'; |
| 95 |
|
| 96 |
endforeach; |
| 97 |
|
| 98 |
endforeach; |
| 99 |
echo '</div>'; |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
echo '</div>'; |
| 104 |
|
| 105 |
|
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
|
| 110 |
if ( !function_exists ( "vs_setting_tabs" )){ |
| 111 |
function vs_setting_tabs(){ |
| 112 |
$setting=array(); |
| 113 |
$vs_setting_options = array(apply_filters('vs_setting_options',$setting)); |
| 114 |
$tab= array(); |
| 115 |
|
| 116 |
foreach ($vs_setting_options as $setting) : |
| 117 |
foreach ($setting as $option ) : |
| 118 |
if(!empty($option['group'])){ |
| 119 |
$dass = sanitize_title($option['group']); |
| 120 |
if(!array_key_exists($dass,$tab)){ |
| 121 |
$tab[sanitize_title($option['group'])] = $option['group']; |
| 122 |
} |
| 123 |
}else{ |
| 124 |
$general = esc_html__('General','visual-slider'); |
| 125 |
$tab[sanitize_title($general)] = $general; |
| 126 |
} |
| 127 |
endforeach; |
| 128 |
endforeach; |
| 129 |
|
| 130 |
return $tab; |
| 131 |
|
| 132 |
} |
| 133 |
} |
| 134 |
|
| 135 |
|