本文整理汇总了PHP中RevOperations类的典型用法代码示例。如果您正苦于以下问题:PHP RevOperations类的具体用法?PHP RevOperations怎么用?PHP RevOperations使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RevOperations类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: yit_revslider_slider
function yit_revslider_slider()
{
$operations = new RevOperations();
$arrValues = $operations->getGeneralSettingsValues();
$includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally","on");
$isWidgetActive = is_active_widget( false, false, "rev-slider-widget", true );
$hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider");
if ( yit_slider_get_setting('slider_type',yit_slider_name()) != 'revolution-slider' || $includesGlobally == "on" || $isWidgetActive || $hasShortcode ) {
return;
}
wp_enqueue_style('rs-plugin-settings', RS_PLUGIN_URL .'public/assets/css/settings.css', array(), RevSliderGlobals::SLIDER_REVISION);
$custom_css = RevOperations::getStaticCss();
$custom_css = UniteCssParserRev::compress_css($custom_css);
wp_add_inline_style('rs-plugin-settings', $custom_css);
$setBase = (is_ssl()) ? "https://" : "http://";
$url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution";
wp_enqueue_script("jquery", $url_jquery);
// put javascript to footer
add_action('wp_footer', array($GLOBALS['productFront'], 'putJavascript'));
}
示例2: putJavascript
/**
*
* javascript output to footer
*/
public function putJavascript()
{
$urlPlugin = UniteBaseClassRev::$url_plugin . "rs-plugin/";
$operations = new RevOperations();
$arrValues = $operations->getGeneralSettingsValues();
$use_hammer = UniteFunctionsRev::getVal($arrValues, "use_hammer_js", 'on');
if ($use_hammer == 'off') {
?>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.disablehammer.js?rev=<?php
echo GlobalsRevSlider::SLIDER_REVISION;
?>
'></script>
<?php
}
?>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.tools.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>
<?php
}
示例3: initByPostData
/**
*
* init slide by post data
*/
public function initByPostData($postData, RevSlide $slideTemplate, $sliderID)
{
$this->postData = $this->postData;
$_view_link = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . UniteFunctionsRev::getVal($postData, 'url_path');
$_cart_link = UniteFunctionsRev::getVal($postData, 'cart_link');
$_wishlist_link = UniteFunctionsRev::getVal($postData, 'wishlist_link');
$postID = $postData["entity_id"];
$arrWildcardsValues = RevOperations::getPostWilcardValues($postID);
$slideTemplateID = UniteFunctionsRev::getVal($arrWildcardsValues, "slide_template");
if (!empty($slideTemplateID) && is_numeric($slideTemplateID)) {
//init by local template, if fail, init by global (slider) template
try {
$slideTemplateLocal = new RevSlide();
$slideTemplateLocal->initByID($slideTemplateID);
$this->initBySlide($slideTemplateLocal);
} catch (Exception $e) {
$this->initBySlide($slideTemplate);
}
} else {
//init by global template
$this->initBySlide($slideTemplate);
}
//set some slide params
$this->id = $postID;
$this->params["title"] = UniteFunctionsRev::getVal($postData, "name");
if (@$this->params['enable_link'] == "true" && @$this->params['link_type'] == "regular") {
$this->params["link"] = str_replace('%view_link%', $_view_link, $this->params["link"]);
$this->params["link"] = str_replace('%cart_link%', $_cart_link, $this->params["link"]);
$this->params["link"] = str_replace('%wishlist_link%', $_wishlist_link, $this->params["link"]);
}
//set image
$this->imageFilename = $postData['image'];
//replace placeholders in layers:
$this->setLayersByPostData($postData, $sliderID);
}
示例4: putRevSlider
/**
*
* put rev slider on the page.
* the data can be slider ID or slider alias.
*/
function putRevSlider($data, $putIn = "")
{
$operations = new RevOperations();
$arrValues = $operations->getGeneralSettingsValues();
$includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on");
$strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes");
$isPutIn = RevSliderOutput::isPutIn($strPutIn, true);
if ($isPutIn == false && $includesGlobally == "off") {
$output = new RevSliderOutput();
$option1Name = "Include RevSlider libraries globally (all pages/posts)";
$option2Name = "Pages to include RevSlider libraries";
$output->putErrorMessage(__("If you want to use the PHP function \"putRevSlider\" in your code please make sure to check \" ", REVSLIDER_TEXTDOMAIN) . $option1Name . __(" \" in the backend's \"General Settings\" (top right panel). <br> <br> Or add the current page to the \"", REVSLIDER_TEXTDOMAIN) . $option2Name . __("\" option box."));
return false;
}
RevSliderOutput::putSlider($data, $putIn);
}
示例5: __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);
}
示例6: onAddScripts
/**
*
* a must function. you can not use it, but the function must stay there!.
*
*/
public static function onAddScripts()
{
$operations = new RevOperations();
$arrValues = $operations->getGeneralSettingsValues();
$includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on");
$includesFooter = UniteFunctionsRev::getVal($arrValues, "js_to_footer", "off");
$strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes");
$isPutIn = RevSliderOutput::isPutIn($strPutIn, true);
//put the includes only on pages with active widget or shortcode
// if the put in match, then include them always (ignore this if)
if ($isPutIn == false && $includesGlobally == "off") {
$isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true);
$hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider");
if ($isWidgetActive == false && $hasShortcode == false) {
return false;
}
}
self::addStyle("settings", "rs-plugin-settings", "rs-plugin/css");
//check if dynamic-captions.css exists. If not, include captions.php
if (file_exists(self::$path_plugin . "rs-plugin/css/dynamic-captions.css") == false) {
self::addDynamicStyle("captions", "rs-plugin-captions", "rs-plugin/css");
} else {
$db = new UniteDBRev();
$styles = $db->fetch(GlobalsRevSlider::$table_css);
$styles = UniteCssParserRev::parseDbArrayToCss($styles, "\n");
wp_add_inline_style('rs-plugin-settings', $styles);
//self::addStyle("dynamic-captions","rs-captions","rs-plugin/css");
}
$custom_css = RevOperations::getStaticCss();
wp_add_inline_style('rs-plugin-settings', $custom_css);
//self::addStyle("static-captions","rs-plugin-static","rs-plugin/css");
$setBase = is_ssl() ? "https://" : "http://";
$url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution";
self::addScriptAbsoluteUrl($url_jquery, "jquery");
if ($includesFooter == "off") {
self::addScriptWaitFor("jquery.themepunch.plugins.min", "rs-plugin/js", 'themepunchtools', 'jquery');
self::addScriptWaitFor("jquery.themepunch.revolution.min", "rs-plugin/js", 'revmin', 'jquery');
} else {
//put javascript to footer
UniteBaseClassRev::addAction('wp_footer', 'putJavascript');
}
}
示例7: yit_revslider_slider
function yit_revslider_slider()
{
if ( ! class_exists('RevOperations') ) {
return;
}
$operations = new RevOperations();
$arrValues = $operations->getGeneralSettingsValues();
$includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally","on");
$isWidgetActive = is_active_widget( false, false, "rev-slider-widget", true );
$hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider");
if ( YIT_Layout()->slider_name===false
|| (YIT_Layout()->slider_name != 'none' && YIT_Slider::get_slider( YIT_Layout()->slider_name )->config->layout != 'revolution-slider')
|| $includesGlobally == "on"
|| $isWidgetActive
|| $hasShortcode ) {
return;
}
if ( defined( 'RS_PLUGIN_URL' ) ) {
wp_enqueue_style( 'rs-plugin-settings', RS_PLUGIN_URL . 'public/assets/css/settings.css', array(), RevSliderGlobals::SLIDER_REVISION );
}
else {
wp_enqueue_style( "rs-plugin-settings", UniteBaseClassRev::$url_plugin . "rs-plugin/css/settings.css", array(), GlobalsRevSlider::SLIDER_REVISION );
}
$custom_css = RevOperations::getStaticCss();
$custom_css = UniteCssParserRev::compress_css($custom_css);
wp_add_inline_style('rs-plugin-settings', $custom_css);
$setBase = (is_ssl()) ? "https://" : "http://";
$url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution";
wp_enqueue_script("jquery", $url_jquery);
// put javascript to footer
add_action('wp_footer', array($GLOBALS['productFront'], 'putJavascript'));
}
示例8: onAddScripts
public static function onAddScripts()
{
$operations = new RevOperations();
$arrValues = $operations->getGeneralSettingsValues();
$includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on");
$includesFooter = UniteFunctionsRev::getVal($arrValues, "js_to_footer", "off");
$strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes");
$isPutIn = RevSliderOutput::isPutIn($strPutIn, true);
//put the includes only on pages with active widget or shortcode
// if the put in match, then include them always (ignore this if)
if ($isPutIn == false && $includesGlobally == "off") {
$isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true);
$hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider");
if ($isWidgetActive == false && $hasShortcode == false) {
return false;
}
}
//self::addStyle("settings","rs-settings","rs-plugin/css");
//check if dynamic-captions.css exists. If not, include captions.php
//if(file_exists(self::$path_plugin."rs-plugin/css/dynamic-captions.css") == false){
//self::addDynamicStyle("captions","rs-plugin-captions","rs-plugin/css");
// $captionsAction = Context::getContext()->link->getAdminLink('Revolutionslider_ajax').'&revControllerAction=captions';
//
// wp_enqueue_style ('captions', $captionsAction);
// }
//else
//self::addStyle("dynamic-captions","rs-captions","rs-plugin/css");
//self::addStyle("static-captions","rs-plugin-static","rs-plugin/css");
// $setBase = (is_ssl()) ? "https://" : "http://";
// $url_jquery = $setBase."ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution";
// self::addScriptAbsoluteUrl($url_jquery, "jquery");
// if($includesFooter == "off"){
// self::addScript("jquery.themepunch.tools.min","rs-plugin/js",'themepunchtools');
// self::addScript("jquery.themepunch.revolution.min","rs-plugin/js");
//self::addScriptWaitFor("jquery.themepunch.tools.min","rs-plugin/js",'themepunchtools', array('jquery'));
//self::addScriptWaitFor("jquery.themepunch.revolution.min","rs-plugin/js", null, array('jquery'));
// }else{
//put javascript to footer
// UniteBaseClassRev::addAction('wp_footer', 'putJavascript');
// }
}
示例9: putJavascript
public function putJavascript()
{
$urlPlugin = UniteBaseClassRev::$url_plugin . "rs-plugin/";
$operations = new RevOperations();
$arrValues = $operations->getGeneralSettingsValues();
?>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.tools.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>
<?php
}
示例10: onAddScripts
/**
*
* a must function. you can not use it, but the function must stay there!.
*
*/
public static function onAddScripts()
{
$operations = new RevOperations();
$arrValues = $operations->getGeneralSettingsValues();
$includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on");
$strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes");
$isPutIn = RevSliderOutput::isPutIn($strPutIn, true);
//put the includes only on pages with active widget or shortcode
// if the put in match, then include them always (ignore this if)
if ($isPutIn == false && $includesGlobally == "off") {
$isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true);
$hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider");
if ($isWidgetActive == false && $hasShortcode == false) {
return false;
}
}
self::addStyle("settings", "rs-settings", "rs-plugin/css");
self::addStyle("captions", "rs-captions", "rs-plugin/css");
$url_jquery = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution";
self::addScriptAbsoluteUrl($url_jquery, "jquery");
self::addScript("jquery.themepunch.revolution.min", "rs-plugin/js");
}
示例11: RevSliderSettingsProduct
<?php
$sliderTemplate = true;
$settingsMain = self::getSettings("slider_main");
$settingsParams = self::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 = self::getGetVar("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);
示例12: foreach
<!-- load good font -->
<?php
if ($loadGoogleFont == "true") {
$googleFont = $slider->getParam("google_font", "");
if (!empty($googleFont)) {
if (is_array($googleFont)) {
foreach ($googleFont as $key => $font) {
echo RevOperations::getCleanFontImport($font);
}
} else {
echo RevOperations::getCleanFontImport($googleFont);
}
}
}
if ($slide->isStaticSlide()) {
//insert sliderid for preview
?>
<input type="hidden" id="sliderid" value="<?php
echo $slider->getID();
?>
" />
<?php
}
?>
<div class="wrap settings_wrap">
<div class="clear_both"></div>
<div class="title_line">
<div id="icon-options-general" class="icon32"></div>
<div class="view_title">
示例13: putSliderBase
/**
*
* put html slider on the html page.
* @param $data - mixed, can be ID ot Alias.
*/
public function putSliderBase($sliderID)
{
try {
self::$sliderSerial++;
$this->slider = new RevSlider();
$this->slider->initByMixed($sliderID);
// Do not output Slider if we are on mobile
$disable_on_mobile = $this->slider->getParam("disable_on_mobile", "off");
$isMobile = strstr($_SERVER['HTTP_USER_AGENT'], 'Android') || strstr($_SERVER['HTTP_USER_AGENT'], 'webOS') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') ? true : false;
if ($disable_on_mobile == 'on' && $isMobile) {
return false;
}
$show_alternate = $this->slider->getParam("show_alternative_type", "off");
if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') {
if ($isMobile) {
$show_alternate_image = $this->slider->getParam("show_alternate_image", "");
echo '<img class="tp-slider-alternative-image" src="' . $show_alternate_image . '">';
return false;
}
}
$doWrapFromTemplate = false;
if ($this->slider->isSlidesFromPosts() && $this->slider->getParam("slider_template_id", false) !== false) {
//need to use general settings from the Template Slider
$this->slider->initByMixed($this->slider->getParam("slider_template_id", false));
$doWrapFromTemplate = $sliderID;
}
//modify settings for admin preview mode
if ($this->previewMode == true) {
$this->modifyPreviewModeSettings();
}
//set slider language
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $this->slider->getParam("use_wpml", "off");
if ($isWpmlExists && $useWpml == "on") {
if ($this->previewMode == false) {
$this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode();
}
}
//edit html before slider
$htmlBeforeSlider = "";
if ($this->slider->getParam("load_googlefont", "false") == "true") {
$googleFont = $this->slider->getParam("google_font");
if (is_array($googleFont)) {
foreach ($googleFont as $key => $font) {
$htmlBeforeSlider .= RevOperations::getCleanFontImport($font);
}
} else {
$htmlBeforeSlider .= RevOperations::getCleanFontImport($googleFont);
}
}
//pub js to body handle
if ($this->jsToBody == true) {
//$operations = new RevOperations();
//$arrValues = $operations->getGeneralSettingsValues();
$urlIncludeJSTools = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.tools.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJSTools}'></script>\n";
//$enable_logs = UniteFunctionsRev::getVal($arrValues, "enable_logs",'off');
$enable_logs = "off";
if ($enable_logs == 'on') {
$urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.enablelog.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
}
$useHammer = 'on';
if ($useHammer == 'off') {
$urlIncludeJS = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.disablehammer.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>\n";
}
$urlIncludeJS = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.revolution.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>\n";
}
//the initial id can be alias
$sliderID = $this->slider->getID();
$bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width");
$bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height");
$sliderType = $this->slider->getParam("slider_type");
//set wrapper height
$wrapperHeigh = 0;
$wrapperHeigh += $this->slider->getParam("height");
//add thumb height
if ($this->slider->getParam("navigaion_type") == "thumb") {
$wrapperHeigh += $this->slider->getParam("thumb_height");
}
$this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial;
$this->sliderHtmlID_wrapper = $this->sliderHtmlID . "_wrapper";
$containerStyle = "";
$sliderPosition = $this->slider->getParam("position", "center");
//set position:
if ($sliderType != "fullscreen") {
switch ($sliderPosition) {
case "center":
default:
$containerStyle .= "margin:0px auto;";
break;
case "left":
$containerStyle .= "float:left;";
//.........这里部分代码省略.........
示例14: 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");
try {
switch ($action) {
case "export_slider":
$sliderID = self::getGetVar("sliderid");
$slider->initByID($sliderID);
$slider->exportSlider();
break;
case "import_slider":
self::importSliderHandle();
break;
case "create_slider":
$newSliderID = $slider->createSliderFromOptions($data);
self::ajaxResponseSuccessRedirect("The slider successfully created", self::getViewUrl("sliders"));
break;
case "update_slider":
$slider->updateSliderFromOptions($data);
self::ajaxResponseSuccess("Slider updated");
break;
case "delete_slider":
$slider->deleteSliderFromData($data);
self::ajaxResponseSuccessRedirect("The slider deleted", self::getViewUrl(self::VIEW_SLIDERS));
break;
case "duplicate_slider":
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect("The duplicate successfully, refreshing page...", self::getViewUrl(self::VIEW_SLIDERS));
break;
case "add_slide":
$slider->createSlideFromData($data);
$sliderID = $data["sliderid"];
self::ajaxResponseSuccessRedirect("Slide Created", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "update_slide":
$slide->updateSlideFromData($data);
self::ajaxResponseSuccess("Slide updated");
break;
case "delete_slide":
$slide->deleteSlideFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "sliderID");
self::ajaxResponseSuccessRedirect("Slide Deleted Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "duplicate_slide":
$sliderID = $slider->duplicateSlideFromData($data);
self::ajaxResponseSuccessRedirect("Slide Duplicated Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "get_captions_css":
$contentCSS = $operations->getCaptionsContent();
self::ajaxResponseData($contentCSS);
break;
case "update_captions_css":
$arrCaptions = $operations->updateCaptionsContentData($data);
self::ajaxResponseSuccess("CSS file saved succesfully!", array("arrCaptions" => $arrCaptions));
break;
case "restore_captions_css":
$operations->restoreCaptionsCss();
$contentCSS = $operations->getCaptionsContent();
self::ajaxResponseData($contentCSS);
break;
case "update_slides_order":
$slider->updateSlidesOrderFromData($data);
self::ajaxResponseSuccess("Order updated successfully");
break;
case "change_slide_image":
$slide->updateSlideImageFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "slider_id");
self::ajaxResponseSuccessRedirect("Slide Changed Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "preview_slide":
$operations->putSlidePreviewByData($data);
break;
case "preview_slider":
$sliderID = UniteFunctionsRev::getPostVariable("sliderid");
$operations->previewOutput($sliderID);
break;
default:
self::ajaxResponseError("wrong ajax action: {$action} ");
break;
}
} catch (Exception $e) {
$message = $e->getMessage();
self::ajaxResponseError($message);
}
//it's an ajax action, so exit
self::ajaxResponseError("No response output on <b> {$action} </b> action. please check with the developer.");
exit;
}
示例15: onAjaxAction
/**
*
* onAjax action handler
*/
public static function onAjaxAction()
{
$actionIndicator = self::getPostGetVar("action");
if ($actionIndicator != "uniterevolution_ajax_action") {
return false;
}
$action = self::getPostGetVar("client_action");
$data = self::getPostGetVar("data");
$nonce = self::getPostGetVar("nonce");
$slider = new RevSlider();
$slide = new RevSlide();
$operations = new RevOperations();
try {
//verify the nonce
$isVerified = wp_verify_nonce($nonce, "revslider_actions");
if ($isVerified == false) {
UniteFunctionsRev::throwError("Wrong request");
}
switch ($action) {
case "export_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
$sliderID = self::getGetVar("sliderid");
$dummy = self::getGetVar("dummy");
$slider->initByID($sliderID);
$slider->exportSlider($dummy);
break;
case "import_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
$updateAnim = self::getPostGetVar("update_animations");
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderHandle(null, $updateAnim, $updateStatic);
break;
case "import_slider_slidersview":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
$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":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
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(__ug("The slider successfully created", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders"));
break;
case "update_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_SETTINGS);
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(__ug("Slider updated", REVSLIDER_TEXTDOMAIN));
break;
case "delete_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
$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(__ug("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
}
break;
case "duplicate_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect(__ug("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
break;
case "add_slide":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
$numSlides = $slider->createSlideFromData($data);
$sliderID = $data["sliderid"];
if ($numSlides == 1) {
$responseText = __ug("Slide Created", REVSLIDER_TEXTDOMAIN);
} else {
$responseText = $numSlides . " " . __ug("Slides Created", REVSLIDER_TEXTDOMAIN);
}
$urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}");
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "add_slide_fromslideview":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
$slideID = $slider->createSlideFromData($data, true);
$urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
$responseText = __ug("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN);
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "update_slide":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_EDIT_SLIDE);
require self::getSettingsFilePath("slide_settings");
$slide->updateSlideFromData($data, $slideSettings);
self::ajaxResponseSuccess(__ug("Slide updated", REVSLIDER_TEXTDOMAIN));
//.........这里部分代码省略.........