Example #1
0
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'));
}
    /**
     * 
     * 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 
    }
 /**
  *
  * 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);
 }
 /**
  * 
  * 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);
 }
Example #5
0
 /**
  * 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);
 }
 /**
  * 
  * 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');
     }
 }
Example #7
0
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'));
}
Example #8
0
 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');
     // }
 }
    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 
    }
Example #10
0
 /**
  * 
  * 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");
 }
<?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);
Example #12
0
	<!--  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">
Example #13
0
 /**
  * 
  * 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;";
                     break;
                 case "right":
                     $containerStyle .= "float:right;";
                     break;
             }
         }
         //add background color
         $backgrondColor = trim($this->slider->getParam("background_color"));
         if (!empty($backgrondColor)) {
             $containerStyle .= "background-color:{$backgrondColor};";
         }
         //set padding
         $containerStyle .= "padding:" . $this->slider->getParam("padding", "0") . "px;";
         //set margin:
         if ($sliderType != "fullscreen") {
             if ($sliderPosition != "center") {
                 $containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;";
                 $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;";
             }
             $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;";
             $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;";
         }
         //set height and width:
         $bannerStyle = "display:none;";
         //add background image (to banner style)
         $showBackgroundImage = $this->slider->getParam("show_background_image", "false");
         if ($showBackgroundImage == "true") {
             $backgroundImage = $this->slider->getParam("background_image");
             $backgroundFit = $this->slider->getParam("bg_fit", "cover");
             $backgroundRepeat = $this->slider->getParam("bg_repeat", "no-repeat");
             $backgroundPosition = $this->slider->getParam("bg_position", "center top");
             if (!empty($backgroundImage)) {
                 $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:" . $backgroundRepeat . ";background-fit:" . $backgroundFit . ";background-position:" . $backgroundPosition . ";";
             }
         }
         //set wrapper and slider class:
         $sliderWrapperClass = "rev_slider_wrapper";
         $sliderClass = "rev_slider";
         $putResponsiveStyles = false;
         switch ($sliderType) {
             default:
             case "fixed":
                 $bannerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 $containerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 break;
             case "responsitive":
                 //$containerStyle .= "height:".$bannerHeight."px;";
                 $putResponsiveStyles = true;
                 break;
             case "fullwidth":
                 $sliderWrapperClass .= " fullwidthbanner-container";
                 $sliderClass .= " fullwidthabanner";
                 $bannerStyle .= "max-height:" . $bannerHeight . "px;height:" . $bannerHeight . "px;";
                 $containerStyle .= "max-height:" . $bannerHeight . "px;";
                 break;
             case "fullscreen":
                 //$containerStyle .= "height:".$bannerHeight."px;";
                 $sliderWrapperClass .= " fullscreen-container";
                 $sliderClass .= " fullscreenbanner";
                 break;
         }
         //handle position behind
         $posBehind = $this->slider->getParam("position_behind", "false");
         $posBehind = UniteFunctionsRev::strToBool($posBehind);
         if ($posBehind == true) {
             $containerStyle .= "position:relative;z-index:0;";
         }
         $htmlTimerBar = "";
         $timerBar = $this->slider->getParam("show_timerbar", "top");
         if ($timerBar == "true") {
             $timerBar = $this->slider->getParam("timebar_position", "top");
         }
         switch ($timerBar) {
             case "top":
                 $htmlTimerBar = '<div class="tp-bannertimer"></div>';
                 break;
             case "bottom":
                 $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>';
                 break;
             case "hide":
                 $htmlTimerBar = '<div class="tp-bannertimer tp-bottom" style="display:none; visibility: hidden !important;"></div>';
                 break;
         }
         //check inner / outer border
         $paddingType = $this->slider->getParam("padding_type", "outter");
         if ($paddingType == "inner") {
             $sliderWrapperClass .= " tp_inner_padding";
         }
         global $revSliderVersion;
         echo "<!-- START REVOLUTION SLIDER " . $revSliderVersion . " " . $sliderType . " mode -->\n";
         if ($putResponsiveStyles == true) {
             $this->putResponsitiveStyles();
         }
         echo $htmlBeforeSlider . "\n";
         echo "<div id=\"";
         echo $this->sliderHtmlID_wrapper;
         echo "\" ";
         echo "class=\"" . $sliderWrapperClass . "\"";
         $show_alternate = $this->slider->getParam("show_alternative_type", "off");
         if ($show_alternate !== 'off') {
             $show_alternate_image = $this->slider->getParam("show_alternate_image", "");
             echo ' data-aimg="' . $show_alternate_image . '" ';
             if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') {
                 echo ' data-amobile="enabled" ';
             } else {
                 echo ' data-amobile="disabled" ';
             }
             if ($show_alternate == 'mobile-ie8' || $show_alternate == 'ie8') {
                 echo ' data-aie8="enabled" ';
             } else {
                 echo ' data-aie8="disabled" ';
             }
         }
         echo " style=\"" . $containerStyle . "\">\n";
         echo "\t<div id=\"";
         echo $this->sliderHtmlID;
         echo "\" ";
         echo "class=\"" . $sliderClass . "\"";
         echo " style=\"" . $bannerStyle . "\">\n";
         echo $this->putSlides($doWrapFromTemplate);
         echo $htmlTimerBar;
         echo "\t</div>\n";
         $this->putJS();
         echo "</div>\n";
         echo "<!-- END REVOLUTION SLIDER -->";
     } catch (Exception $e) {
         $message = $e->getMessage();
         $this->putErrorMessage($message);
     }
 }
Example #14
0
 /**
  * 
  * 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;
 }
Example #15
0
 /**
  * 
  * 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));
                 break;
             case "delete_slide":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $isPost = $slide->deleteSlideFromData($data);
                 if ($isPost) {
                     $message = __ug("Post Deleted Successfully", REVSLIDER_TEXTDOMAIN);
                 } else {
                     $message = __ug("Slide Deleted Successfully", REVSLIDER_TEXTDOMAIN);
                 }
                 $sliderID = UniteFunctionsRev::getVal($data, "sliderID");
                 self::ajaxResponseSuccessRedirect($message, self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "update_static_slide":
                 $slide->updateStaticSlideFromData($data);
                 self::ajaxResponseSuccess(__ug("Static Global Layers updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "duplicate_slide":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $sliderID = $slider->duplicateSlideFromData($data);
                 self::ajaxResponseSuccessRedirect(__ug("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "copy_move_slide":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $sliderID = $slider->copyMoveSlideFromData($data);
                 self::ajaxResponseSuccessRedirect(__ug("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "get_static_css":
                 $contentCSS = $operations->getStaticCss();
                 self::ajaxResponseData($contentCSS);
                 break;
             case "get_dynamic_css":
                 $contentCSS = $operations->getDynamicCss();
                 self::ajaxResponseData($contentCSS);
                 break;
             case "insert_captions_css":
                 $arrCaptions = $operations->insertCaptionsContentData($data);
                 self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "update_captions_css":
                 $arrCaptions = $operations->updateCaptionsContentData($data);
                 self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "delete_captions_css":
                 $arrCaptions = $operations->deleteCaptionsContentData($data);
                 self::ajaxResponseSuccess(__ug("Style deleted succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "update_static_css":
                 $staticCss = $operations->updateStaticCss($data);
                 self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("css" => $staticCss));
                 break;
             case "insert_custom_anim":
                 $arrAnims = $operations->insertCustomAnim($data);
                 //$arrCaptions =
                 self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_custom_anim":
                 $arrAnims = $operations->updateCustomAnim($data);
                 self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "delete_custom_anim":
                 $arrAnims = $operations->deleteCustomAnim($data);
                 self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_slides_order":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $slider->updateSlidesOrderFromData($data);
                 self::ajaxResponseSuccess(__ug("Order updated successfully", REVSLIDER_TEXTDOMAIN));
                 break;
             case "change_slide_image":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $slide->updateSlideImageFromData($data);
                 $sliderID = UniteFunctionsRev::getVal($data, "slider_id");
                 self::ajaxResponseSuccessRedirect(__ug("Slide Changed Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "preview_slide":
                 $operations->putSlidePreviewByData($data);
                 break;
             case "preview_slider":
                 $sliderID = UniteFunctionsRev::getPostGetVariable("sliderid");
                 $do_markup = UniteFunctionsRev::getPostGetVariable("only_markup");
                 if ($do_markup == 'true') {
                     $operations->previewOutputMarkup($sliderID);
                 } else {
                     $operations->previewOutput($sliderID);
                 }
                 break;
             case "toggle_slide_state":
                 $currentState = $slide->toggleSlideStatFromData($data);
                 self::ajaxResponseData(array("state" => $currentState));
                 break;
             case "slide_lang_operation":
                 $responseData = $slide->doSlideLangOperation($data);
                 self::ajaxResponseData($responseData);
                 break;
             case "update_plugin":
                 self::updatePlugin(self::DEFAULT_VIEW);
                 break;
             case "update_text":
                 self::updateSettingsText();
                 self::ajaxResponseSuccess(__ug("All files successfully updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_general_settings":
                 $operations->updateGeneralSettings($data);
                 self::ajaxResponseSuccess(__ug("General settings updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_posts_sortby":
                 $slider->updatePostsSortbyFromData($data);
                 self::ajaxResponseSuccess(__ug("Sortby updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "replace_image_urls":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
                 $slider->replaceImageUrlsFromData($data);
                 self::ajaxResponseSuccess(__ug("Image urls replaced", REVSLIDER_TEXTDOMAIN));
                 break;
             case "reset_slide_settings":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $slider->resetSlideSettings($data);
                 self::ajaxResponseSuccess(__ug("Settings in all Slides changed", REVSLIDER_TEXTDOMAIN));
                 break;
             default:
                 self::ajaxResponseError("wrong ajax action: {$action} ");
                 break;
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         if ($action == "preview_slide" || $action == "preview_slider") {
             echo $message;
             exit;
         }
         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;
 }
function cmo_import_sliders_ajax()
{
    global $wpdb;
    if (!class_exists('UniteFunctionsRev')) {
        ajax_finish(false, __('Revolution Slider plugin is not installed or activated.', 'cumulo'));
    } else {
        $rev_directory = CMO_FRAMEWORK_PATH . '/demo/sliders/';
        if (!empty($_POST['demo'])) {
            if ($_POST['demo'] != 'default') {
                $rev_directory .= $_POST['demo'] . '/';
            }
        }
        foreach (glob($rev_directory . '*.zip') as $filename) {
            $filename = basename($filename);
            $rev_files[] = $rev_directory . $filename;
        }
        foreach ($rev_files as $rev_file) {
            $filepath = $rev_file;
            $zip = new ZipArchive();
            $importZip = $zip->open($filepath, ZIPARCHIVE::CREATE);
            if ($importZip === true) {
                $slider_export = $zip->getStream('slider_export.txt');
                $custom_animations = $zip->getStream('custom_animations.txt');
                $dynamic_captions = $zip->getStream('dynamic-captions.css');
                $static_captions = $zip->getStream('static-captions.css');
                $content = '';
                $animations = '';
                $dynamic = '';
                $static = '';
                while (!feof($slider_export)) {
                    $content .= fread($slider_export, 1024);
                }
                if ($custom_animations) {
                    while (!feof($custom_animations)) {
                        $animations .= fread($custom_animations, 1024);
                    }
                }
                if ($dynamic_captions) {
                    while (!feof($dynamic_captions)) {
                        $dynamic .= fread($dynamic_captions, 1024);
                    }
                }
                if ($static_captions) {
                    while (!feof($static_captions)) {
                        $static .= fread($static_captions, 1024);
                    }
                }
                fclose($slider_export);
                if ($custom_animations) {
                    fclose($custom_animations);
                }
                if ($dynamic_captions) {
                    fclose($dynamic_captions);
                }
                if ($static_captions) {
                    fclose($static_captions);
                }
                //check for images!
            } else {
                $content = @file_get_contents($filepath);
            }
            if ($importZip === true) {
                //we have a zip
                $db = new UniteDBRev();
                //update/insert custom animations
                $animations = @unserialize($animations);
                if (!empty($animations)) {
                    foreach ($animations as $key => $animation) {
                        $exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
                        if (!empty($exist)) {
                            if ($updateAnim == "true") {
                                $arrUpdate = array();
                                $arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                                $db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
                                $id = $exist['0']['id'];
                            } else {
                                $arrInsert = array();
                                $arrInsert["handle"] = 'copy_' . $animation['handle'];
                                $arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                                $id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
                            }
                        } else {
                            $arrInsert = array();
                            $arrInsert["handle"] = $animation['handle'];
                            $arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                            $id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
                        }
                        $content = str_replace(array('customin-' . $animation['id'], 'customout-' . $animation['id']), array('customin-' . $id, 'customout-' . $id), $content);
                    }
                } else {
                }
                //overwrite/append static-captions.css
                if (!empty($static)) {
                    if (isset($updateStatic) && $updateStatic == "true") {
                        RevOperations::updateStaticCss($static);
                    } else {
                        //append
                        $static_cur = RevOperations::getStaticCss();
                        $static = $static_cur . "\n" . $static;
                        RevOperations::updateStaticCss($static);
                    }
                }
                $dynamicCss = UniteCssParserRev::parseCssToArray($dynamic);
                if (is_array($dynamicCss) && $dynamicCss !== false && count($dynamicCss) > 0) {
                    foreach ($dynamicCss as $class => $styles) {
                        $class = trim($class);
                        if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || strpos($class, ".tp-caption") === false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) {
                            //.tp-caption>.imageclass or .tp-caption.imageclass>img or .tp-caption.imageclass .img
                            continue;
                        }
                        //is a dynamic style
                        if (strpos($class, ':hover') !== false) {
                            $class = trim(str_replace(':hover', '', $class));
                            $arrInsert = array();
                            $arrInsert["hover"] = json_encode($styles);
                            $arrInsert["settings"] = json_encode(array('hover' => 'true'));
                        } else {
                            $arrInsert = array();
                            $arrInsert["params"] = json_encode($styles);
                        }
                        //check if class exists
                        $result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
                        if (!empty($result)) {
                            //update
                            $db->update(GlobalsRevSlider::$table_css, $arrInsert, array('handle' => $class));
                        } else {
                            //insert
                            $arrInsert["handle"] = $class;
                            $db->insert(GlobalsRevSlider::$table_css, $arrInsert);
                        }
                    }
                } else {
                }
            }
            $content = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", $content);
            //clear errors in string
            $arrSlider = @unserialize($content);
            $sliderParams = $arrSlider["params"];
            if (isset($sliderParams["background_image"])) {
                $sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
            }
            $json_params = json_encode($sliderParams);
            $arrInsert = array();
            $arrInsert["params"] = $json_params;
            $arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title", "Slider1");
            $arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias", "slider1");
            $sliderID = $wpdb->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
            $sliderID = $wpdb->insert_id;
            $arrSlides = $arrSlider["slides"];
            $alreadyImported = array();
            foreach ($arrSlides as $slide) {
                $params = $slide["params"];
                $layers = $slide["layers"];
                if (isset($params["image"])) {
                    if (trim($params["image"]) !== '') {
                        if ($importZip === true) {
                            $image = $zip->getStream('images/' . $params["image"]);
                            if (!$image) {
                                echo esc_html($params["image"]) . ' not found!<br>';
                            } else {
                                if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
                                    $importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
                                    if ($importImage !== false) {
                                        $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
                                        $params["image"] = $importImage['path'];
                                    }
                                } else {
                                    $params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
                                }
                            }
                        }
                    }
                    $params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
                }
                //convert layers images:
                foreach ($layers as $key => $layer) {
                    if (isset($layer["image_url"])) {
                        //import if exists in zip folder
                        if (trim($layer["image_url"]) !== '') {
                            if ($importZip === true) {
                                //we have a zip, check if exists
                                $image_url = $zip->getStream('images/' . $layer["image_url"]);
                                if (!$image_url) {
                                    echo esc_html($layer["image_url"]) . ' not found!<br>';
                                } else {
                                    if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
                                        $importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
                                        if ($importImage !== false) {
                                            $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
                                            $layer["image_url"] = $importImage['path'];
                                        }
                                    } else {
                                        $layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $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);
            }
        }
        ajax_finish(true, "done");
    }
}
Example #17
0
<?php

//get input
$slideID = UniteFunctionsRev::getGetVar("id");
//init slide object
$slide = new RevSlide();
$slide->initByID($slideID);
$slideParams = $slide->getParams();
//dmp($slideParams);exit();
$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 self::getSettingsFilePath("slide_settings");
require self::getSettingsFilePath("layer_settings");
//add tools.min.js
self::addScript("jquery.themepunch.tools.min", "rs-plugin/js", 'tp-tools');
$settingsLayerOutput = new UniteSettingsProductSidebarRev();
$settingsSlideOutput = new UniteSettingsRevProductRev();
$arrLayers = $slide->getLayers();
 /**
  * 
  * delete slide from data
  */
 public function deleteSlideFromData($data)
 {
     $sliderID = UniteFunctionsRev::getVal($data, "sliderID");
     $slider = new RevSlider();
     $slider->initByID($sliderID);
     $isPost = $slider->isSlidesFromPosts();
     if ($isPost == true) {
         //delete post
         $postID = UniteFunctionsRev::getVal($data, "slideID");
         UniteFunctionsWPRev::deletePost($postID);
     } else {
         //delete slide
         $slideID = UniteFunctionsRev::getVal($data, "slideID");
         $this->initByID($slideID);
         $this->deleteChildren();
         $this->deleteSlide();
     }
     RevOperations::updateDynamicCaptions();
 }
