/** * * put slide preview by data */ public function putSlidePreviewByData($data) { if ($data == "empty_output") { $this->loadingMessageOutput(); exit; } $data = UniteFunctionsRev::jsonDecodeFromClientSide($data); $slideID = $data["slideid"]; $slide = new RevSlide(); $slide->initByID($slideID); $sliderID = $slide->getSliderID(); $output = new RevSliderOutput(); $output->setOneSlideMode($data); $this->previewOutput($sliderID, $output); }
<?php //get input $slideID = UniteFunctionsRev::getGetVar("id"); //init slide object $slide = new RevSlide(); $slide->initByID($slideID); $slideParams = $slide->getParams(); $operations = new RevOperations(); //init slider object $sliderID = $slide->getSliderID(); $slider = new RevSlider(); $slider->initByID($sliderID); $sliderParams = $slider->getParams(); //set slide delay $sliderDelay = $slider->getParam("delay", "9000"); $slideDelay = $slide->getParam("delay", ""); if (empty($slideDelay)) { $slideDelay = $sliderDelay; } require self::getSettingsFilePath("slide_settings"); require self::getSettingsFilePath("layer_settings"); $settingsLayerOutput = new UniteSettingsProductSidebarRev(); $settingsSlideOutput = new UniteSettingsRevProductRev(); $arrLayers = $slide->getLayers(); //get settings objects $settingsLayer = self::getSettings("layer_settings"); $settingsSlide = self::getSettings("slide_settings"); $cssContent = self::getSettings("css_captions_content"); $arrCaptionClasses = $operations->getArrCaptionClasses($cssContent); $arrButtonClasses = $operations->getButtonClasses();
/** * * add language (add slide that connected to current slide) from data */ private function addLangFromData($data) { $sliderID = RevSliderFunctions::getVal($data, "sliderid"); $slideID = RevSliderFunctions::getVal($data, "slideid"); $lang = RevSliderFunctions::getVal($data, "lang"); //duplicate slide $slider = new RevSlider(); $slider->initByID($sliderID); $newSlideID = $slider->duplicateSlide($slideID); //update new slide $this->initByID($newSlideID); $arrUpdate = array(); $arrUpdate["lang"] = $lang; $arrUpdate["parentid"] = $slideID; $this->updateParamsInDB($arrUpdate); $urlIcon = RevSliderWpml::getFlagUrl($lang); $title = RevSliderWpml::getLangTitle($lang); $newSlide = new RevSlide(); $newSlide->initByID($slideID); $arrLangCodes = $newSlide->getArrChildLangCodes(); $isAll = RevSliderWpml::isAllLangsInArray($arrLangCodes); $html = "<li>\r\n\t\t\t\t\t<img id=\"icon_lang_" . $newSlideID . "\" class=\"icon_slide_lang\" src=\"" . $urlIcon . "\" title=\"" . $title . "\" data-slideid=\"" . $newSlideID . "\" data-lang=\"" . $lang . "\">\r\n\t\t\t\t\t<div class=\"icon_lang_loader loader_round\" style=\"display:none\"></div>\t\t\t\t\t\t\t\t\r\n\t\t\t\t</li>"; $response = array(); $response["operation"] = "add"; $response["isAll"] = $isAll; $response["html"] = $html; return $response; }
/** * * duplicate slide children * @param $slideID */ private function duplicateChildren($slideID, $newSlideID) { $arrChildren = $this->getArrSlideChildren($slideID); foreach ($arrChildren as $childSlide) { $childSlideID = $childSlide->getID(); //duplicate $duplicatedSlideID = $this->duplicateSlide($childSlideID); //update parent id $duplicatedSlide = new RevSlide(); $duplicatedSlide->initByID($duplicatedSlideID); $duplicatedSlide->updateParentSlideID($newSlideID); } }
public static function include_custom_css() { $type = isset($_GET['view']) ? $_GET['view'] : ''; $page = isset($_GET['page']) ? $_GET['page'] : ''; if ($page !== 'slider' && $page !== 'revslider_navigation') { return false; } //showbiz fix $sliderID = ''; switch ($type) { case 'slider': $sliderID = isset($_GET['id']) ? $_GET['id'] : ''; break; case 'slide': $slideID = isset($_GET['id']) ? $_GET['id'] : ''; if ($slideID == 'new') { break; } $slide = new RevSlide(); $slide->initByID($slideID); $sliderID = $slide->getSliderID(); break; default: if (isset($_GET['slider'])) { $sliderID = $_GET['slider']; } break; } $arrFieldsParams = array(); if (!empty($sliderID)) { $slider = new RevSlider(); $slider->initByID($sliderID); $settingsFields = $slider->getSettingsFields(); $arrFieldsMain = $settingsFields['main']; $arrFieldsParams = $settingsFields['params']; $custom_css = @stripslashes($arrFieldsParams['custom_css']); $custom_css = RevSliderCssParser::compress_css($custom_css); echo '<style>' . $custom_css . '</style>'; } }
/** * * put the slider slides */ private function putSlides() { $sliderType = $this->slider->getParam("slider_type"); $publishedOnly = true; if ($this->previewMode == true && $this->oneSlideMode == true) { $previewSlideID = UniteFunctionsRev::getVal($this->oneSlideData, "slideid"); $previewSlide = new RevSlide(); $previewSlide->initByID($previewSlideID); $slides = array($previewSlide); } else { $slides = $this->slider->getSlidesForOutput($publishedOnly, $this->sliderLang); } $this->slidesNumIndex = $this->slider->getSlidesNumbersByIDs(true); if (empty($slides)) { ?> <div class="no-slides-text"> No slides found, please add some slides </div> <?php } $thumbWidth = $this->slider->getParam("thumb_width", 100); $thumbHeight = $this->slider->getParam("thumb_height", 50); $slideWidth = $this->slider->getParam("width", 900); $slideHeight = $this->slider->getParam("height", 300); $navigationType = $this->slider->getParam("navigaion_type", "none"); $isThumbsActive = $navigationType == "thumb" ? true : false; //for one slide preview if ($this->oneSlideMode == true) { $slides = $this->filterOneSlide($slides); } ?> <ul> <?php foreach ($slides as $index => $slide) { $params = $slide->getParams(); //check if date is set $date_from = $slide->getParam("date_from", ""); $date_to = $slide->getParam("date_to", ""); if ($date_from != "") { $date_from = strtotime($date_from); if (time() < $date_from) { continue; } } if ($date_to != "") { $date_to = strtotime($date_to); if (time() > $date_to) { continue; } } $transition = $slide->getParam("slide_transition", "random"); $slotAmount = $slide->getParam("slot_amount", "7"); $urlSlideImage = $slide->getImageUrl(); //get image alt $imageFilename = $slide->getImageFilename(); $info = pathinfo($imageFilename); $alt = $info["filename"]; //get thumb url $htmlThumb = ""; if ($isThumbsActive == true) { $urlThumb = $slide->getParam("slide_thumb", ""); if (empty($urlThumb)) { //try to get resized thumb $pathThumb = $slide->getImageFilepath(); if (!empty($pathThumb)) { $urlThumb = UniteBaseClassRev::getImageUrl($pathThumb, $thumbWidth, $thumbHeight, true); } } //if not - put regular image: if (empty($urlThumb)) { $urlThumb = $slide->getImageUrl(); } $htmlThumb = 'data-thumb="' . $urlThumb . '" '; } //get link $htmlLink = ""; $enableLink = $slide->getParam("enable_link", "false"); if ($enableLink == "true") { $linkType = $slide->getParam("link_type", "regular"); switch ($linkType) { //---- normal link default: case "regular": $link = $slide->getParam("link", ""); $linkOpenIn = $slide->getParam("link_open_in", "same"); $htmlTarget = ""; if ($linkOpenIn == "new") { $htmlTarget = ' data-target="_blank"'; } $htmlLink = "data-link=\"{$link}\" {$htmlTarget} "; break; //---- link to slide //---- link to slide case "slide": $slideLink = UniteFunctionsRev::getVal($params, "slide_link"); if (!empty($slideLink) && $slideLink != "nothing") { //get slide index from id if (is_numeric($slideLink)) { $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink); } if (!empty($slideLink)) { $htmlLink = "data-link=\"slide\" data-linktoslide=\"{$slideLink}\" "; } } break; } //set link position: $linkPos = UniteFunctionsRev::getVal($params, "link_pos", "front"); if ($linkPos == "back") { $htmlLink .= ' data-slideindex="back"'; } } //set delay $htmlDelay = ""; $delay = $slide->getParam("delay", ""); if (!empty($delay) && is_numeric($delay)) { $htmlDelay = "data-delay=\"{$delay}\" "; } //get duration $htmlDuration = ""; $duration = $slide->getParam("transition_duration", ""); if (!empty($duration) && is_numeric($duration)) { $htmlDuration = "data-masterspeed=\"{$duration}\" "; } //get rotation $htmlRotation = ""; $rotation = $slide->getParam("transition_rotation", ""); if (!empty($rotation)) { $rotation = (int) $rotation; if ($rotation != 0) { if ($rotation > 720 && $rotation != 999) { $rotation = 720; } if ($rotation < -720) { $rotation = -720; } } $htmlRotation = "data-rotate=\"{$rotation}\" "; } $fullWidthVideoData = $this->getSlideFullWidthVideoData($slide); //set full width centering. $htmlImageCentering = ""; $fullWidthCentering = $slide->getParam("fullwidth_centering", "false"); if ($sliderType == "fullwidth" && $fullWidthCentering == "true") { $htmlImageCentering = ' data-fullwidthcentering="on"'; } //set first slide transition $htmlFirstTrans = ""; $startWithSlide = $this->slider->getStartWithSlideSetting(); if ($index == $startWithSlide) { $firstTransActive = $this->slider->getParam("first_transition_active", "false"); if ($firstTransActive == "true") { $firstTransition = $this->slider->getParam("first_transition_type", "fade"); $htmlFirstTrans .= " data-fstransition=\"{$firstTransition}\""; $firstDuration = $this->slider->getParam("first_transition_duration", "300"); if (!empty($firstDuration) && is_numeric($firstDuration)) { $htmlFirstTrans .= " data-fsmasterspeed=\"{$firstDuration}\""; } $firstSlotAmount = $this->slider->getParam("first_transition_slot_amount", "7"); if (!empty($firstSlotAmount) && is_numeric($firstSlotAmount)) { $htmlFirstTrans .= " data-fsslotamount=\"{$firstSlotAmount}\""; } } } //first trans $htmlParams = $htmlDuration . $htmlLink . $htmlThumb . $htmlDelay . $htmlRotation . $htmlFirstTrans; $bgType = $slide->getParam("background_type", "image"); $styleImage = ""; $urlImageTransparent = UniteBaseClassRev::$url_plugin . "images/transparent.png"; switch ($bgType) { case "trans": $urlSlideImage = $urlImageTransparent; break; case "solid": $urlSlideImage = $urlImageTransparent; $slideBGColor = $slide->getParam("slide_bg_color", "#d0d0d0"); $styleImage = "style='background-color:{$slideBGColor}'"; break; } //additional params $imageAddParams = ""; $lazyLoad = $this->slider->getParam("lazy_load", "off"); if ($lazyLoad == "on") { $imageAddParams .= "data-lazyload=\"{$urlSlideImage}\""; $urlSlideImage = UniteBaseClassRev::$url_plugin . "images/dummy.png"; } $imageAddParams .= $htmlImageCentering; //Html ?> <li data-transition="<?php echo $transition; ?> " data-slotamount="<?php echo $slotAmount; ?> " <?php echo $htmlParams; ?> > <img src="<?php echo $urlSlideImage; ?> " <?php echo $styleImage; ?> alt="<?php echo $alt; ?> " <?php echo $imageAddParams; ?> > <?php //put video: if ($fullWidthVideoData["found"] == true) { //backward compatability $this->putFullWidthVideoLayer($fullWidthVideoData); } $this->putCreativeLayer($slide); ?> </li> <?php } //get foreach ?> </ul> <?php }
/** * * put the slider slides */ private function putSlides($doWrapFromTemplate) { //go to template slider if post template if ($doWrapFromTemplate !== false) { $this->slider->initByMixed($doWrapFromTemplate); } //back to original Slider $sliderType = $this->slider->getParam("slider_type"); $publishedOnly = true; if ($this->previewMode == true && $this->oneSlideMode == true) { $previewSlideID = UniteFunctionsRev::getVal($this->oneSlideData, "slideid"); $previewSlide = new RevSlide(); $previewSlide->initByID($previewSlideID); $slides = array($previewSlide); } else { $slides = $this->slider->getSlidesForOutput($publishedOnly, $this->sliderLang); } $this->slidesNumIndex = $this->slider->getSlidesNumbersByIDs(true); if (empty($slides)) { ?> <div class="no-slides-text"> No slides found, please add some slides </div> <?php } //go back to normal slider if post template if ($doWrapFromTemplate) { $this->slider->initByMixed($this->slider->getParam("slider_template_id", false)); } //back to template for JS $thumbWidth = $this->slider->getParam("thumb_width", 100); $thumbHeight = $this->slider->getParam("thumb_height", 50); $slideWidth = $this->slider->getParam("width", 900); $slideHeight = $this->slider->getParam("height", 300); $navigationType = $this->slider->getParam("navigaion_type", "none"); $isThumbsActive = $navigationType == "thumb" ? true : false; $lazyLoad = $this->slider->getParam("lazy_load", "off"); //for one slide preview if ($this->oneSlideMode == true) { $slides = $this->filterOneSlide($slides); } echo "<ul>"; $htmlFirstTransWrap = ""; $startWithSlide = $this->slider->getStartWithSlideSetting(); $firstTransActive = $this->slider->getParam("first_transition_active", "false"); if ($firstTransActive == "true") { $firstTransition = $this->slider->getParam("first_transition_type", "fade"); $htmlFirstTransWrap .= " data-fstransition=\"{$firstTransition}\""; $firstDuration = $this->slider->getParam("first_transition_duration", "300"); if (!empty($firstDuration) && is_numeric($firstDuration)) { $htmlFirstTransWrap .= " data-fsmasterspeed=\"{$firstDuration}\""; } $firstSlotAmount = $this->slider->getParam("first_transition_slot_amount", "7"); if (!empty($firstSlotAmount) && is_numeric($firstSlotAmount)) { $htmlFirstTransWrap .= " data-fsslotamount=\"{$firstSlotAmount}\""; } } if (count($slides) == 1 && $this->oneSlideMode == false) { $slides[] = $slides[0]; $slides[1]->ignore_alt = true; $this->hasOnlyOneSlide = true; } foreach ($slides as $index => $slide) { $params = $slide->getParams(); $cur_slide_title = $this->slider->getParam("navigation_style", "round"); //check if date is set $date_from = $slide->getParam("date_from", ""); $date_to = $slide->getParam("date_to", ""); if ($date_from != "") { $date_from = strtotime($date_from); if (time() < $date_from) { continue; } } if ($date_to != "") { $date_to = strtotime($date_to); if (time() > $date_to) { continue; } } $transition = $slide->getParam("slide_transition", "random"); $transition_arr = explode(',', $transition); $add_rand = ''; if (is_array($transition_arr) && !empty($transition_arr)) { foreach ($transition_arr as $tkey => $trans) { if ($trans == 'random-selected') { $add_rand = ' data-randomtransition="on"'; unset($transition_arr[$tkey]); $transition = implode(',', $transition_arr); break; } } } //if($transition == "fade") $transition = "tp-fade"; //$transitionPremium = $slide->getParam("slide_transition_premium","random"); //if(trim($transition) == '') // $transition = $transitionPremium; //else // if(trim($transitionPremium) != '') $transition .= ','.$transitionPremium; $slotAmount = $slide->getParam("slot_amount", "7"); $isExternal = $slide->getParam("background_type", "image"); if ($isExternal != "external") { $urlSlideImage = $slide->getImageUrl(); //get image alt $imageFilename = $slide->getImageFilename(); $info = pathinfo($imageFilename); $alt = $info["filename"]; } else { $urlSlideImage = $slide->getParam("slide_bg_external", ""); $info = ''; $alt = ''; } if (isset($slide->ignore_alt)) { $alt = ''; } $bgType = $slide->getParam("background_type", "image"); //get thumb url $is_special_nav = false; switch ($cur_slide_title) { //generate also if we have a special navigation selected case 'preview1': case 'preview2': case 'preview3': case 'preview4': case 'custom': $is_special_nav = true; } $htmlThumb = ""; if ($isThumbsActive == true || $is_special_nav == true) { $urlThumb = null; //check if post slider, if yes, get thumb from featured image //if($this->slider->isSlidesFromPosts()) // $urlThumb = ''; if (empty($urlThumb)) { $urlThumb = $slide->getParam("slide_thumb", ""); } if ($bgType == 'image') { /* if(empty($urlThumb)){ //try to get resized thumb $url_img_link = $slide->getImageUrl(); $urlThumb = rev_aq_resize($url_img_link, 320, 200, true, true, true); } */ //if not - put regular image: if (empty($urlThumb)) { $urlThumb = $slide->getImageUrl(); } } $htmlThumb = 'data-thumb="' . $urlThumb . '" '; } //get link $htmlLink = ""; $enableLink = $slide->getParam("enable_link", "false"); if ($enableLink == "true") { $linkType = $slide->getParam("link_type", "regular"); switch ($linkType) { //---- normal link default: case "regular": $link = $slide->getParam("link", ""); $linkOpenIn = $slide->getParam("link_open_in", "same"); $htmlTarget = ""; if ($linkOpenIn == "new") { $htmlTarget = ' data-target="_blank"'; } $htmlLink = "data-link=\"{$link}\" {$htmlTarget} "; break; //---- link to slide //---- link to slide case "slide": $slideLink = UniteFunctionsRev::getVal($params, "slide_link"); if (!empty($slideLink) && $slideLink != "nothing") { //get slide index from id if (is_numeric($slideLink)) { $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink); } if (!empty($slideLink)) { $htmlLink = "data-link=\"slide\" data-linktoslide=\"{$slideLink}\" "; } } break; } //set link position: $linkPos = UniteFunctionsRev::getVal($params, "link_pos", "front"); if ($linkPos == "back") { $htmlLink .= ' data-slideindex="back"'; } } //set delay $htmlDelay = ""; $delay = $slide->getParam("delay", ""); if (!empty($delay) && is_numeric($delay)) { $htmlDelay = "data-delay=\"{$delay}\" "; } //get duration $htmlDuration = ""; $duration = $slide->getParam("transition_duration", ""); if (!empty($duration) && is_numeric($duration)) { $htmlDuration = "data-masterspeed=\"{$duration}\" "; } //get performance $htmlPerformance = ""; $performance = $slide->getParam("save_performance", "off"); if (!empty($performance) && ($performance == 'on' || $performance == 'off')) { $htmlPerformance = " data-saveperformance=\"{$performance}\" "; } //get rotation $htmlRotation = ""; $rotation = $slide->getParam("transition_rotation", ""); if (!empty($rotation)) { $rotation = (int) $rotation; if ($rotation != 0) { if ($rotation > 720 && $rotation != 999) { $rotation = 720; } if ($rotation < -720) { $rotation = -720; } } $htmlRotation = "data-rotate=\"{$rotation}\" "; } $fullWidthVideoData = $this->getSlideFullWidthVideoData($slide); //set full width centering. /*$htmlImageCentering = ""; $fullWidthCentering = $slide->getParam("fullwidth_centering","false"); if($sliderType == "fullwidth" && $fullWidthCentering == "true") $htmlImageCentering = ' data-fullwidthcentering="on"'; */ //set first slide transition $htmlFirstTrans = ""; if ($index == $startWithSlide) { $htmlFirstTrans = $htmlFirstTransWrap; } //first trans $htmlParams = $htmlDuration . $htmlLink . $htmlThumb . $htmlDelay . $htmlRotation . $htmlFirstTrans . $htmlPerformance; $styleImage = ""; $urlImageTransparent = GlobalsRevSlider::$url_media . "assets/images/transparent.png"; switch ($bgType) { case "trans": $urlSlideImage = $urlImageTransparent; break; case "solid": $urlSlideImage = $urlImageTransparent; $slideBGColor = $slide->getParam("slide_bg_color", "#d0d0d0"); $styleImage = "style='background-color:" . $slideBGColor . "'"; break; } //additional params $imageAddParams = ""; if ($lazyLoad == "on") { $imageAddParams .= "data-lazyload=\"{$urlSlideImage}\""; $urlSlideImage = GlobalsRevSlider::$url_media . "assets/images/dummy.png"; } //$imageAddParams .= $htmlImageCentering; //additional background params $bgFit = $slide->getParam("bg_fit", "cover"); $bgFitX = intval($slide->getParam("bg_fit_x", "100")); $bgFitY = intval($slide->getParam("bg_fit_y", "100")); $bgPosition = $slide->getParam("bg_position", "center top"); $bgPositionX = intval($slide->getParam("bg_position_x", "0")); $bgPositionY = intval($slide->getParam("bg_position_y", "0")); $bgRepeat = $slide->getParam("bg_repeat", "no-repeat"); if ($bgPosition == 'percentage') { $imageAddParams .= ' data-bgposition="' . $bgPositionX . '% ' . $bgPositionY . '%"'; } else { $imageAddParams .= ' data-bgposition="' . $bgPosition . '"'; } //check for kenburn & pan zoom $kenburn_effect = $slide->getParam("kenburn_effect", "off"); //$kb_rotation_start = intval($slide->getParam("kb_rotation_start","0")); //$kb_rotation_end = intval($slide->getParam("kb_rotation_end","0")); $kb_duration = intval($slide->getParam("kb_duration", $this->slider->getParam("delay", 9000))); $kb_ease = $slide->getParam("kb_easing", "Linear.easeNone"); $kb_start_fit = $slide->getParam("kb_start_fit", "100"); $kb_end_fit = $slide->getParam("kb_end_fit", "100"); $kb_pz = ''; if ($kenburn_effect == "on" && ($bgType == 'image' || $bgType == 'external')) { $kb_pz .= ' data-kenburns="on"'; //$kb_pz.= ' data-rotationstart="'.$kb_rotation_start.'"'; //$kb_pz.= ' data-rotationend="'.$kb_rotation_end.'"'; $kb_pz .= ' data-duration="' . $kb_duration . '"'; $kb_pz .= ' data-ease="' . $kb_ease . '"'; $kb_pz .= ' data-bgfit="' . $kb_start_fit . '"'; $kb_pz .= ' data-bgfitend="' . $kb_end_fit . '"'; $bgEndPosition = $slide->getParam("bg_end_position", "center top"); $bgEndPositionX = intval($slide->getParam("bg_end_position_x", "0")); $bgEndPositionY = intval($slide->getParam("bg_end_position_y", "0")); if ($bgEndPosition == 'percentage') { $kb_pz .= ' data-bgpositionend="' . $bgEndPositionX . '% ' . $bgEndPositionY . '%"'; } else { $kb_pz .= ' data-bgpositionend="' . $bgEndPosition . '"'; } //set image original width and height //$imgSize = @getimagesize($urlSlideImage); //if(is_array($imgSize) && !empty($imgSize)){ // $kb_pz.= ' data-owidth="'.$imgSize[0].'"'; // $kb_pz.= ' data-oheight="'.$imgSize[1].'"'; //} } else { //only set if kenburner is off if ($bgFit == 'percentage') { $imageAddParams .= ' data-bgfit="' . $bgFitX . '% ' . $bgFitY . '%"'; } else { $imageAddParams .= ' data-bgfit="' . $bgFit . '"'; } $imageAddParams .= ' data-bgrepeat="' . $bgRepeat . '"'; } $thumbWidth = $this->slider->getParam("thumb_width", 100); //add Slide Title if we have special navigation type choosen $slide_title = ''; $class_attr = $slide->getParam("class_attr", ""); if ($class_attr !== '') { $htmlParams .= ' class="' . $class_attr . '"'; } $id_attr = $slide->getParam("id_attr", ""); if ($id_attr !== '') { $htmlParams .= ' id="' . $id_attr . '"'; } $attr_attr = $slide->getParam("attr_attr", ""); if ($attr_attr !== '') { $htmlParams .= ' id="' . $attr_attr . '"'; } $data_attr = stripslashes($slide->getParam("data_attr", "")); if ($data_attr !== '') { $htmlParams .= ' ' . $data_attr; } switch ($cur_slide_title) { case 'preview1': case 'preview2': case 'preview3': case 'preview4': case 'custom': //check if we are post based or normal slider $slide_title = ' data-title="' . str_replace("\\'", "'", $slide->getParam("title", "Slide")) . '"'; break; } $slideCounter = $index + 1; //Html echo "\t<!-- SLIDE {$slideCounter}-->\n"; echo "\t<li data-transition=\"" . $transition . "\" data-slotamount=\"" . $slotAmount . "\" " . $add_rand . $htmlParams . $slide_title . ">\n"; echo "\t\t<!-- MAIN IMAGE -->\n"; echo "\t\t<img src=\"" . $urlSlideImage . "\" " . $styleImage . " alt=\"" . $alt . "\" " . $imageAddParams . $kb_pz . ">\n"; echo "\t\t<!-- LAYERS -->\n"; //put video: if ($fullWidthVideoData["found"] == true) { //backward compatability $this->putFullWidthVideoLayer($fullWidthVideoData); } $this->putCreativeLayer($slide); echo "\t</li>\n"; } //get foreach echo "</ul>\n"; //check for static layers $useStaticLayers = $this->slider->getParam("enable_static_layers", "off"); if ($useStaticLayers == 'on') { $sliderID = $this->slider->getID(); $staticID = $slide->getStaticSlideID($sliderID); if ($staticID !== false) { $static_slide = new RevSlide(); $static_slide->initByStaticID($staticID); echo '<div class="tp-static-layers">' . "\n"; $this->putCreativeLayer($static_slide, true); echo '</div>' . "\n"; } } }
/** * Constructor */ public function __construct() { parent::__construct(); //get input $slideID = $this->getRequest()->getParam('id'); //init slide object $slide = new RevSlide(); $slide->initByID($slideID); $slideParams = $slide->getParams(); $operations = new RevOperations(); //init slider object $sliderID = $slide->getSliderID(); $slider = new RevSlider(); $slider->initByID($sliderID); $sliderParams = $slider->getParams(); $arrSlideNames = $slider->getArrSlideNames(); //check if slider is template $sliderTemplate = $slider->getParam("template", "false"); //set slide delay $sliderDelay = $slider->getParam("delay", "9000"); $slideDelay = $slide->getParam("delay", ""); if (empty($slideDelay)) { $slideDelay = $sliderDelay; } require $this->getSettingsFilePath("slide_settings"); require $this->getSettingsFilePath("layer_settings"); $settingsLayerOutput = new UniteSettingsProductSidebarRev(); $settingsSlideOutput = new UniteSettingsRevProductRev(); $arrLayers = $slide->getLayers(); $loadGoogleFont = $slider->getParam("load_googlefont", "false"); //get settings objects $settingsLayer = $this->getSettings("layer_settings"); $settingsSlide = $this->getSettings("slide_settings"); $cssContent = $this->getSettings("css_captions_content"); $arrCaptionClasses = $operations->getArrCaptionClasses($cssContent); $arrFontFamily = $operations->getArrFontFamilys($slider); $arrCSS = $operations->getCaptionsContentArray(); $arrButtonClasses = $operations->getButtonClasses(); $urlCaptionsCSS = GlobalsRevSlider::$urlCaptionsCSS; $arrAnim = $operations->getFullCustomAnimations(); //set layer caption as first caption class $firstCaption = !empty($arrCaptionClasses) ? $arrCaptionClasses[0] : ""; $settingsLayer->updateSettingValue("layer_caption", $firstCaption); //set stored values from "slide params" $settingsSlide->setStoredValues($slideParams); //init the settings output object $settingsLayerOutput->init($settingsLayer); $settingsSlideOutput->init($settingsSlide); //set various parameters needed for the page $width = $sliderParams["width"]; $height = $sliderParams["height"]; $imageUrl = $slide->getImageUrl(); $imageID = $slide->getImageID(); $imageFilename = $slide->getImageFilename(); $style = "height:" . $height . "px;"; // $divLayersWidth = "width:" . $width . "px;"; $divbgminwidth = "min-width:" . $width . "px;"; //set iframe parameters $iframeWidth = $width + 60; $iframeHeight = $height + 50; $iframeStyle = "width:" . $iframeWidth . "px;height:" . $iframeHeight . "px;"; $closeUrl = $this->getViewUrl(RevSliderAdmin::VIEW_SLIDES, "id=" . $sliderID); $jsonLayers = UniteFunctionsRev::jsonEncodeForClientSide($arrLayers); $jsonCaptions = UniteFunctionsRev::jsonEncodeForClientSide($arrCaptionClasses); $jsonFontFamilys = UniteFunctionsRev::jsonEncodeForClientSide($arrFontFamily); $arrCssStyles = UniteFunctionsRev::jsonEncodeForClientSide($arrCSS); $arrCustomAnim = UniteFunctionsRev::jsonEncodeForClientSide($arrAnim); //bg type params $bgType = UniteFunctionsRev::getVal($slideParams, "background_type", "image"); $slideBGColor = UniteFunctionsRev::getVal($slideParams, "slide_bg_color", "#E7E7E7"); $divLayersClass = "slide_layers"; $bgSolidPickerProps = 'class="inputColorPicker slide_bg_color disabled" disabled="disabled"'; $bgFit = UniteFunctionsRev::getVal($slideParams, "bg_fit", "cover"); $bgFitX = intval(UniteFunctionsRev::getVal($slideParams, "bg_fit_x", "100")); $bgFitY = intval(UniteFunctionsRev::getVal($slideParams, "bg_fit_y", "100")); $bgPosition = UniteFunctionsRev::getVal($slideParams, "bg_position", "center top"); $bgPositionX = intval(UniteFunctionsRev::getVal($slideParams, "bg_position_x", "0")); $bgPositionY = intval(UniteFunctionsRev::getVal($slideParams, "bg_position_y", "0")); $bgEndPosition = UniteFunctionsRev::getVal($slideParams, "bg_end_position", "center top"); $bgEndPositionX = intval(UniteFunctionsRev::getVal($slideParams, "bg_end_position_x", "0")); $bgEndPositionY = intval(UniteFunctionsRev::getVal($slideParams, "bg_end_position_y", "0")); $kenburn_effect = UniteFunctionsRev::getVal($slideParams, "kenburn_effect", "off"); $kb_duration = UniteFunctionsRev::getVal($slideParams, "kb_duration", $sliderParams["delay"]); $kb_easing = UniteFunctionsRev::getVal($slideParams, "kb_easing", "Linear.easeNone"); $kb_start_fit = UniteFunctionsRev::getVal($slideParams, "kb_start_fit", "100"); $kb_end_fit = UniteFunctionsRev::getVal($slideParams, "kb_end_fit", "100"); $bgRepeat = UniteFunctionsRev::getVal($slideParams, "bg_repeat", "no-repeat"); $slideBGExternal = UniteFunctionsRev::getVal($slideParams, "slide_bg_external", ""); $style_wrapper = ''; $class_wrapper = ''; switch ($bgType) { case "trans": $divLayersClass = "slide_layers"; $class_wrapper = "trans_bg"; break; case "solid": $style_wrapper .= "background-color:" . $slideBGColor . ";"; $bgSolidPickerProps = 'class="inputColorPicker slide_bg_color" style="background-color:' . $slideBGColor . '"'; break; case "image": $style_wrapper .= "background-image:url('" . $imageUrl . "');"; if ($bgFit == 'percentage') { $style_wrapper .= "background-size: " . $bgFitX . '% ' . $bgFitY . '%;'; } else { $style_wrapper .= "background-size: " . $bgFit . ";"; } if ($bgPosition == 'percentage') { $style_wrapper .= "background-position: " . $bgPositionX . '% ' . $bgPositionY . '%;'; } else { $style_wrapper .= "background-position: " . $bgPosition . ";"; } $style_wrapper .= "background-repeat: " . $bgRepeat . ";"; break; case "external": $style_wrapper .= "background-image:url('" . $slideBGExternal . "');"; if ($bgFit == 'percentage') { $style_wrapper .= "background-size: " . $bgFitX . '% ' . $bgFitY . '%;'; } else { $style_wrapper .= "background-size: " . $bgFit . ";"; } if ($bgPosition == 'percentage') { $style_wrapper .= "background-position: " . $bgPositionX . '% ' . $bgPositionY . '%;'; } else { $style_wrapper .= "background-position: " . $bgPosition . ";"; } $style_wrapper .= "background-repeat: " . $bgRepeat . ";"; break; } $slideTitle = $slide->getParam("title", "Slide"); $slideOrder = $slide->getOrder(); $this->assign('loadGoogleFont', $loadGoogleFont)->assign('settingsLayerOutput', $settingsLayerOutput)->assign('slider', $slider)->assign('slide', $slide)->assign('sliderTemplate', $sliderTemplate)->assign('slideOrder', $slideOrder)->assign('slideTitle', $slideTitle)->assign('slideDelay', $slideDelay)->assign('sliderParams', $sliderParams)->assign('arrSlideNames', $arrSlideNames)->assign('arrCustomAnim', $arrCustomAnim)->assign('slideID', $slideID)->assign('sliderID', $sliderID)->assign('settingsSlideOutput', $settingsSlideOutput)->assign('imageUrl', $imageUrl)->assign('imageID', $imageID)->assign('bgType', $bgType)->assign('slideBGColor', $slideBGColor)->assign('divLayersClass', $divLayersClass)->assign('bgSolidPickerProps', $bgSolidPickerProps)->assign('bgFit', $bgFit)->assign('bgFitX', $bgFitX)->assign('bgFitY', $bgFitY)->assign('bgRepeat', $bgRepeat)->assign('bgPosition', $bgPosition)->assign('bgPositionX', $bgPositionX)->assign('bgPositionY', $bgPositionY)->assign('bgEndPosition', $bgEndPosition)->assign('bgEndPositionX', $bgEndPositionX)->assign('bgEndPositionY', $bgEndPositionY)->assign('slideBGExternal', $slideBGExternal)->assign('slideBGColor', $slideBGColor)->assign('style', $style)->assign('iframeStyle', $iframeStyle)->assign('closeUrl', $closeUrl)->assign('jsonLayers', $jsonLayers)->assign('jsonCaptions', $jsonCaptions)->assign('jsonFontFamilys', $jsonFontFamilys)->assign('arrCssStyles', $arrCssStyles)->assign('arrButtonClasses', $arrButtonClasses)->assign('urlCaptionsCSS', $urlCaptionsCSS)->assign('divLayersWidth', $divLayersWidth)->assign('divbgminwidth', $divbgminwidth)->assign('style_wrapper', $style_wrapper)->assign('class_wrapper', $class_wrapper)->assign('kenburn_effect', $kenburn_effect)->assign('kb_duration', $kb_duration)->assign('kb_easing', $kb_easing)->assign('kb_start_fit', $kb_start_fit)->assign('kb_end_fit', $kb_end_fit); }
/** * * put the slider slides */ private function putSlides($gal_ids = array(), $order = array()) { //go to template slider if post template $sliderType = $this->slider->getParam('slider_type'); $slider_type = $this->slider->getParam('slider-type'); //standard, carousel or hero $source_type = $this->slider->getParam('source_type'); //vimeo, post ect. $publishedOnly = true; if ($slider_type == 'hero' || !empty($order)) { $publishedOnly = false; //take all, even unpublished ones } if ($this->previewMode == true && $this->oneSlideMode == true) { $previewSlideID = RevSliderFunctions::getVal($this->oneSlideData, 'slideid'); $previewSlide = new RevSlide(); $previewSlide->initByID($previewSlideID); $slides = array($previewSlide); } else { $slides = $this->slider->getSlidesForOutput($publishedOnly, $this->sliderLang, $gal_ids); if (!empty($gal_ids) && $gal_ids[0]) { //add slides from the images if (count($slides) > 0) { //check if we have at least one slide. If not, then it may result in errors here if (count($gal_ids) !== count($slides)) { //set slides to the same amount as if (count($gal_ids) < count($slides)) { $slides = array_slice($slides, 0, count($gal_ids)); } else { // > while (count($slides) < count($gal_ids)) { foreach ($slides as $slide) { $new_slide = clone $slide; array_push($slides, $new_slide); if (count($slides) >= count($gal_ids)) { break; } } } if (count($gal_ids) < count($slides)) { $slides = array_slice($slides, 0, count($gal_ids)); } } } $sliderSize = $this->slider->getParam('def-image_source_type', 'full'); $isSlidesFromPosts = $this->slider->isSlidesFromPosts(); $gi = 0; foreach ($slides as $skey => $slide) { //add gallery images into slides //set post id to imageid //check if slider is Post Based, if yes use $slide->getID(); else use $gal_ids[$gi] if ($isSlidesFromPosts) { $ret = $slide->setImageByID($slide->getID(), $sliderSize); } else { $ret = $slide->setImageByID($gal_ids[$gi], $sliderSize); } if ($ret === true) { //set slide type to image instead of for example external or transparent $slide->setBackgroundType('image'); } else { unset($slides[$skey]); } $gi++; } } } elseif (!empty($order)) { $tempSlides = $slides; $slides = array(); foreach ($order as $order_slideid) { foreach ($tempSlides as $tempSlide) { if ($tempSlide->getID() == $order_slideid) { $tempSlide->setParam('state', 'published'); //set to published $slides[] = $tempSlide; break; } } } if (count($slides) == 1) { //remove navigation $this->slider->setParam('enable_arrows', 'off'); $this->slider->setParam('enable_bullets', 'off'); $this->slider->setParam('enable_tabs', 'off'); $this->slider->setParam('enable_thumbnails', 'off'); } } } $this->slidesNumIndex = $this->slider->getSlidesNumbersByIDs(true); if ($slider_type == 'hero' && empty($order) && empty($gal_ids)) { //we are a hero Slider, show only one Slide! $hero = $this->getHeroSlide($slides); $slides = !empty($hero) ? array($hero) : array(); } //check if mobile, if yes, then remove certain slides $mobile = 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') || strstr($_SERVER['HTTP_USER_AGENT'], 'Windows Phone') || wp_is_mobile() ? true : false; if ($mobile && !empty($slides)) { foreach ($slides as $ss => $sv) { $hsom = $sv->getParam('hideslideonmobile', 'off'); if ($hsom == 'on') { unset($slides[$ss]); } } } if (empty($slides)) { ?> <div class="no-slides-text"> <?php if ($this->slider->isSlidesFromPosts()) { _e('No slides found, please add at least one Slide Template to the choosen language.', 'revslider'); } else { _e('No slides found, please add some slides', 'revslider'); } ?> </div> <?php } //set that we are originally template slider $post_based_slider = false; if ($this->slider->isSlidesFromPosts()) { $post_based_slider = true; } $slideWidth = $this->slider->getParam('width', 900); $slideHeight = $this->slider->getParam('height', 300); $do_bullets = $this->slider->getParam('enable_bullets', 'off'); $do_thumbnails = $this->slider->getParam('enable_thumbnails', 'off'); $do_arrows = $this->slider->getParam('enable_arrows', 'off'); $do_tabs = $this->slider->getParam('enable_tabs', 'off'); $isThumbsActive = $do_bullets == 'on' || $do_thumbnails == 'on' || $do_arrows == 'on' || $do_tabs == 'on' ? true : false; $lazyLoad = $this->slider->getParam('lazy_load_type', false); if ($lazyLoad === false) { //do fallback checks to removed lazy_load value since version 5.0 and replaced with an enhanced version $old_ll = $this->slider->getParam('lazy_load', 'off'); $lazyLoad = $old_ll == 'on' ? 'all' : 'none'; } //for one slide preview //if($this->oneSlideMode == true) // $slides = $this->filterOneSlide($slides); echo "<ul>"; $htmlFirstTransWrap = ""; $startWithSlide = $this->slider->getStartWithSlideSetting(); $firstTransActive = $this->slider->getParam('first_transition_active', 'false'); if ($firstTransActive == 'on' && $slider_type !== 'hero') { $firstTransition = $this->slider->getParam('first_transition_type', 'fade'); $htmlFirstTransWrap .= ' data-fstransition="' . $firstTransition . '"'; $firstDuration = $this->slider->getParam('first_transition_duration', '300'); if (!empty($firstDuration) && is_numeric($firstDuration)) { $htmlFirstTransWrap .= ' data-fsmasterspeed="' . $firstDuration . '"'; } $firstSlotAmount = $this->slider->getParam('first_transition_slot_amount', '7'); if (!empty($firstSlotAmount) && is_numeric($firstSlotAmount)) { $htmlFirstTransWrap .= ' data-fsslotamount="' . $firstSlotAmount . '"'; } } $oneSlideLoop = $this->slider->getParam("loop_slide", "loop"); if (($oneSlideLoop == 'loop' || $oneSlideLoop == 'on') && $slider_type !== 'hero') { if (count($slides) == 1 && $this->oneSlideMode == false) { $new_slide = clone reset($slides); $new_slide->ignore_alt = true; $new_slide->setID($new_slide->getID() . '-1'); $slides[] = $new_slide; $this->hasOnlyOneSlide = true; } } if (count($slides) == 0) { return false; } // No Slides added yet $def_transition = $this->slider->getParam('def-slide_transition', 'fade'); $def_image_source_type = $this->slider->getParam('def-image_source_type', 'full'); $do_static = apply_filters('revslider_enable_static_layers', true); if ($do_static) { $sliderID = $this->slider->getID(); foreach ($slides as $slide) { $staticID = $slide->getStaticSlideID($sliderID); if ($staticID !== false) { $static_slide = new RevSlide(); $static_slide->initByStaticID($staticID); $this->static_slide = $static_slide; } break; } } $index = 0; foreach ($slides as $slide) { $params = $slide->getParams(); $navigation_arrow_stlye = $this->slider->getParam('navigation_arrow_style', 'round'); $navigation_bullets_style = $this->slider->getParam('navigation_bullets_style', 'round'); //check if date is set $date_from = $slide->getParam('date_from', ''); $date_to = $slide->getParam('date_to', ''); if ($this->previewMode === false) { // do only if we are not in preview mode $ts = current_time('timestamp'); if ($date_from != '') { $date_from = strtotime($date_from); if ($ts < $date_from) { continue; } } if ($date_to != '') { $date_to = strtotime($date_to); if ($ts > $date_to) { continue; } } } $transition = $slide->getParam('slide_transition', $def_transition); if (!is_array($transition)) { $transition_arr = explode(',', $transition); } else { $transition_arr = $transition; $transition = implode(',', $transition); } $add_rand = ''; if (is_array($transition_arr) && !empty($transition_arr)) { foreach ($transition_arr as $tkey => $trans) { if ($trans == 'random-selected') { $add_rand = ' data-randomtransition="on"'; unset($transition_arr[$tkey]); $transition = implode(',', $transition_arr); break; } } } $slotAmount = $slide->getParam('slot_amount', '7'); if (is_array($slotAmount)) { $slotAmount = implode(',', $slotAmount); } $imageAddParams = ''; $isExternal = $slide->getParam('background_type', 'image'); if ($isExternal != 'external') { $urlSlideImage = $slide->getImageUrl(); //get image alt $alt_type = $slide->getParam('alt_option', 'media_library'); $title_type = $slide->getParam('title_option', 'media_library'); $alt = ''; $img_title = ''; $img_id = $slide->getImageID(); switch ($alt_type) { case 'media_library': $alt = get_post_meta($img_id, '_wp_attachment_image_alt', true); break; case 'file_name': $imageFilename = $slide->getImageFilename(); $info = pathinfo($imageFilename); $alt = $info['filename']; break; case 'custom': $alt = esc_attr($slide->getParam('alt_attr', '')); break; } switch ($title_type) { case 'media_library': $img_title = get_the_title($img_id); break; case 'file_name': $imageFilename = $slide->getImageFilename(); $info = pathinfo($imageFilename); $img_title = $info['filename']; break; case 'custom': $img_title = esc_attr($slide->getParam('title_attr', '')); break; } $img_w = ''; $img_h = ''; $img_size = $slide->getParam('image_source_type', $def_image_source_type); if ($img_id !== false) { $img_data = wp_get_attachment_metadata($img_id); if ($img_data !== false && !empty($img_data)) { if ($img_size !== 'full') { if (isset($img_data['sizes']) && isset($img_data['sizes'][$img_size])) { $img_w = isset($img_data['sizes'][$img_size]['width']) ? $img_data['sizes'][$img_size]['width'] : ''; $img_h = isset($img_data['sizes'][$img_size]['height']) ? $img_data['sizes'][$img_size]['height'] : ''; } } if ($img_w == '' || $img_h == '') { $img_w = isset($img_data['width']) ? $img_data['width'] : ''; $img_h = isset($img_data['height']) ? $img_data['height'] : ''; } $imageAddParams .= ' width="' . $img_w . '" height="' . $img_h . '"'; } } } else { $urlSlideImage = $slide->getParam('slide_bg_external', ''); $alt = esc_attr($slide->getParam('alt_attr', '')); $img_title = esc_attr($slide->getParam('title_attr', '')); $img_w = $slide->getParam('ext_width', '1920'); $img_h = $slide->getParam('ext_height', '1080'); $imageAddParams .= ' width="' . $img_w . '" height="' . $img_h . '"'; } if (isset($slide->ignore_alt)) { $alt = ''; } $bgType = $slide->getParam('background_type', 'image'); //get thumb url $is_special_nav = false; switch ($navigation_arrow_stlye) { //generate also if we have a special navigation selected case 'preview1': case 'preview2': case 'preview3': case 'preview4': case 'custom': $is_special_nav = true; } switch ($navigation_bullets_style) { //generate also if we have a special navigation selected case 'preview1': case 'preview2': case 'preview3': case 'preview4': case 'custom': $is_special_nav = true; } $htmlThumb = ""; if ($isThumbsActive == true || $is_special_nav == true) { $urlThumb = null; if (empty($urlThumb)) { $urlThumb = $slide->getParam('slide_thumb', ''); } $thumb_do = $slide->getParam('thumb_dimension', 'slider'); if ($thumb_do == 'slider') { //use the slider settings for width / height $th_width = intval($this->slider->getParam('previewimage_width', $this->slider->getParam('thumb_width', 100))); $th_height = intval($this->slider->getParam('previewimage_height', $this->slider->getParam('thumb_height', 50))); //$th_width = intval($this->slider->getParam('thumb_width', 100)); //$th_height = intval($this->slider->getParam('thumb_height', 50)); if ($th_width == 0) { $th_width = 100; } if ($th_height == 0) { $th_height = 50; } if ($source_type == 'youtube' || $source_type == 'vimeo' || $bgType == 'image' || $bgType == 'vimeo' || $bgType == 'youtube' || $bgType == 'html5' || $bgType == 'streamvimeo' || $bgType == 'streamyoutube' || $bgType == 'streaminstagram' || $bgType == 'streamtwitter' || $bgType == 'streamvimeoboth' || $bgType == 'streamyoutubeboth' || $bgType == 'streaminstagramboth' || $bgType == 'streamtwitterboth') { if (empty($urlThumb)) { //try to get resized thumb $url_img_link = $slide->getImageUrl(); $urlThumb = rev_aq_resize($url_img_link, $th_width, $th_height, true, true, true); } else { $urlThumb = rev_aq_resize($urlThumb, $th_width, $th_height, true, true, true); if (empty($urlThumb)) { $urlThumb = $slide->getImageUrl(); $urlThumb = rev_aq_resize($urlThumb, $th_width, $th_height, true, true, true); } } //if not - put regular image: if (empty($urlThumb)) { $urlThumb = $slide->getImageUrl(); } } } else { //if not - put regular image: if (empty($urlThumb)) { $urlThumb = $slide->getImageUrl(); } } if (is_ssl()) { $urlThumb = str_replace('http://', 'https://', $urlThumb); } else { $urlThumb = str_replace('https://', 'http://', $urlThumb); } $htmlThumb = ' data-thumb="' . $urlThumb . '" '; } //get link $htmlLink = ''; $enableLink = $slide->getParam('enable_link', 'false'); if ($enableLink == 'true') { $linkType = $slide->getParam('link_type', 'regular'); switch ($linkType) { //---- normal link default: case 'regular': $link = do_shortcode($slide->getParam('link', '')); $linkOpenIn = $slide->getParam('link_open_in', 'same'); $htmlTarget = ''; if ($linkOpenIn == 'new') { $htmlTarget = ' data-target="_blank"'; } $htmlLink = ' data-link="' . $link . '" ' . $htmlTarget . ' '; break; //---- link to slide //---- link to slide case 'slide': $slideLink = RevSliderFunctions::getVal($params, 'slide_link'); if (!empty($slideLink) && $slideLink != 'nothing') { //get slide index from id if (is_numeric($slideLink)) { $slideLink = RevSliderFunctions::getVal($this->slidesNumIndex, $slideLink); } if (!empty($slideLink)) { $htmlLink = ' data-link="slide" data-linktoslide="' . $slideLink . '" '; } } break; } //set link position: $linkPos = RevSliderFunctions::getVal($params, 'link_pos', 'front'); if ($linkPos == 'back') { $htmlLink .= ' data-slideindex="back"'; } } //set delay $htmlDelay = ''; $delay = $slide->getParam('delay', ''); if (!empty($delay) && is_numeric($delay)) { $htmlDelay = ' data-delay="' . $delay . '" '; } //set Stop Slide on Purpose $htmlStopPurpose = ''; $stoponpurpose = $slide->getParam('stoponpurpose', ''); if (!empty($stoponpurpose) && $stoponpurpose == "true") { $htmlStopPurpose = ' data-ssop="true" '; } //set Stop Slide on Purpose $htmlInvisibleSlide = ''; $invisibleslide = $slide->getParam('invisibleslide', ''); if (!empty($invisibleslide) && $invisibleslide == "true") { $htmlInvisibleSlide = ' data-invisible="true" '; } //get duration $htmlDuration = ''; $duration = $slide->getParam('transition_duration', $this->slider->getParam('def-transition_duration', '')); if (is_array($duration)) { $duration = implode(',', $duration); } if (!empty($duration)) { $htmlDuration = ' data-masterspeed="' . $duration . '" '; } //get performance $htmlPerformance = ''; $performance = $slide->getParam('save_performance', 'off'); if (!empty($performance) && ($performance == 'on' || $performance == 'off')) { $htmlPerformance = ' data-saveperformance="' . $performance . '" '; } //get rotation $htmlRotation = ''; $rotation = (array) $slide->getParam('transition_rotation', ''); if (!empty($rotation)) { $rot_string = ''; foreach ($rotation as $rkey => $rot) { $rot = (int) $rot; if ($rot != 0) { if ($rot > 720 && $rot != 999) { $rot = 720; } if ($rot < -720) { $rot = -720; } } if ($rkey > 0) { $rot_string .= ','; } $rot_string .= $rot; } $htmlRotation = ' data-rotate="' . $rot_string . '" '; } $htmlEaseIn = ''; $easein = $slide->getParam('transition_ease_in', 'default'); if (!empty($easein) && is_array($easein)) { $easein = implode(',', $easein); } if ($easein !== '') { $htmlEaseIn = ' data-easein="' . $easein . '"'; } $htmlEaseOut = ''; $easeout = $slide->getParam('transition_ease_out', 'default'); if (!empty($easeout) && is_array($easeout)) { $easeout = implode(',', $easeout); } if ($easeout !== '') { $htmlEaseOut = ' data-easeout="' . $easeout . '"'; } $fullWidthVideoData = $this->getSlideFullWidthVideoData($slide); //set first slide transition $htmlFirstTrans = ''; if ($index == $startWithSlide && $slider_type !== 'hero') { $htmlFirstTrans = $htmlFirstTransWrap; } //first trans $htmlParams = $htmlEaseIn . $htmlEaseOut . $htmlDuration . $htmlLink . $htmlThumb . $htmlDelay . $htmlRotation . $htmlFirstTrans . $htmlPerformance . $htmlStopPurpose . $htmlInvisibleSlide; $styleImage = ''; $urlImageTransparent = RS_PLUGIN_URL . 'admin/assets/images/transparent.png'; switch ($bgType) { case 'trans': $urlSlideImage = $urlImageTransparent; break; case 'solid': $urlSlideImage = $urlImageTransparent; $slideBGColor = $slide->getParam('slide_bg_color', '#d0d0d0'); $styleImage = "style='background-color:" . $slideBGColor . "'"; break; case 'streamvimeo': case 'streamyoutube': case 'streaminstagram': case 'streamtwitter': if ($slide->getParam('stream_do_cover', 'on') == 'off') { $urlSlideImage = $urlImageTransparent; } break; case 'streamvimeoboth': case 'streamyoutubeboth': case 'streaminstagramboth': case 'streamtwitterboth': if ($this->checkIfStreamVideoExists($slide)) { if ($slide->getParam('stream_do_cover_both', 'on') == 'off') { $urlSlideImage = $urlImageTransparent; } } break; } if (trim($urlSlideImage) == '') { $urlSlideImage = $urlImageTransparent; } //go back to transparent if img is empty //additional params if ($lazyLoad != 'none') { $imageAddParams .= ' data-lazyload="' . $urlSlideImage . '"'; $urlSlideImage = RS_PLUGIN_URL . 'admin/assets/images/dummy.png'; } //additional background params $bgFit = $slide->getParam('bg_fit', $this->slider->getParam('def-background_fit', 'cover')); $bgFitX = intval($slide->getParam('bg_fit_x', $this->slider->getParam('def-bg_fit_x', '100'))); $bgFitY = intval($slide->getParam('bg_fit_y', $this->slider->getParam('def-bg_fit_y', '100'))); $bgPosition = $slide->getParam('bg_position', $this->slider->getParam('def-bg_position', 'center center')); if ($bgType == 'streamvimeoboth' || $bgType == 'streamyoutubeboth' || $bgType == 'streaminstagramboth' || $bgType == 'streamtwitterboth') { if ($this->checkIfStreamVideoExists($slide)) { $bgPosition = 'center center'; } } else { if ($bgType == 'youtube' || $bgType == 'vimeo' || $bgType == 'html5' || $bgType == 'streamvimeo' || $bgType == 'streamyoutube' || $bgType == 'streaminstagram' || $bgType == 'streamtwitter') { $bgPosition = 'center center'; } } $bgPositionX = intval($slide->getParam('bg_position_x', $this->slider->getParam('def-bg_position_x', '0'))); $bgPositionY = intval($slide->getParam('bg_position_y', $this->slider->getParam('def-bg_position_y', '0'))); $bgRepeat = $slide->getParam('bg_repeat', $this->slider->getParam('def-bg_repeat', 'no-repeat')); if ($bgPosition == 'percentage') { $imageAddParams .= ' data-bgposition="' . $bgPositionX . '% ' . $bgPositionY . '%"'; } else { $imageAddParams .= ' data-bgposition="' . $bgPosition . '"'; } //check for kenburn & pan zoom $kenburn_effect = $slide->getParam('kenburn_effect', $this->slider->getParam('def-kenburn_effect', 'off')); $kb_duration = intval($slide->getParam('kb_duration', $this->slider->getParam('def-kb_duration', '10000'))); $kb_ease = $slide->getParam('kb_easing', $this->slider->getParam('def-kb_easing', 'Linear.easeNone')); $kb_start_fit = $slide->getParam('kb_start_fit', $this->slider->getParam('def-kb_start_fit', '100')); $kb_end_fit = $slide->getParam('kb_end_fit', $this->slider->getParam('def-kb_end_fit', '100')); $kb_start_offset_x = $slide->getParam('kb_start_offset_x', $this->slider->getParam('def-kb_start_offset_x', '0')); $kb_start_offset_y = $slide->getParam('kb_start_offset_y', $this->slider->getParam('def-kb_start_offset_y', '0')); $kb_end_offset_x = $slide->getParam('kb_end_offset_x', $this->slider->getParam('def-kb_end_offset_x', '0')); $kb_end_offset_y = $slide->getParam('kb_end_offset_y', $this->slider->getParam('def-kb_end_offset_y', '0')); $kb_start_rotate = $slide->getParam('kb_start_rotate', $this->slider->getParam('def-kb_start_rotate', '0')); $kb_end_rotate = $slide->getParam('kb_end_rotate', $this->slider->getParam('def-kb_end_rotate', '0')); $kb_pz = ''; if ($kenburn_effect == "on" && ($bgType == 'image' || $bgType == 'external')) { $kb_pz .= ' data-kenburns="on"'; $kb_pz .= ' data-duration="' . $kb_duration . '"'; $kb_pz .= ' data-ease="' . $kb_ease . '"'; $kb_pz .= ' data-scalestart="' . $kb_start_fit . '"'; $kb_pz .= ' data-scaleend="' . $kb_end_fit . '"'; $kb_pz .= ' data-rotatestart="' . $kb_start_rotate . '"'; $kb_pz .= ' data-rotateend="' . $kb_end_rotate . '"'; $kb_pz .= ' data-offsetstart="' . $kb_start_offset_x . ' ' . $kb_start_offset_y . '"'; $kb_pz .= ' data-offsetend="' . $kb_end_offset_x . ' ' . $kb_end_offset_y . '"'; } else { //only set if kenburner is off and not a background video if ($bgType == 'youtube' || $bgType == 'html5' || $bgType == 'vimeo' || $bgType == 'streamvimeo' || $bgType == 'streamyoutube' || $bgType == 'streaminstagram' || $bgType == 'streamtwitter') { $imageAddParams .= ' data-bgfit="cover"'; } else { if ($bgFit == 'percentage') { $imageAddParams .= ' data-bgfit="' . $bgFitX . '% ' . $bgFitY . '%"'; } else { $imageAddParams .= ' data-bgfit="' . $bgFit . '"'; } $imageAddParams .= ' data-bgrepeat="' . $bgRepeat . '"'; } } //add Slide Title if we have special navigation type choosen $slide_title = ''; $class_attr = $slide->getParam("class_attr", ""); if ($class_attr !== '') { $htmlParams .= ' class="' . $class_attr . '"'; } $id_attr = $slide->getParam('id_attr', ''); if ($id_attr !== '') { $htmlParams .= ' id="' . $id_attr . '"'; } $data_attr = stripslashes($slide->getParam('data_attr', '')); if ($data_attr !== '') { $htmlParams .= ' ' . $data_attr; } if ($post_based_slider) { //check if we are post based or normal slider $the_post = get_post($slide->getID()); $new_title = @get_the_title($slide->getID()); $the_excerpt = strip_tags(strip_shortcodes($the_post->post_excerpt)); $slide_title = ' data-title="' . stripslashes(esc_attr($new_title)) . '"'; $slide_description = ' data-description="' . str_replace(array("\\'", '\\"'), array("'", '"'), esc_attr($the_excerpt)) . '"'; } else { $slide_title = ' data-title="' . stripslashes(esc_attr($slide->getParam("title", "Slide"))) . '"'; $slide_description = ' data-description="' . str_replace(array("\\'", '\\"'), array("'", '"'), esc_attr($slide->getParam('slide_description', ''))) . '"'; } $slide_id = $slide->getID(); if ($slide->getParam('slide_id', '') !== '') { $slide_id = esc_attr($slide_id); } $add_params = ''; for ($mi = 1; $mi <= 10; $mi++) { $pa = $slide->getParam('params_' . $mi, ''); //add meta functionality here if ($pa !== '') { $pa_limit = $slide->getParam('params_' . $mi . '_chars', 10, RevSlider::FORCE_NUMERIC); $pa = strip_tags($pa); $pa = mb_substr($pa, 0, $pa_limit, 'utf-8'); } $add_params .= ' data-param' . $mi . '="' . stripslashes(esc_attr($pa)) . '"'; } $use_parallax = $this->slider->getParam("use_parallax", $this->slider->getParam('use_parallax', 'off')); $parallax_attr = ''; if ($use_parallax == 'on') { $slide_level = $slide->getParam('slide_parallax_level', '-'); if ($slide_level == '-') { $slide_level = 'off'; } $parallax_attr = ' data-bgparallax="' . $slide_level . '"'; } $hideslideafter = $slide->getParam("hideslideafter", 0); $hsom = $slide->getParam('hideslideonmobile', 'off'); if ($img_title !== '') { $img_title = ' title="' . $img_title . '"'; } //Html rev-main- echo ' <!-- SLIDE -->' . "\n"; echo ' <li data-index="rs-' . $slide_id . '" data-transition="' . $transition . '" data-slotamount="' . $slotAmount . '" data-hideafterloop="' . $hideslideafter . '" data-hideslideonmobile="' . $hsom . '" ' . $add_rand . $htmlParams . $slide_title . $add_params . $slide_description; do_action('revslider_add_li_data', $this->slider, $slide); echo '>' . "\n"; echo ' <!-- MAIN IMAGE -->' . "\n"; echo ' <img src="' . $urlSlideImage . '" ' . $styleImage . ' alt="' . $alt . '"' . $img_title . ' ' . $imageAddParams . $kb_pz . $parallax_attr . ' class="rev-slidebg" data-no-retina>' . "\n"; echo ' <!-- LAYERS -->' . "\n"; //check if we are youtube, vimeo or html5 if ($bgType == 'youtube' || $bgType == 'html5' || $bgType == 'vimeo' || $bgType == 'streamvimeo' || $bgType == 'streamyoutube' || $bgType == 'streaminstagram' || $bgType == 'streamtwitter') { $this->putBackgroundVideo($slide); } if ($bgType == 'streamvimeoboth' || $bgType == 'streamyoutubeboth' || $bgType == 'streaminstagramboth' || $bgType == 'streamtwitterboth') { if ($this->checkIfStreamVideoExists($slide)) { $this->putBackgroundVideo($slide); } } $this->putCreativeLayer($slide); do_action('revslider_add_layer_html', $this->slider, $slide); echo "\t</li>\n"; $index++; } //get foreach echo "</ul>\n"; if ($do_static && !empty($this->static_slide)) { $layers = $this->static_slide->getLayers(); if (!empty($layers)) { $htmlstaticoverflow = ''; $staticoverflow = $this->static_slide->getParam('staticoverflow', ''); if (!empty($staticoverflow) && $staticoverflow == "hidden") { $htmlstaticoverflow = 'overflow:hidden;width:100%;height:100%;top:0px;left:0px;'; } //check for static layers echo '<div style="' . $htmlstaticoverflow . '" class="tp-static-layers">' . "\n"; $this->putCreativeLayer($this->static_slide, true); do_action('revslider_add_static_layer_html', $this->slider); echo '</div>' . "\n"; } } $this->add_custom_navigation_css($slides); }
/** * * put the slider slides */ private function putSlides($doWrapFromTemplate) { //go to template slider if post template if ($doWrapFromTemplate !== false) { $this->slider->initByMixed($doWrapFromTemplate); } //back to original Slider $sliderType = $this->slider->getParam("slider_type"); $publishedOnly = true; if ($this->previewMode == true && $this->oneSlideMode == true) { $previewSlideID = UniteFunctionsRev::getVal($this->oneSlideData, "slideid"); $previewSlide = new RevSlide(); $previewSlide->initByID($previewSlideID); $slides = array($previewSlide); } else { $slides = $this->slider->getSlidesForOutput($publishedOnly, $this->sliderLang); } $this->slidesNumIndex = $this->slider->getSlidesNumbersByIDs(true); if (empty($slides)) { ?> <div class="no-slides-text"> No slides found, please add some slides </div> <?php } //go back to normal slider if post template if ($doWrapFromTemplate) { $this->slider->initByMixed($this->slider->getParam("slider_template_id", false)); } //back to template for JS $thumbWidth = $this->slider->getParam("thumb_width", 100); $thumbHeight = $this->slider->getParam("thumb_height", 50); $slideWidth = $this->slider->getParam("width", 900); $slideHeight = $this->slider->getParam("height", 300); $navigationType = $this->slider->getParam("navigaion_type", "none"); $isThumbsActive = $navigationType == "thumb" ? true : false; $lazyLoad = $this->slider->getParam("lazy_load", "off"); //for one slide preview if ($this->oneSlideMode == true) { $slides = $this->filterOneSlide($slides); } echo "<ul>"; $htmlFirstTransWrap = ""; $startWithSlide = $this->slider->getStartWithSlideSetting(); $firstTransActive = $this->slider->getParam("first_transition_active", "false"); if ($firstTransActive == "true") { $firstTransition = $this->slider->getParam("first_transition_type", "fade"); $htmlFirstTransWrap .= " data-fstransition=\"{$firstTransition}\""; $firstDuration = $this->slider->getParam("first_transition_duration", "300"); if (!empty($firstDuration) && is_numeric($firstDuration)) { $htmlFirstTransWrap .= " data-fsmasterspeed=\"{$firstDuration}\""; } $firstSlotAmount = $this->slider->getParam("first_transition_slot_amount", "7"); if (!empty($firstSlotAmount) && is_numeric($firstSlotAmount)) { $htmlFirstTransWrap .= " data-fsslotamount=\"{$firstSlotAmount}\""; } } foreach ($slides as $index => $slide) { $params = $slide->getParams(); //check if date is set $date_from = $slide->getParam("date_from", ""); $date_to = $slide->getParam("date_to", ""); if ($date_from != "") { $date_from = strtotime($date_from); if (time() < $date_from) { continue; } } if ($date_to != "") { $date_to = strtotime($date_to); if (time() > $date_to) { continue; } } $transition = $slide->getParam("slide_transition", "random"); //if($transition == "fade") $transition = "tp-fade"; //$transitionPremium = $slide->getParam("slide_transition_premium","random"); //if(trim($transition) == '') // $transition = $transitionPremium; //else // if(trim($transitionPremium) != '') $transition .= ','.$transitionPremium; $slotAmount = $slide->getParam("slot_amount", "7"); $isExternal = $slide->getParam("background_type", "image"); if ($isExternal != "external") { $urlSlideImage = $slide->getImageUrl(); //get image alt $imageFilename = $slide->getImageFilename(); $info = pathinfo($imageFilename); $alt = $info["filename"]; } else { $urlSlideImage = $slide->getParam("slide_bg_external", ""); $info = ''; $alt = ''; } //get thumb url $htmlThumb = ""; if ($isThumbsActive == true) { $urlThumb = null; //check if post slider, if yes, get thumb from featured image //if($this->slider->isSlidesFromPosts()) // $urlThumb = ''; if (empty($urlThumb)) { $urlThumb = $slide->getParam("slide_thumb", ""); } if (empty($urlThumb)) { //try to get resized thumb $pathThumb = $slide->getImageFilepath(); if (!empty($pathThumb)) { $urlThumb = UniteBaseClassRev::getImageUrl($pathThumb, $thumbWidth, $thumbHeight, true); } } //if not - put regular image: if (empty($urlThumb)) { $urlThumb = $slide->getImageUrl(); } $htmlThumb = 'data-thumb="' . $urlThumb . '" '; } //get link $htmlLink = ""; $enableLink = $slide->getParam("enable_link", "false"); if ($enableLink == "true") { $linkType = $slide->getParam("link_type", "regular"); switch ($linkType) { //---- normal link default: case "regular": $link = $slide->getParam("link", ""); $linkOpenIn = $slide->getParam("link_open_in", "same"); $htmlTarget = ""; if ($linkOpenIn == "new") { $htmlTarget = ' data-target="_blank"'; } $htmlLink = "data-link=\"{$link}\" {$htmlTarget} "; break; //---- link to slide //---- link to slide case "slide": $slideLink = UniteFunctionsRev::getVal($params, "slide_link"); if (!empty($slideLink) && $slideLink != "nothing") { //get slide index from id if (is_numeric($slideLink)) { $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink); } if (!empty($slideLink)) { $htmlLink = "data-link=\"slide\" data-linktoslide=\"{$slideLink}\" "; } } break; } //set link position: $linkPos = UniteFunctionsRev::getVal($params, "link_pos", "front"); if ($linkPos == "back") { $htmlLink .= ' data-slideindex="back"'; } } //set delay $htmlDelay = ""; $delay = $slide->getParam("delay", ""); if (!empty($delay) && is_numeric($delay)) { $htmlDelay = "data-delay=\"{$delay}\" "; } //get duration $htmlDuration = ""; $duration = $slide->getParam("transition_duration", ""); if (!empty($duration) && is_numeric($duration)) { $htmlDuration = "data-masterspeed=\"{$duration}\" "; } //get rotation $htmlRotation = ""; $rotation = $slide->getParam("transition_rotation", ""); if (!empty($rotation)) { $rotation = (int) $rotation; if ($rotation != 0) { if ($rotation > 720 && $rotation != 999) { $rotation = 720; } if ($rotation < -720) { $rotation = -720; } } $htmlRotation = "data-rotate=\"{$rotation}\" "; } $fullWidthVideoData = $this->getSlideFullWidthVideoData($slide); //set full width centering. /*$htmlImageCentering = ""; $fullWidthCentering = $slide->getParam("fullwidth_centering","false"); if($sliderType == "fullwidth" && $fullWidthCentering == "true") $htmlImageCentering = ' data-fullwidthcentering="on"'; */ //set first slide transition $htmlFirstTrans = ""; if ($index == $startWithSlide) { $htmlFirstTrans = $htmlFirstTransWrap; } //first trans $htmlParams = $htmlDuration . $htmlLink . $htmlThumb . $htmlDelay . $htmlRotation . $htmlFirstTrans; $bgType = $slide->getParam("background_type", "image"); $styleImage = ""; $urlImageTransparent = UniteBaseClassRev::$url_plugin . "images/transparent.png"; switch ($bgType) { case "trans": $urlSlideImage = $urlImageTransparent; break; case "solid": $urlSlideImage = $urlImageTransparent; $slideBGColor = $slide->getParam("slide_bg_color", "#d0d0d0"); $styleImage = "style='background-color:" . $slideBGColor . "'"; break; } //additional params $imageAddParams = ""; if ($lazyLoad == "on") { $imageAddParams .= "data-lazyload=\"{$urlSlideImage}\""; $urlSlideImage = UniteBaseClassRev::$url_plugin . "images/dummy.png"; } //$imageAddParams .= $htmlImageCentering; //additional background params $bgFit = $slide->getParam("bg_fit", "cover"); $bgFitX = intval($slide->getParam("bg_fit_x", "100")); $bgFitY = intval($slide->getParam("bg_fit_y", "100")); $bgPosition = $slide->getParam("bg_position", "left top"); $bgPositionX = intval($slide->getParam("bg_position_x", "0")); $bgPositionY = intval($slide->getParam("bg_position_y", "0")); $bgRepeat = $slide->getParam("bg_repeat", "no-repeat"); if ($bgFit == 'percentage') { $imageAddParams .= ' data-bgfit="' . $bgFitX . '% ' . $bgFitY . '%"'; } else { $imageAddParams .= ' data-bgfit="' . $bgFit . '"'; } if ($bgPosition == 'percentage') { $imageAddParams .= ' data-bgposition="' . $bgPositionX . '% ' . $bgPositionY . '%"'; } else { $imageAddParams .= ' data-bgposition="' . $bgPosition . '"'; } $imageAddParams .= ' data-bgrepeat="' . $bgRepeat . '"'; //Html echo "\t<!-- SLIDE -->\n"; echo "\t<li data-transition=\"" . $transition . "\" data-slotamount=\"" . $slotAmount . "\" " . $htmlParams . ">\n"; echo "\t\t<!-- MAIN IMAGE -->\n"; echo "\t\t<img src=\"" . $urlSlideImage . "\" " . $styleImage . " alt=\"" . $alt . "\" " . $imageAddParams . ">\n"; echo "\t\t<!-- LAYERS -->\n"; //put video: if ($fullWidthVideoData["found"] == true) { //backward compatability $this->putFullWidthVideoLayer($fullWidthVideoData); } $this->putCreativeLayer($slide); echo "\t</li>\n"; } //get foreach echo "</ul>\n"; }
private function putSlides($doWrapFromTemplate) { if ($doWrapFromTemplate !== false) { $this->slider->initByMixed($doWrapFromTemplate); } $sliderType = $this->slider->getParam("slider_type"); $is_gallery_type = $this->slider->getParam("source_type", "gallery"); $publishedOnly = true; if ($this->previewMode == true && $this->oneSlideMode == true) { $previewSlideID = UniteFunctionsRev::getVal($this->oneSlideData, "slideid"); $previewSlide = new RevSlide(); $previewSlide->initByID($previewSlideID); $slides = array($previewSlide); } else { $slides = $this->slider->getSlidesForOutput($publishedOnly, $this->sliderLang); } $this->slidesNumIndex = $this->slider->getSlidesNumbersByIDs(true); if (empty($slides)) { ?> <div class="no-slides-text"> <?php if ($this->slider->isSlidesFromPosts()) { _e('No slides found, please add at least one Slide Template to the choosen Template Slider.', REVSLIDER_TEXTDOMAIN); } else { _e('No slides found, please add some slides', REVSLIDER_TEXTDOMAIN); } ?> </div> <?php } $templateSlider = false; $postData = array(); if ($this->slider->isSlidesFromPosts() && $this->slider->getParam("slider_template_id", false) !== false) { $templateSlider = true; } if ($doWrapFromTemplate) { $this->slider->initByMixed($this->slider->getParam("slider_template_id", false)); } $thumbWidth = $this->slider->getParam("thumb_width", 100); $thumbHeight = $this->slider->getParam("thumb_height", 50); $slideWidth = $this->slider->getParam("width", 900); $slideHeight = $this->slider->getParam("height", 300); $navigationType = $this->slider->getParam("navigaion_type", "none"); $isThumbsActive = $navigationType == "thumb" ? true : false; $lazyLoad = $this->slider->getParam("lazy_load", "off"); if ($this->oneSlideMode == true) { $slides = $this->filterOneSlide($slides); } echo "<ul>"; $htmlFirstTransWrap = ""; $startWithSlide = $this->slider->getStartWithSlideSetting(); $firstTransActive = $this->slider->getParam("first_transition_active", "false"); if ($firstTransActive == "true") { $firstTransition = $this->slider->getParam("first_transition_type", "fade"); $htmlFirstTransWrap .= " data-fstransition=\"{$firstTransition}\""; $firstDuration = $this->slider->getParam("first_transition_duration", "300"); if (!empty($firstDuration) && is_numeric($firstDuration)) { $htmlFirstTransWrap .= " data-fsmasterspeed=\"{$firstDuration}\""; } $firstSlotAmount = $this->slider->getParam("first_transition_slot_amount", "7"); if (!empty($firstSlotAmount) && is_numeric($firstSlotAmount)) { $htmlFirstTransWrap .= " data-fsslotamount=\"{$firstSlotAmount}\""; } } if (count($slides) == 1 && $this->oneSlideMode == false) { $slides[] = $slides[0]; $slides[1]->ignore_alt = true; $this->hasOnlyOneSlide = true; } foreach ($slides as $index => $slide) { $params = $slide->getParams(); $cur_slide_title = $this->slider->getParam("navigation_style", "round"); if ($templateSlider) { $postData = $slide->getPostData(); } $date_from = $slide->getParam("date_from", ""); $date_to = $slide->getParam("date_to", ""); if ($date_from != "") { $date_from = strtotime($date_from); if (time() < $date_from) { continue; } } if ($date_to != "") { $date_to = strtotime($date_to); if (time() > $date_to) { continue; } } $transition = $slide->getParam("slide_transition", "random"); $transition_arr = explode(',', $transition); $add_rand = ''; if (is_array($transition_arr) && !empty($transition_arr)) { foreach ($transition_arr as $tkey => $trans) { if ($trans == 'random-selected') { $add_rand = ' data-randomtransition="on"'; unset($transition_arr[$tkey]); $transition = implode(',', $transition_arr); break; } } } $slotAmount = $slide->getParam("slot_amount", "7"); $isExternal = $slide->getParam("background_type", "image"); if ($isExternal != "external") { $urlSlideImage = $slide->getImageUrl(); if ($is_gallery_type == 'gallery') { $urlSlideImage = modify_layer_image($urlSlideImage); if (is_ssl()) { $urlSlideImage = str_replace("http://", "https://", $urlSlideImage); } } $imageFilename = $slide->getImageFilename(); $info = pathinfo($imageFilename); $alt = $info["filename"]; } else { $urlSlideImage = $slide->getParam("slide_bg_external", ""); $info = ''; $alt = ''; } if (isset($slide->ignore_alt)) { $alt = ''; } $bgType = $slide->getParam("background_type", "image"); $is_special_nav = false; switch ($cur_slide_title) { case 'preview1': case 'preview2': case 'preview3': case 'preview4': case 'custom': $is_special_nav = true; } $htmlThumb = ""; if ($isThumbsActive == true || $is_special_nav == true) { $urlThumb = null; if (empty($urlThumb)) { $urlThumb = $slide->getParam("slide_thumb", ""); } if ($bgType == 'image') { if (empty($urlThumb)) { $url_img_link = $slide->getImageUrl(); $urlThumb = rev_aq_resize($url_img_link, 320, 200, true, true, true); } if (empty($urlThumb)) { $urlThumb = $slide->getImageUrl(); } $urlThumb = modify_layer_image($urlThumb); } $htmlThumb = 'data-thumb="' . $urlThumb . '" '; } $htmlLink = ""; $enableLink = $slide->getParam("enable_link", "false"); if ($enableLink == "true") { $linkType = $slide->getParam("link_type", "regular"); switch ($linkType) { default: case "regular": $link = $slide->getParam("link", ""); $linkOpenIn = $slide->getParam("link_open_in", "same"); $htmlTarget = ""; if ($linkOpenIn == "new") { $htmlTarget = ' data-target="_blank"'; } $htmlLink = "data-link=\"{$link}\" {$htmlTarget} "; break; case "slide": $slideLink = UniteFunctionsRev::getVal($params, "slide_link"); if (!empty($slideLink) && $slideLink != "nothing") { if (is_numeric($slideLink)) { $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink); } if (!empty($slideLink)) { $htmlLink = "data-link=\"slide\" data-linktoslide=\"{$slideLink}\" "; } } break; } $linkPos = UniteFunctionsRev::getVal($params, "link_pos", "front"); if ($linkPos == "back") { $htmlLink .= ' data-slideindex="back"'; } } $htmlDelay = ""; $delay = $slide->getParam("delay", ""); if (!empty($delay) && is_numeric($delay)) { $htmlDelay = "data-delay=\"{$delay}\" "; } $htmlDuration = ""; $duration = $slide->getParam("transition_duration", ""); if (!empty($duration) && is_numeric($duration)) { $htmlDuration = "data-masterspeed=\"{$duration}\" "; } $htmlPerformance = ""; $performance = $slide->getParam("save_performance", "off"); if (!empty($performance) && ($performance == 'on' || $performance == 'off')) { $htmlPerformance = " data-saveperformance=\"{$performance}\" "; } $htmlRotation = ""; $rotation = $slide->getParam("transition_rotation", ""); if (!empty($rotation)) { $rotation = (int) $rotation; if ($rotation != 0) { if ($rotation > 720 && $rotation != 999) { $rotation = 720; } if ($rotation < -720) { $rotation = -720; } } $htmlRotation = "data-rotate=\"{$rotation}\" "; } $fullWidthVideoData = $this->getSlideFullWidthVideoData($slide); $htmlFirstTrans = ""; if ($index == $startWithSlide) { $htmlFirstTrans = $htmlFirstTransWrap; } $htmlParams = $htmlDuration . $htmlLink . $htmlThumb . $htmlDelay . $htmlRotation . $htmlFirstTrans . $htmlPerformance; $styleImage = ""; $urlImageTransparent = UniteBaseClassRev::$url_plugin . "images/transparent.png"; switch ($bgType) { case "trans": $urlSlideImage = $urlImageTransparent; break; case "solid": $urlSlideImage = $urlImageTransparent; $slideBGColor = $slide->getParam("slide_bg_color", "#d0d0d0"); $styleImage = "style='background-color:" . $slideBGColor . "'"; break; } $imageAddParams = ""; if ($lazyLoad == "on") { $imageAddParams .= "data-lazyload=\"{$urlSlideImage}\""; $urlSlideImage = UniteBaseClassRev::$url_plugin . "images/dummy.png"; } $bgFit = $slide->getParam("bg_fit", "cover"); $bgFitX = intval($slide->getParam("bg_fit_x", "100")); $bgFitY = intval($slide->getParam("bg_fit_y", "100")); $bgPosition = $slide->getParam("bg_position", "center top"); $bgPositionX = intval($slide->getParam("bg_position_x", "0")); $bgPositionY = intval($slide->getParam("bg_position_y", "0")); $bgRepeat = $slide->getParam("bg_repeat", "no-repeat"); if ($bgPosition == 'percentage') { $imageAddParams .= ' data-bgposition="' . $bgPositionX . '% ' . $bgPositionY . '%"'; } else { $imageAddParams .= ' data-bgposition="' . $bgPosition . '"'; } $kenburn_effect = $slide->getParam("kenburn_effect", "off"); $kb_duration = intval($slide->getParam("kb_duration", $this->slider->getParam("delay", 9000))); $kb_ease = $slide->getParam("kb_easing", "Linear.easeNone"); $kb_start_fit = $slide->getParam("kb_start_fit", "100"); $kb_end_fit = $slide->getParam("kb_end_fit", "100"); $kb_pz = ''; if ($kenburn_effect == "on" && ($bgType == 'image' || $bgType == 'external')) { $kb_pz .= ' data-kenburns="on"'; $kb_pz .= ' data-duration="' . $kb_duration . '"'; $kb_pz .= ' data-ease="' . $kb_ease . '"'; $kb_pz .= ' data-bgfit="' . $kb_start_fit . '"'; $kb_pz .= ' data-bgfitend="' . $kb_end_fit . '"'; $bgEndPosition = $slide->getParam("bg_end_position", "center top"); $bgEndPositionX = intval($slide->getParam("bg_end_position_x", "0")); $bgEndPositionY = intval($slide->getParam("bg_end_position_y", "0")); if ($bgEndPosition == 'percentage') { $kb_pz .= ' data-bgpositionend="' . $bgEndPositionX . '% ' . $bgEndPositionY . '%"'; } else { $kb_pz .= ' data-bgpositionend="' . $bgEndPosition . '"'; } } else { if ($bgFit == 'percentage') { $imageAddParams .= ' data-bgfit="' . $bgFitX . '% ' . $bgFitY . '%"'; } else { $imageAddParams .= ' data-bgfit="' . $bgFit . '"'; } $imageAddParams .= ' data-bgrepeat="' . $bgRepeat . '"'; } $thumbWidth = $this->slider->getParam("thumb_width", 100); $slide_title = ''; $class_attr = $slide->getParam("class_attr", ""); if ($class_attr !== '') { $htmlParams .= ' class="' . $class_attr . '"'; } $id_attr = $slide->getParam("id_attr", ""); if ($id_attr !== '') { $htmlParams .= ' id="' . $id_attr . '"'; } $attr_attr = $slide->getParam("attr_attr", ""); if ($attr_attr !== '') { $htmlParams .= ' id="' . $attr_attr . '"'; } $data_attr = stripslashes($slide->getParam("data_attr", "")); if ($data_attr !== '') { $htmlParams .= ' ' . $data_attr; } switch ($cur_slide_title) { case 'preview1': case 'preview2': case 'preview3': case 'preview4': case 'custom': if ($templateSlider) { $new_title = @get_the_title($slide->getID()); $slide_title = ' data-title="' . str_replace("\\'", "'", $new_title) . '"'; } else { $slide_title = ' data-title="' . str_replace("\\'", "'", $slide->getParam("title", "Slide")) . '"'; } break; } echo "\t<!-- SLIDE -->\n"; echo "\t<li data-transition=\"" . $transition . "\" data-slotamount=\"" . $slotAmount . "\" " . $add_rand . $htmlParams . $slide_title . ">\n"; echo "\t\t<!-- MAIN IMAGE -->\n"; echo "\t\t<img src=\"" . $urlSlideImage . "\" " . $styleImage . " alt=\"" . $alt . "\" " . $imageAddParams . $kb_pz . ">\n"; echo "\t\t<!-- LAYERS -->\n"; if ($fullWidthVideoData["found"] == true) { $this->putFullWidthVideoLayer($fullWidthVideoData); } $this->putCreativeLayer($slide); echo "\t</li>\n"; } echo "</ul>\n"; $useStaticLayers = $this->slider->getParam("enable_static_layers", "off"); if ($useStaticLayers == 'on') { $sliderID = $this->slider->getID(); $staticID = $slide->getStaticSlideID($sliderID); if ($staticID !== false) { $static_slide = new RevSlide(); $static_slide->initByStaticID($staticID); echo '<div class="tp-static-layers">' . "\n"; $this->putCreativeLayer($static_slide, true); echo '</div>' . "\n"; }
/** * * duplicate slide */ private function duplicateSlide($slideID) { $slide = new RevSlide(); $slide->initByID($slideID); $order = $slide->getOrder(); $slides = $this->getSlides(); $newOrder = $order + 1; $this->shiftOrder($newOrder); //do duplication $sqlSelect = "select " . GlobalsRevSlider::FIELDS_SLIDE . " from " . GlobalsRevSlider::$table_slides . " where id={$slideID}"; $sqlInsert = "insert into " . GlobalsRevSlider::$table_slides . " (" . GlobalsRevSlider::FIELDS_SLIDE . ") ({$sqlSelect})"; $this->db->runSql($sqlInsert); $lastID = $this->db->getLastInsertID(); UniteFunctionsRev::validateNotEmpty($lastID); //update order $arrUpdate = array("slide_order" => $newOrder); $this->db->update(GlobalsRevSlider::$table_slides, $arrUpdate, array("id" => $lastID)); }
/** * * return parent slide. If the slide is parent, return this slide. */ public function getParentSlide() { $parentID = $this->getParam("parentid", ""); if (empty($parentID)) { return $this; } $parentSlide = new RevSlide(); $parentSlide->initByID($parentID); return $parentSlide; }
/** * * put slide preview by data */ public function putSlidePreviewByData($data) { $data = stripslashes($data); $data = json_decode($data); $data = (array) $data; $slideID = $data["slideid"]; $slide = new RevSlide(); $slide->initByID($slideID); $sliderID = $slide->getSliderID(); $output = new RevSliderOutput(); $output->setOneSlideMode($data); $this->previewOutput($sliderID, $output); }