PageRenderTime 47ms CodeModel.GetById 14ms app.highlight 20ms RepoModel.GetById 1ms app.codeStats 1ms

/wp-content/plugins/revslider/inc_php/revslider_output.class.php

https://bitbucket.org/acipriani/madeinapulia.com
PHP | 2210 lines | 1455 code | 448 blank | 307 comment | 378 complexity | e026674e032b9f223173731c4a8e311c MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1<?php
   2
   3	class RevSliderOutput{
   4
   5		private static $sliderSerial = 0;
   6
   7		private $sliderHtmlID;
   8		private $sliderHtmlID_wrapper;
   9		private $slider;
  10		private $oneSlideMode = false;
  11		private $oneSlideData;
  12		private $previewMode = false;	//admin preview mode
  13		private $slidesNumIndex;
  14		private $sliderLang = null;
  15		private $hasOnlyOneSlide = false;
  16		private $rev_inline_js = '';
  17		private $class_include = array();
  18
  19		/**
  20		 *
  21		 * check the put in string
  22		 * return true / false if the put in string match the current page.
  23		 */
  24		public static function isPutIn($putIn,$emptyIsFalse = false){
  25
  26			$putIn = strtolower($putIn);
  27			$putIn = trim($putIn);
  28
  29			if($emptyIsFalse && empty($putIn))
  30				return(false);
  31
  32			if($putIn == "homepage"){		//filter by homepage
  33				if(is_front_page() == false)
  34					return(false);
  35			}
  36			else		//case filter by pages
  37			if(!empty($putIn)){
  38				$arrPutInPages = array();
  39				$arrPagesTemp = explode(",", $putIn);
  40				foreach($arrPagesTemp as $page){
  41					$page = trim($page);
  42					if(is_numeric($page) || $page == "homepage")
  43						$arrPutInPages[] = $page;
  44				}
  45				if(!empty($arrPutInPages)){
  46
  47					//get current page id
  48					$currentPageID = "";
  49					if(is_front_page() == true)
  50						$currentPageID = "homepage";
  51					else{
  52						global $post;
  53						if(isset($post->ID))
  54							$currentPageID = $post->ID;
  55					}
  56
  57					//do the filter by pages
  58					if(array_search($currentPageID, $arrPutInPages) === false)
  59						return(false);
  60				}
  61			}
  62
  63			return(true);
  64		}
  65
  66
  67		/**
  68		 *
  69		 * put the rev slider slider on the html page.
  70		 * @param $data - mixed, can be ID ot Alias.
  71		 */
  72		public static function putSlider($sliderID,$putIn=""){
  73
  74			$isPutIn = self::isPutIn($putIn);
  75			if($isPutIn == false)
  76				return(false);
  77			
  78			//check if on mobile and if option hide on mobile is set
  79
  80			$output = new RevSliderOutput();
  81
  82			$output->putSliderBase($sliderID);
  83
  84			$slider = $output->getSlider();
  85			return($slider);
  86		}
  87
  88
  89		/**
  90		 *
  91		 * set language
  92		 */
  93		public function setLang($lang){
  94			$this->sliderLang = $lang;
  95		}
  96
  97		/**
  98		 *
  99		 * set one slide mode for preview
 100		 */
 101		public function setOneSlideMode($data){
 102			$this->oneSlideMode = true;
 103			$this->oneSlideData = $data;
 104		}
 105
 106		/**
 107		 *
 108		 * set preview mode
 109		 */
 110		public function setPreviewMode(){
 111			$this->previewMode = true;
 112		}
 113
 114		/**
 115		 *
 116		 * get the last slider after the output
 117		 */
 118		public function getSlider(){
 119			return($this->slider);
 120		}
 121
 122		/**
 123		 *
 124		 * get slide full width video data
 125		 */
 126		private function getSlideFullWidthVideoData(RevSlide $slide){
 127
 128			$response = array("found"=>false);
 129
 130			//deal full width video:
 131			$enableVideo = $slide->getParam("enable_video","false");
 132			if($enableVideo != "true")
 133				return($response);
 134
 135			$videoID = $slide->getParam("video_id","");
 136			$videoID = trim($videoID);
 137
 138			if(empty($videoID))
 139				return($response);
 140
 141			$response["found"] = true;
 142
 143			$videoType = is_numeric($videoID)?"vimeo":"youtube";
 144			$videoAutoplay = $slide->getParam("video_autoplay");
 145			$videoCover = $slide->getParam("cover");
 146			$videoAutoplayOnlyFirstTime = $slide->getParam("autoplayonlyfirsttime");
 147			$previewimage = $slide->getParam("previewimage", "");
 148			$videoNextslide = $slide->getParam("video_nextslide");
 149			$mute = $slide->getParam("mute");
 150
 151			$response["type"] = $videoType;
 152			$response["videoID"] = $videoID;
 153			$response["autoplay"] = UniteFunctionsRev::strToBool($videoAutoplay);
 154			$response["cover"] = UniteFunctionsRev::strToBool($videoCover);
 155			$response["autoplayonlyfirsttime"] = UniteFunctionsRev::strToBool($videoAutoplayOnlyFirstTime);
 156			$response["previewimage"] = UniteFunctionsRev::strToBool($previewimage);
 157			$response["nextslide"] = UniteFunctionsRev::strToBool($videoNextslide);
 158			$response["mute"] = UniteFunctionsRev::strToBool($mute);
 159
 160			return($response);
 161		}
 162
 163
 164		/**
 165		 *
 166		 * put full width video layer
 167		 */
 168		private function putFullWidthVideoLayer($videoData){
 169
 170			/*if($videoData["found"] == false)
 171				return(false);
 172
 173			$autoplayonlyfirsttime = "";
 174			$autoplay = UniteFunctionsRev::boolToStr($videoData["autoplay"]);
 175			if($autoplay == "true"){
 176				$autoplayonlyfirsttime = UniteFunctionsRev::boolToStr($videoData["autoplayonlyfirsttime"]);
 177				$autoplayonlyfirsttime = ' data-autoplayonlyfirsttime="'. $autoplayonlyfirsttime.'"';
 178			}
 179			$nextslide = UniteFunctionsRev::boolToStr($videoData["nextslide"]);
 180
 181			$htmlParams = 'data-x="0" data-y="0" data-speed="500" data-start="10" data-easing="easeOutBack"';
 182
 183			if($videoData["previewimage"] != '') $htmlParams.= '			data-videoposter="'.$videoData["previewimage"].'"';
 184
 185			$videoID = $videoData["videoID"];
 186
 187			$setBase = (is_ssl()) ? "https://" : "http://";
 188			
 189			$mute = (UniteFunctionsRev::strToBool($videoData['mute'])) ? ' data-volume="mute"' : '';
 190
 191			if($videoData["type"] == "youtube"):	//youtube
 192				?>	<div class="tp-caption fade fullscreenvideo " data-nextslideatend="<?php echo $nextslide?>" data-autoplay="<?php echo $autoplay?>"<?php echo $autoplayonlyfirsttime; ?> <?php echo $htmlParams?><?php echo $mute; ?>><iframe src="<?php echo $setBase; ?>www.youtube.com/embed/<?php echo $videoID?>?enablejsapi=1&amp;version=3&amp;html5=1&amp;hd=1&amp;controls=1&amp;showinfo=0;" allowfullscreen="true" width="100%" height="100%"></iframe></div><?php
 193			else:									//vimeo
 194				?>	<div class="tp-caption fade fullscreenvideo" data-nextslideatend="<?php echo $nextslide?>" data-autoplay="<?php echo $autoplay?>"<?php echo $autoplayonlyfirsttime; ?> <?php echo $htmlParams?><?php echo $mute; ?>><iframe src="<?php echo $setBase; ?>player.vimeo.com/video/<?php echo $videoID?>?title=0&amp;byline=0&amp;portrait=0;api=1" width="100%" height="100%"></iframe></div><?php
 195			endif;*/
 196		}
 197
 198		/**
 199		 *
 200		 * filter the slides for one slide preview
 201		 */
 202		private function filterOneSlide($slides){
 203
 204			$oneSlideID = $this->oneSlideData["slideid"];
 205
 206
 207			$oneSlideParams = UniteFunctionsRev::getVal($this->oneSlideData, "params");
 208			$oneSlideLayers = UniteFunctionsRev::getVal($this->oneSlideData, "layers");
 209
 210			if(gettype($oneSlideParams) == "object")
 211				$oneSlideParams = (array)$oneSlideParams;
 212
 213			if(gettype($oneSlideLayers) == "object")
 214				$oneSlideLayers = (array)$oneSlideLayers;
 215
 216			if(!empty($oneSlideLayers))
 217				$oneSlideLayers = UniteFunctionsRev::convertStdClassToArray($oneSlideLayers);
 218
 219			$newSlides = array();
 220			foreach($slides as $slide){
 221				$slideID = $slide->getID();
 222
 223				if($slideID == $oneSlideID){
 224
 225					if(!empty($oneSlideParams))
 226						$slide->setParams($oneSlideParams);
 227
 228					if(!empty($oneSlideLayers))
 229						$slide->setLayers($oneSlideLayers);
 230
 231					$newSlides[] = $slide;	//add 2 slides
 232					$newSlides[] = $slide;
 233				}
 234			}
 235
 236			return($newSlides);
 237		}
 238
 239
 240		/**
 241		 *
 242		 * put the slider slides
 243		 */
 244		private function putSlides($doWrapFromTemplate){
 245			//go to template slider if post template
 246			if($doWrapFromTemplate !== false)	$this->slider->initByMixed($doWrapFromTemplate); //back to original Slider
 247
 248			$sliderType = $this->slider->getParam("slider_type");
 249
 250			$publishedOnly = true;
 251			if($this->previewMode == true && $this->oneSlideMode == true){
 252				$previewSlideID = UniteFunctionsRev::getVal($this->oneSlideData, "slideid");
 253				$previewSlide = new RevSlide();
 254				$previewSlide->initByID($previewSlideID);
 255				$slides = array($previewSlide);
 256
 257			}else{
 258				$slides = $this->slider->getSlidesForOutput($publishedOnly,$this->sliderLang);
 259			}
 260			
 261			$this->slidesNumIndex = $this->slider->getSlidesNumbersByIDs(true);
 262			
 263			if(empty($slides)){
 264				?>
 265				<div class="no-slides-text">
 266					<?php
 267					if($this->slider->isSlidesFromPosts()){
 268						_e('No slides found, please add at least one Slide Template to the choosen Template Slider.', REVSLIDER_TEXTDOMAIN);
 269					}else{
 270						_e('No slides found, please add some slides', REVSLIDER_TEXTDOMAIN);
 271					}
 272					 ?>
 273				</div>
 274				<?php
 275			}
 276
 277			//set that we are originally template slider
 278			$templateSlider = false;
 279			$postData = array();
 280			if($this->slider->isSlidesFromPosts() && $this->slider->getParam("slider_template_id",false) !== false){
 281				$templateSlider = true;
 282			}
 283
 284			//go back to normal slider if post template
 285			if($doWrapFromTemplate)	$this->slider->initByMixed($this->slider->getParam("slider_template_id",false)); //back to template for JS
 286
 287			$thumbWidth = $this->slider->getParam("thumb_width",100);
 288			$thumbHeight = $this->slider->getParam("thumb_height",50);
 289
 290			$slideWidth = $this->slider->getParam("width",900);
 291			$slideHeight = $this->slider->getParam("height",300);
 292
 293			$navigationType = $this->slider->getParam("navigaion_type","none");
 294			$isThumbsActive = ($navigationType == "thumb")?true:false;
 295
 296			$lazyLoad = $this->slider->getParam("lazy_load","off");
 297
 298			//for one slide preview
 299			if($this->oneSlideMode == true)
 300				$slides = $this->filterOneSlide($slides);
 301
 302			echo "<ul>";
 303
 304			$htmlFirstTransWrap = "";
 305
 306			$startWithSlide = $this->slider->getStartWithSlideSetting();
 307
 308			$firstTransActive = $this->slider->getParam("first_transition_active","false");
 309			if($firstTransActive == "true"){
 310
 311				$firstTransition = $this->slider->getParam("first_transition_type","fade");
 312				$htmlFirstTransWrap .= " data-fstransition=\"$firstTransition\"";
 313
 314				$firstDuration = $this->slider->getParam("first_transition_duration","300");
 315				if(!empty($firstDuration) && is_numeric($firstDuration))
 316					$htmlFirstTransWrap .= " data-fsmasterspeed=\"$firstDuration\"";
 317
 318				$firstSlotAmount = $this->slider->getParam("first_transition_slot_amount","7");
 319				if(!empty($firstSlotAmount) && is_numeric($firstSlotAmount))
 320				$htmlFirstTransWrap .= " data-fsslotamount=\"$firstSlotAmount\"";
 321
 322			}
 323
 324			if(count($slides) == 1 && $this->oneSlideMode == false){
 325				$slides[] = $slides[0];
 326				$slides[1]->ignore_alt = true;
 327				$this->hasOnlyOneSlide = true;
 328			}
 329
 330			foreach($slides as $index => $slide){
 331				$params = $slide->getParams();
 332
 333				$cur_slide_title = $this->slider->getParam("navigation_style","round");
 334
 335				if($templateSlider)
 336					$postData = $slide->getPostData();
 337
 338				//check if date is set
 339				$date_from = $slide->getParam("date_from","");
 340				$date_to = $slide->getParam("date_to","");
 341
 342				if($date_from != ""){
 343					$date_from = strtotime($date_from);
 344					if(time() < $date_from) continue;
 345				}
 346
 347				if($date_to != ""){
 348					$date_to = strtotime($date_to);
 349					if(time() > $date_to) continue;
 350				}
 351
 352				$transition = $slide->getParam("slide_transition","random");
 353				
 354				$transition_arr = explode(',', $transition);
 355				
 356				$add_rand = '';
 357				if(is_array($transition_arr) && !empty($transition_arr)){
 358					foreach($transition_arr as $tkey => $trans){
 359						if($trans == 'random-selected'){
 360							$add_rand = ' data-randomtransition="on"';
 361							unset($transition_arr[$tkey]);
 362							$transition = implode(',', $transition_arr);
 363							break;
 364						}
 365					}
 366				}
 367				
 368				//if($transition == "fade") $transition = "tp-fade";
 369				//$transitionPremium = $slide->getParam("slide_transition_premium","random");
 370
 371				//if(trim($transition) == '')
 372				//	$transition = $transitionPremium;
 373				//else
 374				//	if(trim($transitionPremium) != '') $transition .= ','.$transitionPremium;
 375
 376
 377				$slotAmount = $slide->getParam("slot_amount","7");
 378
 379				$isExternal = $slide->getParam("background_type","image");
 380				if($isExternal != "external"){
 381					$urlSlideImage = $slide->getImageUrl();
 382
 383					//get image alt
 384					$imageFilename = $slide->getImageFilename();
 385					$info = pathinfo($imageFilename);
 386					$alt = $info["filename"];
 387				}else{
 388
 389					$urlSlideImage = $slide->getParam("slide_bg_external","");
 390
 391					$info = '';
 392					$alt = '';
 393				}
 394				
 395				if(isset($slide->ignore_alt)) $alt = '';
 396
 397				$bgType = $slide->getParam("background_type","image");
 398
 399				//get thumb url
 400
 401				$is_special_nav = false;
 402				switch($cur_slide_title){ //generate also if we have a special navigation selected
 403					case 'preview1':
 404					case 'preview2':
 405					case 'preview3':
 406					case 'preview4':
 407					case 'custom':
 408						$is_special_nav = true;
 409				}
 410				$htmlThumb = "";
 411				if($isThumbsActive == true || $is_special_nav == true){
 412					$urlThumb = null;
 413
 414					//check if post slider, if yes, get thumb from featured image
 415					//if($this->slider->isSlidesFromPosts())
 416					//	$urlThumb = '';
 417
 418					if(empty($urlThumb)){
 419						$urlThumb = $slide->getParam("slide_thumb","");
 420					}
 421
 422					if($bgType == 'image'){
 423
 424						if(empty($urlThumb)){	//try to get resized thumb
 425							$url_img_link = $slide->getImageUrl();
 426
 427							$urlThumb = rev_aq_resize($url_img_link, 320, 200, true, true, true);
 428							/*$pathThumb = $slide->getImageFilepath();
 429							if(!empty($pathThumb))
 430								$urlThumb = UniteBaseClassRev::getImageUrl($pathThumb,$thumbWidth,$thumbHeight,true);*/
 431						}
 432
 433						//if not - put regular image:
 434						if(empty($urlThumb))
 435							$urlThumb = $slide->getImageUrl();
 436					}
 437
 438					$htmlThumb = 'data-thumb="'.$urlThumb.'" ';
 439				}
 440
 441				//get link
 442				$htmlLink = "";
 443				$enableLink = $slide->getParam("enable_link","false");
 444				if($enableLink == "true"){
 445					$linkType = $slide->getParam("link_type","regular");
 446					switch($linkType){
 447
 448						//---- normal link
 449
 450						default:
 451						case "regular":
 452							$link = $slide->getParam("link","");
 453							$linkOpenIn = $slide->getParam("link_open_in","same");
 454							$htmlTarget = "";
 455							if($linkOpenIn == "new")
 456								$htmlTarget = ' data-target="_blank"';
 457							$htmlLink = "data-link=\"$link\" $htmlTarget ";
 458						break;
 459
 460						//---- link to slide
 461
 462						case "slide":
 463							$slideLink = UniteFunctionsRev::getVal($params, "slide_link");
 464							if(!empty($slideLink) && $slideLink != "nothing"){
 465								//get slide index from id
 466								if(is_numeric($slideLink))
 467									$slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink);
 468
 469								if(!empty($slideLink)){
 470									$htmlLink = "data-link=\"slide\" data-linktoslide=\"$slideLink\" ";
 471								}
 472							}
 473						break;
 474					}
 475
 476					//set link position:
 477					$linkPos = UniteFunctionsRev::getVal($params, "link_pos","front");
 478					if($linkPos == "back")
 479						$htmlLink .= ' data-slideindex="back"';
 480				}
 481
 482				//set delay
 483				$htmlDelay = "";
 484				$delay = $slide->getParam("delay","");
 485				if(!empty($delay) && is_numeric($delay))
 486					$htmlDelay = "data-delay=\"$delay\" ";
 487
 488				//get duration
 489				$htmlDuration = "";
 490				$duration = $slide->getParam("transition_duration","");
 491				if(!empty($duration) && is_numeric($duration))
 492					$htmlDuration = "data-masterspeed=\"$duration\" ";
 493
 494				//get performance
 495				$htmlPerformance = "";
 496				$performance = $slide->getParam("save_performance","off");
 497				if(!empty($performance) && ($performance == 'on' || $performance == 'off'))
 498					$htmlPerformance = " data-saveperformance=\"$performance\" ";
 499
 500
 501
 502				//get rotation
 503				$htmlRotation = "";
 504				$rotation = $slide->getParam("transition_rotation","");
 505				if(!empty($rotation)){
 506					$rotation = (int)$rotation;
 507					if($rotation != 0){
 508						if($rotation > 720 && $rotation != 999)
 509							$rotation = 720;
 510						if($rotation < -720)
 511							$rotation = -720;
 512					}
 513					$htmlRotation = "data-rotate=\"$rotation\" ";
 514				}
 515
 516				$fullWidthVideoData = $this->getSlideFullWidthVideoData($slide);
 517
 518				//set full width centering.
 519				/*$htmlImageCentering = "";
 520				$fullWidthCentering = $slide->getParam("fullwidth_centering","false");
 521				if($sliderType == "fullwidth" && $fullWidthCentering == "true")
 522					$htmlImageCentering = ' data-fullwidthcentering="on"';
 523				*/
 524
 525				//set first slide transition
 526				$htmlFirstTrans = "";
 527				if($index == $startWithSlide){
 528					$htmlFirstTrans = $htmlFirstTransWrap;
 529				}//first trans
 530
 531				$htmlParams = $htmlDuration.$htmlLink.$htmlThumb.$htmlDelay.$htmlRotation.$htmlFirstTrans.$htmlPerformance;
 532
 533
 534				$styleImage = "";
 535				$urlImageTransparent = UniteBaseClassRev::$url_plugin."images/transparent.png";
 536
 537				switch($bgType){
 538					case "trans":
 539						$urlSlideImage = $urlImageTransparent;
 540					break;
 541					case "solid":
 542						$urlSlideImage = $urlImageTransparent;
 543						$slideBGColor = $slide->getParam("slide_bg_color","#d0d0d0");
 544						$styleImage = "style='background-color:".$slideBGColor."'";
 545					break;
 546				}
 547
 548				//additional params
 549				$imageAddParams = "";
 550				if($lazyLoad == "on"){
 551					$imageAddParams .= "data-lazyload=\"$urlSlideImage\"";
 552					$urlSlideImage = UniteBaseClassRev::$url_plugin."images/dummy.png";
 553				}
 554
 555				//$imageAddParams .= $htmlImageCentering;
 556
 557				//additional background params
 558				$bgFit = $slide->getParam("bg_fit","cover");
 559				$bgFitX = intval($slide->getParam("bg_fit_x","100"));
 560				$bgFitY = intval($slide->getParam("bg_fit_y","100"));
 561
 562				$bgPosition = $slide->getParam("bg_position","center top");
 563				$bgPositionX = intval($slide->getParam("bg_position_x","0"));
 564				$bgPositionY = intval($slide->getParam("bg_position_y","0"));
 565
 566				$bgRepeat = $slide->getParam("bg_repeat","no-repeat");
 567
 568				if($bgPosition == 'percentage'){
 569					$imageAddParams .= ' data-bgposition="'.$bgPositionX.'% '.$bgPositionY.'%"';
 570				}else{
 571					$imageAddParams .= ' data-bgposition="'.$bgPosition.'"';
 572				}
 573
 574
 575
 576				//check for kenburn & pan zoom
 577				$kenburn_effect = $slide->getParam("kenburn_effect","off");
 578				//$kb_rotation_start = intval($slide->getParam("kb_rotation_start","0"));
 579				//$kb_rotation_end = intval($slide->getParam("kb_rotation_end","0"));
 580				$kb_duration = intval($slide->getParam("kb_duration",$this->slider->getParam("delay",9000)));
 581				$kb_ease = $slide->getParam("kb_easing","Linear.easeNone");
 582				$kb_start_fit = $slide->getParam("kb_start_fit","100");
 583				$kb_end_fit =$slide->getParam("kb_end_fit","100");
 584
 585				$kb_pz = '';
 586
 587				if($kenburn_effect == "on" && ($bgType == 'image' || $bgType == 'external')){
 588					$kb_pz.= ' data-kenburns="on"';
 589					//$kb_pz.= ' data-rotationstart="'.$kb_rotation_start.'"';
 590					//$kb_pz.= ' data-rotationend="'.$kb_rotation_end.'"';
 591					$kb_pz.= ' data-duration="'.$kb_duration.'"';
 592					$kb_pz.= ' data-ease="'.$kb_ease.'"';
 593					$kb_pz.= ' data-bgfit="'.$kb_start_fit.'"';
 594					$kb_pz.= ' data-bgfitend="'.$kb_end_fit.'"';
 595
 596					$bgEndPosition = $slide->getParam("bg_end_position","center top");
 597					$bgEndPositionX = intval($slide->getParam("bg_end_position_x","0"));
 598					$bgEndPositionY = intval($slide->getParam("bg_end_position_y","0"));
 599
 600					if($bgEndPosition == 'percentage'){
 601						$kb_pz.= ' data-bgpositionend="'.$bgEndPositionX.'% '.$bgEndPositionY.'%"';
 602					}else{
 603						$kb_pz.= ' data-bgpositionend="'.$bgEndPosition.'"';
 604					}
 605
 606					//set image original width and height
 607					//$imgSize = @getimagesize($urlSlideImage);
 608					//if(is_array($imgSize) && !empty($imgSize)){
 609					//	$kb_pz.= ' data-owidth="'.$imgSize[0].'"';
 610					//	$kb_pz.= ' data-oheight="'.$imgSize[1].'"';
 611					//}
 612
 613				}else{ //only set if kenburner is off
 614
 615					if($bgFit == 'percentage'){
 616						$imageAddParams .= ' data-bgfit="'.$bgFitX.'% '.$bgFitY.'%"';
 617					}else{
 618						$imageAddParams .= ' data-bgfit="'.$bgFit.'"';
 619					}
 620
 621					$imageAddParams .= ' data-bgrepeat="'.$bgRepeat.'"';
 622
 623				}
 624
 625				$thumbWidth = $this->slider->getParam("thumb_width",100);
 626
 627
 628				//add Slide Title if we have special navigation type choosen
 629				$slide_title = '';
 630
 631				$class_attr = $slide->getParam("class_attr","");
 632				if($class_attr !== '')
 633					$htmlParams.= ' class="'.$class_attr.'"';
 634
 635				$id_attr = $slide->getParam("id_attr","");
 636				if($id_attr !== '')
 637					$htmlParams.= ' id="'.$id_attr.'"';
 638
 639				$attr_attr = $slide->getParam("attr_attr","");
 640				if($attr_attr !== '')
 641					$htmlParams.= ' id="'.$attr_attr.'"';
 642
 643				$data_attr = stripslashes($slide->getParam("data_attr",""));
 644				if($data_attr !== '')
 645					$htmlParams.= ' '.$data_attr;
 646
 647				switch($cur_slide_title){
 648					case 'preview1':
 649					case 'preview2':
 650					case 'preview3':
 651					case 'preview4':
 652					case 'custom':
 653						//check if we are post based or normal slider
 654						if($templateSlider){
 655							$new_title = @get_the_title($slide->getID());
 656							$slide_title = ' data-title="'.str_replace("\'", "'", $new_title).'"';
 657						}else{
 658							$slide_title = ' data-title="'.str_replace("\'", "'", $slide->getParam("title","Slide")).'"';
 659						}
 660					break;
 661				}
 662				
 663				//Html
 664				echo "	<!-- SLIDE  -->\n";
 665				echo "	<li data-transition=\"".$transition."\" data-slotamount=\"". $slotAmount."\" ".$add_rand.$htmlParams.$slide_title .">\n";
 666				echo "		<!-- MAIN IMAGE -->\n";
 667				echo "		<img src=\"". $urlSlideImage ."\" ". $styleImage." alt=\"". $alt . "\" ". $imageAddParams. $kb_pz .">\n";
 668				echo "		<!-- LAYERS -->\n";
 669				//put video:
 670				if($fullWidthVideoData["found"] == true)	//backward compatability
 671					$this->putFullWidthVideoLayer($fullWidthVideoData);
 672
 673				$this->putCreativeLayer($slide);
 674
 675				echo "	</li>\n";
 676
 677			}	//get foreach
 678
 679			echo "</ul>\n";
 680
 681			//check for static layers
 682			$useStaticLayers = $this->slider->getParam("enable_static_layers","off");
 683			if($useStaticLayers == 'on'){
 684				$sliderID = $this->slider->getID();
 685				$staticID = $slide->getStaticSlideID($sliderID);
 686				if($staticID !== false){
 687					$static_slide = new RevSlide();
 688					$static_slide->initByStaticID($staticID);
 689					echo '<div class="tp-static-layers">'."\n";
 690					$this->putCreativeLayer($static_slide, true);
 691					echo '</div>'."\n";
 692				}
 693			}
 694
 695
 696			//add styles to the footer
 697			//add_action('wp_footer', array($this, 'add_inline_styles'));
 698
 699		}
 700
 701
 702		/**
 703		 *
 704		 * put creative layer
 705		 */
 706		private function putCreativeLayer(RevSlide $slide, $static_slide = false){
 707			$layers = $slide->getLayers();
 708			$customAnimations = RevOperations::getCustomAnimations('customin'); //get all custom animations
 709			$customEndAnimations = RevOperations::getCustomAnimations('customout'); //get all custom animations
 710			$startAnimations = RevOperations::getArrAnimations(false); //only get the standard animations
 711			$endAnimations = RevOperations::getArrEndAnimations(false); //only get the standard animations
 712
 713			$lazyLoad = $this->slider->getParam("lazy_load","off");
 714			$isTemplate = $this->slider->getParam("template","false");
 715
 716			if(empty($layers))
 717				return(false);
 718
 719			$zIndex = 5;
 720
 721			foreach($layers as $layer):
 722
 723				$type = UniteFunctionsRev::getVal($layer, "type","text");
 724
 725				//set if video full screen
 726				$videoclass = '';
 727				
 728				$isFullWidthVideo = false;
 729				if($type == "video"){
 730					$videoclass = ' tp-videolayer';
 731					$videoData = UniteFunctionsRev::getVal($layer, "video_data");
 732					if(!empty($videoData)){
 733						$videoData = (array)$videoData;
 734						$isFullWidthVideo = UniteFunctionsRev::getVal($videoData, "fullwidth");
 735						$isFullWidthVideo = UniteFunctionsRev::strToBool($isFullWidthVideo);
 736					}else
 737						$videoData = array();
 738				}
 739
 740
 741				$class = UniteFunctionsRev::getVal($layer, "style");
 742
 743				if(trim($class) !== '')
 744					$this->class_include['.'.trim($class)] = true; //add classname for style inclusion
 745
 746				$animation = UniteFunctionsRev::getVal($layer, "animation","tp-fade");
 747				if($animation == "fade") $animation = "tp-fade";
 748
 749				$customin = '';
 750				if(!array_key_exists($animation, $startAnimations) && array_key_exists($animation, $customAnimations)){ //if true, add custom animation
 751					$customin.= 'data-customin="';
 752					$animArr = RevOperations::getCustomAnimationByHandle($customAnimations[$animation]);
 753					if($animArr !== false) $customin.= RevOperations::parseCustomAnimationByArray($animArr);
 754					$customin.= '"';
 755					$animation = 'customin';
 756				}
 757
 758				if(strpos($animation, 'customin-') !== false || strpos($animation, 'customout-') !== false) $animation = "tp-fade";
 759
 760				//set output class:
 761
 762				$layer_2d_rotation = intval(UniteFunctionsRev::getVal($layer, "2d_rotation",'0'));
 763				$layer_2d_origin_x = intval(UniteFunctionsRev::getVal($layer, "2d_origin_x",'50'));
 764				$layer_2d_origin_y = intval(UniteFunctionsRev::getVal($layer, "2d_origin_y",'50'));
 765
 766				if($layer_2d_rotation == 0)
 767					$outputClass = "tp-caption ". trim($class);
 768				else
 769					$outputClass = "tp-caption ";
 770
 771				$outputClass = trim($outputClass) . " ";
 772
 773				$outputClass .= trim($animation);
 774
 775				$left = UniteFunctionsRev::getVal($layer, "left",0);
 776				$top = UniteFunctionsRev::getVal($layer, "top",0);
 777				$speed = UniteFunctionsRev::getVal($layer, "speed",300);
 778				$time = UniteFunctionsRev::getVal($layer, "time",0);
 779				$easing = UniteFunctionsRev::getVal($layer, "easing","easeOutExpo");
 780				$randomRotate = UniteFunctionsRev::getVal($layer, "random_rotation","false");
 781				$randomRotate = UniteFunctionsRev::boolToStr($randomRotate);
 782
 783				$splitin = UniteFunctionsRev::getVal($layer, "split","none");
 784				$splitout = UniteFunctionsRev::getVal($layer, "endsplit","none");
 785				$elementdelay = intval(UniteFunctionsRev::getVal($layer, "splitdelay",0));
 786				$endelementdelay = intval(UniteFunctionsRev::getVal($layer, "endsplitdelay",0));
 787
 788				if($elementdelay > 0) $elementdelay /= 100;
 789				if($endelementdelay > 0) $endelementdelay /= 100;
 790
 791
 792				$text = UniteFunctionsRev::getVal($layer, "text");
 793				if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) //use qTranslate
 794					$text = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($text);
 795
 796				$htmlVideoAutoplay = "";
 797				$htmlVideoAutoplayOnlyFirstTime = "";
 798				$htmlVideoNextSlide = "";
 799				$htmlVideoThumbnail = "";
 800				$htmlMute = '';
 801				$htmlCover = '';
 802				$htmlDotted = '';
 803				$htmlRatio = '';
 804				$htmlRewind = '';
 805				$htmlDisableOnMobile = '';
 806
 807				$ids = UniteFunctionsRev::getVal($layer, "attrID");
 808				$classes = UniteFunctionsRev::getVal($layer, "attrClasses");
 809				$title = UniteFunctionsRev::getVal($layer, "attrTitle");
 810				$rel = UniteFunctionsRev::getVal($layer, "attrRel");
 811
 812				$ids = ($ids != '') ? ' id="'.$ids.'"' : '';
 813				$classes = ($classes != '') ? ' '.$classes : '';
 814				$title = ($title != '') ? ' title="'.$title.'"' : '';
 815				$rel = ($rel != '') ? ' rel="'.$rel.'"' : '';
 816
 817				$max_width = UniteFunctionsRev::getVal($layer, "max_width",'auto');
 818				$max_height = UniteFunctionsRev::getVal($layer, "max_height",'auto');
 819				$white_space = UniteFunctionsRev::getVal($layer, "whitespace",'nowrap');
 820
 821
 822				$inline_styles = '';
 823				$layer_rotation = '';
 824				$do_rotation = false;
 825				$add_data = '';
 826				
 827				//set html:
 828				$html = "";
 829				switch($type){
 830					default:
 831					case "text":
 832						$html = $text;
 833						$html = do_shortcode($html);
 834						$inline_styles .= ' max-width: '.$max_width.'; max-height: '.$max_height.'; white-space: '.$white_space.';';
 835
 836						if($layer_2d_rotation !== 0)
 837							$do_rotation = true;
 838					break;
 839					case "image":
 840						$alt = UniteFunctionsRev::getVal($layer, "alt");
 841						
 842						if(isset($slide->ignore_alt)) $alt = '';
 843				
 844						$urlImage = UniteFunctionsRev::getVal($layer, "image_url");
 845
 846						$additional = "";
 847						$scaleX = UniteFunctionsRev::getVal($layer, "scaleX");
 848						$scaleY = UniteFunctionsRev::getVal($layer, "scaleY");
 849						if($scaleX != '') $additional .= ' data-ww="'.$scaleX.'"';
 850						if($scaleY != '') $additional .= ' data-hh="'.$scaleY.'"';
 851						if(is_ssl()){
 852							$urlImage = str_replace("http://", "https://", $urlImage);
 853						}
 854
 855
 856						$imageAddParams = "";
 857						if($lazyLoad == "on"){
 858							$imageAddParams .= " data-lazyload=\"$urlImage\"";
 859							$urlImage = UniteBaseClassRev::$url_plugin."images/dummy.png";
 860						}
 861
 862						$html = '<img src="'.$urlImage.'" alt="'.$alt.'"'.$additional.$imageAddParams.'>';
 863						$imageLink = UniteFunctionsRev::getVal($layer, "link","");
 864						if(!empty($imageLink)){
 865							$openIn = UniteFunctionsRev::getVal($layer, "link_open_in","same");
 866
 867							$target = "";
 868							if($openIn == "new")
 869								$target = ' target="_blank"';
 870
 871							$linkID = UniteFunctionsRev::getVal($layer, "link_id","");
 872							$linkClass = UniteFunctionsRev::getVal($layer, "link_class","");
 873							$linkTitle = UniteFunctionsRev::getVal($layer, "link_title","");
 874							$linkRel = UniteFunctionsRev::getVal($layer, "link_rel","");
 875
 876							$linkIDHtml = "";
 877							$linkClassHtml = "";
 878							$linkTitleHtml = "";
 879							$linkRelHtml = "";
 880							if(!empty($linkID))
 881								$linkIDHtml = ' id="'.$linkID.'"';
 882
 883							if(!empty($linkClass))
 884								$linkClassHtml = ' class="'.$linkClass.'"';
 885
 886							if(!empty($linkTitle))
 887								$linkTitleHtml = ' title="'.$linkTitle.'"';
 888
 889							if(!empty($linkRel))
 890								$linkRelHtml = ' rel="'.$linkRel.'"';
 891
 892							$html = '<a href="'.$imageLink.'"'.$target.$linkIDHtml.$linkClassHtml.$linkTitleHtml.$linkRelHtml.'>'.$html.'</a>';
 893						}
 894						if($layer_2d_rotation !== 0)
 895							$do_rotation = true;
 896					break;
 897					case "video":
 898						$videoType = trim(UniteFunctionsRev::getVal($layer, "video_type"));
 899						$videoID = trim(UniteFunctionsRev::getVal($layer, "video_id"));
 900						$videoWidth = trim(UniteFunctionsRev::getVal($layer, "video_width"));
 901						$videoHeight = trim(UniteFunctionsRev::getVal($layer, "video_height"));
 902						$videoArgs = trim(UniteFunctionsRev::getVal($layer, "video_args"));
 903						$v_controls = UniteFunctionsRev::getVal($videoData, "controls");
 904						$v_controls = UniteFunctionsRev::strToBool($v_controls);
 905
 906						$rewind = UniteFunctionsRev::getVal($videoData, "forcerewind");
 907						$rewind = UniteFunctionsRev::strToBool($rewind);
 908						$htmlRewind = ($rewind == true) ? ' data-forcerewind="on"' : '';
 909						
 910						/*
 911						$cover = UniteFunctionsRev::getVal($videoData, "cover");
 912						$cover = UniteFunctionsRev::strToBool($cover);
 913						if($cover == true){
 914							$dotted = UniteFunctionsRev::getVal($videoData, "dotted");
 915							if($dotted !== 'none')
 916								$htmlDotted = ' data-dottedoverlay="'.$dotted.'"';
 917								
 918							$ratio = UniteFunctionsRev::getVal($videoData, "ratio");
 919								if(!empty($ratio))
 920									$htmlRatio = ' data-aspectratio="'.$ratio.'"';
 921						}
 922						*/
 923						
 924						if($isFullWidthVideo == true){ // || $cover == true
 925							$videoWidth = "100%";
 926							$videoHeight = "100%";
 927						}
 928
 929						$setBase = (is_ssl()) ? "https://" : "http://";
 930						
 931						switch($videoType){
 932							case "youtube":
 933								if(empty($videoArgs))
 934									$videoArgs = GlobalsRevSlider::DEFAULT_YOUTUBE_ARGUMENTS;
 935									
 936								//check if full URL
 937								if(strpos($videoID, 'http') !== false){
 938									//we have full URL, split it to ID
 939									parse_str( parse_url( $videoID, PHP_URL_QUERY ), $my_v_ret );
 940									$videoID = $my_v_ret['v'];
 941								}
 942								
 943								$videospeed = UniteFunctionsRev::getVal($videoData, "videospeed", '1');
 944								
 945								//$ytBase = 'https://';
 946								//if($v_controls) $videoArgs.='controls=0;';
 947								$videoArgs.=';origin='.$setBase.$_SERVER['SERVER_NAME'].';';
 948								$add_data = ' data-ytid="'.$videoID.'" data-videowidth="'.$videoWidth.'" data-videoheight="'.$videoHeight.'" data-videoattributes="version=3&amp;enablejsapi=1&amp;html5=1&amp;'.$videoArgs.'" data-videorate="'.$videospeed.'"';
 949								$add_data .= ($v_controls) ? ' data-videocontrols="none"' : ' data-videocontrols="controls"';
 950								//$html = "<iframe src='".$ytBase."www.youtube.com/embed/".$videoID."?enablejsapi=1&amp;html5=1&amp;".$videoArgs."' allowfullscreen='true' width='".$videoWidth."' height='".$videoHeight."' style='width:".$videoWidth."px;height:".$videoHeight."px;'></iframe>";
 951							break;
 952							case "vimeo":
 953								if(empty($videoArgs))
 954									$videoArgs = GlobalsRevSlider::DEFAULT_VIMEO_ARGUMENTS;
 955
 956								//check if full URL
 957								if(strpos($videoID, 'http') !== false){
 958									//we have full URL, split it to ID
 959									$videoID = (int) substr(parse_url($videoID, PHP_URL_PATH), 1);
 960								}
 961								
 962								$add_data = ' data-vimeoid="'.$videoID.'" data-videowidth="'.$videoWidth.'" data-videoheight="'.$videoHeight.'" data-videoattributes="'.$videoArgs.'"';
 963								//no controls for vimeo $add_data .= ($v_controls) ? ' data-videocontrols="none"' : ' data-videocontrols="controls"';
 964
 965								//$html = "<iframe src='".$setBase."player.vimeo.com/video/".$videoID."?".$videoArgs."' width='".$videoWidth."' height='".$videoHeight."' style='width:".$videoWidth."px;height:".$videoHeight."px;'></iframe>";
 966							break;
 967							case "html5":
 968								$urlPoster = UniteFunctionsRev::getVal($videoData, "urlPoster");
 969								$urlMp4 = UniteFunctionsRev::getVal($videoData, "urlMp4");
 970								$urlWebm = UniteFunctionsRev::getVal($videoData, "urlWebm");
 971								$urlOgv = UniteFunctionsRev::getVal($videoData, "urlOgv");
 972								$videopreload = UniteFunctionsRev::getVal($videoData, "preload");
 973								$videoloop = UniteFunctionsRev::getVal($videoData, "videoloop");
 974								
 975								
 976								$add_data = ' data-videowidth="'.$videoWidth.'" data-videoheight="'.$videoHeight.'"';
 977								
 978								$cover = UniteFunctionsRev::getVal($videoData, "cover");
 979								$cover = UniteFunctionsRev::strToBool($cover);
 980								
 981								if($cover == true){
 982									$add_data .=  ' data-forceCover="1"';
 983									$dotted = UniteFunctionsRev::getVal($videoData, "dotted");
 984									if($dotted !== 'none')
 985										$add_data .=  ' data-dottedoverlay="'.$dotted.'"';
 986
 987									$ratio = UniteFunctionsRev::getVal($videoData, "ratio");
 988									if(!empty($ratio))
 989										$add_data .=  ' data-aspectratio="'.$ratio.'"';
 990								}
 991								
 992								$add_data .= ($v_controls) ? ' data-videocontrols="none"' : ' data-videocontrols="controls"';
 993								if(!empty($urlPoster)) $add_data .= ' data-videoposter="'.$urlPoster.'"';
 994								if(!empty($urlOgv)) $add_data .= ' data-videoogv="'.$urlOgv.'"';
 995								if(!empty($urlWebm)) $add_data .= ' data-videowebm="'.$urlWebm.'"';
 996								if(!empty($urlMp4)) $add_data .= ' data-videomp4="'.$urlMp4.'"';
 997
 998
 999								if(!empty($videopreload)) $add_data .= ' data-videopreload="'.$videopreload.'"';
1000								if(UniteFunctionsRev::strToBool($videoloop) == true){ //fallback
1001									$add_data .= ' data-videoloop="loop"';
1002								}else{
1003									$add_data .= ' data-videoloop="'.$videoloop.'"';
1004								}
1005								
1006							break;
1007							default:
1008								UniteFunctionsRev::throwError("wrong video type: $videoType");
1009							break;
1010						}
1011
1012						//set video autoplay, with backward compatability
1013						if(array_key_exists("autoplay", $videoData))
1014							$videoAutoplay = UniteFunctionsRev::getVal($videoData, "autoplay");
1015						else	//backword compatability
1016							$videoAutoplay = UniteFunctionsRev::getVal($layer, "video_autoplay");
1017
1018						//set video autoplayonlyfirsttime, with backward compatability
1019						if(array_key_exists("autoplayonlyfirsttime", $videoData))
1020							$videoAutoplayOnlyFirstTime = UniteFunctionsRev::getVal($videoData, "autoplayonlyfirsttime");
1021						else
1022							$videoAutoplayOnlyFirstTime = "";
1023
1024						$videoAutoplay = UniteFunctionsRev::strToBool($videoAutoplay);
1025						$videoAutoplayOnlyFirstTime = UniteFunctionsRev::strToBool($videoAutoplayOnlyFirstTime);
1026						$mute = UniteFunctionsRev::getVal($videoData, "mute");
1027						$mute = UniteFunctionsRev::strToBool($mute);
1028						$htmlMute = ($mute)	? ' data-volume="mute"' : '';
1029
1030						if($videoAutoplay == true)
1031							$htmlVideoAutoplay = '			data-autoplay="true"'." \n";
1032						else
1033							$htmlVideoAutoplay = '			data-autoplay="false"'." \n";
1034
1035						if($videoAutoplayOnlyFirstTime == true && $videoAutoplay == true)
1036							$htmlVideoAutoplayOnlyFirstTime = '			data-autoplayonlyfirsttime="true"'." \n";
1037						else
1038							$htmlVideoAutoplayOnlyFirstTime = '			data-autoplayonlyfirsttime="false"'." \n";
1039
1040						$videoNextSlide = UniteFunctionsRev::getVal($videoData, "nextslide");
1041						$videoNextSlide = UniteFunctionsRev::strToBool($videoNextSlide);
1042
1043						if($videoNextSlide == true)
1044							$htmlVideoNextSlide = '			data-nextslideatend="true"'." \n";
1045
1046						$videoThumbnail = @$videoData["previewimage"];
1047
1048						if(trim($videoThumbnail) !== '') $htmlVideoThumbnail = '			data-videoposter="'.$videoThumbnail.'"'." \n";
1049						
1050						$disable_on_mobile = UniteFunctionsRev::getVal($videoData, "disable_on_mobile");
1051						$disable_on_mobile = UniteFunctionsRev::strToBool($disable_on_mobile);
1052						$htmlDisableOnMobile = ($disable_on_mobile)	? '			data-disablevideoonmobile="1"'." \n" : '';
1053						
1054					break;
1055				}
1056
1057				if($do_rotation){
1058					$layer_rotation = ' -moz-transform: rotate('.$layer_2d_rotation.'deg); -ms-transform: rotate('.$layer_2d_rotation.'deg); -o-transform: rotate('.$layer_2d_rotation.'deg); -webkit-transform: rotate('.$layer_2d_rotation.'deg); transform: rotate('.$layer_2d_rotation.'deg);';
1059					$layer_rotation .= ' -moz-transform-origin: '.$layer_2d_origin_x.'% '.$layer_2d_origin_y.'%; -ms-transform-origin: '.$layer_2d_origin_x.'% '.$layer_2d_origin_y.'%; -o-transform-origin: '.$layer_2d_origin_x.'% '.$layer_2d_origin_y.'%; -webkit-transform-origin: '.$layer_2d_origin_x.'% '.$layer_2d_origin_y.'%; transform-origin: '.$layer_2d_origin_x.'% '.$layer_2d_origin_y.'%;';
1060				}
1061
1062				//handle end transitions:
1063				$endTime = trim(UniteFunctionsRev::getVal($layer, "endtime"));
1064				$realEndTime = trim(UniteFunctionsRev::getVal($layer, "realEndTime"));
1065				$endWithSlide = UniteFunctionsRev::getVal($layer, "endWithSlide",false);
1066				$endSpeed = trim(UniteFunctionsRev::getVal($layer, "endspeed"));
1067
1068				$calcSpeed = (!empty($endSpeed)) ? $endSpeed : $speed;
1069
1070				if(!empty($calcSpeed) && $realEndTime - $calcSpeed !== $endTime){
1071					$endTime = $realEndTime - $calcSpeed;
1072				}
1073
1074				$htmlEnd = "";
1075				$customout = '';
1076				if(!empty($endTime) && $endWithSlide !== true){
1077					$htmlEnd = " data-end=\"$endTime\""." \n";
1078				}
1079
1080				if(!empty($endSpeed))
1081					$htmlEnd .= " data-endspeed=\"$endSpeed\""." \n";
1082
1083				$endEasing = trim(UniteFunctionsRev::getVal($layer, "endeasing"));
1084				if(!empty($endSpeed) && $endEasing != "nothing")
1085					 $htmlEnd .= "			data-endeasing=\"$endEasing\""." \n";
1086
1087				//add animation to class
1088				$endAnimation = trim(UniteFunctionsRev::getVal($layer, "endanimation"));
1089				if($endAnimation == "fade") $endAnimation = "tp-fade";
1090
1091				if(!array_key_exists($endAnimation, $endAnimations) && array_key_exists($endAnimation, $customEndAnimations)){ //if true, add custom animation
1092					$customout = ' data-customout="';
1093					$animArr = RevOperations::getCustomAnimationByHandle($customEndAnimations[$endAnimation]);
1094					if($animArr !== false) $customout.= RevOperations::parseCustomAnimationByArray($animArr);
1095					$customout.= '"';
1096					$endAnimation = 'customout';
1097				}
1098
1099				if(strpos($endAnimation, 'customin-') !== false || strpos($endAnimation, 'customout-') !== false) $endAnimation = "";
1100
1101				if(!empty($endAnimation) && $endAnimation != "auto")
1102					$outputClass .= " ".$endAnimation;
1103
1104				//slide link
1105				$htmlLink = "";
1106				$slideLink = UniteFunctionsRev::getVal($layer, "link_slide");
1107				if(!empty($slideLink) && $slideLink != "nothing" && $slideLink != "scroll_under"){
1108					//get slide index from id
1109					if(is_numeric($slideLink))
1110						$slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink);
1111
1112					if(!empty($slideLink))
1113						$htmlLink = " data-linktoslide=\"$slideLink\""." \n";
1114				}
1115
1116				//scroll under the slider
1117				if($slideLink == "scroll_under"){
1118					$outputClass .= " tp-scrollbelowslider";
1119					$scrollUnderOffset = intval(UniteFunctionsRev::getVal($layer, "scrollunder_offset"));
1120					
1121					$htmlLink .= " data-scrolloffset=\"".$scrollUnderOffset."\""." \n";
1122				}
1123
1124				//hidden under resolution
1125				$htmlHidden = "";
1126				$layerHidden = UniteFunctionsRev::getVal($layer, "hiddenunder");
1127				if($layerHidden == "true" || $layerHidden == "1")
1128					$htmlHidden = '			data-captionhidden="on"'." \n";
1129
1130				$htmlParams = $add_data.$htmlEnd.$htmlLink.$htmlVideoAutoplay.$htmlVideoAutoplayOnlyFirstTime.$htmlVideoNextSlide.$htmlVideoThumbnail.$htmlHidden.$htmlMute.$htmlDisableOnMobile.$htmlCover.$htmlDotted.$htmlRatio.$htmlRewind."\n";
1131
1132				//set positioning options
1133
1134				$alignHor = UniteFunctionsRev::getVal($layer,"align_hor","left");
1135				$alignVert = UniteFunctionsRev::getVal($layer, "align_vert","top");
1136
1137				$htmlPosX = "";
1138				$htmlPosY = "";
1139				switch($alignHor){
1140					default:
1141					case "left":
1142						$htmlPosX = " data-x=\"".$left."\"";
1143					break;
1144					case "center":
1145						$htmlPosX = " data-x=\"center\" data-hoffset=\"".$left."\"";
1146					break;
1147					case "right":
1148						$left = (int)$left*-1;
1149						$htmlPosX = " data-x=\"right\" data-hoffset=\"".$left."\"";
1150					break;
1151				}
1152
1153				switch($alignVert){
1154					default:
1155					case "top":
1156						$htmlPosY = " data-y=\"".$top."\" ";
1157					break;
1158					case "middle":
1159						$htmlPosY = " data-y=\"center\" data-voffset=\"".$top."\"";
1160					break;
1161					case "bottom":
1162						$top = (int)$top*-1;
1163						$htmlPosY = " data-y=\"bottom\" data-voffset=\"".$top."\"";
1164					break;
1165				}
1166
1167				//set corners
1168				$htmlCorners = "";
1169
1170				if($type == "text"){
1171					$cornerLeft = UniteFunctionsRev::getVal($layer, "corner_left");
1172					$cornerRight = UniteFunctionsRev::getVal($layer, "corner_right");
1173					switch($cornerLeft){
1174						case "curved":
1175							$htmlCorners .= "<div class='frontcorner'></div>";
1176						break;
1177						case "reverced":
1178							$htmlCorners .= "<div class='frontcornertop'></div>";
1179						break;
1180					}
1181
1182					switch($cornerRight){
1183						case "curved":
1184							$htmlCorners .= "<div class='backcorner'></div>";
1185						break;
1186						case "reverced":
1187							$htmlCorners .= "<div class='backcornertop'></div>";
1188						break;
1189					}
1190
1191				//add resizeme class
1192				$resizeme = UniteFunctionsRev::getVal($layer, "resizeme");
1193				if($resizeme == "true" || $resizeme == "1")
1194					$outputClass .= ' tp-resizeme';
1195
1196				}//end text related layer
1197
1198				//make some modifications for the full screen video
1199				if($isFullWidthVideo == true){
1200					$htmlPosX = " data-x=\"0\"";
1201					$htmlPosY = " data-y=\"0\"";
1202					$outputClass .= " fullscreenvideo";
1203				}
1204
1205				//parallax part
1206				$use_parallax = $this->slider->getParam("use_parallax","off");
1207
1208				$parallax_class = '';
1209				if($use_parallax == 'on'){
1210					$slide_level = intval(UniteFunctionsRev::getVal($layer, "parallax_level", '-'));
1211					if($slide_level !== '-')
1212						$parallax_class = ' rs-parallaxlevel-'.$slide_level;
1213				}
1214
1215				//check for loop animation here
1216				$do_loop = UniteFunctionsRev::getVal($layer,"loop_animation","none");
1217				$loop_data = '';
1218				$loop_class = '';
1219				
1220				if($do_loop !== 'none'){
1221					$loop_class = ' '.$do_loop;
1222					switch($do_loop){
1223						case 'rs-pendulum':
1224							$loop_data.= ' data-easing="'.UniteFunctionsRev::getVal($layer,"loop_easing","Power3.easeInOut").'"';
1225							$loop_data.= ' data-startdeg="'.UniteFunctionsRev::getVal($layer,"loop_startdeg","-20").'"';
1226							$loop_data.= ' data-enddeg="'.UniteFunctionsRev::getVal($layer,"loop_enddeg","20").'"';
1227							$loop_data.= ' data-speed="'.UniteFunctionsRev::getVal($layer,"loop_speed","2").'"';
1228							$loop_data.= ' data-origin="'.UniteFunctionsRev::getVal($layer,"loop_xorigin","50").'% '.UniteFunctionsRev::getVal($layer,"loop_yorigin","50").'%"';
1229						break;
1230						case 'rs-rotate':
1231							$loop_data.= ' data-easing="'.UniteFunctionsRev::getVal($layer,"loop_easing","Power3.easeInOut").'"';
1232							$loop_data.= ' data-startdeg="'.UniteFunctionsRev::getVal($layer,"loop_startdeg","-20").'"';
1233							$loop_data.= ' data-enddeg="'.UniteFunctionsRev::getVal($layer,"loop_enddeg","20").'"';
1234							$loop_data.= ' data-speed="'.UniteFunctionsRev::getVal($layer,"loop_speed","2").'"';
1235							$loop_data.= ' data-origin="'.UniteFunctionsRev::getVal($layer,"loop_xorigin","50").'% '.UniteFunctionsRev::getVal($layer,"loop_yorigin","50").'%"';
1236						break;
1237						
1238						case 'rs-slideloop':
1239							$loop_data.= ' data-easing="'.UniteFunctionsRev::getVal($layer,"loop_easing","Power3.easeInOut").'"';
1240							$loop_data.= ' data-speed="'.UniteFunctionsRev::getVal($layer,"loop_speed","1").'"';
1241							$loop_data.= ' data-xs="'.UniteFunctionsRev::getVal($layer,"loop_xstart","0").'"';
1242							$loop_data.= ' data-xe="'.UniteFunctionsRev::getVal($layer,"loop_xend","0").'"';
1243							$loop_data.= ' data-ys="'.UniteFunctionsRev::getVal($layer,"loop_ystart","0").'"';
1244							$loop_data.= ' data-ye="'.UniteFunctionsRev::getVal($layer,"loop_yend","0").'"';
1245						break;
1246						case 'rs-pulse':
1247							$loop_data.= ' data-easing="'.UniteFunctionsRev::getVal($layer,"loop_easing","Power3.easeInOut").'"';
1248							$loop_data.= ' data-speed="'.UniteFunctionsRev::getVal($layer,"loop_speed","1").'"';
1249							$loop_data.= ' data-zoomstart="'.UniteFunctionsRev::getVal($layer,"loop_zoomstart","1").'"';
1250							$loop_data.= ' data-zoomend="'.UniteFunctionsRev::getVal($layer,"loop_zoomend","1").'"';
1251						break;
1252						case 'rs-wave':
1253							$loop_data.= ' data-speed="'.UniteFunctionsRev::getVal($layer,"loop_speed","1").'"';
1254							$loop_data.= ' data-angle="'.UniteFunctionsRev::getVal($layer,"loop_angle","0").'"';
1255							$loop_data.= ' data-radius="'.UniteFunctionsRev::getVal($layer,"loop_radius","10").'"';
1256							$loop_data.= ' data-origin="'.UniteFunctionsRev::getVal($layer,"loop_xorigin","50").'% '.UniteFunctionsRev::getVal($layer,"loop_yorigin","50").'%"';
1257						break;
1258					}
1259				}
1260
1261
1262
1263				echo "\n		<!-- LAYER NR. ";
1264				echo $zIndex - 4;
1265				echo " -->\n";
1266				echo "		<div class=\"".$outputClass;
1267				echo ($classes != '') ? ' '.$classes : '';
1268				echo $parallax_class;
1269				if($static_slide) echo ' tp-static-layer';
1270				
1271				echo $videoclass;
1272				
1273				echo "\" \n";
1274				echo ($ids != '') ? '			'.$ids." \n" : '';
1275				echo ($title != '') ? '			'.$title." \n" : '';
1276				echo ($rel != '') ? '			'.$rel." \n" : '';
1277				if($htmlPosX != "") echo "			".$htmlPosX." \n";
1278				if($htmlPosY != "") echo "			".$htmlPosY." \n";
1279				if($customin != "") echo "			".$customin." \n";
1280				if($customout != "") echo "			".$customout." \n";
1281				echo "			data-speed=\"".$speed."\" \n";
1282				echo "			data-start=\"".$time."\" \n";
1283				echo "			data-easing=\"".$easing."\" \n";
1284				if($type == "text"){ //only output if we are a text layer
1285					echo "			data-splitin=\"".$splitin."\" \n";
1286					echo "			data-splitout=\"".$splitout."\" \n";
1287				}
1288				//check if static layer and if yes, set values for it.
1289				if($static_slide){
1290					if($isTemplate != "true"){
1291						$start_on_slide = intval(UniteFunctionsRev::getVal($layer,"static_start",1)) - 1;
1292						$end_on_slide = intval(UniteFunctionsRev::getVal($layer,"static_end",2)) - 1;
1293					}else{
1294						$start_on_slide = '-1';
1295						$end_on_slide = '-1';
1296					}
1297					echo '			data-startslide="'.$start_on_slide.'"'." \n";
1298					echo '			data-endslide="'.$end_on_slide.'"'." \n";
1299				}
1300				echo "			data-elementdelay=\"".$elementdelay."\" \n";
1301				echo "			data-endelementdelay=\"".$endelementdelay."\" \n";
1302				if($htmlParams != "") echo "			".$htmlParams;
1303				echo "			style=\"z-index: ".$zIndex.";".$inline_styles. "\"";
1304				echo ">";
1305				
1306				if($do_loop !== 'none'){
1307
1308					echo "\n".'				<div style="'.$layer_rotation.'" class="tp-layer-inner-rotation ';
1309					$rotationClass = trim($class);
1310					$rotationClass = trim($rotationClass) . " ";
1311					echo $rotationClass;
1312					echo $loop_class;
1313					echo '" ';
1314					echo $loop_data;
1315					echo '>';
1316				}elseif($layer_rotation != ''){
1317					$rotationClass = trim($class);
1318					$rotationClass = trim($rotationClass) . " ";
1319					echo '<div class="tp-layer-inner-rotation '.$rotationClass.'" style="'.$layer_rotation.'">'." \n";
1320				}
1321				echo stripslashes($html)." \n";
1322				if($htmlCorners != ""){
1323					echo $htmlCorners." \n";
1324				}
1325				if($do_loop !== 'none' || $layer_rotation != ''){
1326					echo "				</div>\n";
1327				}
1328				echo "		</div>\n";
1329				$zIndex++;
1330			endforeach;
1331		}
1332
1333		/**
1334		 *
1335		 * put slider javascript
1336		 */
1337		private function putJS(){
1338
1339			$params = $this->slider->getParams();
1340			$sliderType = $this->slider->getParam("slider_type");
1341			$optFullWidth = ($sliderType == "fullwidth")?"on":"off";
1342
1343			$optFullScreen = "off";
1344			if($sliderType == "fullscreen"){
1345				$optFullWidth = "off";
1346				$optFullScreen = "on";
1347			}
1348
1349			$use_spinner = $this->slider->getParam("use_spinner","0");
1350			$spinner_color = $this->slider->getParam("spinner_color","#FFFFFF");
1351
1352			$noConflict = $this->slider->getParam("jquery_noconflict","on");
1353
1354			//set thumb amount
1355			$numSlides = $this->slider->getNumSlides(true);
1356			$thumbAmount = (int)$this->slider->getParam("thumb_amount","5");
1357			if($thumbAmount > $numSlides)
1358				$thumbAmount = $numSlides;
1359
1360
1361			//get stop slider options
1362			$stopSlider = $this->slider->getParam("stop_slider","off");
1363			$stopAfterLoops = $this->slider->getParam("stop_after_loops","0");
1364			$stopAtSlide = $this->slider->getParam("stop_at_slide","2");
1365
1366			if($stopSlider == "off"){
1367				$stopAfterLoops = "-1";
1368				$stopAtSlide = "-1";
1369			}
1370
1371			$oneSlideLoop = $this->slider->getParam("loop_slide","loop");
1372			if($oneSlideLoop == 'noloop' && $this->hasOnlyOneSlide == true){
1373				$stopAfterLoops = '0';
1374				$stopAtSlide = '1';
1375			}
1376
1377			// set hide navigation after
1378			$hideThumbs = $this->slider->getParam("hide_thumbs","200");
1379			if(is_numeric($hideThumbs) == false)
1380				$hideThumbs = "0";
1381			else{
1382				$hideThumbs = (int)$hideThumbs;
1383				if($hideThumbs < 10)
1384					$hideThumbs = 10;
1385			}
1386
1387			$alwaysOn = $this->slider->getParam("navigaion_always_on","false");
1388			if($alwaysOn == "true")
1389				$hideThumbs = "0";
1390
1391			$sliderID = $this->slider->getID();
1392
1393			//treat hide slider at limit
1394			$hideSliderAtLimit = $this->slider->getParam("hide_slider_under","0",RevSlider::VALIDATE_NUMERIC);
1395			if(!empty($hideSliderAtLimit))
1396				$hideSliderAtLimit++;
1397
1398			$hideCaptionAtLimit = $this->slider->getParam("hide_defined_layers_under","0",RevSlider::VALIDATE_NUMERIC);;
1399			if(!empty($hideCaptionAtLimit))
1400				$hideCaptionAtLimit++;
1401
1402			$hideAllCaptionAtLimit = $this->slider->getParam("hide_all_layers_under","0",RevSlider::VALIDATE_NUMERIC);;
1403			if(!empty($hideAllCaptionAtLimit))
1404				$hideAllCaptionAtLimit++;
1405
1406			//start_with_slide
1407			$startWithSlide = $this->slider->getStartWithSlideSetting();
1408
1409	 	  //modify navigation type (backward compatability)
1410			$arrowsType = $this->slider->getParam("navigation_arrows","nexttobullets");
1411			switch($arrowsType){
1412				case "verticalcentered":
1413					$arrowsType = "solo";
1414				break;
1415			}
1416
1417			//More Mobile Options
1418			$hideThumbsOnMobile = $this->slider->getParam("hide_…

Large files files are truncated, but you can click here to view the full file