<?php
/****************** SLIDER ********************/
function alc_slider( $atts, $content ){
	$GLOBALS['slideritem_count'] = 0;
	extract(shortcode_atts(array(
        'smimages' => '',
		"anim"=>'',
		"class"=>'',
		"auto"=>'',
		"speed" => '',
	), $atts));
	do_shortcode( $content );
	$randomId = mt_rand(0, 100000);
	$return = '';
	$anim=(!empty($anim)) ? 'animation '.$anim : '';
	$imgId = explode(',', $smimages);
	$randomId = mt_rand(0, 100000);
		$return.='<div class="flexslidershort '.$anim.' '.$class.'" id="flexslider-'.$randomId.'">
					<ul class="slides" >';
	foreach ($imgId as $smimage) {
				$return.='<li>
							<img src="' . wp_get_attachment_url($smimage) . '" alt="' . $smimage . '" />
						</li>';		
	}
		$return.='</ul>
				</div>';
	$rtl= weblusive_get_option('rtl_mode');
	if($rtl){
		$rtl='true';
	}else{
		$rtl='false';
	}
	$return.='<script type="text/javascript">
				jQuery(document).ready(function(){
					jQuery("#flexslider-'.$randomId.'").flexslider({
								animation: "slide",
								slideshow: '.$auto.',';
								if($auto=='true'){$return.='slideshowSpeed:'.$speed.',';}
								$return.='
									smoothHeight: true,
									// Primary Controls
									controlNav: false,               //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
									directionNav: true,             //Boolean: Create navigation for previous/next navigation? (true/false)
									// Secondary Navigation
									keyboard: true,                 //Boolean: Allow slider navigating via keyboard left/right keys
									multipleKeyboard: false,        //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
									mousewheel: false,              //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
									pausePlay: false,               //Boolean: Create pause/play dynamic element
									pauseText: "Pause",             //String: Set the text for the "pause" pausePlay item
									playText: "Play",               //String: Set the text for the "play" pausePlay item 
									// Usability features
									pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
									pauseOnHover: true,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
									useCSS: true,                   //{NEW} Boolean: Slider will use CSS3 transitions if available
									touch: true,                    //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
									video: true,                 
									start: function(slider){
										jQuery("body").removeClass("loading");
									}';
						
					$return.='});';
	$return.='})
			</script>';
	return $return;
}
add_shortcode('slider', 'alc_slider' );

/****/
vc_map( array(
   "name" => __("Unik Image Slider", "unik"),
   "base" => "slider",
   "class" => "",
   "icon" => "icon-wpb-my_slider",
   'admin_enqueue_css' => array(get_template_directory_uri().'/vc_templates/shortcodes.css'),
   "category" => __('Content', "unik"),
   "params" => array(
       array(
         "type" => "dropdown",
         "class" => "",
         "heading" => __("Animation", "unik"),
         "param_name" => "anim",
         "value" => array( "None"=>"", "bounce"=>"bounce", "flash"=>"flash", "pulse"=>"pulse", "shake"=>"shake", "swing"=>"swing", "tada"=>"tada", "wobble"=>"wobble", "bounceIn"=>"bounceIn", "bounceInDown"=>"bounceInDown", "bounceInLeft"=>"bounceInLeft", "bounceInRight"=>"bounceInRight", "bounceInUp"=>"bounceInUp", "bounceOut"=>"bounceOut", "bounceOutDown"=>"bounceOutDown", "bounceOutLeft"=>"bounceOutLeft", "bounceOutRight"=>"bounceOutRight", "bounceOutUp"=>"bounceOutUp", "fadeIn"=>"fadeIn", "fadeInDown"=>"fadeInDown", "fadeInDownBig"=>"fadeInDownBig", "fadeInLeft"=>"fadeInLeft", "fadeInLeftBig"=>"fadeInLeftBig", "fadeInRight"=>"fadeInRight", "fadeInRightBig"=>"fadeInRightBig", "fadeInUp"=>"fadeInUp", "fadeInUpBig"=>"fadeInUpBig", "fadeOut"=>"fadeOut", "fadeOutDown"=>"fadeOutDown", "fadeOutDownBig"=>"fadeOutDownBig", "fadeOutLeft"=>"fadeOutLeft", "fadeOutLeftBig"=>"fadeOutLeftBig", "fadeOutRight"=>"fadeOutRight", "fadeOutRightBig"=>"fadeOutRightBig", "fadeOutUp"=>"fadeOutUp", "fadeOutUpBig"=>"fadeOutUpBig", "flip"=>"flip", "flipInX"=>"flipInX", "flipInY"=>"flipInY", "flipOutX"=>"flipOutX", "flipOutY"=>"flipOutY", "lightSpeedIn"=>"lightSpeedIn", "lightSpeedOut"=>"lightSpeedOut", "rotateIn"=>"rotateIn", "rotateInDownLeft"=>"rotateInDownLeft", "rotateInDownRight"=>"rotateInDownRight", "rotateInUpLeft"=>"rotateInUpLeft", "rotateInUpRight"=>"rotateInUpRight", "rotateOut"=>"rotateOut", "rotateOutDownLeft"=>"rotateOutDownLeft", "rotateOutDownRight"=>"rotateOutDownRight", "rotateOutUpLeft"=>"rotateOutUpLeft", "rotateOutUpRight"=>"rotateOutUpRight",  "hinge"=>"hinge", "rollIn"=>"rollIn", "rollOut"=>"rollOut", "zoomIn"=>"zoomIn","zoomInDown"=>"zoomInDown", "zoomInLeft"=>"zoomInLeft","zoomInRight"=>"zoomInRight","zoomInUp"=>"zoomInUp","zoomOut"=>"zoomOut", "zoomOutLeft"=>"zoomOutLeft", "zoomOutRight"=>"zoomOutRight","zoomOutUp"=>"zoomOutUp"),
         "description" => __(" Animation.", "unik")
      ),
	   
        array(
         "type" => "attach_images",
         "class" => "",
         "heading" => __("Image", "unik"),
         "param_name" => "smimages"
      ),
	  
	   array(
         "type" => "dropdown",
         "class" => "",
         "heading" => __("Autoplay", "unik"),
         "param_name" => "auto",
         "value" => array("Yes"=>"true", "No"=>"false")
      ),
	    array(
         "type" => "textfield",
         "class" => "",
         "heading" => __("Autoplay speed(milliseconds)", "unik"),
         "param_name" => "speed",
         "value" => '3000'
      ),
	    
      array(
         "type" => "textfield",
         "class" => "",
         "heading" => __("Extra class", "unik"),
         "param_name" => "class",
         "description" => __(' Extra class name', "unik")
      ),
   )
) );
?>