本文整理汇总了PHP中RevSlide::initByID方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSlide::initByID方法的具体用法?PHP RevSlide::initByID怎么用?PHP RevSlide::initByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSlide
的用法示例。
在下文中一共展示了RevSlide::initByID方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: putSlidePreviewByData
/**
*
* 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);
}
示例2: RevSlide
<?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();
示例3: addLangFromData
/**
*
* 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;
}
示例4: duplicateChildren
/**
*
* 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);
}
}
示例5: include_custom_css
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>';
}
}
示例6: putSlides
/**
*
* 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") {
//.........这里部分代码省略.........
示例7: putSlides
/**
*
* 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) == '')
//.........这里部分代码省略.........
示例8: __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":
//.........这里部分代码省略.........
示例9: putSlides
/**
*
* 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)) {
//.........这里部分代码省略.........
示例10: putSlides
/**
*
* 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 = "";
//.........这里部分代码省略.........
示例11: putSlides
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;
}
//.........这里部分代码省略.........
示例12: duplicateSlide
/**
*
* 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));
}
示例13: getParentSlide
/**
*
* 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;
}
示例14: putSlidePreviewByData
/**
*
* 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);
}