| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly. |
| 4 |
} |
| 5 |
if ( !function_exists ( "vs_perview_slide_warp" )){ |
| 6 |
function vs_perview_slide_warp(){ |
| 7 |
|
| 8 |
if ( ! isset( $_POST['_wpnonce'] ) || |
| 9 |
! wp_verify_nonce(sanitize_text_field(wp_unslash( $_POST['_wpnonce'])), 'vs_slider_nonce' ) ) |
| 10 |
return; |
| 11 |
$post_id =!empty($_POST['post_id'])? absint(wp_unslash($_POST['post_id'])): absint(get_the_ID()); |
| 12 |
if (!current_user_can('edit_post', $post_id) && !current_user_can('manage_options')){ |
| 13 |
return; |
| 14 |
} |
| 15 |
|
| 16 |
$setting_json = !empty($_POST['vs_setting_json'])? wp_unslash(filter_input(INPUT_POST, 'vs_setting_json', FILTER_UNSAFE_RAW)):''; |
| 17 |
|
| 18 |
$css=''; |
| 19 |
$setting_value= vs_options_array_row($setting_json,'st'); |
| 20 |
|
| 21 |
$setting_type= !empty($setting_value['type'])?$setting_value['type']:'slider'; |
| 22 |
$class=' vs-has-desktop vs-perview-type-'.$setting_type; |
| 23 |
|
| 24 |
if($setting_type=='glider'){ |
| 25 |
$css.=vs_perview_glider_css($setting_value); |
| 26 |
}else{ |
| 27 |
|
| 28 |
$css = vs_slider_var_2('wt',$setting_value,'size','width'); |
| 29 |
$css.= vs_slider_var_2('ht',$setting_value,'size','height'); |
| 30 |
if(!empty($setting_value['responsive_tablet'])){ |
| 31 |
$css.= vs_slider_var_2('tab-wt',$setting_value,'tablet_size','width'); |
| 32 |
$css.= vs_slider_var_2('tab-ht',$setting_value,'tablet_size','height'); |
| 33 |
} |
| 34 |
|
| 35 |
if(!empty($setting_value['responsive_mobile'])){ |
| 36 |
$css.= vs_slider_var_2('mob-wt',$setting_value,'mobile_size','width'); |
| 37 |
$css.= vs_slider_var_2('mob-ht',$setting_value,'mobile_size','height'); |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
if(!empty($setting_value['responsive_tablet'])){ |
| 42 |
$class.=' vs-has-tablet '; |
| 43 |
} |
| 44 |
if(!empty($setting_value['responsive_mobile'])){ |
| 45 |
$class.=' vs-has-mobile '; |
| 46 |
} |
| 47 |
|
| 48 |
$class.= !empty($setting_value['full_width']) && $setting_type!=='glider' ? ' vs-full-width ' :' vs-not-width '; |
| 49 |
$perview_width = !empty($setting_value['full_width']) && $setting_type!=='glider' ? ' vs-perview-full-width ' :' vs-perview-not-width '; |
| 50 |
?> |
| 51 |
|
| 52 |
<div class="vs_perview_slide vs_perview <?php echo esc_attr($perview_width);?> " style=" <?php echo esc_attr($css);?>"> |
| 53 |
|
| 54 |
<div class="vs_perview_heading" > |
| 55 |
<div class="vs_perview_heading_animte vs_perview_heading_item" > |
| 56 |
<span class="vs_animte_play"><?php echo esc_html__('Start Animation','visual-slider');?></span> |
| 57 |
<span class="vs_animte_stop"><?php echo esc_html__('Stop Animation','visual-slider');?></span> |
| 58 |
</div> |
| 59 |
<div class="vs_perview_heading_desktop vs_perview_heading_item vs_perview_heading_full_screen_hide"> |
| 60 |
<label for="#vs_perview_desktop_width"><?php echo esc_html__('Edit on Desktop ','visual-slider');?></label> |
| 61 |
|
| 62 |
</div> |
| 63 |
|
| 64 |
<?php if(!empty($setting_value['responsive_tablet'])){?> |
| 65 |
<div class="vs_perview_heading_tablet vs_perview_heading_item vs_perview_heading_full_screen_hide"> |
| 66 |
<label for="#vs_perview_tablet_width"><?php echo esc_html__('Edit on Tablet','visual-slider');?></label> |
| 67 |
|
| 68 |
</div> |
| 69 |
<?php } ?> |
| 70 |
|
| 71 |
<?php if(!empty($setting_value['responsive_mobile'])){?> |
| 72 |
<div class="vs_perview_heading_mobile vs_perview_heading_item vs_perview_heading_full_screen_hide"> |
| 73 |
<label for="#vs_perview_mobile_width"><?php echo esc_html__('Edit on Mobile','visual-slider');?></label> |
| 74 |
|
| 75 |
</div> |
| 76 |
|
| 77 |
<?php }?> |
| 78 |
|
| 79 |
|
| 80 |
<div class="vs_perview_heading_desktop vs_perview_heading_full_screen_show vs_perview_heading_item"> |
| 81 |
<label for="#vs_perview_desktop_width"><?php echo esc_html__('View on Desktop','visual-slider');?></label> |
| 82 |
|
| 83 |
<select id="vs_perview_desktop_width" name="vs_perview_desktop_width"> |
| 84 |
<option value="1920px"><?php echo esc_html('1920px');?></option> |
| 85 |
<option value="1680px"><?php echo esc_html('1680px');?></option> |
| 86 |
<option value="1440px"><?php echo esc_html('1440px');?></option> |
| 87 |
<option value="1366px"><?php echo esc_html('1366px');?></option> |
| 88 |
<option value="1280px"><?php echo esc_html('1280px');?></option> |
| 89 |
<option value="1040px"><?php echo esc_html('1040px');?></option> |
| 90 |
</select> |
| 91 |
</div> |
| 92 |
|
| 93 |
|
| 94 |
<div class="vs_perview_heading_tablet vs_perview_heading_full_screen_show vs_perview_heading_item"> |
| 95 |
<label for="#vs_perview_tablet_width"><?php echo esc_html__('View on Tablet','visual-slider');?></label> |
| 96 |
<select id="vs_perview_tablet_width" name="vs_perview_tablet_width"> |
| 97 |
<option value="1024px"><?php echo esc_html('1024px');?></option> |
| 98 |
<option value="991px"><?php echo esc_html('991px');?></option> |
| 99 |
<option value="800px"><?php echo esc_html('800px');?></option> |
| 100 |
<option value="751px"><?php echo esc_html('751px');?></option> |
| 101 |
</select> |
| 102 |
</div> |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
<div class="vs_perview_heading_mobile vs_perview_heading_full_screen_show vs_perview_heading_item"> |
| 107 |
<label for="#vs_perview_mobile_width"><?php echo esc_html__('View on Mobile','visual-slider');?></label> |
| 108 |
<select id="vs_perview_mobile_width" name="vs_perview_mobile_width" value="480px"> |
| 109 |
<option value="750px"><?php echo esc_html('750px');?></option> |
| 110 |
<option value="680px"><?php echo esc_html('680px');?></option> |
| 111 |
<option value="640px"><?php echo esc_html('640px');?></option> |
| 112 |
<option value="520px"><?php echo esc_html('520px');?></option> |
| 113 |
<option value="480px"><?php echo esc_html('480px');?></option> |
| 114 |
<option value="320px"><?php echo esc_html('320px');?></option> |
| 115 |
</select> |
| 116 |
</div> |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
<div class="vs_perview_heading_full_screen vs_perview_heading_item"> |
| 124 |
<div class="vs_perview_full_screen_mode"><?php echo esc_html__('View on Full Screen','visual-slider');?></div> |
| 125 |
<div class="vs_perview_full_screen_close"><?php echo esc_html__('Close Full Screen','visual-slider');?></div> |
| 126 |
|
| 127 |
</div> |
| 128 |
</div> |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
<div class="vs_perview_slide_scroll " > |
| 136 |
<div class="vs_perview_slide_content " > |
| 137 |
<div class="vs-slide-warp vs-visualslider vs-not-scale <?php echo esc_attr($class);?>" > |
| 138 |
<div class="vs-slide-list-warp" > |
| 139 |
<div class="vs-mode-fade vs-slide-list " > |
| 140 |
<?php vs_perview_slide(); ?> |
| 141 |
</div> |
| 142 |
</div> |
| 143 |
</div> |
| 144 |
</div> |
| 145 |
</div> |
| 146 |
</div> |
| 147 |
<?php |
| 148 |
// die(); |
| 149 |
|
| 150 |
} |
| 151 |
} |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
if ( !function_exists ( "vs_perview_slide" )){ |
| 157 |
function vs_perview_slide(){ |
| 158 |
|
| 159 |
|
| 160 |
if ( ! isset( $_POST['_wpnonce'] ) || |
| 161 |
! wp_verify_nonce(sanitize_text_field(wp_unslash( $_POST['_wpnonce'])), 'vs_slider_nonce' ) ) |
| 162 |
return; |
| 163 |
$post_id =!empty($_POST['post_id'])? absint(wp_unslash($_POST['post_id'])): absint(get_the_ID()); |
| 164 |
if (!current_user_can('edit_post', $post_id) && !current_user_can('manage_options')){ |
| 165 |
return; |
| 166 |
} |
| 167 |
|
| 168 |
|
| 169 |
if(!empty(vs_validate_decode_code(wp_unslash(filter_input(INPUT_POST, 'option', FILTER_UNSAFE_RAW))))){ |
| 170 |
$slide_value = vs_new_decode(wp_unslash(filter_input(INPUT_POST, 'option', FILTER_UNSAFE_RAW)),'op'); |
| 171 |
}else{ |
| 172 |
$slide_value = !empty($_POST['option'])? vs_options_decode(urldecode(wp_unslash(filter_input(INPUT_POST, 'option', FILTER_UNSAFE_RAW)))):''; |
| 173 |
} |
| 174 |
|
| 175 |
if(!empty(vs_validate_decode_code(wp_unslash(filter_input(INPUT_POST, 'layer', FILTER_UNSAFE_RAW))))){ |
| 176 |
$layer = vs_new_decode(wp_unslash(filter_input(INPUT_POST, 'layer', FILTER_UNSAFE_RAW)),'ly'); |
| 177 |
}else{ |
| 178 |
$layer =!empty($_POST['layer']) ? vs_options_decode(urldecode(wp_unslash(filter_input(INPUT_POST, 'layer', FILTER_UNSAFE_RAW)))):''; |
| 179 |
} |
| 180 |
$css =vs_slider_var_gradient_background_color('sl',$slide_value,'background_color'); |
| 181 |
$css.=vs_slider_background_image('sl',$slide_value,'background_image'); |
| 182 |
$css.=vs_slider_var_background_image_position('sl',$slide_value,'background_image_position'); |
| 183 |
$css.=vs_slider_var_background_image_position('sl-tab',$slide_value,'tablet_background_image_position'); |
| 184 |
$css.=vs_slider_var_background_image_position('sl-mob',$slide_value,'mobile_background_image_position'); |
| 185 |
|
| 186 |
|
| 187 |
echo '<div class="vs-slide vs-perview-slide" style="'.esc_attr($css).'">'; |
| 188 |
echo '<aside class="vs-slide-cover"></aside>'; |
| 189 |
|
| 190 |
vs_perview_layer(true,$layer); |
| 191 |
|
| 192 |
echo '</div>'; |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
} |
| 197 |
} |
| 198 |
if ( !function_exists ( "vs_perview_layer" )){ |
| 199 |
add_action('wp_ajax_vs_perview_layer', 'vs_perview_layer'); |
| 200 |
function vs_perview_layer($none_ajax='',$layer=[]){ |
| 201 |
|
| 202 |
if(empty($none_ajax)){ |
| 203 |
if ( ! isset( $_POST['_wpnonce'] ) || |
| 204 |
! wp_verify_nonce(sanitize_text_field(wp_unslash( $_POST['_wpnonce'])), 'vs_slider_nonce' ) ) |
| 205 |
return; |
| 206 |
$post_id =!empty($_POST['post_id'])? absint(wp_unslash($_POST['post_id'])): absint(get_the_ID()); |
| 207 |
if (!current_user_can('edit_post', $post_id) && !current_user_can('manage_options')){ |
| 208 |
return; |
| 209 |
} |
| 210 |
} |
| 211 |
|
| 212 |
|
| 213 |
if(!empty($_POST['layer_json']) && empty($none_ajax)){ |
| 214 |
|
| 215 |
if(!empty(vs_validate_decode_code(wp_unslash(filter_input(INPUT_POST, 'layer_json', FILTER_UNSAFE_RAW))))){ |
| 216 |
$layer = vs_new_decode(wp_unslash(filter_input(INPUT_POST, 'layer_json', FILTER_UNSAFE_RAW)),'ly'); |
| 217 |
}else{ |
| 218 |
$layer =vs_options_decode(urldecode(wp_unslash(filter_input(INPUT_POST, 'layer_json', FILTER_UNSAFE_RAW)))); |
| 219 |
} |
| 220 |
} |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
echo '<div class="vs-layer-warp">'; |
| 225 |
echo '<div class="vs-layer-list">'; |
| 226 |
|
| 227 |
if (!empty($layer)) : |
| 228 |
foreach($layer as $layer_key => $layer_value): |
| 229 |
$layer_value['key']=$layer_key; |
| 230 |
$layer_id= $layer_value['id']; |
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
if(has_filter('vs_layer_perview_'.$layer_id)) { |
| 235 |
apply_filters('vs_layer_perview_'.$layer_id, $layer_value) ; |
| 236 |
} |
| 237 |
|
| 238 |
|
| 239 |
endforeach; |
| 240 |
endif; |
| 241 |
|
| 242 |
echo '</div>'; |
| 243 |
echo '</div>'; |
| 244 |
if(empty($none_ajax)){ |
| 245 |
die(''); |
| 246 |
} |
| 247 |
|
| 248 |
} |
| 249 |
} |
| 250 |
|