Esempio n. 1
0
<?php

/**
 * @package   Revolution Slider
 * @author    ThemePunch <*****@*****.**>
 * @link      http://www.revolution.themepunch.com/
 * @copyright 2015 ThemePunch
 */
if (!defined('ABSPATH')) {
    exit;
}
$nav = new RevSliderNavigation();
$navigation = intval(RevSliderBase::getGetVar('navigation', 0));
$navigs = $nav->get_all_navigations();
$rsopr = new RevSliderOperations();
$font_families = $rsopr->getArrFontFamilys();
?>
<div class='wrap'>
	<div class="clear_both"></div>

	<div class="title_line nobgnopd" style="margin-bottom: 20px !important;">
		<div class="icon32" id="icon-options-general"></div>
		<div class="view_title">
			<?php 
_e('Navigation Editor', REVSLIDER_TEXTDOMAIN);
?>
		</div>
	</div>
	
	<div class="setting_box navig" style="margin-bottom: 20px;">
		<h3><span class="setting-step-number">1</span><span style="max-width: 400px;"><?php 
Esempio n. 2
0
 /**
  *
  * onAjax action handler
  */
 public static function onAjaxAction()
 {
     $slider = new RevSlider();
     $slide = new RevSlide();
     $operations = new RevSliderOperations();
     $action = self::getPostGetVar("client_action");
     $data = self::getPostGetVar("data");
     $nonce = self::getPostGetVar("nonce");
     if (empty($nonce)) {
         $nonce = self::getPostGetVar("rs-nonce");
     }
     try {
         //verify the nonce
         $isVerified = wp_verify_nonce($nonce, "revslider_actions");
         if ($isVerified == false) {
             RevSliderFunctions::throwError("Wrong request");
         }
         switch ($action) {
             case 'add_new_preset':
                 if (!isset($data['settings']) || !isset($data['values'])) {
                     self::ajaxResponseError(__('Missing values to add preset', 'revslider'), false);
                 }
                 $result = $operations->add_preset_setting($data);
                 if ($result === true) {
                     $presets = $operations->get_preset_settings();
                     self::ajaxResponseSuccess(__('Preset created', 'revslider'), array('data' => $presets));
                 } else {
                     self::ajaxResponseError($result, false);
                 }
                 exit;
                 break;
             case 'update_preset':
                 if (!isset($data['name']) || !isset($data['values'])) {
                     self::ajaxResponseError(__('Missing values to update preset', 'revslider'), false);
                 }
                 $result = $operations->update_preset_setting($data);
                 if ($result === true) {
                     $presets = $operations->get_preset_settings();
                     self::ajaxResponseSuccess(__('Preset created', 'revslider'), array('data' => $presets));
                 } else {
                     self::ajaxResponseError($result, false);
                 }
                 exit;
                 break;
             case 'remove_preset':
                 if (!isset($data['name'])) {
                     self::ajaxResponseError(__('Missing values to remove preset', 'revslider'), false);
                 }
                 $result = $operations->remove_preset_setting($data);
                 if ($result === true) {
                     $presets = $operations->get_preset_settings();
                     self::ajaxResponseSuccess(__('Preset deleted', 'revslider'), array('data' => $presets));
                 } else {
                     self::ajaxResponseError($result, false);
                 }
                 exit;
                 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");
                 $updateNav = self::getPostGetVar("update_navigations");
                 $updateStatic = self::getPostGetVar("update_static_captions");
                 self::importSliderHandle(null, $updateAnim, $updateStatic, $updateNav);
                 break;
             case "import_slider_slidersview":
                 $viewBack = self::getViewUrl(self::VIEW_SLIDERS);
                 $updateAnim = self::getPostGetVar("update_animations");
                 $updateNav = self::getPostGetVar("update_navigations");
                 $updateStatic = self::getPostGetVar("update_static_captions");
                 self::importSliderHandle($viewBack, $updateAnim, $updateStatic, $updateNav);
                 break;
             case "import_slider_online_template_slidersview":
                 $viewBack = self::getViewUrl(self::VIEW_SLIDERS);
                 self::importSliderOnlineTemplateHandle($viewBack, 'true', 'none');
                 break;
             case "import_slide_online_template_slidersview":
                 $redirect_id = esc_attr(self::getPostGetVar("redirect_id"));
                 $viewBack = self::getViewUrl(self::VIEW_SLIDE, "id={$redirect_id}");
                 $slidenum = intval(self::getPostGetVar("slidenum"));
                 $sliderid = intval(self::getPostGetVar("slider_id"));
                 self::importSliderOnlineTemplateHandle($viewBack, 'true', 'none', array('slider_id' => $sliderid, 'slide_id' => $slidenum));
                 break;
             case "import_slider_template_slidersview":
                 $viewBack = self::getViewUrl(self::VIEW_SLIDERS);
                 $updateAnim = self::getPostGetVar("update_animations");
                 $updateStatic = self::getPostGetVar("update_static_captions");
                 self::importSliderTemplateHandle($viewBack, $updateAnim, $updateStatic);
                 break;
             case "import_slide_template_slidersview":
                 $redirect_id = esc_attr(self::getPostGetVar("redirect_id"));
                 $viewBack = self::getViewUrl(self::VIEW_SLIDE, "id={$redirect_id}");
                 $updateAnim = self::getPostGetVar("update_animations");
                 $updateStatic = self::getPostGetVar("update_static_captions");
                 $slidenum = intval(self::getPostGetVar("slidenum"));
                 $sliderid = intval(self::getPostGetVar("slider_id"));
                 self::importSliderTemplateHandle($viewBack, $updateAnim, $updateStatic, array('slider_id' => $sliderid, 'slide_id' => $slidenum));
                 break;
             case "create_slider":
                 $data = $operations->modifyCustomSliderParams($data);
                 $newSliderID = $slider->createSliderFromOptions($data);
                 self::ajaxResponseSuccessRedirect(__("Slider created", 'revslider'), self::getViewUrl(self::VIEW_SLIDE, 'id=new&slider=' . esc_attr($newSliderID)));
                 //redirect to slide now
                 break;
             case "update_slider":
                 $data = $operations->modifyCustomSliderParams($data);
                 $slider->updateSliderFromOptions($data);
                 self::ajaxResponseSuccess(__("Slider updated", 'revslider'));
                 break;
             case "delete_slider":
             case "delete_slider_stay":
                 $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: ", 'revslider') . $isDeleted);
                 } else {
                     if ($action == 'delete_slider_stay') {
                         self::ajaxResponseSuccess(__("Slider deleted", 'revslider'));
                     } else {
                         self::ajaxResponseSuccessRedirect(__("Slider deleted", 'revslider'), self::getViewUrl(self::VIEW_SLIDERS));
                     }
                 }
                 break;
             case "duplicate_slider":
                 $slider->duplicateSliderFromData($data);
                 self::ajaxResponseSuccessRedirect(__("Success! Refreshing page...", 'revslider'), self::getViewUrl(self::VIEW_SLIDERS));
                 break;
             case "add_slide":
             case "add_bulk_slide":
                 $numSlides = $slider->createSlideFromData($data);
                 $sliderID = $data["sliderid"];
                 if ($numSlides == 1) {
                     $responseText = __("Slide Created", 'revslider');
                 } else {
                     $responseText = $numSlides . " " . __("Slides Created", 'revslider');
                 }
                 $urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id=new&slider={$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');
                 self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
                 break;
             case 'copy_slide_to_slider':
                 $slideID = isset($data['redirect_id']) ? $data['redirect_id'] : -1;
                 if ($slideID === -1) {
                     RevSliderFunctions::throwError(__('Missing redirect ID!', 'revslider'));
                 }
                 $return = $slider->copySlideToSlider($data);
                 if ($return !== true) {
                     RevSliderFunctions::throwError($return);
                 }
                 $urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
                 $responseText = __("Slide copied to current Slider, redirecting...", 'revslider');
                 self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
                 break;
             case "update_slide":
                 $slide->updateSlideFromData($data);
                 self::ajaxResponseSuccess(__("Slide updated", 'revslider'));
                 break;
             case "update_static_slide":
                 $slide->updateStaticSlideFromData($data);
                 self::ajaxResponseSuccess(__("Static Global Layers updated", 'revslider'));
                 break;
             case "delete_slide":
             case "delete_slide_stay":
                 $isPost = $slide->deleteSlideFromData($data);
                 if ($isPost) {
                     $message = __("Post deleted", 'revslider');
                 } else {
                     $message = __("Slide deleted", 'revslider');
                 }
                 $sliderID = RevSliderFunctions::getVal($data, "sliderID");
                 if ($action == 'delete_slide_stay') {
                     self::ajaxResponseSuccess($message);
                 } else {
                     self::ajaxResponseSuccessRedirect($message, self::getViewUrl(self::VIEW_SLIDE, "id=new&slider={$sliderID}"));
                 }
                 break;
             case "duplicate_slide":
             case "duplicate_slide_stay":
                 $return = $slider->duplicateSlideFromData($data);
                 if ($action == 'duplicate_slide_stay') {
                     self::ajaxResponseSuccess(__("Slide duplicated", 'revslider'), array('id' => $return[1]));
                 } else {
                     self::ajaxResponseSuccessRedirect(__("Slide duplicated", 'revslider'), self::getViewUrl(self::VIEW_SLIDE, "id=new&slider=" . $return[0]));
                 }
                 break;
             case "copy_move_slide":
             case "copy_move_slide_stay":
                 $sliderID = $slider->copyMoveSlideFromData($data);
                 if ($action == 'copy_move_slide_stay') {
                     self::ajaxResponseSuccess(__("Success!", 'revslider'));
                 } else {
                     self::ajaxResponseSuccessRedirect(__("Success! Refreshing page...", 'revslider'), self::getViewUrl(self::VIEW_SLIDE, "id=new&slider={$sliderID}"));
                 }
                 break;
             case "add_slide_to_template":
                 $template = new RevSliderTemplate();
                 if (!isset($data['slideID']) || intval($data['slideID']) == 0) {
                     RevSliderFunctions::throwError(__('No valid Slide ID given', 'revslider'));
                     exit;
                 }
                 if (!isset($data['title']) || strlen(trim($data['title'])) < 3) {
                     RevSliderFunctions::throwError(__('No valid title given', 'revslider'));
                     exit;
                 }
                 if (!isset($data['settings']) || !isset($data['settings']['width']) || !isset($data['settings']['height'])) {
                     RevSliderFunctions::throwError(__('No valid title given', 'revslider'));
                     exit;
                 }
                 $return = $template->copySlideToTemplates($data['slideID'], $data['title'], $data['settings']);
                 if ($return == false) {
                     RevSliderFunctions::throwError(__('Could not save Slide as Template', 'revslider'));
                     exit;
                 }
                 //get HTML for template section
                 ob_start();
                 $rs_disable_template_script = true;
                 //disable the script output of template selector file
                 include RS_PLUGIN_PATH . 'admin/views/templates/template-selector.php';
                 $html = ob_get_contents();
                 ob_clean();
                 ob_end_clean();
                 self::ajaxResponseSuccess(__('Slide added to Templates', 'revslider'), array('HTML' => $html));
                 exit;
                 break;
                 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);
                 if ($arrCaptions !== false) {
                     $db = new RevSliderDB();
                     $styles = $db->fetch(RevSliderGlobals::$table_css);
                     $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
                     $styles = RevSliderCssParser::compress_css($styles);
                     $custom_css = RevSliderOperations::getStaticCss();
                     $custom_css = RevSliderCssParser::compress_css($custom_css);
                     $arrCSS = $operations->getCaptionsContentArray();
                     $arrCssStyles = RevSliderFunctions::jsonEncodeForClientSide($arrCSS);
                     $arrCssStyles = $arrCSS;
                     self::ajaxResponseSuccess(__("CSS saved", 'revslider'), array("arrCaptions" => $arrCaptions, 'compressed_css' => $styles . $custom_css, 'initstyles' => $arrCssStyles));
                 }
                 RevSliderFunctions::throwError(__('CSS could not be saved', 'revslider'));
                 exit;
                 break;
             case "update_captions_css":
                 $arrCaptions = $operations->updateCaptionsContentData($data);
                 if ($arrCaptions !== false) {
                     $db = new RevSliderDB();
                     $styles = $db->fetch(RevSliderGlobals::$table_css);
                     $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
                     $styles = RevSliderCssParser::compress_css($styles);
                     $custom_css = RevSliderOperations::getStaticCss();
                     $custom_css = RevSliderCssParser::compress_css($custom_css);
                     $arrCSS = $operations->getCaptionsContentArray();
                     $arrCssStyles = RevSliderFunctions::jsonEncodeForClientSide($arrCSS);
                     $arrCssStyles = $arrCSS;
                     self::ajaxResponseSuccess(__("CSS saved", 'revslider'), array("arrCaptions" => $arrCaptions, 'compressed_css' => $styles . $custom_css, 'initstyles' => $arrCssStyles));
                 }
                 RevSliderFunctions::throwError(__('CSS could not be saved', 'revslider'));
                 exit;
                 break;
             case "update_captions_advanced_css":
                 $arrCaptions = $operations->updateAdvancedCssData($data);
                 if ($arrCaptions !== false) {
                     $db = new RevSliderDB();
                     $styles = $db->fetch(RevSliderGlobals::$table_css);
                     $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
                     $styles = RevSliderCssParser::compress_css($styles);
                     $custom_css = RevSliderOperations::getStaticCss();
                     $custom_css = RevSliderCssParser::compress_css($custom_css);
                     $arrCSS = $operations->getCaptionsContentArray();
                     $arrCssStyles = RevSliderFunctions::jsonEncodeForClientSide($arrCSS);
                     $arrCssStyles = $arrCSS;
                     self::ajaxResponseSuccess(__("CSS saved", 'revslider'), array("arrCaptions" => $arrCaptions, 'compressed_css' => $styles . $custom_css, 'initstyles' => $arrCssStyles));
                 }
                 RevSliderFunctions::throwError(__('CSS could not be saved', 'revslider'));
                 exit;
                 break;
             case "rename_captions_css":
                 //rename all captions in all sliders with new handle if success
                 $arrCaptions = $operations->renameCaption($data);
                 $db = new RevSliderDB();
                 $styles = $db->fetch(RevSliderGlobals::$table_css);
                 $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
                 $styles = RevSliderCssParser::compress_css($styles);
                 $custom_css = RevSliderOperations::getStaticCss();
                 $custom_css = RevSliderCssParser::compress_css($custom_css);
                 $arrCSS = $operations->getCaptionsContentArray();
                 $arrCssStyles = RevSliderFunctions::jsonEncodeForClientSide($arrCSS);
                 $arrCssStyles = $arrCSS;
                 self::ajaxResponseSuccess(__("Class name renamed", 'revslider'), array("arrCaptions" => $arrCaptions, 'compressed_css' => $styles . $custom_css, 'initstyles' => $arrCssStyles));
                 break;
             case "delete_captions_css":
                 $arrCaptions = $operations->deleteCaptionsContentData($data);
                 $db = new RevSliderDB();
                 $styles = $db->fetch(RevSliderGlobals::$table_css);
                 $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
                 $styles = RevSliderCssParser::compress_css($styles);
                 $custom_css = RevSliderOperations::getStaticCss();
                 $custom_css = RevSliderCssParser::compress_css($custom_css);
                 $arrCSS = $operations->getCaptionsContentArray();
                 $arrCssStyles = RevSliderFunctions::jsonEncodeForClientSide($arrCSS);
                 $arrCssStyles = $arrCSS;
                 self::ajaxResponseSuccess(__("Style deleted!", 'revslider'), array("arrCaptions" => $arrCaptions, 'compressed_css' => $styles . $custom_css, 'initstyles' => $arrCssStyles));
                 break;
             case "update_static_css":
                 $staticCss = $operations->updateStaticCss($data);
                 $db = new RevSliderDB();
                 $styles = $db->fetch(RevSliderGlobals::$table_css);
                 $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
                 $styles = RevSliderCssParser::compress_css($styles);
                 $custom_css = RevSliderOperations::getStaticCss();
                 $custom_css = RevSliderCssParser::compress_css($custom_css);
                 self::ajaxResponseSuccess(__("CSS saved", 'revslider'), array("css" => $staticCss, 'compressed_css' => $styles . $custom_css));
                 break;
             case "insert_custom_anim":
                 $arrAnims = $operations->insertCustomAnim($data);
                 //$arrCaptions =
                 self::ajaxResponseSuccess(__("Animation saved", 'revslider'), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_custom_anim":
                 $arrAnims = $operations->updateCustomAnim($data);
                 self::ajaxResponseSuccess(__("Animation saved", 'revslider'), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_custom_anim_name":
                 $arrAnims = $operations->updateCustomAnimName($data);
                 self::ajaxResponseSuccess(__("Animation saved", 'revslider'), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "delete_custom_anim":
                 $arrAnims = $operations->deleteCustomAnim($data);
                 self::ajaxResponseSuccess(__("Animation deleted", 'revslider'), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_slides_order":
                 $slider->updateSlidesOrderFromData($data);
                 self::ajaxResponseSuccess(__("Order updated", 'revslider'));
                 break;
             case "change_slide_title":
                 $slide->updateTitleByID($data);
                 self::ajaxResponseSuccess(__('Title updated', 'revslider'));
                 break;
             case "change_slide_image":
                 $slide->updateSlideImageFromData($data);
                 $sliderID = RevSliderFunctions::getVal($data, "slider_id");
                 self::ajaxResponseSuccessRedirect(__("Slide changed", 'revslider'), self::getViewUrl(self::VIEW_SLIDE, "id=new&slider={$sliderID}"));
                 break;
             case "preview_slide":
                 $operations->putSlidePreviewByData($data);
                 break;
             case "preview_slider":
                 $sliderID = RevSliderFunctions::getPostGetVariable("sliderid");
                 $do_markup = RevSliderFunctions::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 "toggle_hero_slide":
                 $currentHero = $slider->setHeroSlide($data);
                 self::ajaxResponseSuccess(__('Slide is now the new active Hero Slide', 'revslider'));
                 break;
             case "slide_lang_operation":
                 $responseData = $slide->doSlideLangOperation($data);
                 self::ajaxResponseData($responseData);
                 break;
             case "update_general_settings":
                 $operations->updateGeneralSettings($data);
                 self::ajaxResponseSuccess(__("General settings updated", 'revslider'));
                 break;
             case "update_posts_sortby":
                 $slider->updatePostsSortbyFromData($data);
                 self::ajaxResponseSuccess(__("Sortby updated", 'revslider'));
                 break;
             case "replace_image_urls":
                 $slider->replaceImageUrlsFromData($data);
                 self::ajaxResponseSuccess(__("Image urls replaced", 'revslider'));
                 break;
             case "reset_slide_settings":
                 $slider->resetSlideSettings($data);
                 self::ajaxResponseSuccess(__("Settings in all Slides changed", 'revslider'));
                 break;
             case "activate_purchase_code":
                 $result = false;
                 if (!empty($data['code'])) {
                     $result = $operations->checkPurchaseVerification($data);
                 } else {
                     RevSliderFunctions::throwError(__('The API key, the Purchase Code and the Username need to be set!', 'revslider'));
                     exit;
                 }
                 if ($result) {
                     self::ajaxResponseSuccessRedirect(__("Purchase Code Successfully Activated", 'revslider'), self::getViewUrl(self::VIEW_SLIDERS));
                 } else {
                     RevSliderFunctions::throwError(__('Purchase Code is invalid', 'revslider'));
                 }
                 break;
             case "deactivate_purchase_code":
                 $result = $operations->doPurchaseDeactivation($data);
                 if ($result) {
                     self::ajaxResponseSuccessRedirect(__("Successfully removed validation", 'revslider'), self::getViewUrl(self::VIEW_SLIDERS));
                 } else {
                     RevSliderFunctions::throwError(__('Could not remove Validation!', 'revslider'));
                 }
                 break;
             case 'dismiss_notice':
                 update_option('revslider-valid-notice', 'false');
                 self::ajaxResponseSuccess(__(".", 'revslider'));
                 break;
             case 'dismiss_dynamic_notice':
                 $notices_discarded = get_option('revslider-notices-dc', array());
                 $notices_discarded[] = esc_attr(trim($data['id']));
                 update_option('revslider-notices-dc', $notices_discarded);
                 self::ajaxResponseSuccess(__(".", 'revslider'));
                 break;
             case 'toggle_favorite':
                 if (isset($data['id']) && intval($data['id']) > 0) {
                     $return = self::toggle_favorite_by_id($data['id']);
                     if ($return === true) {
                         self::ajaxResponseSuccess(__('Setting Changed!', 'revslider'));
                     } else {
                         $error = $return;
                     }
                 } else {
                     $error = __('No ID given', 'revslider');
                 }
                 self::ajaxResponseError($error);
                 break;
             case "subscribe_to_newsletter":
                 if (isset($data['email']) && !empty($data['email'])) {
                     $return = ThemePunch_Newsletter::subscribe($data['email']);
                     if ($return !== false) {
                         if (!isset($return['status']) || $return['status'] === 'error') {
                             $error = isset($return['message']) && !empty($return['message']) ? $return['message'] : __('Invalid Email', 'revslider');
                             self::ajaxResponseError($error);
                         } else {
                             self::ajaxResponseSuccess(__("Success! Please check your Emails to finish the subscription", 'revslider'), $return);
                         }
                     } else {
                         self::ajaxResponseError(__('Invalid Email/Could not connect to the Newsletter server', 'revslider'));
                     }
                 } else {
                     self::ajaxResponseError(__('No Email given', 'revslider'));
                 }
                 break;
             case "unsubscribe_to_newsletter":
                 if (isset($data['email']) && !empty($data['email'])) {
                     $return = ThemePunch_Newsletter::unsubscribe($data['email']);
                     if ($return !== false) {
                         if (!isset($return['status']) || $return['status'] === 'error') {
                             $error = isset($return['message']) && !empty($return['message']) ? $return['message'] : __('Invalid Email', 'revslider');
                             self::ajaxResponseError($error);
                         } else {
                             self::ajaxResponseSuccess(__("Success! Please check your Emails to finish the process", 'revslider'), $return);
                         }
                     } else {
                         self::ajaxResponseError(__('Invalid Email/Could not connect to the Newsletter server', 'revslider'));
                     }
                 } else {
                     self::ajaxResponseError(__('No Email given', 'revslider'));
                 }
                 break;
             case 'change_specific_navigation':
                 $nav = new RevSliderNavigation();
                 $found = false;
                 $navigations = $nav->get_all_navigations();
                 foreach ($navigations as $navig) {
                     if ($data['id'] == $navig['id']) {
                         $found = true;
                         break;
                     }
                 }
                 if ($found) {
                     $nav->create_update_navigation($data, $data['id']);
                 } else {
                     $nav->create_update_navigation($data);
                 }
                 self::ajaxResponseSuccess(__('Navigation saved/updated', 'revslider'), array('navs' => $nav->get_all_navigations()));
                 break;
             case 'change_navigations':
                 $nav = new RevSliderNavigation();
                 $nav->create_update_full_navigation($data);
                 self::ajaxResponseSuccess(__('Navigations updated', 'revslider'), array('navs' => $nav->get_all_navigations()));
                 break;
             case 'delete_navigation':
                 $nav = new RevSliderNavigation();
                 if (isset($data) && intval($data) > 0) {
                     $return = $nav->delete_navigation($data);
                     if ($return !== true) {
                         self::ajaxResponseError($return);
                     } else {
                         self::ajaxResponseSuccess(__('Navigation deleted', 'revslider'), array('navs' => $nav->get_all_navigations()));
                     }
                 }
                 self::ajaxResponseError(__('Wrong ID given', 'revslider'));
                 break;
             case "get_facebook_photosets":
                 if (!empty($data['url'])) {
                     $facebook = new RevSliderFacebook();
                     $return = $facebook->get_photo_set_photos_options($data['url'], $data['album'], $data['app_id'], $data['app_secret']);
                     if (!empty($return)) {
                         self::ajaxResponseSuccess(__('Successfully fetched Facebook albums', 'revslider'), array('html' => implode(' ', $return)));
                     } else {
                         $error = __('Could not fetch Facebook albums', 'revslider');
                         self::ajaxResponseError($error);
                     }
                 } else {
                     self::ajaxResponseSuccess(__('Cleared Albums', 'revslider'), array('html' => implode(' ', $return)));
                 }
                 break;
             case "get_flickr_photosets":
                 if (!empty($data['url']) && !empty($data['key'])) {
                     $flickr = new RevSliderFlickr($data['key']);
                     $user_id = $flickr->get_user_from_url($data['url']);
                     $return = $flickr->get_photo_sets($user_id, $data['count'], $data['set']);
                     if (!empty($return)) {
                         self::ajaxResponseSuccess(__('Successfully fetched flickr photosets', 'revslider'), array("data" => array('html' => implode(' ', $return))));
                     } else {
                         $error = __('Could not fetch flickr photosets', 'revslider');
                         self::ajaxResponseError($error);
                     }
                 } else {
                     if (empty($data['url']) && empty($data['key'])) {
                         self::ajaxResponseSuccess(__('Cleared Photosets', 'revslider'), array('html' => implode(' ', $return)));
                     } elseif (empty($data['url'])) {
                         $error = __('No User URL - Could not fetch flickr photosets', 'revslider');
                         self::ajaxResponseError($error);
                     } else {
                         $error = __('No API KEY - Could not fetch flickr photosets', 'revslider');
                         self::ajaxResponseError($error);
                     }
                 }
                 break;
             case "get_youtube_playlists":
                 if (!empty($data['id'])) {
                     $youtube = new RevSliderYoutube(trim($data['api']), trim($data['id']));
                     $return = $youtube->get_playlist_options($data['playlist']);
                     self::ajaxResponseSuccess(__('Successfully fetched YouTube playlists', 'revslider'), array("data" => array('html' => implode(' ', $return))));
                 } else {
                     $error = __('Could not fetch YouTube playlists', 'revslider');
                     self::ajaxResponseError($error);
                 }
                 break;
             case 'rs_get_store_information':
                 global $wp_version;
                 $code = get_option('revslider-code', '');
                 $shop_version = RevSliderTemplate::SHOP_VERSION;
                 $validated = get_option('revslider-valid', 'false');
                 if ($validated == 'false') {
                     $api_key = '';
                     $username = '';
                     $code = '';
                 }
                 $rattr = array('code' => urlencode($code), 'product' => urlencode('revslider'), 'shop_version' => urlencode($shop_version), 'version' => urlencode(RevSliderGlobals::SLIDER_REVISION));
                 $request = wp_remote_post('http://templates.themepunch.tools/revslider/store.php', array('user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'), 'body' => $rattr));
                 $response = '';
                 if (!is_wp_error($request)) {
                     $response = json_decode(@$request['body'], true);
                 }
                 self::ajaxResponseData(array("data" => $response));
                 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 {$action} action. please check with the developer.");
     exit;
 }
<?php

/**
 * @author    ThemePunch <*****@*****.**>
 * @link      http://www.themepunch.com/
 * @copyright 2015 ThemePunch
 */
if (!defined('ABSPATH')) {
    exit;
}
$operations = new RevSliderOperations();
$rs_nav = new RevSliderNavigation();
$arrValues = $operations->getGeneralSettingsValues();
$arr_navigations = $rs_nav->get_all_navigations();
$transitions = $operations->getArrTransition();
$_width = isset($arrValues['width']) ? $arrValues['width'] : 1240;
$_width_notebook = isset($arrValues['width_notebook']) ? $arrValues['width_notebook'] : 1024;
$_width_tablet = isset($arrValues['width_tablet']) ? $arrValues['width_tablet'] : 778;
$_width_mobile = isset($arrValues['width_mobile']) ? $arrValues['width_mobile'] : 480;
if (!isset($is_edit)) {
    $is_edit = false;
}
if (!isset($linksEditSlides)) {
    $linksEditSlides = '';
}
?>
<div class="wrap settings_wrap">
	<div class="clear_both"></div>

	<div class="title_line" style="margin-bottom:0px !important">
		<div id="icon-options-general" class="icon32"></div>
Esempio n. 4
0
    public function add_custom_navigation_css($slides)
    {
        $rs_nav = new RevSliderNavigation();
        $all_navs = $rs_nav->get_all_navigations();
        $slider_type = $this->slider->getParam('slider-type');
        $enable_arrows = $this->slider->getParam('enable_arrows', 'off');
        $enable_bullets = $this->slider->getParam('enable_bullets', 'off');
        $enable_tabs = $this->slider->getParam('enable_tabs', 'off');
        $enable_thumbnails = $this->slider->getParam('enable_thumbnails', 'off');
        if ($slider_type !== 'hero' && ($enable_arrows == 'on' || $enable_bullets == 'on' || $enable_tabs == 'on' || $enable_thumbnails == 'on')) {
            if (!empty($slides)) {
                foreach ($slides as $slide) {
                    $navigation_arrow_style = $this->slider->getParam('navigation_arrow_style', 'round');
                    $navigation_bullets_style = $this->slider->getParam('navigation_bullets_style', 'round');
                    $tabs_style = $this->slider->getParam('tabs_style', 'round');
                    $thumbnails_style = $this->slider->getParam('thumbnails_style', 'round');
                    if (!empty($all_navs)) {
                        foreach ($all_navs as $cur_nav) {
                            //get modifications out, wrap the class with slide class to be specific
                            if ($enable_arrows == 'on' && $cur_nav['handle'] == $navigation_arrow_style) {
                                $this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['arrows'], $cur_nav['handle'], 'arrows', $cur_nav['settings'], $slide, $this) . "\n";
                            }
                            if ($enable_bullets == 'on' && $cur_nav['handle'] == $navigation_bullets_style) {
                                $this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['bullets'], $cur_nav['handle'], 'bullets', $cur_nav['settings'], $slide, $this) . "\n";
                            }
                            if ($enable_tabs == 'on' && $cur_nav['handle'] == $tabs_style) {
                                $this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['tabs'], $cur_nav['handle'], 'tabs', $cur_nav['settings'], $slide, $this) . "\n";
                            }
                            if ($enable_thumbnails == 'on' && $cur_nav['handle'] == $thumbnails_style) {
                                $this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['thumbs'], $cur_nav['handle'], 'thumbs', $cur_nav['settings'], $slide, $this) . "\n";
                            }
                        }
                    }
                }
                if ($this->markup_export === true) {
                    echo '<!-- STYLE -->';
                }
                if (!is_admin()) {
                    echo '<script>var htmlDiv = document.getElementById("rs-plugin-settings-inline-css"); var htmlDivCss="';
                } else {
                    echo "<style>";
                }
                if (!is_admin()) {
                    echo addslashes(RevSliderCssParser::compress_css($this->rev_custom_navigation_css)) . '";
						if(htmlDiv) {
							htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
						}else{
							var htmlDiv = document.createElement("div");
							htmlDiv.innerHTML = "<style>" + htmlDivCss + "</style>";
							document.getElementsByTagName("head")[0].appendChild(htmlDiv.childNodes[0]);
						}
					</script>' . "\n";
                } else {
                    echo $this->rev_custom_navigation_css . '</style>';
                }
                if ($this->markup_export === true) {
                    echo '<!-- /STYLE -->';
                }
            }
        }
    }
    /**
     *
     * put slider javascript
     */
    private function putJS($markup_export = false)
    {
        $params = $this->slider->getParams();
        $sliderType = $this->slider->getParam('slider_type');
        $force_fullwidth = $this->slider->getParam('force_full_width', 'on');
        if ($sliderType == 'fixed' || $sliderType == 'responsitive' || $sliderType == 'fullwidth' && $force_fullwidth == "off") {
            $sliderType = 'auto';
        }
        $optFullWidth = $sliderType == 'fullwidth' ? 'on' : 'off';
        $optFullScreen = 'off';
        if ($sliderType == 'fullscreen') {
            $optFullWidth = 'off';
            $optFullScreen = 'on';
        }
        $use_spinner = $this->slider->getParam('use_spinner', '0');
        $spinner_color = $this->slider->getParam('spinner_color', '#FFFFFF');
        $noConflict = $this->slider->getParam("jquery_noconflict", "on");
        $debugmode = $this->slider->getParam("jquery_debugmode", "off") == 'on' ? 'true' : 'false';
        //set thumb amount
        $numSlides = $this->slider->getNumSlides(true);
        //get stop slider options
        $stopSlider = $this->slider->getParam("stop_slider", "off");
        $stopAfterLoops = $this->slider->getParam("stop_after_loops", "0");
        $stopAtSlide = $this->slider->getParam("stop_at_slide", "2");
        if ($stopSlider == "off") {
            $stopAfterLoops = "-1";
            $stopAtSlide = "-1";
        }
        $oneSlideLoop = $this->slider->getParam("loop_slide", "loop");
        if ($oneSlideLoop == 'noloop' && $this->hasOnlyOneSlide == true) {
            $stopAfterLoops = '0';
            $stopAtSlide = '1';
        }
        $sliderID = $this->slider->getID();
        //treat hide slider at limit
        $hideSliderAtLimit = $this->slider->getParam("hide_slider_under", "0", RevSlider::VALIDATE_NUMERIC);
        if (!empty($hideSliderAtLimit)) {
            $hideSliderAtLimit++;
        }
        $hideCaptionAtLimit = $this->slider->getParam("hide_defined_layers_under", "0", RevSlider::VALIDATE_NUMERIC);
        if (!empty($hideCaptionAtLimit)) {
            $hideCaptionAtLimit++;
        }
        $hideAllCaptionAtLimit = $this->slider->getParam("hide_all_layers_under", "0", RevSlider::VALIDATE_NUMERIC);
        if (!empty($hideAllCaptionAtLimit)) {
            $hideAllCaptionAtLimit++;
        }
        //start_with_slide
        $startWithSlide = $this->slider->getStartWithSlideSetting();
        //modify navigation type (backward compatability)
        //FALLBACK
        $enable_arrows = $this->slider->getParam('enable_arrows', 'off');
        $arrowsType = $enable_arrows == 'on' ? 'solo' : 'none';
        //More Mobile Options
        $hideThumbsOnMobile = $this->slider->getParam("hide_thumbs_on_mobile", "off");
        $enable_progressbar = $this->slider->getParam('enable_progressbar', 'on');
        $disableKenBurnOnMobile = $this->slider->getParam("disable_kenburns_on_mobile", "off");
        $swipe_velocity = $this->slider->getParam("swipe_velocity", "0.7", RevSlider::VALIDATE_NUMERIC);
        $swipe_min_touches = $this->slider->getParam("swipe_min_touches", "1", RevSlider::VALIDATE_NUMERIC);
        $swipe_direction = $this->slider->getParam("swipe_direction", "horizontal");
        $drag_block_vertical = $this->slider->getParam("drag_block_vertical", "false");
        $use_parallax = $this->slider->getParam("use_parallax", $this->slider->getParam('use_parallax', 'off'));
        $disable_parallax_mobile = $this->slider->getParam("disable_parallax_mobile", "off");
        if ($use_parallax == 'on') {
            $parallax_type = $this->slider->getParam("parallax_type", "mouse");
            $parallax_origo = $this->slider->getParam("parallax_origo", "enterpoint");
            $parallax_speed = $this->slider->getParam("parallax_speed", "400");
            $parallax_level[] = intval($this->slider->getParam("parallax_level_1", "5"));
            $parallax_level[] = intval($this->slider->getParam("parallax_level_2", "10"));
            $parallax_level[] = intval($this->slider->getParam("parallax_level_3", "15"));
            $parallax_level[] = intval($this->slider->getParam("parallax_level_4", "20"));
            $parallax_level[] = intval($this->slider->getParam("parallax_level_5", "25"));
            $parallax_level[] = intval($this->slider->getParam("parallax_level_6", "30"));
            $parallax_level[] = intval($this->slider->getParam("parallax_level_7", "35"));
            $parallax_level[] = intval($this->slider->getParam("parallax_level_8", "40"));
            $parallax_level[] = intval($this->slider->getParam("parallax_level_9", "45"));
            $parallax_level[] = intval($this->slider->getParam("parallax_level_10", "50"));
            $parallax_level = implode(',', $parallax_level);
        }
        $operations = new RevSliderOperations();
        $arrValues = $operations->getGeneralSettingsValues();
        $do_delay = $this->slider->getParam("start_js_after_delay", "0");
        $do_delay = apply_filters('revslider_add_js_delay', $do_delay);
        $do_delay = intval($do_delay);
        $js_to_footer = isset($arrValues['js_to_footer']) && $arrValues['js_to_footer'] == 'on' ? true : false;
        $slider_type = $this->slider->getParam('slider-type', 'standard');
        //add inline style into the footer
        if ($js_to_footer && $this->previewMode == false && $markup_export == false) {
            ob_start();
        }
        $nav_css = '';
        if ($markup_export === true) {
            echo '<!-- STYLE -->';
        }
        //ADD SCOPED INLINE STYLES
        $this->add_inline_styles();
        if ($markup_export === true) {
            echo '<!-- /STYLE -->';
        }
        $csizes = RevSliderFunctions::get_responsive_size($this);
        if ($markup_export === true) {
            echo '<!-- SCRIPT -->';
        }
        ?>
		<script type="text/javascript">
			<?php 
        if (!$markup_export) {
            //not needed for html markup export
            ?>
			/******************************************
				-	PREPARE PLACEHOLDER FOR SLIDER	-
			******************************************/

			var setREVStartSize=function(){
				try{var e=new Object,i=jQuery(window).width(),t=9999,r=0,n=0,l=0,f=0,s=0,h=0;
					e.c = jQuery('#<?php 
            echo $this->sliderHtmlID;
            ?>
');
<?php 
            if (isset($csizes['level']) && !empty($csizes['level'])) {
                ?>
					e.responsiveLevels = <?php 
                echo '[' . $csizes['level'] . ']';
                ?>
;
					e.gridwidth = <?php 
                echo '[' . $csizes['width'] . ']';
                ?>
;
					e.gridheight = <?php 
                echo '[' . $csizes['height'] . ']';
                ?>
;
<?php 
            } else {
                ?>
					e.gridwidth = <?php 
                echo '[' . $csizes['width'] . ']';
                ?>
;
					e.gridheight = <?php 
                echo '[' . $csizes['height'] . ']';
                ?>
;
<?php 
            }
            ?>
							
<?php 
            if ($optFullScreen == 'on') {
                $sl_layout = 'fullscreen';
            } elseif ($optFullWidth == 'on') {
                $sl_layout = 'fullwidth';
            } else {
                $sl_layout = 'auto';
            }
            ?>
					e.sliderLayout = "<?php 
            echo $sl_layout;
            ?>
";
<?php 
            if ($this->slider->getParam("slider_type") == "fullscreen") {
                ?>
					e.fullScreenAutoWidth='<?php 
                echo esc_attr($this->slider->getParam("autowidth_force", "off"));
                ?>
';
					e.fullScreenAlignForce='<?php 
                echo esc_attr($this->slider->getParam("full_screen_align_force", "off"));
                ?>
';
					e.fullScreenOffsetContainer= '<?php 
                echo esc_attr($this->slider->getParam("fullscreen_offset_container", ""));
                ?>
';
					e.fullScreenOffset='<?php 
                echo esc_attr($this->slider->getParam("fullscreen_offset_size", ""));
                ?>
';
<?php 
            }
            $minHeight = $this->slider->getParam('slider_type') !== 'fullscreen' ? $this->slider->getParam('min_height', '0', RevSlider::FORCE_NUMERIC) : $this->slider->getParam('fullscreen_min_height', '0', RevSlider::FORCE_NUMERIC);
            if ($minHeight > 0) {
                ?>
					e.minHeight = <?php 
                echo $minHeight;
                ?>
;
<?php 
            }
            ?>
					if(e.responsiveLevels&&(jQuery.each(e.responsiveLevels,function(e,f){f>i&&(t=r=f,l=e),i>f&&f>r&&(r=f,n=e)}),t>r&&(l=n)),f=e.gridheight[l]||e.gridheight[0]||e.gridheight,s=e.gridwidth[l]||e.gridwidth[0]||e.gridwidth,h=i/s,h=h>1?1:h,f=Math.round(h*f),"fullscreen"==e.sliderLayout){var u=(e.c.width(),jQuery(window).height());if(void 0!=e.fullScreenOffsetContainer){var c=e.fullScreenOffsetContainer.split(",");if (c) jQuery.each(c,function(e,i){u=jQuery(i).length>0?u-jQuery(i).outerHeight(!0):u}),e.fullScreenOffset.split("%").length>1&&void 0!=e.fullScreenOffset&&e.fullScreenOffset.length>0?u-=jQuery(window).height()*parseInt(e.fullScreenOffset,0)/100:void 0!=e.fullScreenOffset&&e.fullScreenOffset.length>0&&(u-=parseInt(e.fullScreenOffset,0))}f=u}else void 0!=e.minHeight&&f<e.minHeight&&(f=e.minHeight);e.c.closest(".rev_slider_wrapper").css({height:f})
				}catch(d){console.log("Failure at Presize of Slider:"+d)}
			};
						
				
			setREVStartSize();
			function revslider_showDoubleJqueryError(sliderID) {
					var errorMessage = "Revolution Slider Error: You have some jquery.js library include that comes after the revolution files js include.";
					errorMessage += "<br> This includes make eliminates the revolution slider libraries, and make it not work.";
					errorMessage += "<br><br> To fix it you can:<br>&nbsp;&nbsp;&nbsp; 1. In the Slider Settings -> Troubleshooting set option:  <strong><b>Put JS Includes To Body</b></strong> option to true.";
					errorMessage += "<br>&nbsp;&nbsp;&nbsp; 2. Find the double jquery.js include and remove it.";
					errorMessage = "<span style='font-size:16px;color:#BC0C06;'>" + errorMessage + "</span>"
						jQuery(sliderID).show().html(errorMessage);
				}
			<?php 
        }
        ?>
			var tpj=jQuery;
			<?php 
        if ($noConflict == "on") {
            ?>
tpj.noConflict();<?php 
        }
        ?>

			var revapi<?php 
        echo $sliderID;
        ?>
;
			<?php 
        echo 'tpj(document).ready(function() {' . "\n";
        echo '				if(tpj("#' . $this->sliderHtmlID . '").revolution == undefined){' . "\n";
        echo '					revslider_showDoubleJqueryError("#' . $this->sliderHtmlID . '");' . "\n";
        echo '				}else{' . "\n";
        echo '					revapi' . $sliderID . ' = tpj("#' . $this->sliderHtmlID . '").show().revolution({' . "\n";
        if ($do_delay > 0) {
            echo '						startDelay: ' . esc_attr($do_delay) . ',' . "\n";
        }
        echo '						sliderType:"' . esc_attr($slider_type) . '",' . "\n";
        echo '						jsFileLocation:"' . esc_attr(RS_PLUGIN_URL . 'public/assets/js/') . '",' . "\n";
        if ($optFullScreen == 'on') {
            $sl_layout = 'fullscreen';
        } elseif ($optFullWidth == 'on') {
            $sl_layout = 'fullwidth';
        } else {
            $sl_layout = 'auto';
        }
        echo '						sliderLayout:"' . $sl_layout . '",' . "\n";
        echo '						dottedOverlay:"' . esc_attr($this->slider->getParam("background_dotted_overlay", "none")) . '",' . "\n";
        echo '						delay:' . esc_attr($this->slider->getParam("delay", "9000", RevSlider::FORCE_NUMERIC)) . ',' . "\n";
        $enable_arrows = $this->slider->getParam('enable_arrows', 'off');
        $enable_bullets = $this->slider->getParam('enable_bullets', 'off');
        $enable_tabs = $this->slider->getParam('enable_tabs', 'off');
        $enable_thumbnails = $this->slider->getParam('enable_thumbnails', 'off');
        $rs_nav = new RevSliderNavigation();
        $all_navs = $rs_nav->get_all_navigations();
        $touch_enabled = $this->slider->getParam('touchenabled', 'on');
        $keyboard_enabled = $this->slider->getParam('keyboard_navigation', 'off');
        $keyboard_direction = $this->slider->getParam('keyboard_direction', 'horizontal');
        $mousescroll_enabled = $this->slider->getParam('mousescroll_navigation', 'off');
        //no navigation if we are hero
        if ($slider_type !== 'hero' && ($enable_arrows == 'on' || $enable_bullets == 'on' || $enable_tabs == 'on' || $enable_thumbnails == 'on' || $touch_enabled == 'on' || $keyboard_enabled == 'on' || $mousescroll_enabled == 'on')) {
            echo '						navigation: {' . "\n";
            echo '							keyboardNavigation:"' . esc_attr($keyboard_enabled) . '",' . "\n";
            echo '							keyboard_direction: "' . esc_attr($keyboard_direction) . '",' . "\n";
            echo '							mouseScrollNavigation:"' . esc_attr($mousescroll_enabled) . '",' . "\n";
            if ($slider_type !== 'hero') {
                echo '							onHoverStop:"' . esc_attr($this->slider->getParam("stop_on_hover", "on")) . '",' . "\n";
            }
            $add_comma = false;
            if ($touch_enabled == 'on') {
                $add_comma = true;
                echo '							touch:{' . "\n";
                echo '								touchenabled:"' . esc_attr($touch_enabled) . '",' . "\n";
                echo '								swipe_threshold: ' . esc_attr($swipe_velocity) . ',' . "\n";
                echo '								swipe_min_touches: ' . esc_attr($swipe_min_touches) . ',' . "\n";
                echo '								swipe_direction: "' . esc_attr($swipe_direction) . '",' . "\n";
                echo '								drag_block_vertical: ';
                echo $drag_block_vertical == 'true' ? 'true' : 'false';
                echo "\n";
                echo '							}' . "\n";
            }
            if ($enable_arrows == 'on') {
                $navigation_arrow_style = $this->slider->getParam('navigation_arrow_style', 'round');
                $arrows_always_on = $this->slider->getParam('arrows_always_on', 'true') == 'true' ? 'true' : 'false';
                $hide_arrows_on_mobile = $this->slider->getParam('hide_arrows_on_mobile', 'off') == 'on' ? 'true' : 'false';
                $hide_arrows_over = $this->slider->getParam('hide_arrows_over', 'off') == 'on' ? 'true' : 'false';
                $arr_tmp = '';
                $ff = false;
                if (!empty($all_navs)) {
                    foreach ($all_navs as $cur_nav) {
                        if ($cur_nav['handle'] == $navigation_arrow_style) {
                            if (isset($cur_nav['markup']['arrows'])) {
                                $arr_tmp = $cur_nav['markup']['arrows'];
                            }
                            if (isset($cur_nav['css']['arrows'])) {
                                $nav_css .= $cur_nav['css']['arrows'] . "\n";
                            }
                            $ff = true;
                            break;
                        }
                    }
                }
                if ($ff == false) {
                    $navigation_arrow_style = '';
                }
                $navigation_arrow_style = $rs_nav->translate_navigation($navigation_arrow_style);
                if ($add_comma) {
                    echo '							,' . "\n";
                }
                $add_comma = true;
                echo '							arrows: {' . "\n";
                echo '								style:"' . esc_attr($navigation_arrow_style) . '",' . "\n";
                echo '								enable:';
                echo $this->slider->getParam('enable_arrows', 'off') == 'on' ? 'true' : 'false';
                echo ',' . "\n";
                echo '								hide_onmobile:' . $hide_arrows_on_mobile . ',' . "\n";
                if ($hide_arrows_on_mobile === 'true') {
                    echo '								hide_under:' . esc_attr($this->slider->getParam('arrows_under_hidden', '0', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                if ($hide_arrows_over === 'true') {
                    echo '								hide_over:' . esc_attr($this->slider->getParam('arrows_over_hidden', '0', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                echo '								hide_onleave:' . $arrows_always_on . ',' . "\n";
                if ($arrows_always_on === 'true') {
                    echo '								hide_delay:' . esc_attr($this->slider->getParam('hide_arrows', '200', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                    echo '								hide_delay_mobile:' . esc_attr($this->slider->getParam('hide_arrows_mobile', '1200', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                echo '								tmp:\'';
                echo preg_replace("/\r|\n/", "", $arr_tmp);
                echo '\',' . "\n";
                echo '								left: {' . "\n";
                echo '									h_align:"' . esc_attr($this->slider->getParam('leftarrow_align_hor', 'left')) . '",' . "\n";
                echo '									v_align:"' . esc_attr($this->slider->getParam('leftarrow_align_vert', 'center')) . '",' . "\n";
                echo '									h_offset:' . esc_attr($this->slider->getParam('leftarrow_offset_hor', '20', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '									v_offset:' . esc_attr($this->slider->getParam('leftarrow_offset_vert', '0', RevSlider::FORCE_NUMERIC)) . "\n";
                echo '								},' . "\n";
                echo '								right: {' . "\n";
                echo '									h_align:"' . esc_attr($this->slider->getParam('rightarrow_align_hor', 'right')) . '",' . "\n";
                echo '									v_align:"' . esc_attr($this->slider->getParam('rightarrow_align_vert', 'center')) . '",' . "\n";
                echo '									h_offset:' . esc_attr($this->slider->getParam('rightarrow_offset_hor', '20', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '									v_offset:' . esc_attr($this->slider->getParam('rightarrow_offset_vert', '0', RevSlider::FORCE_NUMERIC)) . "\n";
                echo '								}' . "\n";
                echo '							}' . "\n";
            }
            if ($enable_bullets == 'on') {
                $navigation_bullets_style = $this->slider->getParam('navigation_bullets_style', 'round');
                $bullets_always_on = $this->slider->getParam('bullets_always_on', 'true') == 'true' ? 'true' : 'false';
                $hide_bullets_on_mobile = $this->slider->getParam('hide_bullets_on_mobile', 'off') == 'on' ? 'true' : 'false';
                $hide_bullets_over = $this->slider->getParam('hide_bullets_over', 'off') == 'on' ? 'true' : 'false';
                $bul_tmp = '<span class="tp-bullet-image"></span><span class="tp-bullet-title"></span>';
                if (!empty($all_navs)) {
                    foreach ($all_navs as $cur_nav) {
                        if ($cur_nav['handle'] == $navigation_bullets_style) {
                            if (isset($cur_nav['markup']['bullets'])) {
                                $bul_tmp = $cur_nav['markup']['bullets'];
                            }
                            if (isset($cur_nav['css']['bullets'])) {
                                $nav_css .= $cur_nav['css']['bullets'] . "\n";
                            }
                            break;
                        }
                    }
                }
                $navigation_bullets_style = $rs_nav->translate_navigation($navigation_bullets_style);
                if ($add_comma) {
                    echo '							,' . "\n";
                }
                $add_comma = true;
                echo '							bullets: {' . "\n";
                echo '								enable:';
                echo $this->slider->getParam('enable_bullets', 'off') == 'on' ? 'true' : 'false';
                echo ',' . "\n";
                echo '								hide_onmobile:' . $hide_bullets_on_mobile . ',' . "\n";
                if ($hide_bullets_on_mobile === 'true') {
                    echo '								hide_under:' . esc_attr($this->slider->getParam('bullets_under_hidden', '0', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                if ($hide_bullets_over === 'true') {
                    echo '								hide_over:' . esc_attr($this->slider->getParam('bullets_over_hidden', '0', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                echo '								style:"' . esc_attr($navigation_bullets_style) . '",' . "\n";
                echo '								hide_onleave:' . $bullets_always_on . ',' . "\n";
                if ($bullets_always_on === 'true') {
                    echo '								hide_delay:' . esc_attr($this->slider->getParam('hide_bullets', '200', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                    echo '								hide_delay_mobile:' . esc_attr($this->slider->getParam('hide_bullets_mobile', '1200', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                echo '								direction:"' . esc_attr($this->slider->getParam('bullets_direction', 'horizontal')) . '",' . "\n";
                echo '								h_align:"' . esc_attr($this->slider->getParam('bullets_align_hor', 'right')) . '",' . "\n";
                echo '								v_align:"' . esc_attr($this->slider->getParam('bullets_align_vert', 'center')) . '",' . "\n";
                echo '								h_offset:' . esc_attr($this->slider->getParam('bullets_offset_hor', '20', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								v_offset:' . esc_attr($this->slider->getParam('bullets_offset_vert', '0', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								space:' . esc_attr($this->slider->getParam('bullets_space', '5', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								tmp:\'';
                echo preg_replace("/\r|\n/", "", $bul_tmp);
                echo '\'' . "\n";
                echo '							}' . "\n";
            }
            if ($enable_thumbnails == 'on') {
                $thumbnails_style = $this->slider->getParam('thumbnails_style', 'round');
                $thumbs_always_on = $this->slider->getParam('thumbs_always_on', 'true') == 'true' ? 'true' : 'false';
                $hide_thumbs_on_mobile = $this->slider->getParam('hide_thumbs_on_mobile', 'off') == 'on' ? 'true' : 'false';
                $hide_thumbs_over = $this->slider->getParam('hide_thumbs_over', 'off') == 'on' ? 'true' : 'false';
                $thumbs_tmp = '<span class="tp-thumb-image"></span><span class="tp-thumb-title"></span>';
                if (!empty($all_navs)) {
                    foreach ($all_navs as $cur_nav) {
                        if ($cur_nav['handle'] == $thumbnails_style) {
                            if (isset($cur_nav['markup']['thumbs'])) {
                                $thumbs_tmp = $cur_nav['markup']['thumbs'];
                            }
                            if (isset($cur_nav['css']['thumbs'])) {
                                $nav_css .= $cur_nav['css']['thumbs'] . "\n";
                            }
                            break;
                        }
                    }
                }
                $thumbnails_style = $rs_nav->translate_navigation($thumbnails_style);
                if ($add_comma) {
                    echo '							,' . "\n";
                }
                $add_comma = true;
                echo '							thumbnails: {' . "\n";
                echo '								style:"' . esc_attr($thumbnails_style) . '",' . "\n";
                echo '								enable:';
                echo $this->slider->getParam('enable_thumbnails', 'off') == 'on' ? 'true' : 'false';
                echo ',' . "\n";
                echo '								width:' . esc_attr($this->slider->getParam('thumb_width', '100', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								height:' . esc_attr($this->slider->getParam('thumb_height', '50', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								min_width:' . esc_attr($this->slider->getParam('thumb_width_min', '100', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								wrapper_padding:' . esc_attr($this->slider->getParam('thumbnails_padding', '5', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								wrapper_color:"' . esc_attr($this->slider->getParam('thumbnails_wrapper_color', 'transparent')) . '",' . "\n";
                echo '								wrapper_opacity:"' . esc_attr(round($this->slider->getParam('thumbnails_wrapper_opacity', '100') / 100, 2)) . '",' . "\n";
                echo '								tmp:\'';
                echo preg_replace("/\r|\n/", "", $thumbs_tmp);
                echo '\',' . "\n";
                echo '								visibleAmount:' . esc_attr($this->slider->getParam('thumb_amount', '5', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								hide_onmobile:' . $hide_thumbs_on_mobile . ',' . "\n";
                if ($hide_thumbs_on_mobile === 'true') {
                    echo '								hide_under:' . esc_attr($this->slider->getParam('thumbs_under_hidden', '0', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                if ($hide_thumbs_over === 'true') {
                    echo '								hide_over:' . esc_attr($this->slider->getParam('thumbs_over_hidden', '0', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                echo '								hide_onleave:' . $thumbs_always_on . ',' . "\n";
                if ($thumbs_always_on === 'true') {
                    echo '								hide_delay:' . esc_attr($this->slider->getParam('hide_thumbs', '200', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                    echo '								hide_delay_mobile:' . esc_attr($this->slider->getParam('hide_thumbs_mobile', '1200', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                echo '								direction:"' . esc_attr($this->slider->getParam('thumbnail_direction', 'horizontal')) . '",' . "\n";
                echo '								span:';
                echo $this->slider->getParam('span_thumbnails_wrapper', 'off') == 'on' ? 'true' : 'false';
                echo ',' . "\n";
                echo '								position:"' . esc_attr($this->slider->getParam('thumbnails_inner_outer', 'inner')) . '",' . "\n";
                echo '								space:' . esc_attr($this->slider->getParam('thumbnails_space', '5', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								h_align:"' . esc_attr($this->slider->getParam('thumbnails_align_hor', 'left')) . '",' . "\n";
                echo '								v_align:"' . esc_attr($this->slider->getParam('thumbnails_align_vert', 'center')) . '",' . "\n";
                echo '								h_offset:' . esc_attr($this->slider->getParam('thumbnails_offset_hor', '20', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								v_offset:' . esc_attr($this->slider->getParam('thumbnails_offset_vert', '0', RevSlider::FORCE_NUMERIC)) . "\n";
                echo '							}' . "\n";
            }
            if ($enable_tabs == 'on') {
                $tabs_style = $this->slider->getParam('tabs_style', 'round');
                $tabs_always_on = $this->slider->getParam('tabs_always_on', 'true') == 'true' ? 'true' : 'false';
                $hide_tabs_on_mobile = $this->slider->getParam('hide_tabs_on_mobile', 'off') == 'on' ? 'true' : 'false';
                $hide_tabs_over = $this->slider->getParam('hide_tabs_over', 'off') == 'on' ? 'true' : 'false';
                $tabs_tmp = '<span class="tp-thumb-image"></span>';
                if (!empty($all_navs)) {
                    foreach ($all_navs as $cur_nav) {
                        if ($cur_nav['handle'] == $tabs_style) {
                            if (isset($cur_nav['markup']['tabs'])) {
                                $tabs_tmp = $cur_nav['markup']['tabs'];
                            }
                            if (isset($cur_nav['css']['tabs'])) {
                                $nav_css .= $cur_nav['css']['tabs'] . "\n";
                            }
                            break;
                        }
                    }
                }
                $tabs_style = $rs_nav->translate_navigation($tabs_style);
                if ($add_comma) {
                    echo '							,' . "\n";
                }
                $add_comma = true;
                echo '							tabs: {' . "\n";
                echo '								style:"' . esc_attr($tabs_style) . '",' . "\n";
                echo '								enable:';
                echo $this->slider->getParam('enable_tabs', 'off') == 'on' ? 'true' : 'false';
                echo ',' . "\n";
                echo '								width:' . esc_attr($this->slider->getParam('tabs_width', '100', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								height:' . esc_attr($this->slider->getParam('tabs_height', '50', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								min_width:' . esc_attr($this->slider->getParam('tabs_width_min', '100', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								wrapper_padding:' . esc_attr($this->slider->getParam('tabs_padding', '5', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								wrapper_color:"' . esc_attr($this->slider->getParam('tabs_wrapper_color', 'transparent')) . '",' . "\n";
                echo '								wrapper_opacity:"' . esc_attr(round($this->slider->getParam('tabs_wrapper_opacity', '100') / 100, 2)) . '",' . "\n";
                echo '								tmp:\'';
                echo preg_replace("/\r|\n/", "", $tabs_tmp);
                echo '\',' . "\n";
                echo '								visibleAmount: ' . esc_attr($this->slider->getParam('tabs_amount', '5', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								hide_onmobile: ' . $hide_tabs_on_mobile . ',' . "\n";
                if ($hide_tabs_on_mobile === 'true') {
                    echo '								hide_under:' . esc_attr($this->slider->getParam('tabs_under_hidden', '0', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                if ($hide_tabs_over === 'true') {
                    echo '								hide_over:' . esc_attr($this->slider->getParam('tabs_over_hidden', '0', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                echo '								hide_onleave:' . $tabs_always_on . ',' . "\n";
                if ($tabs_always_on === 'true') {
                    echo '								hide_delay:' . esc_attr($this->slider->getParam('hide_tabs', '200', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                    echo '								hide_delay_mobile:' . esc_attr($this->slider->getParam('hide_tabs_mobile', '1200', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                }
                echo '								hide_delay:' . esc_attr($this->slider->getParam('hide_tabs', '200', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								direction:"' . esc_attr($this->slider->getParam('tabs_direction', 'horizontal')) . '",' . "\n";
                echo '								span:';
                echo $this->slider->getParam('span_tabs_wrapper', 'off') == 'on' ? 'true' : 'false';
                echo ',' . "\n";
                echo '								position:"' . esc_attr($this->slider->getParam('tabs_inner_outer', 'inner')) . '",' . "\n";
                echo '								space:' . esc_attr($this->slider->getParam('tabs_space', '5', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								h_align:"' . esc_attr($this->slider->getParam('tabs_align_hor', 'left')) . '",' . "\n";
                echo '								v_align:"' . esc_attr($this->slider->getParam('tabs_align_vert', 'center')) . '",' . "\n";
                echo '								h_offset:' . esc_attr($this->slider->getParam('tabs_offset_hor', '20', RevSlider::FORCE_NUMERIC)) . ',' . "\n";
                echo '								v_offset:' . esc_attr($this->slider->getParam('tabs_offset_vert', '0', RevSlider::FORCE_NUMERIC)) . "\n";
                echo '							}' . "\n";
            }
            echo '						},' . "\n";
        } else {
            //maybe write navigation stuff still here
            echo '						navigation: {' . "\n";
            if ($slider_type !== 'hero') {
                echo '							onHoverStop:"' . esc_attr($this->slider->getParam("stop_on_hover", "on")) . '",' . "\n";
            }
            echo '						},' . "\n";
        }
        if ($slider_type == 'carousel') {
            $car_inf = $this->slider->getParam('carousel_infinity', 'off');
            $car_space = $this->slider->getParam('carousel_space', 0, RevSlider::FORCE_NUMERIC);
            $car_stretch = $this->slider->getParam('carousel_stretch', 'off');
            $car_maxitems = $this->slider->getParam('carousel_maxitems', 5, RevSlider::FORCE_NUMERIC);
            $car_fadeout = $this->slider->getParam('carousel_fadeout', 'on');
            $car_varyfade = $this->slider->getParam('carousel_varyfade', 'off');
            $car_hpos = $this->slider->getParam('carousel_hposition', 'center');
            $car_vpos = $this->slider->getParam('carousel_vposition', 'center');
            $carousel_rotation = $this->slider->getParam('carousel_rotation', 'off');
            $car_maxrotation = $this->slider->getParam('carousel_maxrotation', 90, RevSlider::FORCE_NUMERIC);
            $car_varyrotate = $this->slider->getParam('carousel_varyrotate', 'off');
            $carousel_scale = $this->slider->getParam('carousel_scale', 'off');
            $car_varyscale = $this->slider->getParam('carousel_varyscale', 'off');
            $car_scaledown = $this->slider->getParam('carousel_scaledown', 50, RevSlider::FORCE_NUMERIC);
            if ($car_scaledown > 100) {
                $car_scaledown = 100;
            }
            $car_borderr = $this->slider->getParam('carousel_borderr', 0, RevSlider::FORCE_NUMERIC);
            $car_borderr_unit = $this->slider->getParam('carousel_borderr_unit', 'px');
            $car_padding_top = $this->slider->getParam('carousel_padding_top', 0, RevSlider::FORCE_NUMERIC);
            $car_padding_bottom = $this->slider->getParam('carousel_padding_bottom', 0, RevSlider::FORCE_NUMERIC);
            echo '						carousel: {' . "\n";
            if ($car_borderr > 0) {
                echo '							border_radius: "' . esc_attr($car_borderr . $car_borderr_unit) . '",' . "\n";
            }
            if ($car_padding_top > 0) {
                echo '							padding_top: "' . esc_attr($car_padding_top) . '",' . "\n";
            }
            if ($car_padding_bottom > 0) {
                echo '							padding_bottom: "' . esc_attr($car_padding_bottom) . '",' . "\n";
            }
            if ($carousel_rotation == 'on') {
                echo '							maxRotation: ' . esc_attr($car_maxrotation) . ',' . "\n";
                echo '							vary_rotation: "' . esc_attr($car_varyrotate) . '",' . "\n";
            }
            if ($carousel_scale == 'on') {
                echo '							minScale: ' . esc_attr($car_scaledown) . ',' . "\n";
                echo '							vary_scale: "' . esc_attr($car_varyscale) . '",' . "\n";
            }
            echo '							horizontal_align: "' . esc_attr($car_hpos) . '",' . "\n";
            echo '							vertical_align: "' . esc_attr($car_vpos) . '",' . "\n";
            echo '							fadeout: "' . esc_attr($car_fadeout) . '",' . "\n";
            if ($car_fadeout == 'on') {
                echo '							vary_fade: "' . esc_attr($car_varyfade) . '",' . "\n";
            }
            echo '							maxVisibleItems: ' . esc_attr($car_maxitems) . ',' . "\n";
            echo '							infinity: "' . esc_attr($car_inf) . '",' . "\n";
            echo '							space: ' . esc_attr($car_space) . ',' . "\n";
            echo '							stretch: "' . esc_attr($car_stretch) . '"' . "\n";
            echo '						},' . "\n";
        }
        $label_viewport = $this->slider->getParam('label_viewport', 'off');
        $viewport_start = $this->slider->getParam('viewport_start', 'wait');
        $viewport_area = $this->slider->getParam('viewport_area', 80, RevSlider::FORCE_NUMERIC);
        if ($label_viewport === 'on') {
            echo '						viewPort: {' . "\n";
            echo '							enable:true,' . "\n";
            echo '							outof:"' . esc_attr($viewport_start) . '",' . "\n";
            echo '							visible_area:"' . esc_attr($viewport_area) . '%"' . "\n";
            echo '						},' . "\n";
        }
        if (isset($csizes['level']) && !empty($csizes['level'])) {
            echo '						responsiveLevels:[' . $csizes['level'] . '],' . "\n";
            echo '						gridwidth:[' . $csizes['width'] . '],' . "\n";
            echo '						gridheight:[' . $csizes['height'] . '],' . "\n";
        } else {
            echo '						gridwidth:' . $csizes['width'] . ',' . "\n";
            echo '						gridheight:' . $csizes['height'] . ',' . "\n";
        }
        $lazyLoad = $this->slider->getParam('lazy_load_type', false);
        if ($lazyLoad === false) {
            //do fallback checks to removed lazy_load value since version 5.0 and replaced with an enhanced version
            $old_ll = $this->slider->getParam('lazy_load', 'off');
            $lazyLoad = $old_ll == 'on' ? 'all' : 'none';
        }
        echo '						lazyType:"' . esc_attr($lazyLoad) . '",' . "\n";
        $minHeight = $this->slider->getParam('slider_type') !== 'fullscreen' ? $this->slider->getParam('min_height', '0', RevSlider::FORCE_NUMERIC) : $this->slider->getParam('fullscreen_min_height', '0', RevSlider::FORCE_NUMERIC);
        if ($minHeight > 0) {
            echo '						minHeight:' . $minHeight . ',' . "\n";
        }
        if ($use_parallax == 'on') {
            echo '						parallax: {' . "\n";
            echo '							type:"' . esc_attr($parallax_type) . '",' . "\n";
            echo '							origo:"' . esc_attr($parallax_origo) . '",' . "\n";
            echo '							speed:' . esc_attr($parallax_speed) . ',' . "\n";
            echo '							levels:[' . esc_attr($parallax_level) . '],' . "\n";
            if ($disable_parallax_mobile == 'on') {
                echo '							disable_onmobile:"on"' . "\n";
            }
            echo '						},' . "\n";
        }
        echo '						shadow:' . esc_attr($this->slider->getParam("shadow_type", "2")) . ',' . "\n";
        if ($use_spinner == '-1') {
            echo '						spinner:"off",' . "\n";
        } else {
            echo '						spinner:"spinner' . esc_attr($use_spinner) . '",' . "\n";
        }
        if ($slider_type !== 'hero') {
            echo '						stopLoop:"' . esc_attr($stopSlider) . '",' . "\n";
            echo '						stopAfterLoops:' . esc_attr($stopAfterLoops) . ',' . "\n";
            echo '						stopAtSlide:' . esc_attr($stopAtSlide) . ',' . "\n";
            echo '						shuffle:"' . esc_attr($this->slider->getParam("shuffle", "off")) . '",' . "\n";
        }
        echo '						autoHeight:"' . esc_attr($this->slider->getParam("auto_height", 'off')) . '",' . "\n";
        if ($this->slider->getParam("slider_type") == "fullscreen") {
            echo '						fullScreenAutoWidth:"' . esc_attr($this->slider->getParam("autowidth_force", "off")) . '",' . "\n";
            echo '						fullScreenAlignForce:"' . esc_attr($this->slider->getParam("full_screen_align_force", "off")) . '",' . "\n";
            echo '						fullScreenOffsetContainer: "' . esc_attr($this->slider->getParam("fullscreen_offset_container", "")) . '",' . "\n";
            echo '						fullScreenOffset: "' . esc_attr($this->slider->getParam("fullscreen_offset_size", "")) . '",' . "\n";
        }
        if ($enable_progressbar !== 'on' || $slider_type == 'hero') {
            echo '						disableProgressBar:"on",' . "\n";
        }
        echo '						hideThumbsOnMobile:"' . esc_attr($hideThumbsOnMobile) . '",' . "\n";
        echo '						hideSliderAtLimit:' . esc_attr($hideSliderAtLimit) . ',' . "\n";
        echo '						hideCaptionAtLimit:' . esc_attr($hideCaptionAtLimit) . ',' . "\n";
        echo '						hideAllCaptionAtLilmit:' . esc_attr($hideAllCaptionAtLimit) . ',' . "\n";
        if ($slider_type !== 'hero') {
            $start_with_slide_enable = $this->slider->getParam('start_with_slide_enable', 'off');
            if ($start_with_slide_enable == 'on') {
                echo '						startWithSlide:' . esc_attr($startWithSlide) . ',' . "\n";
            }
        }
        echo '						debugMode:' . $debugmode . ',' . "\n";
        echo '						fallbacks: {' . "\n";
        echo '							simplifyAll:"' . esc_attr($this->slider->getParam('simplify_ie8_ios4', 'off')) . '",' . "\n";
        if ($slider_type !== 'hero') {
            echo '							nextSlideOnWindowFocus:"' . esc_attr($this->slider->getParam('next_slide_on_window_focus', 'off')) . '",' . "\n";
        }
        $dfl = $this->slider->getParam('disable_focus_listener', 'off') == 'on' ? 'true' : 'false';
        echo '							disableFocusListener:' . $dfl . ',' . "\n";
        if ($disableKenBurnOnMobile == 'on') {
            echo '						panZoomDisableOnMobile:"on",' . "\n";
        }
        echo '						}' . "\n";
        echo '					});' . "\n";
        if ($this->slider->getParam("custom_javascript", '') !== '') {
            echo stripslashes($this->slider->getParam("custom_javascript", ''));
        }
        echo '				}' . "\n";
        echo '			});	/*ready*/' . "\n";
        ?>
		</script>
		<?php 
        if ($js_to_footer && $this->previewMode == false && $markup_export == false) {
            $js_content = ob_get_contents();
            ob_clean();
            ob_end_clean();
            $this->rev_inline_js = $js_content;
            add_action('wp_footer', array($this, 'add_inline_js'));
        }
        if ($markup_export === true) {
            echo '<!-- /SCRIPT -->';
        }
        switch ($use_spinner) {
            case '1':
            case '2':
                if (!is_admin()) {
                    ?>
<script>
					var htmlDivCss = ' #<?php 
                    echo $this->sliderHtmlID_wrapper;
                    ?>
 .tp-loader.spinner<?php 
                    echo $use_spinner;
                    ?>
{ background-color: <?php 
                    echo $spinner_color;
                    ?>
 !important; } ';
					var htmlDiv = document.getElementById('rs-plugin-settings-inline-css');
					if(htmlDiv) {
						htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
					}
					else{
						var htmlDiv = document.createElement('div');
						htmlDiv.innerHTML = '<style>' + htmlDivCss + '</style>';
						document.getElementsByTagName('head')[0].appendChild(htmlDiv.childNodes[0]);
					}
					</script>
					<?php 
                } else {
                    if ($markup_export === true) {
                        echo '<!-- STYLE -->';
                    }
                    echo '<style type="text/css">	#' . $this->sliderHtmlID_wrapper . ' .tp-loader.spinner' . $use_spinner . '{ background-color: ' . $spinner_color . ' !important; } </style>';
                    if ($markup_export === true) {
                        echo '<!-- /STYLE -->';
                    }
                }
                break;
            case '3':
            case '4':
                if (!is_admin()) {
                    ?>
<script>
					var htmlDivCss = '	#<?php 
                    echo $this->sliderHtmlID_wrapper;
                    ?>
 .tp-loader.spinner<?php 
                    echo $use_spinner;
                    ?>
 div { background-color: <?php 
                    echo $spinner_color;
                    ?>
 !important; } ';
					var htmlDiv = document.getElementById('rs-plugin-settings-inline-css');
					if(htmlDiv) {
						htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
					}
					else{
						var htmlDiv = document.createElement('div');
						htmlDiv.innerHTML = '<style>' + htmlDivCss + '</style>';
						document.getElementsByTagName('head')[0].appendChild(htmlDiv.childNodes[0]);
					}
					</script>
					<?php 
                } else {
                    if ($markup_export === true) {
                        echo '<!-- STYLE -->';
                    }
                    echo '<style type="text/css">	#' . $this->sliderHtmlID_wrapper . ' .tp-loader.spinner' . $use_spinner . '{ background-color: ' . $spinner_color . ' !important; } </style>';
                    if ($markup_export === true) {
                        echo '<!-- /STYLE -->';
                    }
                }
                break;
            case '0':
            case '5':
            default:
                break;
        }
        if ($this->slider->getParam("custom_css", '') !== '') {
            if (!is_admin()) {
                ?>
<script>
					var htmlDivCss = unescape("<?php 
                echo RevSliderCssParser::compress_css(rawurlencode(stripslashes($this->slider->getParam('custom_css', ''))));
                ?>
");
					var htmlDiv = document.getElementById('rs-plugin-settings-inline-css');
					if(htmlDiv) {
						htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
					}
					else{
						var htmlDiv = document.createElement('div');
						htmlDiv.innerHTML = '<style>' + htmlDivCss + '</style>';
						document.getElementsByTagName('head')[0].appendChild(htmlDiv.childNodes[0]);
					}
				  </script><?php 
            } else {
                if ($markup_export === true) {
                    echo '<!-- STYLE -->';
                }
                ?>
<style type="text/css"><?php 
                echo RevSliderCssParser::compress_css(stripslashes($this->slider->getParam('custom_css', '')));
                ?>
</style><?php 
                if ($markup_export === true) {
                    echo '<!-- /STYLE -->';
                }
            }
        }
        if (trim($nav_css) !== '') {
            if (!is_admin()) {
                ?>
<script>
					var htmlDivCss = unescape("<?php 
                echo RevSliderCssParser::compress_css(rawurlencode($nav_css));
                ?>
");
					var htmlDiv = document.getElementById('rs-plugin-settings-inline-css');
					if(htmlDiv) {
						htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
					}
					else{
						var htmlDiv = document.createElement('div');
						htmlDiv.innerHTML = '<style>' + htmlDivCss + '</style>';
						document.getElementsByTagName('head')[0].appendChild(htmlDiv.childNodes[0]);
					}
				  </script>
				<?php 
            } else {
                if ($markup_export === true) {
                    echo '<!-- STYLE -->';
                }
                ?>
				<style type="text/css"><?php 
                echo RevSliderCssParser::compress_css($nav_css);
                ?>
</style>
				<?php 
                if ($markup_export === true) {
                    echo '<!-- /STYLE -->';
                }
            }
        }
    }
Esempio n. 6
0
 /**
  * 
  * export slider from data, output a file for download
  */
 public function exportSlider($useDummy = false)
 {
     $this->validateInited();
     $sliderParams = $this->getParamsForExport();
     $arrSlides = $this->getSlidesForExport($useDummy);
     $arrStaticSlide = $this->getStaticSlideForExport($useDummy);
     $usedCaptions = array();
     $usedAnimations = array();
     $usedImages = array();
     $usedSVG = array();
     $usedVideos = array();
     $usedNavigations = array();
     $cfw = array();
     if (!empty($arrSlides) && count($arrSlides) > 0) {
         $cfw = array_merge($cfw, $arrSlides);
     }
     if (!empty($arrStaticSlide) && count($arrStaticSlide) > 0) {
         $cfw = array_merge($cfw, $arrStaticSlide);
     }
     //remove image_id as it is not needed in export
     //plus remove background image if solid color or transparent
     if (!empty($arrSlides)) {
         foreach ($arrSlides as $k => $s) {
             if (isset($arrSlides[$k]['params']['image_id'])) {
                 unset($arrSlides[$k]['params']['image_id']);
             }
             if (isset($arrSlides[$k]['params']["background_type"]) && ($arrSlides[$k]['params']["background_type"] == 'solid' || $arrSlides[$k]['params']["background_type"] == "trans" || $arrSlides[$k]['params']["background_type"] == "transparent")) {
                 if (isset($arrSlides[$k]['params']['background_image'])) {
                     $arrSlides[$k]['params']['background_image'] = '';
                 }
             }
         }
     }
     if (!empty($arrStaticSlide)) {
         foreach ($arrStaticSlide as $k => $s) {
             if (isset($arrStaticSlide[$k]['params']['image_id'])) {
                 unset($arrStaticSlide[$k]['params']['image_id']);
             }
             if (isset($arrStaticSlide[$k]['params']["background_type"]) && ($arrStaticSlide[$k]['params']["background_type"] == 'solid' || $arrStaticSlide[$k]['params']["background_type"] == "trans" || $arrStaticSlide[$k]['params']["background_type"] == "transparent")) {
                 if (isset($arrStaticSlide[$k]['params']['background_image'])) {
                     $arrStaticSlide[$k]['params']['background_image'] = '';
                 }
             }
         }
     }
     if (!empty($cfw) && count($cfw) > 0) {
         foreach ($cfw as $key => $slide) {
             //check if we are transparent and so on
             if (isset($slide['params']['image']) && $slide['params']['image'] != '') {
                 $usedImages[$slide['params']['image']] = true;
             }
             //['params']['image'] background url
             if (isset($slide['params']['background_image']) && $slide['params']['background_image'] != '') {
                 $usedImages[$slide['params']['background_image']] = true;
             }
             //['params']['image'] background url
             if (isset($slide['params']['slide_thumb']) && $slide['params']['slide_thumb'] != '') {
                 $usedImages[$slide['params']['slide_thumb']] = true;
             }
             //['params']['image'] background url
             //html5 video
             if (isset($slide['params']['background_type']) && $slide['params']['background_type'] == 'html5') {
                 if (isset($slide['params']['slide_bg_html_mpeg']) && $slide['params']['slide_bg_html_mpeg'] != '') {
                     $usedVideos[$slide['params']['slide_bg_html_mpeg']] = true;
                 }
                 if (isset($slide['params']['slide_bg_html_webm']) && $slide['params']['slide_bg_html_webm'] != '') {
                     $usedVideos[$slide['params']['slide_bg_html_webm']] = true;
                 }
                 if (isset($slide['params']['slide_bg_html_ogv']) && $slide['params']['slide_bg_html_ogv'] != '') {
                     $usedVideos[$slide['params']['slide_bg_html_ogv']] = true;
                 }
             } else {
                 if (isset($slide['params']['slide_bg_html_mpeg']) && $slide['params']['slide_bg_html_mpeg'] != '') {
                     $slide['params']['slide_bg_html_mpeg'] = '';
                 }
                 if (isset($slide['params']['slide_bg_html_webm']) && $slide['params']['slide_bg_html_webm'] != '') {
                     $slide['params']['slide_bg_html_webm'] = '';
                 }
                 if (isset($slide['params']['slide_bg_html_ogv']) && $slide['params']['slide_bg_html_ogv'] != '') {
                     $slide['params']['slide_bg_html_ogv'] = '';
                 }
             }
             //image thumbnail
             if (isset($slide['layers']) && !empty($slide['layers']) && count($slide['layers']) > 0) {
                 foreach ($slide['layers'] as $lKey => $layer) {
                     if (isset($layer['style']) && $layer['style'] != '') {
                         $usedCaptions[$layer['style']] = true;
                     }
                     if (isset($layer['animation']) && $layer['animation'] != '' && strpos($layer['animation'], 'customin') !== false) {
                         $usedAnimations[str_replace('customin-', '', $layer['animation'])] = true;
                     }
                     if (isset($layer['endanimation']) && $layer['endanimation'] != '' && strpos($layer['endanimation'], 'customout') !== false) {
                         $usedAnimations[str_replace('customout-', '', $layer['endanimation'])] = true;
                     }
                     if (isset($layer['image_url']) && $layer['image_url'] != '') {
                         $usedImages[$layer['image_url']] = true;
                     }
                     //image_url if image caption
                     if (isset($layer['type']) && ($layer['type'] == 'video' || $layer['type'] == 'audio')) {
                         $video_data = isset($layer['video_data']) ? (array) $layer['video_data'] : array();
                         if (!empty($video_data) && isset($video_data['video_type']) && $video_data['video_type'] == 'html5') {
                             if (isset($video_data['urlPoster']) && $video_data['urlPoster'] != '') {
                                 $usedImages[$video_data['urlPoster']] = true;
                             }
                             if (isset($video_data['urlMp4']) && $video_data['urlMp4'] != '') {
                                 $usedVideos[$video_data['urlMp4']] = true;
                             }
                             if (isset($video_data['urlWebm']) && $video_data['urlWebm'] != '') {
                                 $usedVideos[$video_data['urlWebm']] = true;
                             }
                             if (isset($video_data['urlOgv']) && $video_data['urlOgv'] != '') {
                                 $usedVideos[$video_data['urlOgv']] = true;
                             }
                         } elseif (!empty($video_data) && isset($video_data['video_type']) && $video_data['video_type'] != 'html5') {
                             //video cover image
                             if ($video_data['video_type'] == 'audio') {
                                 if (isset($video_data['urlAudio']) && $video_data['urlAudio'] != '') {
                                     $usedVideos[$video_data['urlAudio']] = true;
                                 }
                             } else {
                                 if (isset($video_data['previewimage']) && $video_data['previewimage'] != '') {
                                     $usedImages[$video_data['previewimage']] = true;
                                 }
                             }
                         }
                         if ($video_data['video_type'] != 'html5') {
                             $video_data['urlMp4'] = '';
                             $video_data['urlWebm'] = '';
                             $video_data['urlOgv'] = '';
                         }
                         if ($video_data['video_type'] != 'audio') {
                             $video_data['urlAudio'] = '';
                         }
                     }
                     if (isset($layer['type']) && $layer['type'] == 'svg') {
                         if (isset($layer['svg']) && isset($layer['svg']->src)) {
                             $usedSVG[$layer['svg']->src] = true;
                         }
                     }
                 }
             }
         }
     }
     $arrSliderExport = array("params" => $sliderParams, "slides" => $arrSlides);
     if (!empty($arrStaticSlide)) {
         $arrSliderExport['static_slides'] = $arrStaticSlide;
     }
     $strExport = serialize($arrSliderExport);
     //$strExportAnim = serialize(RevSliderOperations::getFullCustomAnimations());
     $exportname = !empty($this->alias) ? $this->alias . '.zip' : "slider_export.zip";
     //add navigations if not default animation
     if (isset($sliderParams['navigation_arrow_style'])) {
         $usedNavigations[$sliderParams['navigation_arrow_style']] = true;
     }
     if (isset($sliderParams['navigation_bullets_style'])) {
         $usedNavigations[$sliderParams['navigation_bullets_style']] = true;
     }
     if (isset($sliderParams['thumbnails_style'])) {
         $usedNavigations[$sliderParams['thumbnails_style']] = true;
     }
     if (isset($sliderParams['tabs_style'])) {
         $usedNavigations[$sliderParams['tabs_style']] = true;
     }
     $navs = false;
     if (!empty($usedNavigations)) {
         $navs = RevSliderNavigation::export_navigation($usedNavigations);
         if ($navs !== false) {
             $navs = serialize($navs);
         }
     }
     $styles = '';
     if (!empty($usedCaptions)) {
         $captions = array();
         foreach ($usedCaptions as $class => $val) {
             $cap = RevSliderOperations::getCaptionsContentArray($class);
             //set also advanced styles here...
             if (!empty($cap)) {
                 $captions[] = $cap;
             }
         }
         $styles = RevSliderCssParser::parseArrayToCss($captions, "\n", true);
     }
     $animations = '';
     if (!empty($usedAnimations)) {
         $animation = array();
         foreach ($usedAnimations as $anim => $val) {
             $anima = RevSliderOperations::getFullCustomAnimationByID($anim);
             if ($anima !== false) {
                 $animation[] = $anima;
             }
         }
         if (!empty($animation)) {
             $animations = serialize($animation);
         }
     }
     $usedImages = array_merge($usedImages, $usedVideos);
     $usepcl = false;
     if (class_exists('ZipArchive')) {
         $zip = new ZipArchive();
         $success = $zip->open(RevSliderGlobals::$uploadsUrlExportZip, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE);
         if ($success !== true) {
             throwError("Can't create zip file: " . RevSliderGlobals::$uploadsUrlExportZip);
         }
     } else {
         //fallback to pclzip
         require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
         $pclzip = new PclZip(RevSliderGlobals::$uploadsUrlExportZip);
         //either the function uses die() or all is cool
         $usepcl = true;
     }
     //add svg to the zip
     if (!empty($usedSVG)) {
         $content_url = content_url();
         $content_path = ABSPATH . 'wp-content';
         $ud = wp_upload_dir();
         $up_dir = $ud['baseurl'];
         foreach ($usedSVG as $file => $val) {
             if (strpos($file, 'http') !== false) {
                 //remove all up to wp-content folder
                 $checkpath = str_replace($content_url, '', $file);
                 $checkpath2 = str_replace($up_dir, '', $file);
                 if ($checkpath2 === $file) {
                     //we have an SVG like whiteboard, fallback to older export
                     $checkpath2 = $checkpath;
                 }
                 if (is_file($content_path . $checkpath)) {
                     $strExport = str_replace($file, str_replace('/revslider/assets/svg', '', $checkpath2), $strExport);
                 }
             }
         }
     }
     //add images to zip
     if (!empty($usedImages)) {
         $upload_dir = RevSliderFunctionsWP::getPathUploads();
         $upload_dir_multisiteless = wp_upload_dir();
         $cont_url = $upload_dir_multisiteless['baseurl'];
         $cont_url_no_www = str_replace('www.', '', $upload_dir_multisiteless['baseurl']);
         $upload_dir_multisiteless = $upload_dir_multisiteless['basedir'] . '/';
         foreach ($usedImages as $file => $val) {
             if ($useDummy == "true") {
                 //only use dummy images
             } else {
                 //use the real images
                 if (strpos($file, 'http') !== false) {
                     $remove = false;
                     $checkpath = str_replace(array($cont_url, $cont_url_no_www), '', $file);
                     if (is_file($upload_dir . $checkpath)) {
                         if (!$usepcl) {
                             $zip->addFile($upload_dir . $checkpath, 'images/' . $checkpath);
                         } else {
                             $v_list = $pclzip->add($upload_dir . $checkpath, PCLZIP_OPT_REMOVE_PATH, $upload_dir, PCLZIP_OPT_ADD_PATH, 'images/');
                         }
                         $remove = true;
                     } elseif (is_file($upload_dir_multisiteless . $checkpath)) {
                         if (!$usepcl) {
                             $zip->addFile($upload_dir_multisiteless . $checkpath, 'images/' . $checkpath);
                         } else {
                             $v_list = $pclzip->add($upload_dir_multisiteless . $checkpath, PCLZIP_OPT_REMOVE_PATH, $upload_dir_multisiteless, PCLZIP_OPT_ADD_PATH, 'images/');
                         }
                         $remove = true;
                     }
                     if ($remove) {
                         //as its http, remove this from strexport
                         $strExport = str_replace(array($cont_url . $checkpath, $cont_url_no_www . $checkpath), $checkpath, $strExport);
                     }
                 } else {
                     if (is_file($upload_dir . $file)) {
                         if (!$usepcl) {
                             $zip->addFile($upload_dir . $file, 'images/' . $file);
                         } else {
                             $v_list = $pclzip->add($upload_dir . $file, PCLZIP_OPT_REMOVE_PATH, $upload_dir, PCLZIP_OPT_ADD_PATH, 'images/');
                         }
                     } elseif (is_file($upload_dir_multisiteless . $file)) {
                         if (!$usepcl) {
                             $zip->addFile($upload_dir_multisiteless . $file, 'images/' . $file);
                         } else {
                             $v_list = $pclzip->add($upload_dir_multisiteless . $file, PCLZIP_OPT_REMOVE_PATH, $upload_dir_multisiteless, PCLZIP_OPT_ADD_PATH, 'images/');
                         }
                     }
                 }
             }
         }
     }
     if (!$usepcl) {
         $zip->addFromString("slider_export.txt", $strExport);
         //add slider settings
     } else {
         $list = $pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'slider_export.txt', PCLZIP_ATT_FILE_CONTENT => $strExport)));
         if ($list == 0) {
             die("ERROR : '" . $pclzip->errorInfo(true) . "'");
         }
     }
     if (strlen(trim($animations)) > 0) {
         if (!$usepcl) {
             $zip->addFromString("custom_animations.txt", $animations);
             //add custom animations
         } else {
             $list = $pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'custom_animations.txt', PCLZIP_ATT_FILE_CONTENT => $animations)));
             if ($list == 0) {
                 die("ERROR : '" . $pclzip->errorInfo(true) . "'");
             }
         }
     }
     if (strlen(trim($styles)) > 0) {
         if (!$usepcl) {
             $zip->addFromString("dynamic-captions.css", $styles);
             //add dynamic styles
         } else {
             $list = $pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'dynamic-captions.css', PCLZIP_ATT_FILE_CONTENT => $styles)));
             if ($list == 0) {
                 die("ERROR : '" . $pclzip->errorInfo(true) . "'");
             }
         }
     }
     if (strlen(trim($navs)) > 0) {
         if (!$usepcl) {
             $zip->addFromString("navigation.txt", $navs);
             //add dynamic styles
         } else {
             $list = $pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'navigation.txt', PCLZIP_ATT_FILE_CONTENT => $navs)));
             if ($list == 0) {
                 die("ERROR : '" . $pclzip->errorInfo(true) . "'");
             }
         }
     }
     $static_css = RevSliderOperations::getStaticCss();
     if (trim($static_css) !== '') {
         if (!$usepcl) {
             $zip->addFromString("static-captions.css", $static_css);
             //add slider settings
         } else {
             $list = $pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'static-captions.css', PCLZIP_ATT_FILE_CONTENT => $static_css)));
             if ($list == 0) {
                 die("ERROR : '" . $pclzip->errorInfo(true) . "'");
             }
         }
     }
     $enable_slider_pack = apply_filters('revslider_slider_pack_export', false);
     if ($enable_slider_pack) {
         //allow for slider packs the automatic creation of the info.cfg
         if (!$usepcl) {
             $zip->addFromString('info.cfg', md5($this->alias));
             //add slider settings
         } else {
             $list = $pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'info.cfg', PCLZIP_ATT_FILE_CONTENT => md5($this->alias))));
             if ($list == 0) {
                 die("ERROR : '" . $pclzip->errorInfo(true) . "'");
             }
         }
     }
     if (!$usepcl) {
         $zip->close();
     } else {
         //do nothing
     }
     header("Content-type: application/zip");
     header("Content-Disposition: attachment; filename=" . $exportname);
     header("Pragma: no-cache");
     header("Expires: 0");
     readfile(RevSliderGlobals::$uploadsUrlExportZip);
     @unlink(RevSliderGlobals::$uploadsUrlExportZip);
     //delete file after sending it to user
     exit;
 }