Example #19
0
$sliderMainSettings->addRadio("auto_height", array("on" => __("On", REVSLIDER_TEXTDOMAIN), "off" => __("Off", REVSLIDER_TEXTDOMAIN)), __("Unlimited Height", REVSLIDER_TEXTDOMAIN), "off");
$sliderMainSettings->addRadio("force_full_width", array("on" => __("On", REVSLIDER_TEXTDOMAIN), "off" => __("Off", REVSLIDER_TEXTDOMAIN)), __("Force Full Width", REVSLIDER_TEXTDOMAIN), "off");
$arrParams = array("description" => __("", REVSLIDER_TEXTDOMAIN));
$sliderMainSettings->addTextBox("min_height", "0", __("Min. Height", REVSLIDER_TEXTDOMAIN), $arrParams);
$paramsSize = array("width" => 960, "height" => 350, "datatype" => UniteSettingsRev::DATATYPE_NUMBER, "description" => __('
- The <span class="prevxmpl">LAYERS GRID</span> is the container of layers within the <span class="prevxmpl">SLIDER</span> <br>
- The "Grid Size" setting does not relate to the actual "Slider Size". <br>
- "Max Height" of the slider equals the "Grid Height"<br>
- "Slider Width" can be greater than the set "Grid Width"', REVSLIDER_TEXTDOMAIN));
$sliderMainSettings->addCustom("slider_size", "slider_size", "", __("Layers Grid Size", REVSLIDER_TEXTDOMAIN), $paramsSize);
$paramsResponsitive = array("w1" => 940, "sw1" => 770, "w2" => 780, "sw2" => 500, "w3" => 510, "sw3" => 310, "datatype" => UniteSettingsRev::DATATYPE_NUMBER);
$sliderMainSettings->addCustom("responsitive_settings", "responsitive", "", __("Responsive Sizes", REVSLIDER_TEXTDOMAIN), $paramsResponsitive);
$sliderMainSettings->addHr();
self::storeSettings("slider_main", $sliderMainSettings);
//set "slider_params" settings.
$sliderParamsSettings = new UniteSettingsAdvancedRev();
$sliderParamsSettings->loadXMLFile(self::$path_settings . "/slider_settings.xml");
//update transition type setting.
$settingFirstType = $sliderParamsSettings->getSettingByName("first_transition_type");
$operations = new RevOperations();
$arrTransitions = $operations->getArrTransition();
if (count($arrTransitions) == 0) {
    $arrTransitions = $operations->getArrTransition(true);
}
//get premium transitions
$settingFirstType["items"] = $arrTransitions;
$sliderParamsSettings->updateArrSettingByName("first_transition_type", $settingFirstType);
//store params
self::storeSettings("slider_params", $sliderParamsSettings);
?>
				
Example #20
0
 /**
  * 
  * Enter description here ...
  */
 protected static function updatePlugin($viewBack = false)
 {
     $linkBack = self::getViewUrl($viewBack);
     $htmlLinkBack = UniteFunctionsRev::getHtmlLink($linkBack, "Go Back");
     //check if css table exist, if not, we need to verify that the current captions.css can be parsed
     if (UniteFunctionsWPRev::isDBTableExists(GlobalsRevSlider::TABLE_CSS_NAME)) {
         $captions = RevOperations::getCaptionsCssContentArray();
         if ($captions === false) {
             $message = "CSS parse error! Please make sure your captions.css is valid CSS before updating the plugin!";
             echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> {$message}</div><br>";
             echo $htmlLinkBack;
             exit;
         }
     }
     $zip = new UniteZipRev();
     try {
         if (function_exists("unzip_file") == false) {
             if (UniteZipRev::isZipExists() == false) {
                 UniteFunctionsRev::throwError("The ZipArchive php extension not exists, can't extract the update file. Please turn it on in php ini.");
             }
         }
         dmp("Update in progress...");
         $arrFiles = UniteFunctionsRev::getVal($_FILES, "update_file");
         if (empty($arrFiles)) {
             UniteFunctionsRev::throwError("Update file don't found.");
         }
         $filename = UniteFunctionsRev::getVal($arrFiles, "name");
         if (empty($filename)) {
             UniteFunctionsRev::throwError("Update filename not found.");
         }
         $fileType = UniteFunctionsRev::getVal($arrFiles, "type");
         /*				
         $fileType = strtolower($fileType);
         
         if($fileType != "application/zip")
         	UniteFunctionsRev::throwError("The file uploaded is not zip.");
         */
         $filepathTemp = UniteFunctionsRev::getVal($arrFiles, "tmp_name");
         if (file_exists($filepathTemp) == false) {
             UniteFunctionsRev::throwError("Can't find the uploaded file.");
         }
         //crate temp folder
         UniteFunctionsRev::checkCreateDir(self::$path_temp);
         //create the update folder
         $pathUpdate = self::$path_temp . "update_extract/";
         UniteFunctionsRev::checkCreateDir($pathUpdate);
         //remove all files in the update folder
         if (is_dir($pathUpdate)) {
             $arrNotDeleted = UniteFunctionsRev::deleteDir($pathUpdate, false);
             if (!empty($arrNotDeleted)) {
                 $strNotDeleted = print_r($arrNotDeleted, true);
                 UniteFunctionsRev::throwError("Could not delete those files from the update folder: {$strNotDeleted}");
             }
         }
         //copy the zip file.
         $filepathZip = $pathUpdate . $filename;
         $success = move_uploaded_file($filepathTemp, $filepathZip);
         if ($success == false) {
             UniteFunctionsRev::throwError("Can't move the uploaded file here: " . $filepathZip . ".");
         }
         if (function_exists("unzip_file") == true) {
             WP_Filesystem();
             $response = unzip_file($filepathZip, $pathUpdate);
         } else {
             $zip->extract($filepathZip, $pathUpdate);
         }
         //get extracted folder
         $arrFolders = UniteFunctionsRev::getFoldersList($pathUpdate);
         if (empty($arrFolders)) {
             UniteFunctionsRev::throwError("The update folder is not extracted");
         }
         if (count($arrFolders) > 1) {
             UniteFunctionsRev::throwError("Extracted folders are more then 1. Please check the update file.");
         }
         //get product folder
         $productFolder = $arrFolders[0];
         if (empty($productFolder)) {
             UniteFunctionsRev::throwError("Wrong product folder.");
         }
         if ($productFolder != self::$dir_plugin) {
             UniteFunctionsRev::throwError("The update folder don't match the product folder, please check the update file.");
         }
         $pathUpdateProduct = $pathUpdate . $productFolder . "/";
         //check some file in folder to validate it's the real one:
         $checkFilepath = $pathUpdateProduct . $productFolder . ".php";
         if (file_exists($checkFilepath) == false) {
             UniteFunctionsRev::throwError("Wrong update extracted folder. The file: " . $checkFilepath . " not found.");
         }
         //copy the plugin without the captions file.
         //$pathOriginalPlugin = $pathUpdate."copy/";
         $pathOriginalPlugin = self::$path_plugin;
         $arrBlackList = array();
         $arrBlackList[] = "rs-plugin/css/captions.css";
         $arrBlackList[] = "rs-plugin/css/dynamic-captions.css";
         $arrBlackList[] = "rs-plugin/css/static-captions.css";
         UniteFunctionsRev::copyDir($pathUpdateProduct, $pathOriginalPlugin, "", $arrBlackList);
         //delete the update
         UniteFunctionsRev::deleteDir($pathUpdate);
         dmp("Updated Successfully, redirecting...");
         echo "<script>location.href='{$linkBack}'</script>";
     } catch (Exception $e) {
         $message = $e->getMessage();
         $message .= " <br> Please update the plugin manually via the ftp";
         echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> {$message}</div><br>";
         echo $htmlLinkBack;
         exit;
     }
 }
 /**
  * 
  * init slide by post data
  */
 public function initByPostData($postData, RevSlide $slideTemplate, $sliderID)
 {
     $this->postData = $this->postData;
     $postID = $postData["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, "post_title");
     if ($this->params['enable_link'] == "true" && $this->params['link_type'] == "regular") {
         $link = get_permalink($postID);
         $this->params["link"] = str_replace("%link%", $link, $this->params["link"]);
         $this->params["link"] = str_replace('-', '_REVSLIDER_', $this->params["link"]);
         //process meta tags:
         $arrMatches = array();
         preg_match('/%meta:\\w+%/', $this->params["link"], $arrMatches);
         foreach ($arrMatches as $match) {
             $meta = str_replace("%meta:", "", $match);
             $meta = str_replace("%", "", $meta);
             $meta = str_replace('_REVSLIDER_', '-', $meta);
             $metaValue = get_post_meta($postID, $meta, true);
             $this->params["link"] = str_replace($match, $metaValue, $this->params["link"]);
         }
         $this->params["link"] = str_replace('_REVSLIDER_', '-', $this->params["link"]);
     }
     $status = $postData["post_status"];
     if ($status == "publish") {
         $this->params["state"] = "published";
     } else {
         $this->params["state"] = "unpublished";
     }
     //set image
     $thumbID = UniteFunctionsWPRev::getPostThumbID($postID);
     if (!empty($thumbID)) {
         $this->setImageByImageID($thumbID);
     }
     //replace placeholders in layers:
     $this->setLayersByPostData($postData, $sliderID);
 }
 /**
  * 
  * import contents of the css file
  */
 public static function importCaptionsCssContentArray()
 {
     $db = new UniteDBRev();
     $css = self::getCaptionsCssContentArray();
     $static = array();
     if (is_array($css) && $css !== false && count($css) > 0) {
         foreach ($css as $class => $styles) {
             //check if static style or dynamic style
             $class = trim($class);
             if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || strpos($class, ".tp-caption") === false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) {
                 //.tp-caption>.imageclass or .tp-caption.imageclass>img or .tp-caption.imageclass .img
                 $static[$class] = $styles;
                 continue;
             }
             //is a dynamic style
             if (strpos($class, ':hover') !== false) {
                 $class = trim(str_replace(':hover', '', $class));
                 $arrInsert = array();
                 $arrInsert["hover"] = json_encode($styles);
                 $arrInsert["settings"] = json_encode(array('hover' => 'true'));
             } else {
                 $arrInsert = array();
                 $arrInsert["params"] = json_encode($styles);
             }
             //check if class exists
             $result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
             if (!empty($result)) {
                 //update
                 $db->update(GlobalsRevSlider::$table_css, $arrInsert, array('handle' => $class));
             } else {
                 //insert
                 $arrInsert["handle"] = $class;
                 $db->insert(GlobalsRevSlider::$table_css, $arrInsert);
             }
         }
     }
     if (!empty($static)) {
         //save static into static-captions.css
         $css = UniteCssParserRev::parseStaticArrayToCss($static);
         $static_cur = RevOperations::getStaticCss();
         //get the open sans line!
         $css = $static_cur . "\n" . $css;
         self::updateStaticCss($css);
     }
 }
 /**
  * 
  * import slider from multipart form
  */
 public function importSliderFromPost($updateAnim = true, $updateStatic = true)
 {
     try {
         $sliderID = UniteFunctionsRev::getPostVariable("sliderid");
         $sliderExists = !empty($sliderID);
         if ($sliderExists) {
             $this->initByID($sliderID);
         }
         $filepath = $_FILES["import_file"]["tmp_name"];
         if (file_exists($filepath) == false) {
             UniteFunctionsRev::throwError("Import file not found!!!");
         }
         //check if zip file or fallback to old, if zip, check if all files exist
         $zip = new ZipArchive();
         $importZip = $zip->open($filepath, ZIPARCHIVE::CREATE);
         if ($importZip === true) {
             //true or integer. If integer, its not a correct zip file
             //check if files all exist in zip
             $slider_export = $zip->getStream('slider_export.txt');
             $custom_animations = $zip->getStream('custom_animations.txt');
             $dynamic_captions = $zip->getStream('dynamic-captions.css');
             $static_captions = $zip->getStream('static-captions.css');
             if (!$slider_export) {
                 UniteFunctionsRev::throwError("slider_export.txt does not exist!");
             }
             //if(!$custom_animations)  UniteFunctionsRev::throwError("custom_animations.txt does not exist!");
             //if(!$dynamic_captions) UniteFunctionsRev::throwError("dynamic-captions.css does not exist!");
             //if(!$static_captions)  UniteFunctionsRev::throwError("static-captions.css does not exist!");
             $content = '';
             $animations = '';
             $dynamic = '';
             $static = '';
             while (!feof($slider_export)) {
                 $content .= fread($slider_export, 1024);
             }
             if ($custom_animations) {
                 while (!feof($custom_animations)) {
                     $animations .= fread($custom_animations, 1024);
                 }
             }
             if ($dynamic_captions) {
                 while (!feof($dynamic_captions)) {
                     $dynamic .= fread($dynamic_captions, 1024);
                 }
             }
             if ($static_captions) {
                 while (!feof($static_captions)) {
                     $static .= fread($static_captions, 1024);
                 }
             }
             fclose($slider_export);
             if ($custom_animations) {
                 fclose($custom_animations);
             }
             if ($dynamic_captions) {
                 fclose($dynamic_captions);
             }
             if ($static_captions) {
                 fclose($static_captions);
             }
             //check for images!
         } else {
             //check if fallback
             //get content array
             $content = @file_get_contents($filepath);
         }
         if ($importZip === true) {
             //we have a zip
             $db = new UniteDBRev();
             //update/insert custom animations
             $animations = @unserialize($animations);
             if (!empty($animations)) {
                 foreach ($animations as $key => $animation) {
                     //$animation['id'], $animation['handle'], $animation['params']
                     $exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
                     if (!empty($exist)) {
                         //update the animation, get the ID
                         if ($updateAnim == "true") {
                             //overwrite animation if exists
                             $arrUpdate = array();
                             $arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                             $db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
                             $id = $exist['0']['id'];
                         } else {
                             //insert with new handle
                             $arrInsert = array();
                             $arrInsert["handle"] = 'copy_' . $animation['handle'];
                             $arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                             $id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
                         }
                     } else {
                         //insert the animation, get the ID
                         $arrInsert = array();
                         $arrInsert["handle"] = $animation['handle'];
                         $arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                         $id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
                     }
                     //and set the current customin-oldID and customout-oldID in slider params to new ID from $id
                     $content = str_replace(array('customin-' . $animation['id'], 'customout-' . $animation['id']), array('customin-' . $id, 'customout-' . $id), $content);
                 }
                 dmp(__("animations imported!", REVSLIDER_TEXTDOMAIN));
             } else {
                 dmp(__("no custom animations found, if slider uses custom animations, the provided export may be broken...", REVSLIDER_TEXTDOMAIN));
             }
             //overwrite/append static-captions.css
             if (!empty($static)) {
                 if ($updateStatic == "true") {
                     //overwrite file
                     RevOperations::updateStaticCss($static);
                 } else {
                     //append
                     $static_cur = RevOperations::getStaticCss();
                     $static = $static_cur . "\n" . $static;
                     RevOperations::updateStaticCss($static);
                 }
             }
             //overwrite/create dynamic-captions.css
             //parse css to classes
             $dynamicCss = UniteCssParserRev::parseCssToArray($dynamic);
             if (is_array($dynamicCss) && $dynamicCss !== false && count($dynamicCss) > 0) {
                 foreach ($dynamicCss as $class => $styles) {
                     //check if static style or dynamic style
                     $class = trim($class);
                     if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || strpos($class, ".tp-caption") === false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) {
                         //.tp-caption>.imageclass or .tp-caption.imageclass>img or .tp-caption.imageclass .img
                         continue;
                     }
                     //is a dynamic style
                     if (strpos($class, ':hover') !== false) {
                         $class = trim(str_replace(':hover', '', $class));
                         $arrInsert = array();
                         $arrInsert["hover"] = json_encode($styles);
                         $arrInsert["settings"] = json_encode(array('hover' => 'true'));
                     } else {
                         $arrInsert = array();
                         $arrInsert["params"] = json_encode($styles);
                     }
                     //check if class exists
                     $result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
                     if (!empty($result)) {
                         //update
                         $db->update(GlobalsRevSlider::$table_css, $arrInsert, array('handle' => $class));
                     } else {
                         //insert
                         $arrInsert["handle"] = $class;
                         $db->insert(GlobalsRevSlider::$table_css, $arrInsert);
                     }
                 }
                 dmp(__("dynamic styles imported!", REVSLIDER_TEXTDOMAIN));
             } else {
                 dmp(__("no dynamic styles found, if slider uses dynamic styles, the provided export may be broken...", REVSLIDER_TEXTDOMAIN));
             }
         }
         $content = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", $content);
         //clear errors in string
         $arrSlider = @unserialize($content);
         if (empty($arrSlider)) {
             UniteFunctionsRev::throwError("Wrong export slider file format!");
         }
         //update slider params
         $sliderParams = $arrSlider["params"];
         if ($sliderExists) {
             $sliderParams["title"] = $this->arrParams["title"];
             $sliderParams["alias"] = $this->arrParams["alias"];
             $sliderParams["shortcode"] = $this->arrParams["shortcode"];
         }
         if (isset($sliderParams["background_image"])) {
             $sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
         }
         $json_params = json_encode($sliderParams);
         //update slider or craete new
         if ($sliderExists) {
             $arrUpdate = array("params" => $json_params);
             $this->db->update(GlobalsRevSlider::$table_sliders, $arrUpdate, array("id" => $sliderID));
         } else {
             //new slider
             $arrInsert = array();
             $arrInsert["params"] = $json_params;
             $arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title", "Slider1");
             $arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias", "slider1");
             $sliderID = $this->db->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
         }
         //-------- Slides Handle -----------
         //delete current slides
         if ($sliderExists) {
             $this->deleteAllSlides();
         }
         //create all slides
         $arrSlides = $arrSlider["slides"];
         $alreadyImported = array();
         foreach ($arrSlides as $slide) {
             $params = $slide["params"];
             $layers = $slide["layers"];
             //convert params images:
             if (isset($params["image"])) {
                 //import if exists in zip folder
                 if (trim($params["image"]) !== '') {
                     if ($importZip === true) {
                         //we have a zip, check if exists
                         $image = $zip->getStream('images/' . $params["image"]);
                         if (!$image) {
                             echo $params["image"] . ' not found!<br>';
                         } else {
                             if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
                                 $importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
                                 if ($importImage !== false) {
                                     $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
                                     $params["image"] = $importImage['path'];
                                 }
                             } else {
                                 $params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
                             }
                         }
                     }
                 }
                 $params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
             }
             //convert layers images:
             foreach ($layers as $key => $layer) {
                 if (isset($layer["image_url"])) {
                     //import if exists in zip folder
                     if (trim($layer["image_url"]) !== '') {
                         if ($importZip === true) {
                             //we have a zip, check if exists
                             $image_url = $zip->getStream('images/' . $layer["image_url"]);
                             if (!$image_url) {
                                 echo $layer["image_url"] . ' not found!<br>';
                             } else {
                                 if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
                                     $importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
                                     if ($importImage !== false) {
                                         $alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
                                         $layer["image_url"] = $importImage['path'];
                                     }
                                 } else {
                                     $layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $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);
             $this->db->insert(GlobalsRevSlider::$table_slides, $arrCreate);
         }
     } catch (Exception $e) {
         $errorMessage = $e->getMessage();
         return array("success" => false, "error" => $errorMessage, "sliderID" => $sliderID);
     }
     //update dynamic-captions.css
     RevOperations::updateDynamicCaptions();
     return array("success" => true, "sliderID" => $sliderID);
 }
 public function putSliderBase($sliderID)
 {
     try {
         self::$sliderSerial++;
         $this->slider = new RevSlider();
         $this->slider->initByMixed($sliderID);
         $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();
         }
         //edit html before slider
         $htmlBeforeSlider = "";
         // add fonts
         $_usedStyles = array();
         $_slides = $this->slider->getSlides();
         foreach ($_slides as $_slide) {
             $_layers = $_slide->getLayers();
             foreach ($_layers as $_layer) {
                 $_style = isset($_layer['style']) ? $_layer['style'] : '';
                 if ($_style && !in_array($_style, $_usedStyles)) {
                     $_usedStyles[] = $_style;
                 }
             }
         }
         $htmlBeforeSlider .= Mage::helper('nwdrevslider')->inlcudeStyleFonts($_usedStyles);
         //pub js to body handle
         if ($this->slider->getParam("js_to_body", "false") == "true") {
             $operations = new RevOperations();
             $arrValues = $operations->getGeneralSettingsValues();
             $enable_logs = UniteFunctionsRev::getVal($arrValues, "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>";
             }
             $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.tools.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
             $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
             $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.revolution.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
             $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
         }
         //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;";
                     break;
                 case "right":
                     $containerStyle .= "float:right;";
                     break;
             }
         }
         //add background color
         $backgrondColor = trim($this->slider->getParam("background_color"));
         if (!empty($backgrondColor)) {
             $containerStyle .= "background-color:{$backgrondColor};";
         }
         //set padding
         $containerStyle .= "padding:" . $this->slider->getParam("padding", "0") . "px;";
         //set margin:
         if ($sliderType != "fullscreen") {
             if ($sliderPosition != "center") {
                 $containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;";
                 $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;";
             }
             $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;";
             $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;";
         }
         //set height and width:
         $bannerStyle = "display:none;";
         //add background image (to banner style)
         $showBackgroundImage = $this->slider->getParam("show_background_image", "false");
         if ($showBackgroundImage == "true") {
             $backgroundImage = $this->slider->getParam("background_image");
             $backgroundFit = $this->slider->getParam("bg_fit", "cover");
             $backgroundRepeat = $this->slider->getParam("bg_repeat", "no-repeat");
             $backgroundPosition = $this->slider->getParam("bg_position", "center top");
             if (!empty($backgroundImage)) {
                 $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:" . $backgroundRepeat . ";background-fit:" . $backgroundFit . ";background-position:" . $backgroundPosition . ";";
             }
         }
         //set wrapper and slider class:
         $sliderWrapperClass = "rev_slider_wrapper";
         $sliderClass = "rev_slider";
         $putResponsiveStyles = false;
         switch ($sliderType) {
             case "responsitive":
                 //$containerStyle .= "height:".$bannerHeight."px;";
                 $putResponsiveStyles = true;
                 break;
             case "fullwidth":
                 $sliderWrapperClass .= " fullwidthbanner-container";
                 $sliderClass .= " fullwidthabanner";
                 $bannerStyle .= "max-height:" . $bannerHeight . "px;height:" . $bannerHeight . "px;";
                 $containerStyle .= "max-height:" . $bannerHeight . "px;";
                 break;
             case "fullscreen":
                 //$containerStyle .= "height:".$bannerHeight."px;";
                 $sliderWrapperClass .= " fullscreen-container";
                 $sliderClass .= " fullscreenbanner";
                 break;
             case "fixed":
             default:
                 $bannerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 $containerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 break;
         }
         $htmlTimerBar = "";
         $timerBar = $this->slider->getParam("show_timerbar", "top");
         if ($timerBar == "true") {
             $timerBar = $this->slider->getParam("timebar_position", "top");
         }
         switch ($timerBar) {
             case "top":
                 $htmlTimerBar = '<div class="tp-bannertimer"></div>';
                 break;
             case "bottom":
                 $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>';
                 break;
             case "hide":
                 $htmlTimerBar = '<div class="tp-bannertimer tp-bottom" style="visibility: hidden !important;"></div>';
                 break;
         }
         //check inner / outer border
         $paddingType = $this->slider->getParam("padding_type", "outter");
         if ($paddingType == "inner") {
             $sliderWrapperClass .= " tp_inner_padding";
         }
         global $revSliderVersion;
         if ($putResponsiveStyles == true) {
             $this->putResponsitiveStyles();
         }
         echo $htmlBeforeSlider . "\n";
         echo "<div id=\"";
         echo $this->sliderHtmlID_wrapper;
         echo "\" ";
         echo "class=\"" . $sliderWrapperClass . "\"";
         $show_alternate = $this->slider->getParam("show_alternative_type", "off");
         if ($show_alternate !== 'off') {
             $show_alternate_image = $this->slider->getParam("show_alternate_image", "");
             echo ' data-aimg="' . $show_alternate_image . '" ';
             if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') {
                 echo ' data-amobile="enabled" ';
             } else {
                 echo ' data-amobile="disabled" ';
             }
             if ($show_alternate == 'mobile-ie8' || $show_alternate == 'ie8') {
                 echo ' data-aie8="enabled" ';
             } else {
                 echo ' data-aie8="disabled" ';
             }
         }
         echo " style=\"" . $containerStyle . "\">\n";
         echo "<!-- START REVOLUTION SLIDER " . $revSliderVersion . " " . $sliderType . " mode -->\n";
         echo "\t<div id=\"";
         echo $this->sliderHtmlID;
         echo "\" ";
         echo "class=\"" . $sliderClass . "\"";
         echo " style=\"" . $bannerStyle . "\">\n";
         echo $this->putSlides($doWrapFromTemplate);
         echo $htmlTimerBar;
         echo "\t</div>\n";
         $this->putJS();
         echo "</div>";
         echo "<!-- END REVOLUTION SLIDER -->";
     } catch (Exception $e) {
         $message = $e->getMessage();
         $this->putErrorMessage($message);
     }
 }
