本文整理汇总了PHP中RevSlider::initByID方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSlider::initByID方法的具体用法?PHP RevSlider::initByID怎么用?PHP RevSlider::initByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSlider
的用法示例。
在下文中一共展示了RevSlider::initByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$revSliderAdmin = Mage::getSingleton('RevSliderAdmin');
$revSliderAdmin->requireSettings("slider_settings");
$settingsMain = $revSliderAdmin->getSettings("slider_main");
$settingsParams = $revSliderAdmin->getSettings("slider_params");
$settingsSliderMain = new RevSliderSettingsProduct();
$settingsSliderParams = new UniteSettingsProductSidebarRev();
//get taxonomies with cats
$postTypesWithCats = RevOperations::getPostTypesWithCatsForClient();
$jsonTaxWithCats = UniteFunctionsRev::jsonEncodeForClientSide($postTypesWithCats);
//check existing slider data:
$sliderID = $this->getRequest()->getParam('id');
if (!empty($sliderID)) {
$slider = new RevSlider();
$slider->initByID($sliderID);
//get setting fields
$settingsFields = $slider->getSettingsFields();
$arrFieldsMain = $settingsFields["main"];
$arrFieldsParams = $settingsFields["params"];
//modify arrows type for backword compatability
$arrowsType = UniteFunctionsRev::getVal($arrFieldsParams, "navigation_arrows");
switch ($arrowsType) {
case "verticalcentered":
$arrFieldsParams["navigation_arrows"] = "solo";
break;
}
//set custom type params values:
$settingsMain = RevSliderSettingsProduct::setSettingsCustomValues($settingsMain, $arrFieldsParams, $postTypesWithCats);
//set setting values from the slider
$settingsMain->setStoredValues($arrFieldsParams);
$settingsParams->setStoredValues($arrFieldsParams);
//update short code setting
$shortcode = $slider->getShortcode();
$settingsMain->updateSettingValue("shortcode", htmlentities($shortcode));
$linksEditSlides = $this->helper("adminhtml")->getUrl('adminhtml/nwdrevslider/slides/id/' . $sliderID);
$settingsSliderParams->init($settingsParams);
$settingsSliderMain->init($settingsMain);
$settingsSliderParams->isAccordion(true);
$this->assign('sliderID', $sliderID);
$this->assign('linksEditSlides', $linksEditSlides);
$this->assign('arrFieldsParams', $arrFieldsParams);
$this->setTemplate('nwdthemes/revslider/templates/slider_edit.phtml');
} else {
//set custom type params values:
$settingsMain = RevSliderSettingsProduct::setSettingsCustomValues($settingsMain, array(), $postTypesWithCats);
$settingsSliderParams->init($settingsParams);
$settingsSliderMain->init($settingsMain);
$settingsSliderParams->isAccordion(true);
$this->setTemplate('nwdthemes/revslider/templates/slider_new.phtml');
}
$this->assign('sliderTemplate', $this->_sliderTemplate);
$this->assign('settingsSliderMain', $settingsSliderMain);
$this->assign('settingsSliderParams', $settingsSliderParams);
$this->assign('jsonTaxWithCats', $jsonTaxWithCats);
}
示例2: previewOutput
/**
*
* preview slider output
* if output object is null - create object
*/
public function previewOutput($sliderID, $output = null)
{
if ($sliderID == "empty_output") {
$this->loadingMessageOutput();
exit;
}
if ($output == null) {
$output = new RevSliderOutput();
}
$slider = new RevSlider();
$slider->initByID($sliderID);
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
$arrLanguages = UniteWpmlRev::getArrLanguages(false);
//set current lang to output
$currentLang = UniteFunctionsRev::getPostGetVariable("lang");
if (empty($currentLang)) {
$currentLang = UniteWpmlRev::getCurrentLang();
}
if (empty($currentLang)) {
$currentLang = $arrLanguages[0];
}
$output->setLang($currentLang);
$selectLangChoose = UniteFunctionsRev::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true);
}
$output->setPreviewMode();
//put the output html
$urlPlugin = RevSliderAdmin::$url_plugin . "rs-plugin/";
$urlPreviewPattern = UniteBaseClassRev::$url_ajax_actions . "&client_action=preview_slider&sliderid=" . $sliderID . "&lang=[lang]&nonce=[nonce]";
$nonce = wp_create_nonce("revslider_actions");
$setBase = is_ssl() ? "https://" : "http://";
?>
<html>
<head>
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
css/settings.css?rev=<?php
echo GlobalsRevSlider::SLIDER_REVISION;
?>
' type='text/css' media='all' />
<?php
//check if dynamic-captions.css exists. If not, include captions.php
//if(file_exists(UniteBaseClassRev::$path_plugin."rs-plugin/css/dynamic-captions.css") == false){
?>
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
css/captions.php?rev=<?php
echo GlobalsRevSlider::SLIDER_REVISION;
?>
' type='text/css' media='all' />
<?php
/*}else{
?>
<link rel='stylesheet' href='<?php echo $urlPlugin?>css/dynamic-captions.css?rev=<?php echo GlobalsRevSlider::SLIDER_REVISION; ?>' type='text/css' media='all' />
<?php
}*/
$custom_css = RevOperations::getStaticCss();
echo '<style type="text/css">' . $custom_css . '</style>';
/*<!--link rel='stylesheet' href='<?php echo $urlPlugin?>css/static-captions.css?rev=<?php echo GlobalsRevSlider::SLIDER_REVISION; ?>' type='text/css' media='all' /-->*/
?>
<script type='text/javascript' src='<?php
echo $setBase;
?>
ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.plugins.min.js?rev=<?php
echo GlobalsRevSlider::SLIDER_REVISION;
?>
'></script>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.revolution.min.js?rev=<?php
echo GlobalsRevSlider::SLIDER_REVISION;
?>
'></script>
</head>
<body style="padding:0px;margin:0px;">
<?php
if ($wpmlActive == true) {
?>
<div style="margin-bottom:10px;text-align:center;">
<?php
_e("Choose language", REVSLIDER_TEXTDOMAIN);
?>
: <?php
echo $selectLangChoose;
//.........这里部分代码省略.........
示例3: previewOutputMarkup
public function previewOutputMarkup($sliderID)
{
$export_real = true;
//if false, then kriki export for JavaScript Standalone version
if ($export_real) {
//set all different file path's here
$path_fonts = 'fonts/';
$path_css = 'css/';
$path_js = 'js/';
$path_assets = 'assets';
$path_assets_raw = 'assets';
$path_assets_vid = 'assets';
$path_assets_raw_vid = 'assets';
} else {
$path_fonts = '../../revolution/fonts/';
$path_css = '../../revolution/css/';
$path_js = '../../revolution/js/';
$path_assets = '../../assets/images';
$path_assets_raw = 'assets/images';
$path_assets_vid = '../../assets/videos';
$path_assets_raw_vid = 'assets/videos';
}
if (function_exists("unzip_file") == false && class_exists("ZipArchive") == false) {
echo __('ZipArchive extension not available, please enable it to use this functionality.', REVSLIDER_TEXTDOMAIN);
exit;
}
$zip = new ZipArchive();
$success = $zip->open(RevSliderGlobals::$uploadsUrlExportZip, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE);
if ($success !== true) {
echo __("No write permissions. Can't create zip file: ", REVSLIDER_TEXTDOMAIN) . RevSliderGlobals::$uploadsUrlExportZip;
exit;
}
if ($sliderID == "empty_output") {
echo __("Wrong request!", REVSLIDER_TEXTDOMAIN);
exit;
}
$output = new RevSliderOutput();
$operations = new RevSliderOperations();
$slider = new RevSlider();
$slider->initByID($sliderID);
$output->setPreviewMode();
$http = is_ssl() ? 'https' : 'http';
$arrValues = $operations->getGeneralSettingsValues();
$set_diff_font = RevSliderFunctions::getVal($arrValues, "change_font_loading", '');
if ($set_diff_font !== '') {
$font_url = $set_diff_font;
} else {
$font_url = $http . '://fonts.googleapis.com/css?family=';
}
$static_css = RevSliderOperations::getStaticCss();
ob_start();
$output->putSliderBase($sliderID, array(), true);
$content = ob_get_contents();
ob_clean();
ob_end_clean();
$fonts = '';
while (strpos($content, '<!-- FONT -->') !== false) {
$temp_font = substr($content, strpos($content, '<!-- FONT -->'), strpos($content, '<!-- /FONT -->') + 14 - strpos($content, '<!-- FONT -->')) . "\n";
$fonts .= $temp_font;
$starthtml = substr($content, 0, strpos($content, '<!-- FONT -->'));
$endhtml = substr($content, strpos($content, '<!-- /FONT -->') + 14);
$content = $starthtml . $endhtml;
//remove from html markup
}
$fonts = str_replace(array('<!-- FONT -->', '<!-- /FONT -->'), '', $fonts);
//remove the tags
$scripts = '';
while (strpos($content, '<!-- SCRIPT -->') !== false) {
$temp_script = substr($content, strpos($content, '<!-- SCRIPT -->'), strpos($content, '<!-- /SCRIPT -->') + 16 - strpos($content, '<!-- SCRIPT -->')) . "\n";
$scripts .= $temp_script;
$starthtml = substr($content, 0, strpos($content, '<!-- SCRIPT -->'));
$endhtml = substr($content, strpos($content, '<!-- /SCRIPT -->') + 16);
$content = $starthtml . $endhtml;
//remove from html markup
}
$scripts = str_replace(array('<!-- SCRIPT -->', '<!-- /SCRIPT -->'), '', $scripts);
//remove the tags
$styles = '';
while (strpos($content, '<!-- STYLE -->') !== false) {
$temp_style = substr($content, strpos($content, '<!-- STYLE -->'), strpos($content, '<!-- /STYLE -->') + 15 - strpos($content, '<!-- STYLE -->')) . "\n";
$styles .= $temp_style;
$starthtml = substr($content, 0, strpos($content, '<!-- STYLE -->'));
$endhtml = substr($content, strpos($content, '<!-- /STYLE -->') + 15);
$content = $starthtml . $endhtml;
//remove from html markup
}
$styles = str_replace(array('<!-- STYLE -->', '<!-- /STYLE -->'), '', $styles);
//remove the tags
$full_content = '';
ob_start();
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
//.........这里部分代码省略.........
示例4: importSlider
/**
* Import slider
* @param $config
* @throws Exception
* @return array
*/
protected function importSlider($config)
{
global $wpdb;
//we take name/alias/shortcode from file name
$name = str_replace(array('revolution_slider_', '.txt'), '', basename($config));
$slider = new RevSlider();
try {
$sliderId = $slider->createSliderFromOptions(array('main' => array('title' => $name, 'alias' => $name), 'params' => array()));
} catch (Exception $e) {
//already exists - let's leave it as is
return;
}
//create a slider
try {
$slider->initByID($sliderId);
//get content array
$content = @file_get_contents($config);
$arrSlider = @unserialize($content);
if (empty($arrSlider)) {
UniteFunctionsRev::throwError("Wrong export slider file format!");
}
//update slider params
$sliderParams = $arrSlider["params"];
$sliderParams["title"] = $name;
$sliderParams["alias"] = $name;
$sliderParams["shortcode"] = '[rev_slider ' . $name . ']';
if (isset($sliderParams["background_image"])) {
$sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
}
$json_params = json_encode($sliderParams);
$arrUpdate = array("params" => $json_params);
$wpdb->update(GlobalsRevSlider::$table_sliders, $arrUpdate, array("id" => $sliderId));
//-------- Slides Handle -----------
//create all slides
$arrSlides = $arrSlider["slides"];
foreach ($arrSlides as $slide) {
$params = $slide["params"];
$layers = $slide["layers"];
//convert params images:
if (isset($params["image"])) {
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
//convert layers images:
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($layer["image_url"]);
$layers[$key] = $layer;
}
}
//create new slide
$arrCreate = array();
$arrCreate["slider_id"] = $sliderId;
$arrCreate["slide_order"] = $slide["slide_order"];
$arrCreate["layers"] = json_encode($layers);
$arrCreate["params"] = json_encode($params);
$wpdb->insert(GlobalsRevSlider::$table_slides, $arrCreate);
}
} catch (Exception $e) {
if (WP_DEBUG) {
throw $e;
}
}
}
示例5: 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;
}
示例6: 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();
示例7: getArrSlidersWithSlidesShort
/**
*
* get array of sliders with slides, short, assoc.
*/
public function getArrSlidersWithSlidesShort($filterType = self::SLIDER_TYPE_ALL)
{
$arrSliders = self::getArrSlidersShort(null, $filterType);
$output = array();
foreach ($arrSliders as $sliderID => $sliderName) {
$slider = new RevSlider();
$slider->initByID($sliderID);
$isFromPosts = $slider->isSlidesFromPosts();
$isTemplate = $slider->getParam("template", "false");
//filter by gallery only
if ($filterType == self::SLIDER_TYPE_POSTS && $isFromPosts == false) {
continue;
}
if ($filterType == self::SLIDER_TYPE_GALLERY && $isFromPosts == true) {
continue;
}
//filter by template type
if ($filterType == self::SLIDER_TYPE_TEMPLATE && $isTemplate == "false") {
continue;
}
$sliderTitle = $slider->getTitle();
$arrSlides = $slider->getArrSlidesFromGalleryShort();
foreach ($arrSlides as $slideID => $slideName) {
$output[$slideID] = $sliderName . ", " . $slideName;
}
}
return $output;
}
示例8: intval
<?php
if (!defined('ABSPATH')) {
exit;
}
//get input
$slideID = RevSliderFunctions::getGetVar("id");
if ($slideID == 'new') {
//add new transparent slide
$sID = intval(RevSliderFunctions::getGetVar("slider"));
if ($sID > 0) {
$revs = new RevSlider();
$revs->initByID($sID);
//check if we already have slides, if yes, go to first
$arrS = $revs->getSlides(false);
if (empty($arrS)) {
$slideID = $revs->createSlideFromData(array('sliderid' => $sID), true);
} else {
$slideID = key($arrS);
}
}
}
$patternViewSlide = self::getViewUrl("slide", "id=[slideid]");
//init slide object
$slide = new RevSlide();
$slide->initByID($slideID);
$slideParams = $slide->getParams();
$operations = new RevSliderOperations();
//init slider object
$sliderID = $slide->getSliderID();
$slider = new RevSlider();
示例9: __construct
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$operations = new RevOperations();
$sliderID = $this->getRequest()->getParam('id');
$storeID = $this->getRequest()->getParam('store_id', 0);
if (empty($sliderID)) {
UniteFunctionsRev::throwError("Slider ID not found");
}
$slider = new RevSlider();
$slider->initByID($sliderID);
$sliderParams = $slider->getParams();
$arrSliders = $slider->getArrSlidersShort($sliderID);
$selectSliders = UniteFunctionsRev::getHTMLSelect($arrSliders, "", "id='selectSliders'", true);
$numSliders = count($arrSliders);
//set iframe parameters
$width = $sliderParams["width"];
$height = $sliderParams["height"];
$iframeWidth = $width + 60;
$iframeHeight = $height + 50;
$iframeStyle = "width:" . $iframeWidth . "px;height:" . $iframeHeight . "px;";
$arrSlides = $slider->getSlides(false, $storeID);
$numSlides = count($arrSlides);
$linksSliderSettings = $this->helper("adminhtml")->getUrl('adminhtml/nwdrevslider/slider/id/' . $sliderID);
$patternViewSlide = $this->helper("adminhtml")->getUrl('adminhtml/nwdrevslider/slider/id/[slideid]');
$useStaticLayers = $slider->getParam("enable_static_layers", "off");
//treat in case of slides from gallery
if ($slider->isSlidesFromPosts() == false) {
$templateName = "slides_gallery";
// store view
$selectStoreView = Mage::app()->getLayout()->createBlock('core/html_select')->setName('select_storeview')->setId('select_storeview')->setTitle('Store View')->setValue($storeID)->setOptions(Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true))->getHtml();
$this->assign('storeID', $storeID);
$this->assign('selectStoreView', $selectStoreView);
$this->setTemplate('nwdthemes/revslider/templates/slides_gallery.phtml');
} else {
//slides from posts
$templateName = "slides_posts";
$sourceType = $slider->getParam("source_type", "posts");
$showSortBy = $sourceType == "posts" ? true : false;
$showDelete = $sourceType == "specific_posts" ? true : false;
//get button links
$urlNewPost = $this->helper('adminhtml')->getUrl('adminhtml/catalog_product/new');
$linkNewPost = UniteFunctionsRev::getHtmlLink($urlNewPost, $this->__("<i class='revicon-pencil-1'></i>New Product"), "button_new_post", "button-primary revblue", true);
//get ordering
$arrSortBy = $this->helper('nwdrevslider')->getArrSortBy();
$sortBy = $slider->getParam("post_sortby", RevSlider::DEFAULT_POST_SORTBY);
$selectSortBy = UniteFunctionsRev::getHTMLSelect($arrSortBy, $sortBy, "id='select_sortby'", true);
$this->assign('showSortBy', $showSortBy);
$this->assign('showDelete', $showDelete);
$this->assign('selectSortBy', $selectSortBy);
$this->assign('linkNewPost', $linkNewPost);
$this->setTemplate('nwdthemes/revslider/templates/slides_posts.phtml');
}
$this->assign('sliderID', $sliderID);
$this->assign('iframeStyle', $iframeStyle);
$this->assign('patternViewSlide', $patternViewSlide);
$this->assign('selectSliders', $selectSliders);
$this->assign('linksSliderSettings', $linksSliderSettings);
$this->assign('useStaticLayers', $useStaticLayers);
$this->assign('arrSlides', $arrSlides);
$this->assign('slider', $slider);
$this->assign('numSlides', $numSlides);
$this->assign('numSliders', $numSliders);
}
示例10: copyMoveSlide
/**
*
* copy / move slide
*/
private function copyMoveSlide($slideID, $targetSliderID, $operation)
{
if ($operation == "move") {
$targetSlider = new RevSlider();
$targetSlider->initByID($targetSliderID);
$maxOrder = $targetSlider->getMaxOrder();
$newOrder = $maxOrder + 1;
$arrUpdate = array("slider_id" => $targetSliderID, "slide_order" => $newOrder);
$this->db->update(GlobalsRevSlider::$table_slides, $arrUpdate, array("id" => $slideID));
} else {
//in place of copy
$this->duplicateSlide($slideID);
$this->copyMoveSlide($slideID, $targetSliderID, "move");
}
}
示例11: createSlide
/**
*
* create the slide (from image)
*/
public function createSlide($sliderID, $obj = "")
{
$imageID = null;
if (is_array($obj)) {
$urlImage = UniteFunctionsRev::getVal($obj, "url");
$imageID = UniteFunctionsRev::getVal($obj, "id");
} else {
$urlImage = $obj;
}
//get max order
$slider = new RevSlider();
$slider->initByID($sliderID);
$maxOrder = $slider->getMaxOrder();
$order = $maxOrder + 1;
$params = array();
if (!empty($urlImage)) {
$params["background_type"] = "image";
$params["image"] = $urlImage;
if (!empty($imageID)) {
$params["image_id"] = $imageID;
}
} else {
//create transparent slide
$params["background_type"] = "trans";
}
$jsonParams = json_encode($params);
$arrInsert = array("params" => $jsonParams, "slider_id" => $sliderID, "slide_order" => $order, "layers" => "");
$slideID = $this->db->insert(GlobalsRevSlider::$table_slides, $arrInsert);
return $slideID;
}
示例12: get_external_sliders
function get_external_sliders($type)
{
global $wpdb;
$sliders = array();
if ($type == 'layerslider') {
/* SLIDER VALUES */
if (class_exists('LS_Sliders')) {
$layer_sliders = LS_Sliders::find(array('data' => false));
foreach ($layer_sliders as $item) {
$sliders = array_merge($sliders, array("layerslider_" . $item['id'] => "LayerSlider - " . $item['name']));
}
}
} else {
if ($type == 'revslider') {
if (class_exists('RevSlider')) {
$revo = new RevSlider();
$revo_sliders = $revo->getArrSlidersShort();
foreach ($revo_sliders as $rev_id => $rev_title) {
$s = new RevSlider();
$s->initByID($rev_id);
$alias = $s->getAlias();
$sliders = array_merge($sliders, array("revslider_" . $alias => "Revolution Slider - " . $rev_title));
}
}
} else {
if ($type == 'masterslider') {
if (function_exists('get_mastersliders')) {
$master_sliders = get_mastersliders();
foreach ($master_sliders as $slider) {
$sliders = array_merge($sliders, array("masterslider_" . $slider['ID'] => "Master Slider - " . $slider['title']));
}
}
}
}
}
return $sliders;
}
示例13: previewOutput
/**
*
* preview slider output
* if output object is null - create object
*/
public function previewOutput($sliderID, $output = null)
{
if ($sliderID == "empty_output") {
$this->loadingMessageOutput();
exit;
}
if ($output == null) {
$output = new RevSliderOutput();
}
$slider = new RevSlider();
$slider->initByID($sliderID);
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
$arrLanguages = UniteWpmlRev::getArrLanguages(false);
//set current lang to output
$currentLang = UniteFunctionsRev::getPostGetVariable("lang");
if (empty($currentLang)) {
$currentLang = UniteWpmlRev::getCurrentLang();
}
if (empty($currentLang)) {
$currentLang = $arrLanguages[0];
}
$output->setLang($currentLang);
$selectLangChoose = UniteFunctionsRev::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true);
}
$output->setPreviewMode();
//put the output html
$urlPlugin = RevSliderAdmin::$url_plugin . "rs-plugin/";
$urlPreviewPattern = UniteBaseClassRev::$url_ajax_actions . "&client_action=preview_slider&sliderid={$sliderID}&lang=[lang]";
?>
<html>
<head>
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
css/settings.css' type='text/css' media='all' />
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
css/captions.css' type='text/css' media='all' />
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.revolution.min.js'></script>
</head>
<body style="padding:0px;margin:0px;">
<?php
if ($wpmlActive == true) {
?>
<div style="margin-bottom:10px;text-align:center;">
<?php
_e("Choose language");
?>
: <?php
echo $selectLangChoose;
?>
</div>
<script type="text/javascript">
var g_previewPattern = '<?php
echo $urlPreviewPattern;
?>
';
jQuery("#select_langs").change(function(){
var lang = this.value;
var pattern = g_previewPattern;
var urlPreview = pattern.replace("[lang]",lang);
location.href = urlPreview;
});
</script>
<?php
}
?>
<?php
$output->putSliderBase($sliderID);
?>
</body>
</html>
<?php
exit;
}
示例14: copyMoveSlide
/**
*
* copy / move slide
*/
private function copyMoveSlide($slideID, $targetSliderID, $operation)
{
if ($operation == "move") {
$targetSlider = new RevSlider();
$targetSlider->initByID($targetSliderID);
$maxOrder = $targetSlider->getMaxOrder();
$newOrder = $maxOrder + 1;
$arrUpdate = array("slider_id" => $targetSliderID, "slide_order" => $newOrder);
//update children
$arrChildren = $this->getArrSlideChildren($slideID);
foreach ($arrChildren as $child) {
$childID = $child->getID();
$this->db->update(GlobalsRevSlider::$table_slides, $arrUpdate, array("id" => $childID));
}
$this->db->update(GlobalsRevSlider::$table_slides, $arrUpdate, array("id" => $slideID));
} else {
//in place of copy
$newSlideID = $this->duplicateSlide($slideID);
$this->duplicateChildren($slideID, $newSlideID);
$this->copyMoveSlide($newSlideID, $targetSliderID, "move");
}
}
示例15: onAjaxAction
/**
*
* onAjax action handler
*/
public static function onAjaxAction()
{
$slider = new RevSlider();
$slide = new RevSlide();
$operations = new RevOperations();
$action = self::getPostGetVar("client_action");
$data = self::getPostGetVar("data");
$nonce = self::getPostGetVar("nonce");
try {
//verify the nonce
$isVerified = wp_verify_nonce($nonce, "revslider_actions");
if ($isVerified == false) {
UniteFunctionsRev::throwError("Wrong request");
}
switch ($action) {
case 'add_google_fonts':
$f = new ThemePunch_Fonts();
$result = $f->add_new_font($data);
if ($result === true) {
self::ajaxResponseSuccess(__("Font successfully created!", REVSLIDER_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getFontsUrl()));
} else {
self::ajaxResponseError($result, false);
}
break;
case 'remove_google_fonts':
if (!isset($data['handle'])) {
self::ajaxResponseError(__('Font not found', REVSLIDER_TEXTDOMAIN), false);
}
$f = new ThemePunch_Fonts();
$result = $f->remove_font_by_handle($data['handle']);
if ($result === true) {
self::ajaxResponseSuccess(__("Font successfully removed!", REVSLIDER_TEXTDOMAIN), array('data' => $result));
} else {
self::ajaxResponseError($result, false);
}
break;
case 'edit_google_fonts':
if (!isset($data['handle'])) {
self::ajaxResponseError(__('No handle given', REVSLIDER_TEXTDOMAIN), false);
}
if (!isset($data['url'])) {
self::ajaxResponseError(__('No parameters given', REVSLIDER_TEXTDOMAIN), false);
}
$f = new ThemePunch_Fonts();
$result = $f->edit_font_by_handle($data);
if ($result === true) {
self::ajaxResponseSuccess(__("Font successfully changed!", REVSLIDER_TEXTDOMAIN), array('data' => $result));
} else {
self::ajaxResponseError($result, false);
}
break;
case "export_slider":
$sliderID = self::getGetVar("sliderid");
$dummy = self::getGetVar("dummy");
$slider->initByID($sliderID);
$slider->exportSlider($dummy);
break;
case "import_slider":
$updateAnim = self::getPostGetVar("update_animations");
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderHandle(null, $updateAnim, $updateStatic);
break;
case "import_slider_slidersview":
$viewBack = self::getViewUrl(self::VIEW_SLIDERS);
$updateAnim = self::getPostGetVar("update_animations");
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderHandle($viewBack, $updateAnim, $updateStatic);
break;
case "create_slider":
self::requireSettings("slider_settings");
$settingsMain = self::getSettings("slider_main");
$settingsParams = self::getSettings("slider_params");
$data = $operations->modifyCustomSliderParams($data);
$newSliderID = $slider->createSliderFromOptions($data, $settingsMain, $settingsParams);
self::ajaxResponseSuccessRedirect(__("The slider successfully created", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders"));
break;
case "update_slider":
self::requireSettings("slider_settings");
$settingsMain = self::getSettings("slider_main");
$settingsParams = self::getSettings("slider_params");
$data = $operations->modifyCustomSliderParams($data);
$slider->updateSliderFromOptions($data, $settingsMain, $settingsParams);
self::ajaxResponseSuccess(__("Slider updated", REVSLIDER_TEXTDOMAIN));
break;
case "delete_slider":
$isDeleted = $slider->deleteSliderFromData($data);
if (is_array($isDeleted)) {
$isDeleted = implode(', ', $isDeleted);
self::ajaxResponseError("Template can't be deleted, it is still being used by the following Sliders: " . $isDeleted);
} else {
self::ajaxResponseSuccessRedirect(__("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
}
break;
case "duplicate_slider":
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect(__("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
//.........这里部分代码省略.........