/** * * get slide full width video data */ private function getSlideFullWidthVideoData(RevSlide $slide) { $response = array("found" => false); //deal full width video: $enableVideo = $slide->getParam("enable_video", "false"); if ($enableVideo != "true") { return $response; } $videoID = $slide->getParam("video_id", ""); $videoID = trim($videoID); if (empty($videoID)) { return $response; } $response["found"] = true; $videoType = is_numeric($videoID) ? "vimeo" : "youtube"; $videoAutoplay = $slide->getParam("video_autoplay"); $response["type"] = $videoType; $response["videoID"] = $videoID; $response["autoplay"] = UniteFunctionsRev::strToBool($videoAutoplay); return $response; }
public function loadXMLFile($filepath) { if (!file_exists($filepath)) { UniteFunctionsRev::throwError("File: '{$filepath}' not exists!!!"); } $obj = simplexml_load_file($filepath); if (empty($obj)) { UniteFunctionsRev::throwError("Wrong xml file format: {$filepath}"); } $fieldsets = $obj->fieldset; if (!@count($obj->fieldset)) { $fieldsets = array($fieldsets); } $this->addSection("Xml Settings"); foreach ($fieldsets as $fieldset) { //Add Section $attribs = $fieldset->attributes(); $sapName = (string) UniteFunctionsRev::getVal($attribs, "name"); $sapLabel = (string) UniteFunctionsRev::getVal($attribs, "label"); if ($sapLabel != '' && isset(RevsliderPrestashop::$lang[$sapLabel])) { $sapLabel = RevsliderPrestashop::$lang[$sapLabel]; } $sapIcon = (string) UniteFunctionsRev::getVal($attribs, "icon"); UniteFunctionsRev::validateNotEmpty($sapName, "sapName"); UniteFunctionsRev::validateNotEmpty($sapLabel, "sapLabel"); $this->addSap($sapLabel, $sapName, false, $sapIcon); //--- add fields $fieldset = (array) $fieldset; $fields = $fieldset["field"]; if (is_array($fields) == false) { $fields = array($fields); } foreach ($fields as $field) { $attribs = $field->attributes(); $fieldType = (string) UniteFunctionsRev::getVal($attribs, "type"); $fieldName = (string) UniteFunctionsRev::getVal($attribs, "name"); $fieldLabel = (string) UniteFunctionsRev::getVal($attribs, "label"); if ($fieldLabel != '' && isset(RevsliderPrestashop::$lang[$fieldLabel])) { $fieldLabel = RevsliderPrestashop::$lang[$fieldLabel]; } $fieldDefaultValue = (string) UniteFunctionsRev::getVal($attribs, "default"); //all other params will be added to "params array". $arrMustParams = array("type", "name", "label", "default"); $arrParams = array(); foreach ($attribs as $key => $value) { $key = (string) $key; $value = (string) $value; //skip must params: if (in_array($key, $arrMustParams)) { continue; } $arrParams[$key] = $value; } $options = $this->getOptionsFromXMLField($field, $fieldName); //validate must fields: UniteFunctionsRev::validateNotEmpty($fieldType, "type"); //validate name if ($fieldType != self::TYPE_HR && $fieldType != self::TYPE_CONTROL && $fieldType != "bulk_control_start" && $fieldType != "bulk_control_end") { UniteFunctionsRev::validateNotEmpty($fieldName, "name"); } switch ($fieldType) { case self::TYPE_CHECKBOX: $fieldDefaultValue = UniteFunctionsRev::strToBool($fieldDefaultValue); $this->addCheckbox($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams); break; case self::TYPE_COLOR: $this->addColorPicker($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams); break; case self::TYPE_HR: $this->addHr(); break; case self::TYPE_TEXT: $this->addTextBox($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams); break; case self::TYPE_MULTIPLE_TEXT: $this->addMultipleTextBox($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams); break; case self::TYPE_STATIC_TEXT: $this->addStaticText($fieldLabel, $fieldName, $arrParams); break; case self::TYPE_IMAGE: $this->addImage($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams); break; case self::TYPE_SELECT: $this->addSelect($fieldName, $options, $fieldLabel, $fieldDefaultValue, $arrParams); break; case self::TYPE_CHECKBOX: $this->addChecklist($fieldName, $options, $fieldLabel, $fieldDefaultValue, $arrParams); break; case self::TYPE_RADIO: $this->addRadio($fieldName, $options, $fieldLabel, $fieldDefaultValue, $arrParams); break; case self::TYPE_TEXTAREA: $this->addTextArea($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams); break; case self::TYPE_CUSTOM: $this->add($fieldName, $fieldDefaultValue, $fieldLabel, self::TYPE_CUSTOM, $arrParams); break; case self::TYPE_BUTTON: $this->addButton($fieldName, $fieldDefaultValue, $arrParams); break; case self::TYPE_CONTROL: $parent = UniteFunctionsRev::getVal($arrParams, "parent"); $child = UniteFunctionsRev::getVal($arrParams, "child"); $ctype = UniteFunctionsRev::getVal($arrParams, "ctype"); $value = UniteFunctionsRev::getVal($arrParams, "value"); $this->addControl($parent, $child, $ctype, $value); break; case "bulk_control_start": $parent = UniteFunctionsRev::getVal($arrParams, "parent"); $ctype = UniteFunctionsRev::getVal($arrParams, "ctype"); $value = UniteFunctionsRev::getVal($arrParams, "value"); $this->startBulkControl($parent, $ctype, $value); break; case "bulk_control_end": $this->endBulkControl(); break; case "codemirror": $this->addCodemirror($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams); break; default: UniteFunctionsRev::throwError("wrong type: {$fieldType}"); break; } } } }
/** * * put html slider on the html page. * @param $data - mixed, can be ID ot Alias. */ public function putSliderBase($sliderID) { try { self::$sliderSerial++; $this->slider = new RevSlider(); $this->slider->initByMixed($sliderID); // Do not output Slider if we are on mobile $disable_on_mobile = $this->slider->getParam("disable_on_mobile", "off"); $isMobile = strstr($_SERVER['HTTP_USER_AGENT'], 'Android') || strstr($_SERVER['HTTP_USER_AGENT'], 'webOS') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') ? true : false; if ($disable_on_mobile == 'on' && $isMobile) { return false; } $show_alternate = $this->slider->getParam("show_alternative_type", "off"); if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') { if ($isMobile) { $show_alternate_image = $this->slider->getParam("show_alternate_image", ""); echo '<img class="tp-slider-alternative-image" src="' . $show_alternate_image . '">'; return false; } } $doWrapFromTemplate = false; if ($this->slider->isSlidesFromPosts() && $this->slider->getParam("slider_template_id", false) !== false) { //need to use general settings from the Template Slider $this->slider->initByMixed($this->slider->getParam("slider_template_id", false)); $doWrapFromTemplate = $sliderID; } //modify settings for admin preview mode if ($this->previewMode == true) { $this->modifyPreviewModeSettings(); } //set slider language $isWpmlExists = UniteWpmlRev::isWpmlExists(); $useWpml = $this->slider->getParam("use_wpml", "off"); if ($isWpmlExists && $useWpml == "on") { if ($this->previewMode == false) { $this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode(); } } //edit html before slider $htmlBeforeSlider = ""; if ($this->slider->getParam("load_googlefont", "false") == "true") { $googleFont = $this->slider->getParam("google_font"); if (is_array($googleFont)) { foreach ($googleFont as $key => $font) { $htmlBeforeSlider .= RevOperations::getCleanFontImport($font); } } else { $htmlBeforeSlider .= RevOperations::getCleanFontImport($googleFont); } } //pub js to body handle if ($this->jsToBody == true) { //$operations = new RevOperations(); //$arrValues = $operations->getGeneralSettingsValues(); $urlIncludeJSTools = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.tools.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJSTools}'></script>\n"; //$enable_logs = UniteFunctionsRev::getVal($arrValues, "enable_logs",'off'); $enable_logs = "off"; if ($enable_logs == 'on') { $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.enablelog.js?rev=" . GlobalsRevSlider::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>"; } $useHammer = 'on'; if ($useHammer == 'off') { $urlIncludeJS = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.disablehammer.js?rev=" . GlobalsRevSlider::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>\n"; } $urlIncludeJS = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.revolution.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>\n"; } //the initial id can be alias $sliderID = $this->slider->getID(); $bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width"); $bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height"); $sliderType = $this->slider->getParam("slider_type"); //set wrapper height $wrapperHeigh = 0; $wrapperHeigh += $this->slider->getParam("height"); //add thumb height if ($this->slider->getParam("navigaion_type") == "thumb") { $wrapperHeigh += $this->slider->getParam("thumb_height"); } $this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial; $this->sliderHtmlID_wrapper = $this->sliderHtmlID . "_wrapper"; $containerStyle = ""; $sliderPosition = $this->slider->getParam("position", "center"); //set position: if ($sliderType != "fullscreen") { switch ($sliderPosition) { case "center": default: $containerStyle .= "margin:0px auto;"; break; case "left": $containerStyle .= "float:left;"; break; case "right": $containerStyle .= "float:right;"; break; } } //add background color $backgrondColor = trim($this->slider->getParam("background_color")); if (!empty($backgrondColor)) { $containerStyle .= "background-color:{$backgrondColor};"; } //set padding $containerStyle .= "padding:" . $this->slider->getParam("padding", "0") . "px;"; //set margin: if ($sliderType != "fullscreen") { if ($sliderPosition != "center") { $containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;"; $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;"; } $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;"; $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;"; } //set height and width: $bannerStyle = "display:none;"; //add background image (to banner style) $showBackgroundImage = $this->slider->getParam("show_background_image", "false"); if ($showBackgroundImage == "true") { $backgroundImage = $this->slider->getParam("background_image"); $backgroundFit = $this->slider->getParam("bg_fit", "cover"); $backgroundRepeat = $this->slider->getParam("bg_repeat", "no-repeat"); $backgroundPosition = $this->slider->getParam("bg_position", "center top"); if (!empty($backgroundImage)) { $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:" . $backgroundRepeat . ";background-fit:" . $backgroundFit . ";background-position:" . $backgroundPosition . ";"; } } //set wrapper and slider class: $sliderWrapperClass = "rev_slider_wrapper"; $sliderClass = "rev_slider"; $putResponsiveStyles = false; switch ($sliderType) { default: case "fixed": $bannerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;"; $containerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;"; break; case "responsitive": //$containerStyle .= "height:".$bannerHeight."px;"; $putResponsiveStyles = true; break; case "fullwidth": $sliderWrapperClass .= " fullwidthbanner-container"; $sliderClass .= " fullwidthabanner"; $bannerStyle .= "max-height:" . $bannerHeight . "px;height:" . $bannerHeight . "px;"; $containerStyle .= "max-height:" . $bannerHeight . "px;"; break; case "fullscreen": //$containerStyle .= "height:".$bannerHeight."px;"; $sliderWrapperClass .= " fullscreen-container"; $sliderClass .= " fullscreenbanner"; break; } //handle position behind $posBehind = $this->slider->getParam("position_behind", "false"); $posBehind = UniteFunctionsRev::strToBool($posBehind); if ($posBehind == true) { $containerStyle .= "position:relative;z-index:0;"; } $htmlTimerBar = ""; $timerBar = $this->slider->getParam("show_timerbar", "top"); if ($timerBar == "true") { $timerBar = $this->slider->getParam("timebar_position", "top"); } switch ($timerBar) { case "top": $htmlTimerBar = '<div class="tp-bannertimer"></div>'; break; case "bottom": $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>'; break; case "hide": $htmlTimerBar = '<div class="tp-bannertimer tp-bottom" style="display:none; visibility: hidden !important;"></div>'; break; } //check inner / outer border $paddingType = $this->slider->getParam("padding_type", "outter"); if ($paddingType == "inner") { $sliderWrapperClass .= " tp_inner_padding"; } global $revSliderVersion; echo "<!-- START REVOLUTION SLIDER " . $revSliderVersion . " " . $sliderType . " mode -->\n"; if ($putResponsiveStyles == true) { $this->putResponsitiveStyles(); } echo $htmlBeforeSlider . "\n"; echo "<div id=\""; echo $this->sliderHtmlID_wrapper; echo "\" "; echo "class=\"" . $sliderWrapperClass . "\""; $show_alternate = $this->slider->getParam("show_alternative_type", "off"); if ($show_alternate !== 'off') { $show_alternate_image = $this->slider->getParam("show_alternate_image", ""); echo ' data-aimg="' . $show_alternate_image . '" '; if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') { echo ' data-amobile="enabled" '; } else { echo ' data-amobile="disabled" '; } if ($show_alternate == 'mobile-ie8' || $show_alternate == 'ie8') { echo ' data-aie8="enabled" '; } else { echo ' data-aie8="disabled" '; } } echo " style=\"" . $containerStyle . "\">\n"; echo "\t<div id=\""; echo $this->sliderHtmlID; echo "\" "; echo "class=\"" . $sliderClass . "\""; echo " style=\"" . $bannerStyle . "\">\n"; echo $this->putSlides($doWrapFromTemplate); echo $htmlTimerBar; echo "\t</div>\n"; $this->putJS(); echo "</div>\n"; echo "<!-- END REVOLUTION SLIDER -->"; } catch (Exception $e) { $message = $e->getMessage(); $this->putErrorMessage($message); } }
/** * * put creative layer */ private function putCreativeLayer(RevSlide $slide) { $layers = $slide->getLayers(); if (empty($layers)) { return false; } ?> <?php foreach ($layers as $layer) { $type = UniteFunctionsRev::getVal($layer, "type", "text"); //set if video full screen $isFullWidthVideo = false; if ($type == "video") { $videoData = UniteFunctionsRev::getVal($layer, "video_data"); if (!empty($videoData)) { $videoData = (array) $videoData; $isFullWidthVideo = UniteFunctionsRev::getVal($videoData, "fullwidth"); $isFullWidthVideo = UniteFunctionsRev::strToBool($isFullWidthVideo); } else { $videoData = array(); } } $class = UniteFunctionsRev::getVal($layer, "style"); $animation = UniteFunctionsRev::getVal($layer, "animation", "fade"); //set output class: $outputClass = "tp-caption " . trim($class); $outputClass = trim($outputClass) . " "; $outputClass .= trim($animation); $left = UniteFunctionsRev::getVal($layer, "left", 0); $top = UniteFunctionsRev::getVal($layer, "top", 0); $speed = UniteFunctionsRev::getVal($layer, "speed", 300); $time = UniteFunctionsRev::getVal($layer, "time", 0); $easing = UniteFunctionsRev::getVal($layer, "easing", "easeOutExpo"); $randomRotate = UniteFunctionsRev::getVal($layer, "random_rotation", "false"); $randomRotate = UniteFunctionsRev::boolToStr($randomRotate); $text = UniteFunctionsRev::getVal($layer, "text"); $htmlVideoAutoplay = ""; $htmlVideoNextSlide = ""; //set html: $html = ""; switch ($type) { default: case "text": $html = $text; $html = do_shortcode($html); break; case "image": $urlImage = UniteFunctionsRev::getVal($layer, "image_url"); $html = '<img src="' . $urlImage . '" alt="' . $text . '">'; $imageLink = UniteFunctionsRev::getVal($layer, "link", ""); if (!empty($imageLink)) { $openIn = UniteFunctionsRev::getVal($layer, "link_open_in", "same"); $target = ""; if ($openIn == "new") { $target = ' target="_blank"'; } $html = '<a href="' . $imageLink . '"' . $target . '>' . $html . '</a>'; } break; case "video": $videoType = trim(UniteFunctionsRev::getVal($layer, "video_type")); $videoID = trim(UniteFunctionsRev::getVal($layer, "video_id")); $videoWidth = trim(UniteFunctionsRev::getVal($layer, "video_width")); $videoHeight = trim(UniteFunctionsRev::getVal($layer, "video_height")); $videoArgs = trim(UniteFunctionsRev::getVal($layer, "video_args")); if ($isFullWidthVideo == true) { $videoWidth = "100%"; $videoHeight = "100%"; } switch ($videoType) { case "youtube": if (empty($videoArgs)) { $videoArgs = GlobalsRevSlider::DEFAULT_YOUTUBE_ARGUMENTS; } $html = "<iframe src='http://www.youtube.com/embed/{$videoID}?{$videoArgs}' width='{$videoWidth}' height='{$videoHeight}' style='width:{$videoWidth}px;height:{$videoHeight}px;'></iframe>"; break; case "vimeo": if (empty($videoArgs)) { $videoArgs = GlobalsRevSlider::DEFAULT_VIMEO_ARGUMENTS; } $html = "<iframe src='http://player.vimeo.com/video/{$videoID}?{$videoArgs}' width='{$videoWidth}' height='{$videoHeight}' style='width:{$videoWidth}px;height:{$videoHeight}px;'></iframe>"; break; case "html5": $html = $this->getHtml5LayerHtml($videoData); break; default: UniteFunctionsRev::throwError("wrong video type: {$videoType}"); break; } //set video autoplay, with backward compatability if (array_key_exists("autoplay", $videoData)) { $videoAutoplay = UniteFunctionsRev::getVal($videoData, "autoplay"); } else { //backword compatability $videoAutoplay = UniteFunctionsRev::getVal($layer, "video_autoplay"); } $videoAutoplay = UniteFunctionsRev::strToBool($videoAutoplay); if ($videoAutoplay == true) { $htmlVideoAutoplay = ' data-autoplay="true"'; } $videoNextSlide = UniteFunctionsRev::getVal($videoData, "nextslide"); $videoNextSlide = UniteFunctionsRev::strToBool($videoNextSlide); if ($videoNextSlide == true) { $htmlVideoNextSlide = ' data-nextslideatend="true"'; } break; } //handle end transitions: $endTime = trim(UniteFunctionsRev::getVal($layer, "endtime")); $htmlEnd = ""; if (!empty($endTime)) { $htmlEnd = "data-end=\"{$endTime}\""; $endSpeed = trim(UniteFunctionsRev::getVal($layer, "endspeed")); if (!empty($endSpeed)) { $htmlEnd .= " data-endspeed=\"{$endSpeed}\""; } $endEasing = trim(UniteFunctionsRev::getVal($layer, "endeasing")); if (!empty($endSpeed) && $endEasing != "nothing") { $htmlEnd .= " data-endeasing=\"{$endEasing}\""; } //add animation to class $endAnimation = trim(UniteFunctionsRev::getVal($layer, "endanimation")); if (!empty($endAnimation) && $endAnimation != "auto") { $outputClass .= " " . $endAnimation; } } //slide link $htmlLink = ""; $slideLink = UniteFunctionsRev::getVal($layer, "link_slide"); if (!empty($slideLink) && $slideLink != "nothing" && $slideLink != "scroll_under") { //get slide index from id if (is_numeric($slideLink)) { $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink); } if (!empty($slideLink)) { $htmlLink = " data-linktoslide=\"{$slideLink}\""; } } //scroll under the slider if ($slideLink == "scroll_under") { $outputClass .= " tp-scrollbelowslider"; $scrollUnderOffset = UniteFunctionsRev::getVal($layer, "scrollunder_offset"); if (!empty($scrollUnderOffset)) { $htmlLink .= " data-scrolloffset=\"{$scrollUnderOffset}\""; } } //hidden under resolution $htmlHidden = ""; $layerHidden = UniteFunctionsRev::getVal($layer, "hiddenunder"); if ($layerHidden == "true" || $layerHidden == "1") { $htmlHidden = ' data-captionhidden="on"'; } $htmlParams = $htmlEnd . $htmlLink . $htmlVideoAutoplay . $htmlVideoNextSlide . $htmlHidden; //set positioning options $alignHor = UniteFunctionsRev::getVal($layer, "align_hor", "left"); $alignVert = UniteFunctionsRev::getVal($layer, "align_vert", "top"); $htmlPosX = ""; $htmlPosY = ""; switch ($alignHor) { default: case "left": $htmlPosX = "data-x=\"{$left}\" \n"; break; case "center": $htmlPosX = "data-x=\"center\" data-hoffset=\"{$left}\" \n"; break; case "right": $left = (int) $left * -1; $htmlPosX = "data-x=\"right\" data-hoffset=\"{$left}\" \n"; break; } switch ($alignVert) { default: case "top": $htmlPosY = "data-y=\"{$top}\" "; break; case "middle": $htmlPosY = "data-y=\"center\" data-voffset=\"{$top}\" "; break; case "bottom": $top = (int) $top * -1; $htmlPosY = "data-y=\"bottom\" data-voffset=\"{$top}\" "; break; } //set corners $htmlCorners = ""; if ($type == "text") { $cornerLeft = UniteFunctionsRev::getVal($layer, "corner_left"); $cornerRight = UniteFunctionsRev::getVal($layer, "corner_right"); switch ($cornerLeft) { case "curved": $htmlCorners .= "<div class='frontcorner'></div>"; break; case "reverced": $htmlCorners .= "<div class='frontcornertop'></div>"; break; } switch ($cornerRight) { case "curved": $htmlCorners .= "<div class='backcorner'></div>"; break; case "reverced": $htmlCorners .= "<div class='backcornertop'></div>"; break; } //add resizeme class $resizeme = UniteFunctionsRev::getVal($layer, "resizeme"); if ($resizeme == "true" || $resizeme == "1") { $outputClass .= ' tp-resizeme'; } } //end text related layer //make some modifications for the full screen video if ($isFullWidthVideo == true) { $htmlPosX = "data-x=\"0\"" . "\n"; $htmlPosY = "data-y=\"0\"" . "\n"; $outputClass .= " fullscreenvideo"; } ?> <div class="<?php echo $outputClass; ?> " <?php echo $htmlPosX; ?> <?php echo $htmlPosY; ?> data-speed="<?php echo $speed; ?> " data-start="<?php echo $time; ?> " data-easing="<?php echo $easing; ?> " <?php echo $htmlParams; ?> ><?php echo $html; ?> <?php echo $htmlCorners; ?> </div> <?php } }
/** * * put creative layer */ private function putCreativeLayer(RevSlide $slide, $static_slide = false) { $layers = $slide->getLayers(); $customAnimations = RevOperations::getCustomAnimations('customin'); //get all custom animations $customEndAnimations = RevOperations::getCustomAnimations('customout'); //get all custom animations $startAnimations = RevOperations::getArrAnimations(false); //only get the standard animations $endAnimations = RevOperations::getArrEndAnimations(false); //only get the standard animations $lazyLoad = $this->slider->getParam("lazy_load", "off"); $isTemplate = $this->slider->getParam("template", "false"); if (empty($layers)) { return false; } $zIndex = 2; foreach ($layers as $layer) { $type = UniteFunctionsRev::getVal($layer, "type", "text"); //set if video full screen $videoclass = ''; $isFullWidthVideo = false; if ($type == "video") { $videoclass = ' tp-videolayer'; $videoData = UniteFunctionsRev::getVal($layer, "video_data"); if (!empty($videoData)) { $videoData = (array) $videoData; $isFullWidthVideo = UniteFunctionsRev::getVal($videoData, "fullwidth"); $isFullWidthVideo = UniteFunctionsRev::strToBool($isFullWidthVideo); } else { $videoData = array(); } } $class = UniteFunctionsRev::getVal($layer, "style"); if (trim($class) !== '') { $this->class_include['.' . trim($class)] = true; } //add classname for style inclusion $animation = UniteFunctionsRev::getVal($layer, "animation", "tp-fade"); if ($animation == "fade") { $animation = "tp-fade"; } $customin = ''; if (!array_key_exists($animation, $startAnimations) && array_key_exists($animation, $customAnimations)) { //if true, add custom animation $customin .= 'data-customin="'; $animArr = RevOperations::getCustomAnimationByHandle($customAnimations[$animation]); if ($animArr !== false) { $customin .= RevOperations::parseCustomAnimationByArray($animArr); } $customin .= '"'; $animation = 'customin'; } if (strpos($animation, 'customin-') !== false || strpos($animation, 'customout-') !== false) { $animation = "tp-fade"; } //set output class: $layer_2d_rotation = intval(UniteFunctionsRev::getVal($layer, "2d_rotation", '0')); $layer_2d_origin_x = intval(UniteFunctionsRev::getVal($layer, "2d_origin_x", '50')); $layer_2d_origin_y = intval(UniteFunctionsRev::getVal($layer, "2d_origin_y", '50')); if ($layer_2d_rotation == 0) { $outputClass = "tp-caption " . trim($class); } else { $outputClass = "tp-caption "; } $outputClass = trim($outputClass) . " "; $outputClass .= trim($animation); $left = UniteFunctionsRev::getVal($layer, "left", 0); $top = UniteFunctionsRev::getVal($layer, "top", 0); $speed = UniteFunctionsRev::getVal($layer, "speed", 300); $time = UniteFunctionsRev::getVal($layer, "time", 0); $easing = UniteFunctionsRev::getVal($layer, "easing", "easeOutExpo"); $randomRotate = UniteFunctionsRev::getVal($layer, "random_rotation", "false"); $randomRotate = UniteFunctionsRev::boolToStr($randomRotate); $splitin = UniteFunctionsRev::getVal($layer, "split", "none"); $splitout = UniteFunctionsRev::getVal($layer, "endsplit", "none"); $elementdelay = intval(UniteFunctionsRev::getVal($layer, "splitdelay", 0)); $endelementdelay = intval(UniteFunctionsRev::getVal($layer, "endsplitdelay", 0)); if ($elementdelay > 0) { $elementdelay /= 100; } if ($endelementdelay > 0) { $endelementdelay /= 100; } $text = UniteFunctionsRev::getVal($layer, "text"); if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) { //use qTranslate $text = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($text); } $htmlVideoAutoplay = ""; $htmlVideoAutoplayOnlyFirstTime = ""; $htmlVideoNextSlide = ""; $htmlVideoThumbnail = ""; $htmlMute = ''; $htmlCover = ''; $htmlDotted = ''; $htmlRatio = ''; $htmlRewind = ''; $htmlDisableOnMobile = ''; $ids = UniteFunctionsRev::getVal($layer, "attrID"); $classes = UniteFunctionsRev::getVal($layer, "attrClasses"); $title = UniteFunctionsRev::getVal($layer, "attrTitle"); $rel = UniteFunctionsRev::getVal($layer, "attrRel"); $ids = $ids != '' ? ' id="' . $ids . '"' : ''; $classes = $classes != '' ? ' ' . $classes : ''; $title = $title != '' ? ' title="' . $title . '"' : ''; $rel = $rel != '' ? ' rel="' . $rel . '"' : ''; $max_width = UniteFunctionsRev::getVal($layer, "max_width", 'auto'); $max_height = UniteFunctionsRev::getVal($layer, "max_height", 'auto'); $white_space = UniteFunctionsRev::getVal($layer, "whitespace", 'nowrap'); $inline_styles = ''; $layer_rotation = ''; $do_rotation = false; $add_data = ''; //set html: $html = ""; switch ($type) { default: case "text": $html = $text; $inline_styles .= ' max-width: ' . $max_width . '; max-height: ' . $max_height . '; white-space: ' . $white_space . ';'; if ($layer_2d_rotation !== 0) { $do_rotation = true; } break; case "image": $alt = UniteFunctionsRev::getVal($layer, "alt"); if (isset($slide->ignore_alt)) { $alt = ''; } $urlImage = UniteFunctionsRev::getVal($layer, "image_url"); $additional = ""; $scaleX = UniteFunctionsRev::getVal($layer, "scaleX"); $scaleY = UniteFunctionsRev::getVal($layer, "scaleY"); if ($scaleX != '') { $additional .= ' data-ww="' . $scaleX . '"'; } if ($scaleY != '') { $additional .= ' data-hh="' . $scaleY . '"'; } if (is_ssl()) { $urlImage = str_replace("http://", "https://", $urlImage); } $imageAddParams = ""; if ($lazyLoad == "on") { $imageAddParams .= " data-lazyload=\"{$urlImage}\""; $urlImage = GlobalsRevSlider::$url_media . "assets/images/dummy.png"; } $urlImage = UniteFunctionJoomlaRev::urlToFull($urlImage); $html = '<img src="' . $urlImage . '" alt="' . $alt . '"' . $additional . $imageAddParams . '>'; $imageLink = UniteFunctionsRev::getVal($layer, "link", ""); if (!empty($imageLink)) { $openIn = UniteFunctionsRev::getVal($layer, "link_open_in", "same"); $target = ""; if ($openIn == "new") { $target = ' target="_blank"'; } $linkID = UniteFunctionsRev::getVal($layer, "link_id", ""); $linkClass = UniteFunctionsRev::getVal($layer, "link_class", ""); $linkTitle = UniteFunctionsRev::getVal($layer, "link_title", ""); $linkRel = UniteFunctionsRev::getVal($layer, "link_rel", ""); $linkIDHtml = ""; $linkClassHtml = ""; $linkTitleHtml = ""; $linkRelHtml = ""; if (!empty($linkID)) { $linkIDHtml = ' id="' . $linkID . '"'; } if (!empty($linkClass)) { $linkClassHtml = ' class="' . $linkClass . '"'; } if (!empty($linkTitle)) { $linkTitleHtml = ' title="' . $linkTitle . '"'; } if (!empty($linkRel)) { $linkRelHtml = ' rel="' . $linkRel . '"'; } $html = '<a href="' . $imageLink . '"' . $target . $linkIDHtml . $linkClassHtml . $linkTitleHtml . $linkRelHtml . '>' . $html . '</a>'; } if ($layer_2d_rotation !== 0) { $do_rotation = true; } break; case "video": $videoType = trim(UniteFunctionsRev::getVal($layer, "video_type")); $videoID = trim(UniteFunctionsRev::getVal($layer, "video_id")); $videoWidth = trim(UniteFunctionsRev::getVal($layer, "video_width")); $videoHeight = trim(UniteFunctionsRev::getVal($layer, "video_height")); $videoArgs = trim(UniteFunctionsRev::getVal($layer, "video_args")); $v_controls = UniteFunctionsRev::getVal($videoData, "controls"); $v_controls = UniteFunctionsRev::strToBool($v_controls); $rewind = UniteFunctionsRev::getVal($videoData, "forcerewind"); $rewind = UniteFunctionsRev::strToBool($rewind); $htmlRewind = $rewind == true ? ' data-forcerewind="on"' : ''; /* $cover = UniteFunctionsRev::getVal($videoData, "cover"); $cover = UniteFunctionsRev::strToBool($cover); if($cover == true){ $dotted = UniteFunctionsRev::getVal($videoData, "dotted"); if($dotted !== 'none') $htmlDotted = ' data-dottedoverlay="'.$dotted.'"'; $ratio = UniteFunctionsRev::getVal($videoData, "ratio"); if(!empty($ratio)) $htmlRatio = ' data-aspectratio="'.$ratio.'"'; } */ if ($isFullWidthVideo == true) { // || $cover == true $videoWidth = "100%"; $videoHeight = "100%"; } $setBase = is_ssl() ? "https://" : "http://"; switch ($videoType) { case "youtube": if (empty($videoArgs)) { $videoArgs = GlobalsRevSlider::DEFAULT_YOUTUBE_ARGUMENTS; } //check if full URL if (strpos($videoID, 'http') !== false) { //we have full URL, split it to ID parse_str(parse_url($videoID, PHP_URL_QUERY), $my_v_ret); $videoID = $my_v_ret['v']; } $videospeed = UniteFunctionsRev::getVal($videoData, "videospeed", '1'); //$ytBase = 'https://'; //if($v_controls) $videoArgs.='controls=0;'; $videoArgs .= ';origin=' . $setBase . $_SERVER['SERVER_NAME'] . ';'; $add_data = ' data-ytid="' . $videoID . '" data-videowidth="' . $videoWidth . '" data-videoheight="' . $videoHeight . '" data-videoattributes="version=3&enablejsapi=1&html5=1&' . $videoArgs . '" data-videorate="' . $videospeed . '"'; $add_data .= $v_controls ? ' data-videocontrols="none"' : ' data-videocontrols="controls"'; //$html = "<iframe src='".$ytBase."www.youtube.com/embed/".$videoID."?enablejsapi=1&html5=1&".$videoArgs."' allowfullscreen='true' width='".$videoWidth."' height='".$videoHeight."' style='width:".$videoWidth."px;height:".$videoHeight."px;'></iframe>"; break; case "vimeo": if (empty($videoArgs)) { $videoArgs = GlobalsRevSlider::DEFAULT_VIMEO_ARGUMENTS; } //check if full URL if (strpos($videoID, 'http') !== false) { //we have full URL, split it to ID $videoID = (int) substr(parse_url($videoID, PHP_URL_PATH), 1); } $add_data = ' data-vimeoid="' . $videoID . '" data-videowidth="' . $videoWidth . '" data-videoheight="' . $videoHeight . '" data-videoattributes="' . $videoArgs . '"'; //no controls for vimeo $add_data .= ($v_controls) ? ' data-videocontrols="none"' : ' data-videocontrols="controls"'; //$html = "<iframe src='".$setBase."player.vimeo.com/video/".$videoID."?".$videoArgs."' width='".$videoWidth."' height='".$videoHeight."' style='width:".$videoWidth."px;height:".$videoHeight."px;'></iframe>"; break; case "html5": $urlPoster = UniteFunctionsRev::getVal($videoData, "urlPoster"); $urlMp4 = UniteFunctionsRev::getVal($videoData, "urlMp4"); $urlWebm = UniteFunctionsRev::getVal($videoData, "urlWebm"); $urlOgv = UniteFunctionsRev::getVal($videoData, "urlOgv"); $videopreload = UniteFunctionsRev::getVal($videoData, "preload"); $videoloop = UniteFunctionsRev::getVal($videoData, "videoloop"); $add_data = ' data-videowidth="' . $videoWidth . '" data-videoheight="' . $videoHeight . '"'; $cover = UniteFunctionsRev::getVal($videoData, "cover"); $cover = UniteFunctionsRev::strToBool($cover); if ($cover == true) { $add_data .= ' data-forceCover="1"'; $dotted = UniteFunctionsRev::getVal($videoData, "dotted"); if ($dotted !== 'none') { $add_data .= ' data-dottedoverlay="' . $dotted . '"'; } $ratio = UniteFunctionsRev::getVal($videoData, "ratio"); if (!empty($ratio)) { $add_data .= ' data-aspectratio="' . $ratio . '"'; } } $add_data .= $v_controls ? ' data-videocontrols="none"' : ' data-videocontrols="controls"'; if (!empty($urlPoster)) { $add_data .= ' data-videoposter="' . $urlPoster . '"'; } if (!empty($urlOgv)) { $add_data .= ' data-videoogv="' . $urlOgv . '"'; } if (!empty($urlWebm)) { $add_data .= ' data-videowebm="' . $urlWebm . '"'; } if (!empty($urlMp4)) { $add_data .= ' data-videomp4="' . $urlMp4 . '"'; } if (!empty($videopreload)) { $add_data .= ' data-videopreload="' . $videopreload . '"'; } if (UniteFunctionsRev::strToBool($videoloop) == true) { //fallback $add_data .= ' data-videoloop="loop"'; } else { $add_data .= ' data-videoloop="' . $videoloop . '"'; } break; default: UniteFunctionsRev::throwError("wrong video type: {$videoType}"); break; } //set video autoplay, with backward compatability if (array_key_exists("autoplay", $videoData)) { $videoAutoplay = UniteFunctionsRev::getVal($videoData, "autoplay"); } else { //backword compatability $videoAutoplay = UniteFunctionsRev::getVal($layer, "video_autoplay"); } //set video autoplayonlyfirsttime, with backward compatability if (array_key_exists("autoplayonlyfirsttime", $videoData)) { $videoAutoplayOnlyFirstTime = UniteFunctionsRev::getVal($videoData, "autoplayonlyfirsttime"); } else { $videoAutoplayOnlyFirstTime = ""; } $videoAutoplay = UniteFunctionsRev::strToBool($videoAutoplay); $videoAutoplayOnlyFirstTime = UniteFunctionsRev::strToBool($videoAutoplayOnlyFirstTime); $mute = UniteFunctionsRev::getVal($videoData, "mute"); $mute = UniteFunctionsRev::strToBool($mute); $htmlMute = $mute ? ' data-volume="mute"' : ''; if ($videoAutoplay == true) { $htmlVideoAutoplay = ' data-autoplay="true"' . "\n"; } else { $htmlVideoAutoplay = ' data-autoplay="false"' . "\n"; } if ($videoAutoplayOnlyFirstTime == true && $videoAutoplay == true) { $htmlVideoAutoplayOnlyFirstTime = ' data-autoplayonlyfirsttime="true"' . "\n"; } else { $htmlVideoAutoplayOnlyFirstTime = ' data-autoplayonlyfirsttime="false"' . "\n"; } $videoNextSlide = UniteFunctionsRev::getVal($videoData, "nextslide"); $videoNextSlide = UniteFunctionsRev::strToBool($videoNextSlide); if ($videoNextSlide == true) { $htmlVideoNextSlide = ' data-nextslideatend="true"' . "\n"; } $videoThumbnail = @$videoData["previewimage"]; if (trim($videoThumbnail) !== '') { $htmlVideoThumbnail = ' data-videoposter="' . $videoThumbnail . '"' . "\n"; } $disable_on_mobile = UniteFunctionsRev::getVal($videoData, "disable_on_mobile"); $disable_on_mobile = UniteFunctionsRev::strToBool($disable_on_mobile); $htmlDisableOnMobile = $disable_on_mobile ? ' data-disablevideoonmobile="1"' . "\n" : ''; break; } if ($do_rotation) { $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);'; $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 . '%;'; } //handle end transitions: $endTime = trim(UniteFunctionsRev::getVal($layer, "endtime")); $realEndTime = trim(UniteFunctionsRev::getVal($layer, "realEndTime")); $endWithSlide = UniteFunctionsRev::getVal($layer, "endWithSlide", false); $endSpeed = trim(UniteFunctionsRev::getVal($layer, "endspeed")); $calcSpeed = !empty($endSpeed) ? $endSpeed : $speed; if (!empty($calcSpeed) && $realEndTime - $calcSpeed !== $endTime) { $endTime = $realEndTime - $calcSpeed; } $htmlEnd = ""; $customout = ''; if (!empty($endTime) && $endWithSlide !== true) { $htmlEnd = "data-end=\"{$endTime}\"" . "\n"; } if (!empty($endSpeed)) { $htmlEnd .= "data-endspeed=\"{$endSpeed}\"" . "\n"; } $endEasing = trim(UniteFunctionsRev::getVal($layer, "endeasing")); if (!empty($endSpeed) && $endEasing != "nothing") { $htmlEnd .= "\t\t\tdata-endeasing=\"{$endEasing}\"" . "\n"; } //add animation to class $endAnimation = trim(UniteFunctionsRev::getVal($layer, "endanimation")); if ($endAnimation == "fade") { $endAnimation = "tp-fade"; } if (!array_key_exists($endAnimation, $endAnimations) && array_key_exists($endAnimation, $customEndAnimations)) { //if true, add custom animation $customout = 'data-customout="'; $animArr = RevOperations::getCustomAnimationByHandle($customEndAnimations[$endAnimation]); if ($animArr !== false) { $customout .= RevOperations::parseCustomAnimationByArray($animArr); } $customout .= '"'; $endAnimation = 'customout'; } if (strpos($endAnimation, 'customin-') !== false || strpos($endAnimation, 'customout-') !== false) { $endAnimation = ""; } if (!empty($endAnimation) && $endAnimation != "auto") { $outputClass .= " " . $endAnimation; } //slide link $htmlLink = ""; $slideLink = UniteFunctionsRev::getVal($layer, "link_slide"); if (!empty($slideLink) && $slideLink != "nothing" && $slideLink != "scroll_under") { //get slide index from id if (is_numeric($slideLink)) { $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink); } if (!empty($slideLink)) { $htmlLink = "data-linktoslide=\"{$slideLink}\"" . "\n"; } } //scroll under the slider if ($slideLink == "scroll_under") { $outputClass .= " tp-scrollbelowslider"; $scrollUnderOffset = intval(UniteFunctionsRev::getVal($layer, "scrollunder_offset")); $htmlLink .= " data-scrolloffset=\"" . $scrollUnderOffset . "\"" . "\n"; } //hidden under resolution $htmlHidden = ""; $layerHidden = UniteFunctionsRev::getVal($layer, "hiddenunder"); if ($layerHidden == "true" || $layerHidden == "1") { $htmlHidden = ' data-captionhidden="on"' . "\n"; } $htmlParams = $add_data . $htmlEnd . $htmlLink . $htmlVideoAutoplay . $htmlVideoAutoplayOnlyFirstTime . $htmlVideoNextSlide . $htmlVideoThumbnail . $htmlHidden . $htmlMute . $htmlDisableOnMobile . $htmlCover . $htmlDotted . $htmlRatio . $htmlRewind . "\n"; //set positioning options $alignHor = UniteFunctionsRev::getVal($layer, "align_hor", "left"); $alignVert = UniteFunctionsRev::getVal($layer, "align_vert", "top"); $htmlPosX = ""; $htmlPosY = ""; switch ($alignHor) { default: case "left": $htmlPosX = "data-x=\"" . $left . "\""; break; case "center": $htmlPosX = "data-x=\"center\" data-hoffset=\"" . $left . "\""; break; case "right": $left = (int) $left * -1; $htmlPosX = "data-x=\"right\" data-hoffset=\"" . $left . "\""; break; } switch ($alignVert) { default: case "top": $htmlPosY = "data-y=\"" . $top . "\" "; break; case "middle": $htmlPosY = "data-y=\"center\" data-voffset=\"" . $top . "\""; break; case "bottom": $top = (int) $top * -1; $htmlPosY = "data-y=\"bottom\" data-voffset=\"" . $top . "\""; break; } //set corners $htmlCorners = ""; if ($type == "text") { $cornerLeft = UniteFunctionsRev::getVal($layer, "corner_left"); $cornerRight = UniteFunctionsRev::getVal($layer, "corner_right"); switch ($cornerLeft) { case "curved": $htmlCorners .= "<div class='frontcorner'></div>"; break; case "reverced": $htmlCorners .= "<div class='frontcornertop'></div>"; break; } switch ($cornerRight) { case "curved": $htmlCorners .= "<div class='backcorner'></div>"; break; case "reverced": $htmlCorners .= "<div class='backcornertop'></div>"; break; } //add resizeme class $resizeme = UniteFunctionsRev::getVal($layer, "resizeme"); if ($resizeme == "true" || $resizeme == "1") { $outputClass .= ' tp-resizeme'; } } //end text related layer //make some modifications for the full screen video if ($isFullWidthVideo == true) { $htmlPosX = "data-x=\"0\""; $htmlPosY = "data-y=\"0\""; $outputClass .= " fullscreenvideo"; } //parallax part $use_parallax = $this->slider->getParam("use_parallax", "off"); $parallax_class = ''; if ($use_parallax == 'on') { $slide_level = intval(UniteFunctionsRev::getVal($layer, "parallax_level", '-')); if ($slide_level !== '-') { $parallax_class = ' rs-parallaxlevel-' . $slide_level; } } //check for loop animation here $do_loop = UniteFunctionsRev::getVal($layer, "loop_animation", "none"); $loop_data = ''; $loop_class = ''; if ($do_loop !== 'none') { $loop_class = ' ' . $do_loop; switch ($do_loop) { case 'rs-pendulum': $loop_data .= ' data-easing="' . UniteFunctionsRev::getVal($layer, "loop_easing", "Power3.easeInOut") . '"'; $loop_data .= ' data-startdeg="' . UniteFunctionsRev::getVal($layer, "loop_startdeg", "-20") . '"'; $loop_data .= ' data-enddeg="' . UniteFunctionsRev::getVal($layer, "loop_enddeg", "20") . '"'; $loop_data .= ' data-speed="' . UniteFunctionsRev::getVal($layer, "loop_speed", "2") . '"'; $loop_data .= ' data-origin="' . UniteFunctionsRev::getVal($layer, "loop_xorigin", "50") . '% ' . UniteFunctionsRev::getVal($layer, "loop_yorigin", "50") . '%"'; break; case 'rs-slideloop': $loop_data .= ' data-easing="' . UniteFunctionsRev::getVal($layer, "loop_easing", "Power3.easeInOut") . '"'; $loop_data .= ' data-speed="' . UniteFunctionsRev::getVal($layer, "loop_speed", "1") . '"'; $loop_data .= ' data-xs="' . UniteFunctionsRev::getVal($layer, "loop_xstart", "0") . '"'; $loop_data .= ' data-xe="' . UniteFunctionsRev::getVal($layer, "loop_xend", "0") . '"'; $loop_data .= ' data-ys="' . UniteFunctionsRev::getVal($layer, "loop_ystart", "0") . '"'; $loop_data .= ' data-ye="' . UniteFunctionsRev::getVal($layer, "loop_yend", "0") . '"'; break; case 'rs-pulse': $loop_data .= ' data-easing="' . UniteFunctionsRev::getVal($layer, "loop_easing", "Power3.easeInOut") . '"'; $loop_data .= ' data-speed="' . UniteFunctionsRev::getVal($layer, "loop_speed", "1") . '"'; $loop_data .= ' data-zoomstart="' . UniteFunctionsRev::getVal($layer, "loop_zoomstart", "1") . '"'; $loop_data .= ' data-zoomend="' . UniteFunctionsRev::getVal($layer, "loop_zoomend", "1") . '"'; break; case 'rs-wave': $loop_data .= ' data-speed="' . UniteFunctionsRev::getVal($layer, "loop_speed", "1") . '"'; $loop_data .= ' data-angle="' . UniteFunctionsRev::getVal($layer, "loop_angle", "0") . '"'; $loop_data .= ' data-radius="' . UniteFunctionsRev::getVal($layer, "loop_radius", "10") . '"'; $loop_data .= ' data-origin="' . UniteFunctionsRev::getVal($layer, "loop_xorigin", "50") . '% ' . UniteFunctionsRev::getVal($layer, "loop_yorigin", "50") . '%"'; break; } } echo "\n\t\t<!-- LAYER NR. "; echo $zIndex - 1; echo " -->\n"; echo "\t\t<div class=\"" . $outputClass; echo $classes != '' ? ' ' . $classes : ''; echo $parallax_class; if ($static_slide) { echo ' tp-static-layer'; } echo $videoclass; echo "\"\n"; echo $ids != '' ? ' ' . $ids . "\n" : ''; echo $title != '' ? ' ' . $title . "\n" : ''; echo $rel != '' ? ' ' . $rel . "\n" : ''; if ($htmlPosX != "") { echo "\t\t\t" . $htmlPosX . "\n"; } if ($htmlPosY != "") { echo "\t\t\t" . $htmlPosY . "\n"; } if ($customin != "") { echo "\t\t\t" . $customin . "\n"; } if ($customout != "") { echo "\t\t\t" . $customout . "\n"; } echo "\t\t\tdata-speed=\"" . $speed . "\"\n"; echo "\t\t\tdata-start=\"" . $time . "\"\n"; echo "\t\t\tdata-easing=\"" . $easing . "\"\n"; if ($type == "text") { //only output if we are a text layer echo "\t\t\tdata-splitin=\"" . $splitin . "\"\n"; echo "\t\t\tdata-splitout=\"" . $splitout . "\"\n"; } //check if static layer and if yes, set values for it. if ($static_slide) { if ($isTemplate != "true") { $start_on_slide = intval(UniteFunctionsRev::getVal($layer, "static_start", 1)) - 1; $end_on_slide = intval(UniteFunctionsRev::getVal($layer, "static_end", 2)) - 1; } else { $start_on_slide = '-1'; $end_on_slide = '-1'; } echo ' data-startslide="' . $start_on_slide . '"' . "\n"; echo ' data-endslide="' . $end_on_slide . '"' . "\n"; } echo "\t\t\tdata-elementdelay=\"" . $elementdelay . "\"\n"; echo "\t\t\tdata-endelementdelay=\"" . $endelementdelay . "\"\n"; if ($htmlParams != "") { echo "\t\t\t" . $htmlParams; } echo "\t\t\tstyle=\"z-index: " . $zIndex . ";" . $inline_styles . "\""; echo ">"; if ($do_loop !== 'none') { echo "\n" . ' <div style="' . $layer_rotation . '" class="tp-layer-inner-rotation '; $rotationClass = trim($class); $rotationClass = trim($rotationClass) . " "; echo $rotationClass; echo $loop_class; echo '" '; echo $loop_data; echo '>'; } elseif ($layer_rotation != '') { $rotationClass = trim($class); $rotationClass = trim($rotationClass) . " "; echo '<div class="tp-layer-inner-rotation ' . $rotationClass . '" style="' . $layer_rotation . '">' . "\n"; } echo stripslashes($html) . "\n"; if ($htmlCorners != "") { echo $htmlCorners . "\n"; } if ($do_loop !== 'none' || $layer_rotation != '') { echo "\t\t\t\t</div>\n"; } echo "\t\t</div>\n"; $zIndex++; } }
/** * * put creative layer */ private function putCreativeLayer(RevSlide $slide) { $layers = $slide->getLayers(); $customAnimations = RevOperations::getCustomAnimations('customin'); //get all custom animations $customEndAnimations = RevOperations::getCustomAnimations('customout'); //get all custom animations $startAnimations = RevOperations::getArrAnimations(false); //only get the standard animations $endAnimations = RevOperations::getArrEndAnimations(false); //only get the standard animations $lazyLoad = $this->slider->getParam("lazy_load", "off"); if (empty($layers)) { return false; } $zIndex = 2; foreach ($layers as $layer) { $type = UniteFunctionsRev::getVal($layer, "type", "text"); //set if video full screen $isFullWidthVideo = false; if ($type == "video") { $videoData = UniteFunctionsRev::getVal($layer, "video_data"); if (!empty($videoData)) { $videoData = (array) $videoData; $isFullWidthVideo = UniteFunctionsRev::getVal($videoData, "fullwidth"); $isFullWidthVideo = UniteFunctionsRev::strToBool($isFullWidthVideo); } else { $videoData = array(); } } $class = UniteFunctionsRev::getVal($layer, "style"); $animation = UniteFunctionsRev::getVal($layer, "animation", "tp-fade"); if ($animation == "fade") { $animation = "tp-fade"; } $customin = ''; if (!array_key_exists($animation, $startAnimations) && array_key_exists($animation, $customAnimations)) { //if true, add custom animation $customin .= 'data-customin="'; $animArr = RevOperations::getCustomAnimationByHandle($customAnimations[$animation]); if ($animArr !== false) { $customin .= RevOperations::parseCustomAnimationByArray($animArr); } $customin .= '"'; $animation = 'customin'; } if (strpos($animation, 'customin-') !== false || strpos($animation, 'customout-') !== false) { $animation = "tp-fade"; } //set output class: $outputClass = "tp-caption " . trim($class); $outputClass = trim($outputClass) . " "; $outputClass .= trim($animation); $left = UniteFunctionsRev::getVal($layer, "left", 0); $top = UniteFunctionsRev::getVal($layer, "top", 0); $speed = UniteFunctionsRev::getVal($layer, "speed", 300); $time = UniteFunctionsRev::getVal($layer, "time", 0); $easing = UniteFunctionsRev::getVal($layer, "easing", "easeOutExpo"); $randomRotate = UniteFunctionsRev::getVal($layer, "random_rotation", "false"); $randomRotate = UniteFunctionsRev::boolToStr($randomRotate); $splitin = UniteFunctionsRev::getVal($layer, "split", "none"); $splitout = UniteFunctionsRev::getVal($layer, "endsplit", "none"); $elementdelay = intval(UniteFunctionsRev::getVal($layer, "splitdelay", 0)); $endelementdelay = intval(UniteFunctionsRev::getVal($layer, "endsplitdelay", 0)); if ($elementdelay > 0) { $elementdelay /= 100; } if ($endelementdelay > 0) { $endelementdelay /= 100; } $text = UniteFunctionsRev::getVal($layer, "text"); $htmlVideoAutoplay = ""; $htmlVideoAutoplayOnlyFirstTime = ""; $htmlVideoNextSlide = ""; $htmlVideoThumbnail = ""; $htmlMute = ''; $htmlCover = ''; $htmlDotted = ''; $htmlRatio = ''; $htmlRewind = ''; $ids = UniteFunctionsRev::getVal($layer, "attrID"); $classes = UniteFunctionsRev::getVal($layer, "attrClasses"); $title = UniteFunctionsRev::getVal($layer, "attrTitle"); $rel = UniteFunctionsRev::getVal($layer, "attrRel"); $ids = $ids != '' ? ' id="' . $ids . '"' : ''; $classes = $classes != '' ? ' ' . $classes : ''; $title = $title != '' ? ' title="' . $title . '"' : ''; $rel = $rel != '' ? ' rel="' . $rel . '"' : ''; $max_width = UniteFunctionsRev::getVal($layer, "max_width", 'auto'); $max_height = UniteFunctionsRev::getVal($layer, "max_height", 'auto'); $white_space = UniteFunctionsRev::getVal($layer, "whitespace", 'nowrap'); $inline_styles = ''; //set html: $html = ""; switch ($type) { default: case "text": $html = $text; $html = do_shortcode($html); $inline_styles .= ' max-width: ' . $max_width . '; max-height: ' . $max_height . '; white-space: ' . $white_space . ';'; break; case "image": $alt = UniteFunctionsRev::getVal($layer, "alt"); $urlImage = UniteFunctionsRev::getVal($layer, "image_url"); $additional = ""; $scaleX = UniteFunctionsRev::getVal($layer, "scaleX"); $scaleY = UniteFunctionsRev::getVal($layer, "scaleY"); if ($scaleX != '') { $additional .= ' data-ww="' . $scaleX . '"'; } if ($scaleY != '') { $additional .= ' data-hh="' . $scaleY . '"'; } if (is_ssl()) { $urlImage = str_replace("http://", "https://", $urlImage); } $imageAddParams = ""; if ($lazyLoad == "on") { $imageAddParams .= " data-lazyload=\"{$urlImage}\""; $urlImage = UniteBaseClassRev::$url_plugin . "images/dummy.png"; } $html = '<img src="' . $urlImage . '" alt="' . $alt . '"' . $additional . $imageAddParams . '>'; $imageLink = UniteFunctionsRev::getVal($layer, "link", ""); if (!empty($imageLink)) { $openIn = UniteFunctionsRev::getVal($layer, "link_open_in", "same"); $target = ""; if ($openIn == "new") { $target = ' target="_blank"'; } $linkID = UniteFunctionsRev::getVal($layer, "link_id", ""); $linkClass = UniteFunctionsRev::getVal($layer, "link_class", ""); $linkTitle = UniteFunctionsRev::getVal($layer, "link_title", ""); $linkRel = UniteFunctionsRev::getVal($layer, "link_rel", ""); $linkIDHtml = ""; $linkClassHtml = ""; $linkTitleHtml = ""; $linkRelHtml = ""; if (!empty($linkID)) { $linkIDHtml = ' id="' . $linkID . '"'; } if (!empty($linkClass)) { $linkClassHtml = ' class="' . $linkClass . '"'; } if (!empty($linkTitle)) { $linkTitleHtml = ' title="' . $linkTitle . '"'; } if (!empty($linkRel)) { $linkRelHtml = ' rel="' . $linkRel . '"'; } $html = '<a href="' . $imageLink . '"' . $target . $linkIDHtml . $linkClassHtml . $linkTitleHtml . $linkRelHtml . '>' . $html . '</a>'; } break; case "video": $videoType = trim(UniteFunctionsRev::getVal($layer, "video_type")); $videoID = trim(UniteFunctionsRev::getVal($layer, "video_id")); $videoWidth = trim(UniteFunctionsRev::getVal($layer, "video_width")); $videoHeight = trim(UniteFunctionsRev::getVal($layer, "video_height")); $videoArgs = trim(UniteFunctionsRev::getVal($layer, "video_args")); $rewind = UniteFunctionsRev::getVal($videoData, "forcerewind"); $rewind = UniteFunctionsRev::strToBool($rewind); $htmlRewind = $rewind == true ? ' data-forcerewind="on"' : ''; if ($isFullWidthVideo == true) { $videoWidth = "100%"; $videoHeight = "100%"; } $setBase = is_ssl() ? "https://" : "http://"; switch ($videoType) { case "youtube": if (empty($videoArgs)) { $videoArgs = GlobalsRevSlider::DEFAULT_YOUTUBE_ARGUMENTS; } $videoArgs = str_replace('rel=0', '', $videoArgs); $ytBase = 'https://'; $videoArgs .= ';origin=' . $setBase . $_SERVER['SERVER_NAME'] . ';'; $html = "<iframe src='" . $ytBase . "www.youtube.com/embed/" . $videoID . "?enablejsapi=1&html5=1&" . $videoArgs . "' width='" . $videoWidth . "' height='" . $videoHeight . "' style='width:" . $videoWidth . "px;height:" . $videoHeight . "px;'></iframe>"; break; case "vimeo": if (empty($videoArgs)) { $videoArgs = GlobalsRevSlider::DEFAULT_VIMEO_ARGUMENTS; } $html = "<iframe src='" . $setBase . "player.vimeo.com/video/" . $videoID . "?" . $videoArgs . "' width='" . $videoWidth . "' height='" . $videoHeight . "' style='width:" . $videoWidth . "px;height:" . $videoHeight . "px;'></iframe>"; break; case "html5": $html = $this->getHtml5LayerHtml($videoData); $cover = UniteFunctionsRev::getVal($videoData, "cover"); $cover = UniteFunctionsRev::strToBool($cover); if ($cover == true) { $htmlCover = ' data-forceCover="1"'; $dotted = UniteFunctionsRev::getVal($videoData, "dotted"); if ($dotted !== 'none') { $htmlDotted = ' data-dottedoverlay="' . $dotted . '"'; } $ratio = UniteFunctionsRev::getVal($videoData, "ratio"); if (!empty($ratio)) { $htmlRatio = ' data-aspectratio="' . $ratio . '"'; } } break; default: UniteFunctionsRev::throwError("wrong video type: {$videoType}"); break; } //set video autoplay, with backward compatability if (array_key_exists("autoplay", $videoData)) { $videoAutoplay = UniteFunctionsRev::getVal($videoData, "autoplay"); } else { //backword compatability $videoAutoplay = UniteFunctionsRev::getVal($layer, "video_autoplay"); } //set video autoplayonlyfirsttime, with backward compatability if (array_key_exists("autoplayonlyfirsttime", $videoData)) { $videoAutoplayOnlyFirstTime = UniteFunctionsRev::getVal($videoData, "autoplayonlyfirsttime"); } else { $videoAutoplayOnlyFirstTime = ""; } $videoAutoplay = UniteFunctionsRev::strToBool($videoAutoplay); $videoAutoplayOnlyFirstTime = UniteFunctionsRev::strToBool($videoAutoplayOnlyFirstTime); $mute = UniteFunctionsRev::getVal($videoData, "mute"); $mute = UniteFunctionsRev::strToBool($mute); $htmlMute = $mute ? ' data-volume="mute"' : ''; if ($videoAutoplay == true) { $htmlVideoAutoplay = ' data-autoplay="true"' . "\n"; } else { $htmlVideoAutoplay = ' data-autoplay="false"' . "\n"; } if ($videoAutoplayOnlyFirstTime == true && $videoAutoplay == true) { $htmlVideoAutoplayOnlyFirstTime = ' data-autoplayonlyfirsttime="true"' . "\n"; } else { $htmlVideoAutoplayOnlyFirstTime = ' data-autoplayonlyfirsttime="false"' . "\n"; } $videoNextSlide = UniteFunctionsRev::getVal($videoData, "nextslide"); $videoNextSlide = UniteFunctionsRev::strToBool($videoNextSlide); if ($videoNextSlide == true) { $htmlVideoNextSlide = ' data-nextslideatend="true"' . "\n"; } $videoThumbnail = @$videoData["previewimage"]; if (trim($videoThumbnail) !== '') { $htmlVideoThumbnail = ' data-thumbimage="' . $videoThumbnail . '"' . "\n"; } break; } //handle end transitions: $endTime = trim(UniteFunctionsRev::getVal($layer, "endtime")); $htmlEnd = ""; $customout = ''; if (!empty($endTime)) { $htmlEnd = "data-end=\"{$endTime}\"" . "\n"; } $endSpeed = trim(UniteFunctionsRev::getVal($layer, "endspeed")); if (!empty($endSpeed)) { $htmlEnd .= "data-endspeed=\"{$endSpeed}\"" . "\n"; } $endEasing = trim(UniteFunctionsRev::getVal($layer, "endeasing")); if (!empty($endSpeed) && $endEasing != "nothing") { $htmlEnd .= "\t\t\tdata-endeasing=\"{$endEasing}\"" . "\n"; } //add animation to class $endAnimation = trim(UniteFunctionsRev::getVal($layer, "endanimation")); if ($endAnimation == "fade") { $endAnimation = "tp-fade"; } if (!array_key_exists($endAnimation, $endAnimations) && array_key_exists($endAnimation, $customEndAnimations)) { //if true, add custom animation $customout = 'data-customout="'; $animArr = RevOperations::getCustomAnimationByHandle($customEndAnimations[$endAnimation]); if ($animArr !== false) { $customout .= RevOperations::parseCustomAnimationByArray($animArr); } $customout .= '"'; $endAnimation = 'customout'; } if (strpos($endAnimation, 'customin-') !== false || strpos($endAnimation, 'customout-') !== false) { $endAnimation = ""; } if (!empty($endAnimation) && $endAnimation != "auto") { $outputClass .= " " . $endAnimation; } //slide link $htmlLink = ""; $slideLink = UniteFunctionsRev::getVal($layer, "link_slide"); if (!empty($slideLink) && $slideLink != "nothing" && $slideLink != "scroll_under") { //get slide index from id if (is_numeric($slideLink)) { $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink); } if (!empty($slideLink)) { $htmlLink = "data-linktoslide=\"{$slideLink}\"" . "\n"; } } //scroll under the slider if ($slideLink == "scroll_under") { $outputClass .= " tp-scrollbelowslider"; $scrollUnderOffset = UniteFunctionsRev::getVal($layer, "scrollunder_offset"); if (!empty($scrollUnderOffset)) { $htmlLink .= "data-scrolloffset=\"" . $scrollUnderOffset . "\"" . "\n"; } } //hidden under resolution $htmlHidden = ""; $layerHidden = UniteFunctionsRev::getVal($layer, "hiddenunder"); if ($layerHidden == "true" || $layerHidden == "1") { $htmlHidden = ' data-captionhidden="on"' . "\n"; } $htmlParams = $htmlEnd . $htmlLink . $htmlVideoAutoplay . $htmlVideoAutoplayOnlyFirstTime . $htmlVideoNextSlide . $htmlVideoThumbnail . $htmlHidden . $htmlMute . $htmlCover . $htmlDotted . $htmlRatio . $htmlRewind; //set positioning options $alignHor = UniteFunctionsRev::getVal($layer, "align_hor", "left"); $alignVert = UniteFunctionsRev::getVal($layer, "align_vert", "top"); $htmlPosX = ""; $htmlPosY = ""; switch ($alignHor) { default: case "left": $htmlPosX = "data-x=\"" . $left . "\""; break; case "center": $htmlPosX = "data-x=\"center\" data-hoffset=\"" . $left . "\""; break; case "right": $left = (int) $left * -1; $htmlPosX = "data-x=\"right\" data-hoffset=\"" . $left . "\""; break; } switch ($alignVert) { default: case "top": $htmlPosY = "data-y=\"" . $top . "\" "; break; case "middle": $htmlPosY = "data-y=\"center\" data-voffset=\"" . $top . "\""; break; case "bottom": $top = (int) $top * -1; $htmlPosY = "data-y=\"bottom\" data-voffset=\"" . $top . "\""; break; } //set corners $htmlCorners = ""; if ($type == "text") { $cornerLeft = UniteFunctionsRev::getVal($layer, "corner_left"); $cornerRight = UniteFunctionsRev::getVal($layer, "corner_right"); switch ($cornerLeft) { case "curved": $htmlCorners .= "<div class='frontcorner'></div>"; break; case "reverced": $htmlCorners .= "<div class='frontcornertop'></div>"; break; } switch ($cornerRight) { case "curved": $htmlCorners .= "<div class='backcorner'></div>"; break; case "reverced": $htmlCorners .= "<div class='backcornertop'></div>"; break; } //add resizeme class $resizeme = UniteFunctionsRev::getVal($layer, "resizeme"); if ($resizeme == "true" || $resizeme == "1") { $outputClass .= ' tp-resizeme'; } } //end text related layer //make some modifications for the full screen video if ($isFullWidthVideo == true) { $htmlPosX = "data-x=\"0\""; $htmlPosY = "data-y=\"0\""; $outputClass .= " fullscreenvideo"; } echo "\n\t\t<!-- LAYER NR. "; echo $zIndex - 1; echo " -->\n"; echo "\t\t<div class=\"" . $outputClass; echo $classes != '' ? ' ' . $classes : ''; echo "\"\n"; echo $ids != '' ? ' ' . $ids . "\n" : ''; echo $title != '' ? ' ' . $title . "\n" : ''; echo $rel != '' ? ' ' . $rel . "\n" : ''; if ($htmlPosX != "") { echo "\t\t\t" . $htmlPosX . "\n"; } if ($htmlPosY != "") { echo "\t\t\t" . $htmlPosY . "\n"; } if ($customin != "") { echo "\t\t\t" . $customin . "\n"; } if ($customout != "") { echo "\t\t\t" . $customout . "\n"; } echo "\t\t\tdata-speed=\"" . $speed . "\"\n"; echo "\t\t\tdata-start=\"" . $time . "\"\n"; echo "\t\t\tdata-easing=\"" . $easing . "\"\n"; echo "\t\t\tdata-splitin=\"" . $splitin . "\"\n"; echo "\t\t\tdata-splitout=\"" . $splitout . "\"\n"; echo "\t\t\tdata-elementdelay=\"" . $elementdelay . "\"\n"; echo "\t\t\tdata-endelementdelay=\"" . $endelementdelay . "\"\n"; if ($htmlParams != "") { echo "\t\t\t" . $htmlParams; } echo "\t\t\tstyle=\"z-index: " . $zIndex . ";" . $inline_styles . "\""; echo ">"; echo $html . "\n"; if ($htmlCorners != "") { echo $htmlCorners . "\n"; } echo "\t\t</div>\n"; $zIndex++; } }
/** * * publish some item from data */ public function publishUnpublishItemFromData($data) { $itemID = $data["itemID"]; $isPublished = $data["isPublished"]; $isPublished = UniteFunctionsRev::strToBool($isPublished); $newState = !$isPublished; $this->updateItemPublished($itemID, $newState); return $newState; }