Example #25
0
<?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();
 public function putSliderBase($sliderID)
 {
     try {
         self::$sliderSerial++;
         $this->slider = new RevSlider();
         $this->slider->initByMixed($sliderID);
         $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->slider->getParam("js_to_body", "false") == "true") {
             $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.plugins.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
             $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
             $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.revolution.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
             $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
         }
         //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;";
                     break;
                 case "right":
                     $containerStyle .= "float:right;";
                     break;
             }
         }
         //add background color
         $backgrondColor = trim($this->slider->getParam("background_color"));
         if (!empty($backgrondColor)) {
             $containerStyle .= "background-color:{$backgrondColor};";
         }
         //set padding
         $containerStyle .= "padding:" . $this->slider->getParam("padding", "0") . "px;";
         //set margin:
         if ($sliderType != "fullscreen") {
             if ($sliderPosition != "center") {
                 $containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;";
                 $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;";
             }
             $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;";
             $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;";
         }
         //set height and width:
         $bannerStyle = "display:none;";
         //add background image (to banner style)
         $showBackgroundImage = $this->slider->getParam("show_background_image", "false");
         if ($showBackgroundImage == "true") {
             $backgroundImage = $this->slider->getParam("background_image");
             $backgroundFit = $this->slider->getParam("bg_fit", "cover");
             $backgroundRepeat = $this->slider->getParam("bg_repeat", "no-repeat");
             $backgroundPosition = $this->slider->getParam("bg_position", "center top");
             if (!empty($backgroundImage)) {
                 $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:" . $backgroundRepeat . ";background-fit:" . $backgroundFit . ";background-position:" . $backgroundPosition . ";";
             }
         }
         //set wrapper and slider class:
         $sliderWrapperClass = "rev_slider_wrapper";
         $sliderClass = "rev_slider";
         $putResponsiveStyles = false;
         switch ($sliderType) {
             default:
             case "fixed":
                 $bannerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 $containerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 break;
             case "responsitive":
                 //$containerStyle .= "height:".$bannerHeight."px;";
                 $putResponsiveStyles = true;
                 break;
             case "fullwidth":
                 $sliderWrapperClass .= " fullwidthbanner-container";
                 $sliderClass .= " fullwidthabanner";
                 $bannerStyle .= "max-height:" . $bannerHeight . "px;height:" . $bannerHeight . ";";
                 $containerStyle .= "max-height:" . $bannerHeight . "px;";
                 break;
             case "fullscreen":
                 //$containerStyle .= "height:".$bannerHeight."px;";
                 $sliderWrapperClass .= " fullscreen-container";
                 $sliderClass .= " fullscreenbanner";
                 break;
         }
         $htmlTimerBar = "";
         $timerBar = $this->slider->getParam("show_timerbar", "top");
         if ($timerBar == "true") {
             $timerBar = $this->slider->getParam("timebar_position", "top");
         }
         switch ($timerBar) {
             case "top":
                 $htmlTimerBar = '<div class="tp-bannertimer"></div>';
                 break;
             case "bottom":
                 $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>';
                 break;
         }
         //check inner / outer border
         $paddingType = $this->slider->getParam("padding_type", "outter");
         if ($paddingType == "inner") {
             $sliderWrapperClass .= " tp_inner_padding";
         }
         global $revSliderVersion;
         echo "<!-- START REVOLUTION SLIDER " . $revSliderVersion . " " . $sliderType . " mode -->\n";
         if ($putResponsiveStyles == true) {
             $this->putResponsitiveStyles();
         }
         echo $htmlBeforeSlider . "\n";
         echo "<div id=\"";
         echo $this->sliderHtmlID_wrapper;
         echo "\" ";
         echo "class=\"" . $sliderWrapperClass . "\"";
         echo " style=\"" . $containerStyle . "\">\n";
         echo "\t<div id=\"";
         echo $this->sliderHtmlID;
         echo "\" ";
         echo "class=\"" . $sliderClass . "\"";
         echo " style=\"" . $bannerStyle . "\">\n";
         echo $this->putSlides($doWrapFromTemplate);
         echo $htmlTimerBar;
         echo "\t</div>\n";
         echo "</div>";
         $this->putJS();
         echo "<!-- END REVOLUTION SLIDER -->";
     } catch (Exception $e) {
         $message = $e->getMessage();
         $this->putErrorMessage($message);
     }
 }
 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) {
             //start font
             case 'add_google_fonts':
                 $f = new ThemePunch_Fonts();
                 $result = $f->add_new_font($data);
                 if ($result === true) {
                     self::ajaxResponseSuccessRedirect(__("Font successfully created!", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders"));
                 } 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;
                 //end font
             //end font
             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);
                 //var_dump($settingsMain);
                 $newSliderID = $slider->createSliderFromOptions($data, $settingsMain, $settingsParams);
                 if ($newSliderID > 0) {
                     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);
                 sdsconfig::getgeneratecssfile();
                 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));
                 break;
             case "add_slide":
                 $numSlides = $slider->createSlideFromData($data);
                 $sliderID = $data["sliderid"];
                 if ($numSlides == 1) {
                     $responseText = __("Slide Created", REVSLIDER_TEXTDOMAIN);
                 } else {
                     $responseText = $numSlides . " " . __("Slides Created", REVSLIDER_TEXTDOMAIN);
                 }
                 $urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}");
                 sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
                 break;
             case "add_slide_fromslideview":
                 $slideID = $slider->createSlideFromData($data, true);
                 $urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
                 $responseText = __("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN);
                 sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
                 break;
             case "update_slide":
                 require self::getSettingsFilePath("slide_settings");
                 $slide->updateSlideFromData($data, $slideSettings);
                 sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccess(__("Slide updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_static_slide":
                 $slide->updateStaticSlideFromData($data);
                 sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccess(__("Static Layers updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "delete_slide":
                 $isPost = $slide->deleteSlideFromData($data);
                 if ($isPost) {
                     $message = __("Post Deleted Successfully", REVSLIDER_TEXTDOMAIN);
                 } else {
                     $message = __("Slide Deleted Successfully", REVSLIDER_TEXTDOMAIN);
                 }
                 $sliderID = UniteFunctionsRev::getVal($data, "sliderID");
                 self::ajaxResponseSuccessRedirect($message, self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "duplicate_slide":
                 $sliderID = $slider->duplicateSlideFromData($data);
                 self::ajaxResponseSuccessRedirect(__("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "copy_move_slide":
                 $sliderID = $slider->copyMoveSlideFromData($data);
                 self::ajaxResponseSuccessRedirect(__("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "get_static_css":
                 sdsconfig::getgeneratecssfile();
                 $contentCSS = $operations->getStaticCss();
                 self::ajaxResponseData($contentCSS);
                 break;
             case "get_dynamic_css":
                 sdsconfig::getgeneratecssfile();
                 $contentCSS = $operations->getDynamicCss();
                 self::ajaxResponseData($contentCSS);
                 break;
             case "insert_captions_css":
                 $arrCaptions = $operations->insertCaptionsContentData($data);
                 sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "update_captions_css":
                 $arrCaptions = $operations->updateCaptionsContentData($data);
                 sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "delete_captions_css":
                 $arrCaptions = $operations->deleteCaptionsContentData($data);
                 sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccess(__("Style deleted succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "update_static_css":
                 $staticCss = $operations->updateStaticCss($data);
                 sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("css" => $staticCss));
                 break;
             case "insert_custom_anim":
                 $arrAnims = $operations->insertCustomAnim($data);
                 //$arrCaptions =
                 self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_custom_anim":
                 $arrAnims = $operations->updateCustomAnim($data);
                 self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "delete_custom_anim":
                 $arrAnims = $operations->deleteCustomAnim($data);
                 self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_slides_order":
                 $slider->updateSlidesOrderFromData($data);
                 self::ajaxResponseSuccess(__("Order updated successfully", REVSLIDER_TEXTDOMAIN));
                 break;
             case "change_slide_image":
                 $slide->updateSlideImageFromData($data);
                 $sliderID = UniteFunctionsRev::getVal($data, "slider_id");
                 self::ajaxResponseSuccessRedirect(__("Slide Changed Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "preview_slide":
                 $operations->putSlidePreviewByData($data);
                 break;
                 // case "preview_slider":
                 // 	$sliderID = UniteFunctionsRev::getPostGetVariable("sliderid");
                 // 	$operations->previewOutput($sliderID);
                 // break;
             // case "preview_slider":
             // 	$sliderID = UniteFunctionsRev::getPostGetVariable("sliderid");
             // 	$operations->previewOutput($sliderID);
             // break;
             case "preview_slider":
                 $sliderID = UniteFunctionsRev::getPostGetVariable("sliderid");
                 $do_markup = UniteFunctionsRev::getPostGetVariable("only_markup");
                 if ($do_markup == 'true') {
                     $operations->previewOutputMarkup($sliderID);
                 } else {
                     $operations->previewOutput($sliderID);
                 }
                 break;
             case "toggle_slide_state":
                 $currentState = $slide->toggleSlideStatFromData($data);
                 self::ajaxResponseData(array("state" => $currentState));
                 break;
             case "slide_lang_operation":
                 $responseData = $slide->doSlideLangOperation($data);
                 self::ajaxResponseData($responseData);
                 break;
             case "update_plugin":
                 self::updatePlugin(self::DEFAULT_VIEW);
                 break;
             case "update_text":
                 self::updateSettingsText();
                 sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccess(__("All files successfully updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_general_settings":
                 $new_data = array();
                 // print_r($data);
                 foreach ($data as $key => $value) {
                     $new_data[$key] = $value;
                 }
                 $operations->updateGeneralSettings($new_data);
                 // sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccess(__("General settings updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_posts_sortby":
                 $slider->updatePostsSortbyFromData($data);
                 self::ajaxResponseSuccess(__("Sortby updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "replace_image_urls":
                 $slider->replaceImageUrlsFromData($data);
                 self::ajaxResponseSuccess(__("Image urls replaced", REVSLIDER_TEXTDOMAIN));
                 break;
             case "reset_slide_settings":
                 $slider->resetSlideSettings($data);
                 sdsconfig::getgeneratecssfile();
                 self::ajaxResponseSuccess(__("Settings in all Slides changed", REVSLIDER_TEXTDOMAIN));
                 break;
             case 'delete_uploaded_image':
                 self::delete_uploaded_file($data);
                 break;
             case 'get_uploaded_images':
                 self::get_uploaded_files_json();
                 break;
             case 'add_slider_pos_val':
                 $newdata = array();
                 if (!empty($data)) {
                     $k = array_keys($data);
                     $k = preg_replace_callback('/\\[[0-9]+/', create_function('$match', 'return "";'), $k[0]);
                     foreach ($data as $key => $arr) {
                         $newdata[$k][] = $arr;
                     }
                     $data = $newdata;
                 }
                 sdsconfig::editSetting('revslideropencart', $data);
                 self::ajaxResponseSuccess(__("Slider Position Save SuccessFully", REVSLIDER_TEXTDOMAIN));
                 break;
             default:
                 self::ajaxResponseError("wrong ajax action: {$action} ");
                 break;
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         if ($action == "preview_slide" || $action == "preview_slider") {
             echo $message;
             exit;
         }
         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;
 }
    /**
     * 
     * 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;
            ?>
							</div>
							
							<script type="text/javascript">
								var g_previewPattern = '<?php 
            echo $urlPreviewPattern;
            ?>
';
								jQuery("#select_langs").change(function(){
									var lang = this.value;
									var nonce = "<?php 
            echo $nonce;
            ?>
";
									var pattern = g_previewPattern;
									var urlPreview = pattern.replace("[lang]",lang).replace("[nonce]",nonce);
									location.href = urlPreview;
								});
							</script>
						<?php 
        }
        ?>
						
						<?php 
        $output->putSliderBase($sliderID);
        ?>
					</body>
				</html>
			<?php 
        exit;
    }
    public function previewOutputMarkup($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 = "http://yourpluginpath/";
        $urlPreviewPattern = UniteBaseClassRev::$url_ajax_actions . "&client_action=preview_slider&only_markup=true&sliderid=" . $sliderID . "&lang=[lang]&nonce=[nonce]";
        $nonce = wp_create_nonce("revslider_actions");
        $setBase = is_ssl() ? "https://" : "http://";
        $f = new ThemePunch_Fonts();
        $my_fonts = $f->get_all_fonts();
        ?>
			<html>
			<head>
				<script type='text/javascript' src='<?php 
        echo $setBase;
        ?>
ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.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", REVSLIDER_TEXTDOMAIN);
            ?>
: <?php 
            echo $selectLangChoose;
            ?>
					</div>

					<script type="text/javascript">
						var g_previewPattern = '<?php 
            echo $urlPreviewPattern;
            ?>
';
						jQuery("#select_langs").change(function(){
							var lang = this.value;
							var nonce = "<?php 
            echo $nonce;
            ?>
";
							var pattern = g_previewPattern;
							var urlPreview = pattern.replace("[lang]",lang).replace("[nonce]",nonce);
							location.href = urlPreview;
						});

						jQuery('body').on('click', '#rev_replace_images', function(){
							var from = jQuery('input[name="orig_image_path"]').val();
							var to = jQuery('input[name="replace_image_path"]').val();

							jQuery('#rev_script_content').val(jQuery('#rev_script_content').val().replace(from, to));
							jQuery('#rev_the_content').val(jQuery('#rev_the_content').val().replace(from, to));
							jQuery('#rev_style_content').val(jQuery('#rev_style_content').val().replace(from, to));
							jQuery('#rev_head_content').val(jQuery('#rev_head_content').val().replace(from, to));
						});

					</script>
				<?php 
        }
        ?>
			<?php 
        //UniteBaseClassRev::$url_plugin
        ob_start();
        ?>
<link rel='stylesheet' href='<?php 
        echo $urlPlugin;
        ?>
css/settings.css?rev=<?php 
        echo GlobalsRevSlider::SLIDER_REVISION;
        ?>
' type='text/css' media='all' />
<?php 
        $http = is_ssl() ? 'https' : 'http';
        if (!empty($my_fonts)) {
            foreach ($my_fonts as $c_font) {
                ?>
<link rel='stylesheet' href="<?php 
                echo $http . '://fonts.googleapis.com/css?family=' . strip_tags($c_font['url']);
                ?>
" type='text/css' /><?php 
                echo "\n";
            }
        }
        ?>
<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 
        $head_content = ob_get_contents();
        ob_clean();
        ob_end_clean();
        ob_start();
        $custom_css = RevOperations::getStaticCss();
        echo $custom_css . "\n\n";
        echo '/*****************' . "\n";
        echo ' ** ' . __('CAPTIONS CSS', REVSLIDER_TEXTDOMAIN) . "\n";
        echo ' ****************/' . "\n\n";
        $db = new UniteDBRev();
        $styles = $db->fetch(GlobalsRevSlider::$table_css);
        echo UniteCssParserRev::parseDbArrayToCss($styles, "\n");
        $style_content = ob_get_contents();
        ob_clean();
        ob_end_clean();
        ob_start();
        $output->putSliderBase($sliderID);
        $content = ob_get_contents();
        ob_clean();
        ob_end_clean();
        $script_content = substr($content, strpos($content, '<script type="text/javascript">'), strpos($content, '</script>') + 9 - strpos($content, '<script type="text/javascript">'));
        $content = htmlentities(str_replace($script_content, '', $content));
        $script_content = str_replace('				', '', $script_content);
        $script_content = str_replace(array('<script type="text/javascript">', '</script>'), '', $script_content);
        ?>
			<style>
				body 	 { font-family:sans-serif; font-size:12px;}
				textarea { background:#f1f1f1; border:#ddd; font-size:10px; line-height:16px; margin-bottom:40px; padding:10px;}
				.rev_cont_title { color:#000; text-decoration:none;font-size:14px; line-height:24px; font-weight:800;background: #D5D5D5;padding: 10px;}
				.rev_cont_title a,
				.rev_cont_title a:visited { margin-left:25px;font-size:12px;line-height:12px;float:right;background-color:#8e44ad; color:#fff; padding:8px 10px;text-decoration:none;}
				.rev_cont_title a:hover	  { background-color:#9b59b6}
			</style>
			<p><?php 
        $dir = wp_upload_dir();
        ?>
				<?php 
        _e('Replace image path:', REVSLIDER_TEXTDOMAIN);
        ?>
 <?php 
        _e('From:', REVSLIDER_TEXTDOMAIN);
        ?>
 <input type="text" name="orig_image_path" value="<?php 
        echo @$dir['baseurl'];
        ?>
" /> <?php 
        _e('To:', REVSLIDER_TEXTDOMAIN);
        ?>
 <input type="text" name="replace_image_path" value="" /> <input id="rev_replace_images" type="button" name="replace_images" value="<?php 
        _e('Replace', REVSLIDER_TEXTDOMAIN);
        ?>
" />
			</p>

			<div class="rev_cont_title"><?php 
        _e('Header', REVSLIDER_TEXTDOMAIN);
        ?>
 <a class="button-primary revpurple export_slider_standalone copytoclip" data-idt="rev_head_content"  href="javascript:void(0);" original-title=""><?php 
        _e('Mark to Copy', REVSLIDER_TEXTDOMAIN);
        ?>
</a><div style="clear:both"></div></div>
			<textarea id="rev_head_content" readonly="true" style="width: 100%; height: 100px; color:#3498db"><?php 
        echo $head_content;
        ?>
</textarea>
			<div class="rev_cont_title"><?php 
        _e('CSS', REVSLIDER_TEXTDOMAIN);
        ?>
<a class="button-primary revpurple export_slider_standalone copytoclip" data-idt="rev_style_content"  href="javascript:void(0);" original-title=""><?php 
        _e('Mark to Copy', REVSLIDER_TEXTDOMAIN);
        ?>
</a></div>
			<textarea id="rev_style_content" readonly="true" style="width: 100%; height: 100px;"><?php 
        echo $style_content;
        ?>
</textarea>
			<div class="rev_cont_title"><?php 
        _e('Body', REVSLIDER_TEXTDOMAIN);
        ?>
<a class="button-primary revpurple export_slider_standalone copytoclip" data-idt="rev_the_content"  href="javascript:void(0);" original-title=""><?php 
        _e('Mark to Copy', REVSLIDER_TEXTDOMAIN);
        ?>
</a></div>
			<textarea id="rev_the_content" readonly="true" style="width: 100%; height: 100px;"><?php 
        echo $content;
        ?>
</textarea>
			<div class="rev_cont_title"><?php 
        _e('Script', REVSLIDER_TEXTDOMAIN);
        ?>
<a class="button-primary revpurple export_slider_standalone copytoclip" data-idt="rev_script_content"  href="javascript:void(0);" original-title=""><?php 
        _e('Mark to Copy', REVSLIDER_TEXTDOMAIN);
        ?>
</a></div>
			<textarea id="rev_script_content" readonly="true" style="width: 100%; height: 100px;"><?php 
        echo $script_content;
        ?>
</textarea>

			<script>
				jQuery('body').on('click','.copytoclip',function() {
					jQuery("#"+jQuery(this).data('idt')).select();
				});
			</script>
			</body>
			</html>
			<?php 
        exit;
    }
Example #30
0
 /**
  * 
  * 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));
                 break;
             case "add_slide":
                 $numSlides = $slider->createSlideFromData($data);
                 $sliderID = $data["sliderid"];
                 if ($numSlides == 1) {
                     $responseText = __("Slide Created", REVSLIDER_TEXTDOMAIN);
                 } else {
                     $responseText = $numSlides . " " . __("Slides Created", REVSLIDER_TEXTDOMAIN);
                 }
                 $urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}");
                 self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
                 break;
             case "add_slide_fromslideview":
                 $slideID = $slider->createSlideFromData($data, true);
                 $urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
                 $responseText = __("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN);
                 self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
                 break;
             case "update_slide":
                 require self::getSettingsFilePath("slide_settings");
                 $slide->updateSlideFromData($data, $slideSettings);
                 self::ajaxResponseSuccess(__("Slide updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_static_slide":
                 $slide->updateStaticSlideFromData($data);
                 self::ajaxResponseSuccess(__("Static Layers updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "delete_slide":
                 $isPost = $slide->deleteSlideFromData($data);
                 if ($isPost) {
                     $message = __("Post Deleted Successfully", REVSLIDER_TEXTDOMAIN);
                 } else {
                     $message = __("Slide Deleted Successfully", REVSLIDER_TEXTDOMAIN);
                 }
                 $sliderID = UniteFunctionsRev::getVal($data, "sliderID");
                 self::ajaxResponseSuccessRedirect($message, self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "duplicate_slide":
                 $sliderID = $slider->duplicateSlideFromData($data);
                 self::ajaxResponseSuccessRedirect(__("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "copy_move_slide":
                 $sliderID = $slider->copyMoveSlideFromData($data);
                 self::ajaxResponseSuccessRedirect(__("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "get_static_css":
                 $contentCSS = $operations->getStaticCss();
                 self::ajaxResponseData($contentCSS);
                 break;
             case "get_dynamic_css":
                 $contentCSS = $operations->getDynamicCss();
                 self::ajaxResponseData($contentCSS);
                 break;
             case "insert_captions_css":
                 $arrCaptions = $operations->insertCaptionsContentData($data);
                 self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "update_captions_css":
                 $arrCaptions = $operations->updateCaptionsContentData($data);
                 self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "delete_captions_css":
                 $arrCaptions = $operations->deleteCaptionsContentData($data);
                 self::ajaxResponseSuccess(__("Style deleted succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "update_static_css":
                 $staticCss = $operations->updateStaticCss($data);
                 self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("css" => $staticCss));
                 break;
             case "insert_custom_anim":
                 $arrAnims = $operations->insertCustomAnim($data);
                 //$arrCaptions =
                 self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_custom_anim":
                 $arrAnims = $operations->updateCustomAnim($data);
                 self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "delete_custom_anim":
                 $arrAnims = $operations->deleteCustomAnim($data);
                 self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_slides_order":
                 $slider->updateSlidesOrderFromData($data);
                 self::ajaxResponseSuccess(__("Order updated successfully", REVSLIDER_TEXTDOMAIN));
                 break;
             case "change_slide_image":
                 $slide->updateSlideImageFromData($data);
                 $sliderID = UniteFunctionsRev::getVal($data, "slider_id");
                 self::ajaxResponseSuccessRedirect(__("Slide Changed Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "preview_slide":
                 $operations->putSlidePreviewByData($data);
                 break;
             case "preview_slider":
                 $sliderID = UniteFunctionsRev::getPostGetVariable("sliderid");
                 $do_markup = UniteFunctionsRev::getPostGetVariable("only_markup");
                 if ($do_markup == 'true') {
                     $operations->previewOutputMarkup($sliderID);
                 } else {
                     $operations->previewOutput($sliderID);
                 }
                 break;
             case "toggle_slide_state":
                 $currentState = $slide->toggleSlideStatFromData($data);
                 self::ajaxResponseData(array("state" => $currentState));
                 break;
             case "slide_lang_operation":
                 $responseData = $slide->doSlideLangOperation($data);
                 self::ajaxResponseData($responseData);
                 break;
             case "update_plugin":
                 self::updatePlugin(self::DEFAULT_VIEW);
                 break;
             case "update_text":
                 self::updateSettingsText();
                 self::ajaxResponseSuccess(__("All files successfully updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_general_settings":
                 $operations->updateGeneralSettings($data);
                 self::ajaxResponseSuccess(__("General settings updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_posts_sortby":
                 $slider->updatePostsSortbyFromData($data);
                 self::ajaxResponseSuccess(__("Sortby updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "replace_image_urls":
                 $slider->replaceImageUrlsFromData($data);
                 self::ajaxResponseSuccess(__("Image urls replaced", REVSLIDER_TEXTDOMAIN));
                 break;
             case "reset_slide_settings":
                 $slider->resetSlideSettings($data);
                 self::ajaxResponseSuccess(__("Settings in all Slides changed", REVSLIDER_TEXTDOMAIN));
                 break;
             case "activate_purchase_code":
                 $result = false;
                 if (!empty($data['username']) && !empty($data['api_key']) && !empty($data['code'])) {
                     $result = $operations->checkPurchaseVerification($data);
                 } else {
                     UniteFunctionsRev::throwError(__('The API key, the Purchase Code and the Username need to be set!', REVSLIDER_TEXTDOMAIN));
                     exit;
                 }
                 if ($result) {
                     self::ajaxResponseSuccessRedirect(__("Purchase Code Successfully Activated", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
                 } else {
                     UniteFunctionsRev::throwError(__('Purchase Code is invalid', REVSLIDER_TEXTDOMAIN));
                 }
                 break;
             case "deactivate_purchase_code":
                 $result = $operations->doPurchaseDeactivation($data);
                 if ($result) {
                     self::ajaxResponseSuccessRedirect(__("Successfully removed validation", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
                 } else {
                     UniteFunctionsRev::throwError(__('Could not remove Validation!', REVSLIDER_TEXTDOMAIN));
                 }
                 break;
             case "dismiss_notice":
                 update_option('revslider-valid-notice', 'false');
                 self::ajaxResponseSuccess(__(".", REVSLIDER_TEXTDOMAIN));
                 break;
             default:
                 self::ajaxResponseError("wrong ajax action: {$action} ");
                 break;
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         if ($action == "preview_slide" || $action == "preview_slider") {
             echo $message;
             exit;
         }
         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;
 }