本文整理汇总了PHP中RevSlide::getLayers方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSlide::getLayers方法的具体用法?PHP RevSlide::getLayers怎么用?PHP RevSlide::getLayers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSlide
的用法示例。
在下文中一共展示了RevSlide::getLayers方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initBySlide
/**
*
* init by another slide
*/
private function initBySlide(RevSlide $slide)
{
$this->id = "template";
$this->templateID = $slide->getID();
$this->sliderID = $slide->getSliderID();
$this->slideOrder = $slide->getOrder();
$this->imageUrl = $slide->getImageUrl();
$this->imageID = $slide->getImageID();
$this->imageThumb = $slide->getThumbUrl();
$this->imageFilepath = $slide->getImageFilepath();
$this->imageFilename = $slide->getImageFilename();
$this->params = $slide->getParams();
$this->arrLayers = $slide->getLayers();
$this->arrChildren = $slide->getArrChildrenPure();
}
示例2: putCreativeLayer
/**
*
* 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 = 5;
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 = '';
//.........这里部分代码省略.........
示例3: RevSlider
//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();
//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
示例4: RevSlide
$isWpmlExists = RevSliderWpml::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
$jsonStaticLayers = "";
if (!$slide->isStaticSlide()) {
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
$parentSlide = $slide->getParentSlide();
$arrChildLangs = $parentSlide->getArrChildrenLangs();
}
//get static slide, check all layers and add them to the action list
$static_slide_id = $slide->getStaticSlideID($sliderID);
if ($static_slide_id !== false) {
$static_slide = new RevSlide();
$static_slide->initByStaticID($static_slide_id);
$static_layers = $static_slide->getLayers();
$jsonStaticLayers = RevSliderFunctions::jsonEncodeForClientSide($static_layers);
}
}
?>
<script type="text/javascript">
/*
* Copyright 2015 Small Batch, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
示例5: putCreativeLayer
/**
*
* 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");
}
//.........这里部分代码省略.........
示例6: __construct
/**
* 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":
//.........这里部分代码省略.........
示例7: putCreativeLayer
/**
*
* 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:
//.........这里部分代码省略.........
示例8: duplicateSlider
/**
*
* duplicate slider in datatase
*/
private function duplicateSlider($title = false)
{
$this->validateInited();
if ($title === false) {
//get slider number:
$response = $this->db->fetch(RevSliderGlobals::$table_sliders);
$numSliders = count($response);
$newSliderSerial = $numSliders + 1;
$newSliderTitle = "Slider" . $newSliderSerial;
$newSliderAlias = "slider" . $newSliderSerial;
} else {
$newSliderTitle = $title;
$newSliderAlias = sanitize_title($title);
// Check Duplicate Alias
$sqlTitle = $this->db->fetch(RevSliderGlobals::$table_sliders, "alias='" . sanitize_title($title) . "'");
if (!empty($sqlTitle)) {
$response = $this->db->fetch(RevSliderGlobals::$table_sliders);
$numSliders = count($response);
$newSliderSerial = $numSliders + 1;
$newSliderTitle .= $newSliderSerial;
$newSliderAlias .= $newSliderSerial;
}
}
//insert a new slider
$sqlSelect = "select " . RevSliderGlobals::FIELDS_SLIDER . " from " . RevSliderGlobals::$table_sliders . " where id=" . $this->id . "";
$sqlInsert = "insert into " . RevSliderGlobals::$table_sliders . " (" . RevSliderGlobals::FIELDS_SLIDER . ") ({$sqlSelect})";
$this->db->runSql($sqlInsert);
$lastID = $this->db->getLastInsertID();
RevSliderFunctions::validateNotEmpty($lastID);
//update the new slider with the title and the alias values
$arrUpdate = array();
$arrUpdate["title"] = $newSliderTitle;
$arrUpdate["alias"] = $newSliderAlias;
//update params
$params = $this->arrParams;
$params["title"] = $newSliderTitle;
$params["alias"] = $newSliderAlias;
$params["shortcode"] = "[rev_slider alias=\"" . $newSliderAlias . "\"]";
$jsonParams = json_encode($params);
$arrUpdate["params"] = $jsonParams;
$arrUpdate["type"] = '';
//remove the type as we do not want it to be template if it was
$this->db->update(RevSliderGlobals::$table_sliders, $arrUpdate, array("id" => $lastID));
//duplicate Slides
$slides = $this->db->fetch(RevSliderGlobals::$table_slides, "slider_id=" . $this->id);
if (!empty($slides)) {
foreach ($slides as $slide) {
$slide['slider_id'] = $lastID;
$myID = $slide['id'];
unset($slide['id']);
$last_id = $this->db->insert(RevSliderGlobals::$table_slides, $slide);
if (isset($myID)) {
$slider_map[$myID] = $last_id;
}
}
}
//duplicate static slide if exists
$slide = new RevSlide();
$staticID = $slide->getStaticSlideID($this->id);
$static_id = 0;
if ($staticID !== false) {
$record = $this->db->fetchSingle(RevSliderGlobals::$table_static_slides, "id={$staticID}");
unset($record['id']);
$record['slider_id'] = $lastID;
$static_id = $this->db->insert(RevSliderGlobals::$table_static_slides, $record);
}
//update actions
$slides = $this->db->fetch(RevSliderGlobals::$table_slides, "slider_id={$lastID}");
if ($static_id > 0) {
$slides_static = $this->db->fetch(RevSliderGlobals::$table_static_slides, "id={$static_id}");
$slides = array_merge($slides, $slides_static);
}
if (!empty($slides)) {
foreach ($slides as $slide) {
$c_slide = new RevSlide();
$c_slide->initByData($slide);
$layers = $c_slide->getLayers();
$did_change = false;
foreach ($layers as $key => $value) {
if (isset($value['layer_action'])) {
if (isset($value['layer_action']->jump_to_slide) && !empty($value['layer_action']->jump_to_slide)) {
foreach ($value['layer_action']->jump_to_slide as $jtsk => $jtsval) {
if (isset($slider_map[$jtsval])) {
$layers[$key]['layer_action']->jump_to_slide[$jtsk] = $slider_map[$jtsval];
$did_change = true;
}
}
}
}
}
if ($did_change === true) {
$arrCreate = array();
$my_layers = json_encode($layers);
if (empty($my_layers)) {
$my_layers = stripslashes(json_encode($layers));
}
//.........这里部分代码省略.........
示例9: duplicateSlider
/**
*
* duplicate slider in datatase
*/
private function duplicateSlider($title = false, $prefix = false)
{
$this->validateInited();
//insert a new slider
$sqlSelect = $this->db->prepare("select " . RevSliderGlobals::FIELDS_SLIDER . " from " . RevSliderGlobals::$table_sliders . " where id = %s", array($this->id));
$sqlInsert = "insert into " . RevSliderGlobals::$table_sliders . " (" . RevSliderGlobals::FIELDS_SLIDER . ") ({$sqlSelect})";
$this->db->runSql($sqlInsert);
$lastID = $this->db->getLastInsertID();
RevSliderFunctions::validateNotEmpty($lastID);
$params = $this->arrParams;
if ($title === false) {
//get slider number:
$response = $this->db->fetch(RevSliderGlobals::$table_sliders);
$numSliders = count($response);
$newSliderSerial = $numSliders + 1;
$newSliderTitle = "Slider" . $newSliderSerial;
$newSliderAlias = "slider" . $newSliderSerial;
} else {
if ($prefix !== false) {
$newSliderTitle = sanitize_text_field($title . ' ' . $params['title']);
$newSliderAlias = sanitize_title($title . ' ' . $params['title']);
} else {
$newSliderTitle = sanitize_text_field($title);
$newSliderAlias = sanitize_title($title);
}
// Check Duplicate Alias
$sqlTitle = $this->db->fetch(RevSliderGlobals::$table_sliders, $this->db->prepare("alias = %s", array($newSliderAlias)));
if (!empty($sqlTitle)) {
$response = $this->db->fetch(RevSliderGlobals::$table_sliders);
$numSliders = count($response);
$newSliderSerial = $numSliders + 1;
$newSliderTitle .= $newSliderSerial;
$newSliderAlias .= $newSliderSerial;
}
}
//update params
$params["title"] = $newSliderTitle;
$params["alias"] = $newSliderAlias;
$params["shortcode"] = "[rev_slider alias=\"" . $newSliderAlias . "\"]";
//update the new slider with the title and the alias values
$arrUpdate = array();
$arrUpdate["title"] = $newSliderTitle;
$arrUpdate["alias"] = $newSliderAlias;
$jsonParams = json_encode($params);
$arrUpdate["params"] = $jsonParams;
$arrUpdate["type"] = '';
//remove the type as we do not want it to be template if it was
$this->db->update(RevSliderGlobals::$table_sliders, $arrUpdate, array("id" => $lastID));
//duplicate Slides
$slides = $this->db->fetch(RevSliderGlobals::$table_slides, $this->db->prepare("slider_id = %s", array($this->id)));
if (!empty($slides)) {
foreach ($slides as $slide) {
$slide['slider_id'] = $lastID;
$myID = $slide['id'];
unset($slide['id']);
$last_id = $this->db->insert(RevSliderGlobals::$table_slides, $slide);
if (isset($myID)) {
$slider_map[$myID] = $last_id;
}
}
}
//duplicate static slide if exists
$slide = new RevSlide();
$staticID = $slide->getStaticSlideID($this->id);
$static_id = 0;
if ($staticID !== false) {
$record = $this->db->fetchSingle(RevSliderGlobals::$table_static_slides, $this->db->prepare("id = %s", array($staticID)));
unset($record['id']);
$record['slider_id'] = $lastID;
$static_id = $this->db->insert(RevSliderGlobals::$table_static_slides, $record);
}
//update actions
$slides = $this->db->fetch(RevSliderGlobals::$table_slides, $this->db->prepare("slider_id = %s", array($lastID)));
if ($static_id > 0) {
$slides_static = $this->db->fetch(RevSliderGlobals::$table_static_slides, $this->db->prepare("id = %s", array($static_id)));
$slides = array_merge($slides, $slides_static);
}
if (!empty($slides)) {
foreach ($slides as $slide) {
$c_slide = new RevSlide();
$c_slide->initByData($slide);
$layers = $c_slide->getLayers();
$did_change = false;
foreach ($layers as $key => $value) {
if (isset($value['layer_action'])) {
if (isset($value['layer_action']->jump_to_slide) && !empty($value['layer_action']->jump_to_slide)) {
foreach ($value['layer_action']->jump_to_slide as $jtsk => $jtsval) {
if (isset($slider_map[$jtsval])) {
$layers[$key]['layer_action']->jump_to_slide[$jtsk] = $slider_map[$jtsval];
$did_change = true;
}
}
}
}
}
if ($did_change === true) {
//.........这里部分代码省略.........
示例10: putCreativeLayer
/**
*
* 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");
$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 = "";
//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"));
switch ($videoType) {
case "youtube":
$html = "<iframe src='http://www.youtube.com/embed/{$videoID}?hd=1&wmode=opaque&controls=1&showinfo=0;rel=0' width='{$videoWidth}' height='{$videoHeight}' style='width:{$videoWidth}px;height:{$videoHeight}px;'></iframe>";
break;
case "vimeo":
$html = "<iframe src='http://player.vimeo.com/video/{$videoID}?title=0&byline=0&portrait=0' width='{$videoWidth}' height='{$videoHeight}' style='width:{$videoWidth}px;height:{$videoHeight}px;'></iframe>";
break;
default:
UniteFunctionsRev::throwError("wrong video type: {$videoType}");
break;
}
$videoAutoplay = UniteFunctionsRev::getVal($layer, "video_autoplay");
if ($videoAutoplay == "true") {
$htmlVideoAutoplay = ' data-autoplay="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") {
//get slide index from id
if (is_numeric($slideLink)) {
$slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink);
}
if (!empty($slideLink)) {
//.........这里部分代码省略.........
示例11: putCreativeLayer
/**
* put creative layer
*/
private function putCreativeLayer(RevSlide $slide, $static_slide = false)
{
$layers = $slide->getLayers();
$slider_type = $this->slider->getParam('slider-type');
$icon_sets = RevSliderBase::set_icon_sets(array());
$customAnimations = RevSliderOperations::getCustomAnimations('customin');
//get all custom animations
$customEndAnimations = RevSliderOperations::getCustomAnimations('customout');
//get all custom animations
$startAnimations = RevSliderOperations::getArrAnimations(false);
//only get the standard animations
$endAnimations = RevSliderOperations::getArrEndAnimations(false);
//only get the standard animations
$fullCustomAnims = RevSliderOperations::getFullCustomAnimations();
$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';
}
$isTemplate = $this->slider->getParam('template', 'false');
$enable_custom_size_notebook = $this->slider->getParam('enable_custom_size_notebook', 'off');
$enable_custom_size_tablet = $this->slider->getParam('enable_custom_size_tablet', 'off');
$enable_custom_size_iphone = $this->slider->getParam('enable_custom_size_iphone', 'off');
$enabled_sizes = array('desktop' => 'on', 'notebook' => $enable_custom_size_notebook, 'tablet' => $enable_custom_size_tablet, 'mobile' => $enable_custom_size_iphone);
$adv_resp_sizes = $enable_custom_size_notebook == 'on' || $enable_custom_size_tablet == 'on' || $enable_custom_size_iphone == 'on' ? true : false;
$image_source_type = $this->slider->getParam('def-image_source_type', 'full');
if (empty($layers)) {
return false;
}
$zIndex = 5;
$slideID = $slide->getID();
$in_class_usage = array();
foreach ($layers as $layer) {
$unique_id = RevSliderFunctions::getVal($layer, 'unique_id');
if ($unique_id == '') {
$unique_id = $zIndex - 4;
}
//$visible = RevSliderFunctions::getVal($layer, 'visible', true);
//if($visible == false) continue;
$type = RevSliderFunctions::getVal($layer, 'type', 'text');
//set if video full screen
$videoclass = '';
$isFullWidthVideo = false;
if ($type == 'video') {
$videoclass = ' tp-videolayer';
$videoData = RevSliderFunctions::getVal($layer, 'video_data');
if (!empty($videoData)) {
$videoData = (array) $videoData;
$isFullWidthVideo = RevSliderFunctions::getVal($videoData, 'fullwidth');
$isFullWidthVideo = RevSliderFunctions::strToBool($isFullWidthVideo);
} else {
$videoData = array();
}
}
$class = RevSliderFunctions::getVal($layer, 'style');
if (trim($class) !== '') {
$this->class_include['.' . trim($class)] = true;
//add classname for style inclusion
//get class styles for further compare usage
if (!isset($in_class_usage[trim($class)])) {
$in_class_usage[trim($class)] = RevSliderOperations::getCaptionsContentArray(trim($class));
}
}
//set defaults for stylings
$dff = '';
$dta = 'left';
$dfs = 'normal';
$dtd = 'none';
$dpa = '0px 0px 0px 0px';
$dbs = 'none';
$dbw = '0px';
$dbr = '0px 0px 0px 0px';
$dfos = false;
$dlh = false;
$dfw = false;
$dco = false;
$dcot = 1;
$dbc = 'transparent';
$dbt = 1;
$dboc = 'transparent';
$dbot = 1;
/**
* remove this following to get back to 5.0.4.1 in terms of output styling
**/
$do_remove_inline = apply_filters('revslider_remove_inline', true);
if ($do_remove_inline) {
if (isset($in_class_usage[trim($class)]) && isset($in_class_usage[trim($class)]['params'])) {
//defaults get set here
$dfos = isset($in_class_usage[trim($class)]['params']->{'font-size'}) ? $in_class_usage[trim($class)]['params']->{'font-size'} : $dfos;
$dlh = isset($in_class_usage[trim($class)]['params']->{'line-height'}) ? $in_class_usage[trim($class)]['params']->{'line-height'} : $dlh;
$dfw = isset($in_class_usage[trim($class)]['params']->{'font-weight'}) ? $in_class_usage[trim($class)]['params']->{'font-weight'} : $dfw;
$dco = isset($in_class_usage[trim($class)]['params']->{'color'}) ? $in_class_usage[trim($class)]['params']->{'color'} : $dco;
$dcot = isset($in_class_usage[trim($class)]['params']->{'color-transparency'}) ? $in_class_usage[trim($class)]['params']->{'color-transparency'} : $dcot;
$dbc = isset($in_class_usage[trim($class)]['params']->{'background-color'}) ? $in_class_usage[trim($class)]['params']->{'background-color'} : $dbc;
$dbt = isset($in_class_usage[trim($class)]['params']->{'background-transparency'}) ? $in_class_usage[trim($class)]['params']->{'background-transparency'} : $dbt;
$dboc = isset($in_class_usage[trim($class)]['params']->{'border-color'}) ? $in_class_usage[trim($class)]['params']->{'border-color'} : $dboc;
//.........这里部分代码省略.........
示例12: putCreativeLayer
/**
*
* put creative layer
*/
public function putCreativeLayer(RevSlide $slide)
{
$layers = $slide->getLayers();
if (empty($layers)) {
return false;
}
?>
<?php
foreach ($layers as $layer) {
$type = UniteFunctionsRev::getVal($layer, "type", "text");
$class = UniteFunctionsRev::getVal($layer, "style");
$animation = UniteFunctionsRev::getVal($layer, "animation", "fade");
//set output class:
$outputClass = "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");
//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"));
switch ($videoType) {
case "youtube":
$html = "<iframe src='http://www.youtube.com/embed/{$videoID}?hd=1&wmode=opaque&controls=1&showinfo=0' width='{$videoWidth}' height='{$videoHeight}'></iframe>";
break;
case "vimeo":
$html = "<iframe src='http://player.vimeo.com/video/{$videoID}?title=0&byline=0&portrait=0' width='{$videoWidth}' height='{$videoHeight}'></iframe>";
break;
default:
UniteFunctionsRev::throwError("wrong video type: {$videoType}");
break;
}
break;
}
?>
<div class="<?php
echo $outputClass;
?>
"
data-x="<?php
echo $left;
?>
"
data-y="<?php
echo $top;
?>
"
data-speed="<?php
echo $speed;
?>
"
data-start="<?php
echo $time;
?>
"
data-easing="<?php
echo $easing;
?>
"><?php
echo $html;
?>
</div>
<?php
}
?>
<?php
//.........这里部分代码省略.........