'; echo ''; echo ''; } } if ( !function_exists ( "vs_module_layer_list" )){ add_action('wp_ajax_vs_module_layer_list', 'vs_module_layer_list'); function vs_module_layer_list($none_ajax='',$layer=[]){ if(empty($none_ajax)){ if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce(sanitize_text_field(wp_unslash( $_POST['_wpnonce'])), 'vs_slider_nonce' ) ) return; $post_id =!empty($_POST['post_id'])? absint(wp_unslash($_POST['post_id'])):absint(get_the_ID()) ; if (!current_user_can('edit_post', $post_id)) return; } if(!empty($_POST['layer_template_id'])){ $template = get_option( 'vs_layer_template'); $layer_template_id =sanitize_key(wp_unslash($_POST['layer_template_id'])); $layer_json = urldecode($template[sanitize_key($layer_template_id)]['layer']); $layer= vs_options_array_row($layer_json); } if (!empty($layer)) : foreach($layer as $key => $value): vs_module_layer_item(true,$key,$value); endforeach; endif; if(empty($none_ajax)){ die(''); } } } if ( !function_exists ( "vs_module_layer_item" )){ add_action('wp_ajax_vs_module_layer_item', 'vs_module_layer_item'); function vs_module_layer_item($none_ajax='',$key =false,$value=false){ if(empty($none_ajax)){ if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce(sanitize_text_field(wp_unslash( $_POST['_wpnonce'])), 'vs_slider_nonce' ) ) return; $post_id =!empty($_POST['post_id'])? absint(wp_unslash($_POST['post_id'])):absint(get_the_ID()) ; if (!current_user_can('edit_post', $post_id)) return; } if(!empty($_POST['layer_template_id']) && empty($none_ajax)){ $layer_key = 'r'.wp_rand(0000000001,9999999999); $layer_id = $value['id']; }else{ $layer_key = !empty($_POST['layer_key']) ? sanitize_key(wp_unslash($_POST['layer_key'])): $key; $layer_id = !empty($_POST['layer_id']) ? sanitize_key(wp_unslash($_POST['layer_id'])): $value['id']; } echo '
  • '; vs_module_layer_title($layer_id); vs_module_layer_options($layer_key,$layer_id,$value); echo '
  • '; if(empty($none_ajax)){ die(''); } } } if ( !function_exists ( "vs_module_layer_title" )){ function vs_module_layer_title($layer_id) { echo '
    '; echo '
    '; global $vs_layer_options_element; if(!empty($vs_layer_options_element)): foreach ($vs_layer_options_element as $options): if($options['id'] == $layer_id){ if(!empty($options['name'])) echo esc_html($options['name']); } endforeach; endif; echo ''; echo '
    '; echo '
    '; echo ''; echo ''; echo ''; echo ''; echo '
    '; echo '
    '; } } /***************************************************************************************************************************************************** ****************************************************************************************************************************************************** vs_slider_layer_options_value *///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if ( !function_exists ( "vs_module_layer_tabs" )){ function vs_module_layer_tabs($layer_id){ global $vs_layer_options_element; $tab= array(); foreach ($vs_layer_options_element as $layer_options) : if( $layer_options['id'] == $layer_id) { if($layer_options['options']): foreach ($layer_options['options'] as $option ) : if(!empty($option['group'])){ $dass = sanitize_title($option['group']); if(!array_key_exists($dass,$tab)){ $tab[sanitize_title($option['group'])] = $option['group']; } }else{ $general = esc_html__('General','visual-slider'); $tab[sanitize_title($general)] = $general; } endforeach; endif; } endforeach; return $tab; } } if ( !function_exists ( "vs_module_layer_options" )){ function vs_module_layer_options($layer_key=false,$layer_id =false,$layer_value =false){ global $post; //Section global $vs_layer_options_element; echo '
    '; //Title echo '
    '.esc_html__('Layer Options','visual-slider').''; echo '
    '; echo '
    '; foreach ($vs_layer_options_element as $layer_options): if( $layer_options['id']== $layer_id ) { echo'
    '; $array_tab = vs_module_layer_tabs($layer_id); $count_tab=0; foreach ($array_tab as $key=> $tabs) : $count_tab++; if($count_tab==1){ $tab_active = 'vs_layout_active'; }else{ $tab_active = ''; } echo''.esc_html($tabs).''; endforeach; echo'
    '; } endforeach; //Content echo ''; echo '
    '; echo '
    '; } } /***************************************************************************************************************************************************** ****************************************************************************************************************************************************** vs_slider_layer_options_value *///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if ( !function_exists ( "vs_add_layer" )){ function vs_add_layer() { $layer=array(); global $vs_layer_options_element; $count=0; echo '
    '; echo '
    '; // Title echo '

    '.esc_html__('Add New Layer','visual-slider').'

    '; echo '
    '.esc_html__('Cancel','visual-slider').'
    '; echo '
    '.esc_html__('Add Layer','visual-slider').'
    '; echo '
    '; //Content echo '
    '; foreach ($vs_layer_options_element as $value): echo '
    '; echo '<'.esc_attr('img').' src="'.esc_url($value['img']).'" />'; if(!empty($value['name'])){ echo ''.esc_html($value['name']).''; } echo '
    '; endforeach; echo '
    '; //Bottom echo '
    '; echo '
    '; } }