Ejemplo n.º 1
0
 /**
  * onAjax action handler
  */
 public static function onFrontAjaxAction()
 {
     $db = new RevSliderDB();
     $slider = new RevSlider();
     $slide = new RevSlide();
     $operations = new RevSliderOperations();
     $token = self::getPostVar("token", false);
     //verify the token
     $isVerified = wp_verify_nonce($token, 'RevSlider_Front');
     $error = false;
     if ($isVerified) {
         $data = self::getPostVar('data', false);
         switch (self::getPostVar('client_action', false)) {
             case 'get_slider_html':
                 $id = intval(self::getPostVar('id', 0));
                 if ($id > 0) {
                     $html = '';
                     add_filter('revslider_add_js_delay', array('RevSliderAdmin', 'rev_set_js_delay'));
                     ob_start();
                     $slider_class = RevSliderOutput::putSlider($id);
                     $html = ob_get_contents();
                     //add styling
                     $custom_css = RevSliderOperations::getStaticCss();
                     $custom_css = RevSliderCssParser::compress_css($custom_css);
                     $styles = $db->fetch(RevSliderGlobals::$table_css);
                     $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
                     $styles = RevSliderCssParser::compress_css($styles);
                     $html .= '<style type="text/css">' . $custom_css . '</style>';
                     $html .= '<style type="text/css">' . $styles . '</style>';
                     ob_clean();
                     ob_end_clean();
                     $result = !empty($slider_class) && $html !== '' ? true : false;
                     if (!$result) {
                         $error = __('Slider not found', 'revslider');
                     } else {
                         if ($html !== false) {
                             self::ajaxResponseData($html);
                         } else {
                             $error = __('Slider not found', 'revslider');
                         }
                     }
                 } else {
                     $error = __('No Data Received', 'revslider');
                 }
                 break;
         }
     } else {
         $error = true;
     }
     if ($error !== false) {
         $showError = __('Loading Error', 'revslider');
         if ($error !== true) {
             $showError = __('Loading Error: ', 'revslider') . $error;
         }
         self::ajaxResponseError($showError, false);
     }
     exit;
 }
Ejemplo n.º 2
0
    public function previewOutputMarkup($sliderID, $output = null)
    {
        if ($sliderID == "empty_output") {
            $this->loadingMessageOutput();
            exit;
        }
        if ($output == null) {
            $output = new RevSliderOutput();
        }
        $slider = new RevSlider();
        $slider->initByID($sliderID);
        $isWpmlExists = RevSliderWpml::isWpmlExists();
        $useWpml = $slider->getParam("use_wpml", "off");
        $wpmlActive = false;
        if ($isWpmlExists && $useWpml == "on") {
            $wpmlActive = true;
            $arrLanguages = RevSliderWpml::getArrLanguages(false);
            //set current lang to output
            $currentLang = RevSliderFunctions::getPostGetVariable("lang");
            if (empty($currentLang)) {
                $currentLang = RevSliderWpml::getCurrentLang();
            }
            if (empty($currentLang)) {
                $currentLang = $arrLanguages[0];
            }
            $output->setLang($currentLang);
            $selectLangChoose = RevSliderFunctions::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true);
        }
        $output->setPreviewMode();
        //put the output html
        $urlPlugin = "http://yourpluginpath/";
        $urlPreviewPattern = RevSliderBase::$url_ajax_actions . "&client_action=preview_slider&only_markup=true&sliderid=" . $sliderID . "&lang=[lang]&nonce=[nonce]";
        $nonce = wp_create_nonce("revslider_actions");
        $setBase = is_ssl() ? "https://" : "http://";
        $http = is_ssl() ? 'https' : 'http';
        $operations = new RevSliderOperations();
        $arrValues = $operations->getGeneralSettingsValues();
        $set_diff_font = RevSliderFunctions::getVal($arrValues, "change_font_loading", '');
        if ($set_diff_font !== '') {
            $font_url = $set_diff_font;
        } else {
            $font_url = $http . '://fonts.googleapis.com/css?family=';
        }
        ?>
		<html>
		<head>
			<script type='text/javascript' src='<?php 
        echo $setBase;
        ?>
ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
		</head>
		<body style="padding:0px;margin:0px;">
			<?php 
        if ($wpmlActive == true) {
            ?>
				<div style="margin-bottom:10px;text-align:center;">
				<?php 
            _e("Choose language", REVSLIDER_TEXTDOMAIN);
            ?>
: <?php 
            echo $selectLangChoose;
            ?>
				</div>

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

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

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

				</script>
			<?php 
        }
        ?>
		<?php 
        ob_start();
        ?>
<link rel='stylesheet' href='<?php 
        echo $urlPlugin;
        ?>
css/settings.css?rev=<?php 
        echo RevSliderGlobals::SLIDER_REVISION;
        ?>
' type='text/css' media='all' />
		<script type='text/javascript' src='<?php 
        echo $urlPlugin;
        ?>
js/jquery.themepunch.tools.min.js?rev=<?php 
        echo RevSliderGlobals::SLIDER_REVISION;
        ?>
'></script>
		<script type='text/javascript' src='<?php 
        echo $urlPlugin;
        ?>
js/jquery.themepunch.revolution.min.js?rev=<?php 
        echo RevSliderGlobals::SLIDER_REVISION;
        ?>
'></script>
		<?php 
        $head_content = ob_get_contents();
        ob_clean();
        ob_end_clean();
        ob_start();
        $custom_css = RevSliderOperations::getStaticCss();
        echo $custom_css . "\n\n";
        echo '/*****************' . "\n";
        echo ' ** ' . __('CAPTIONS CSS', REVSLIDER_TEXTDOMAIN) . "\n";
        echo ' ****************/' . "\n\n";
        $db = new RevSliderDB();
        $styles = $db->fetch(RevSliderGlobals::$table_css);
        echo RevSliderCssParser::parseDbArrayToCss($styles, "\n");
        $style_content = ob_get_contents();
        ob_clean();
        ob_end_clean();
        ob_start();
        $output->putSliderBase($sliderID);
        $content = ob_get_contents();
        ob_clean();
        ob_end_clean();
        $script_content = substr($content, strpos($content, '<script type="text/javascript">'), strpos($content, '</script>') + 9 - strpos($content, '<script type="text/javascript">'));
        $content = htmlentities(str_replace($script_content, '', $content));
        $script_content = str_replace('				', '', $script_content);
        $script_content = str_replace(array('<script type="text/javascript">', '</script>'), '', $script_content);
        ?>
		<style>
			body 	 { font-family:sans-serif; font-size:12px;}
			textarea { background:#f1f1f1; border:#ddd; font-size:10px; line-height:16px; margin-bottom:40px; padding:10px;}
			.rev_cont_title { color:#000; text-decoration:none;font-size:14px; line-height:24px; font-weight:800;background: #D5D5D5;padding: 10px;}
			.rev_cont_title a, .rev_cont_title a:visited { margin-left:25px;font-size:12px;line-height:12px;float:right;background-color:#8e44ad; color:#fff; padding:8px 10px;text-decoration:none;}
			.rev_cont_title a:hover	  { background-color:#9b59b6;}
		</style>
		<p><?php 
        $dir = wp_upload_dir();
        if (!isset($dir['baseurl'])) {
            $dir['baseurl'] = '';
        }
        ?>
			<?php 
        _e('Replace image path:', REVSLIDER_TEXTDOMAIN);
        ?>
 <?php 
        _e('From:', REVSLIDER_TEXTDOMAIN);
        ?>
 <input type="text" name="orig_image_path" value="<?php 
        echo $dir['baseurl'];
        ?>
" /> <?php 
        _e('To:', REVSLIDER_TEXTDOMAIN);
        ?>
 <input type="text" name="replace_image_path" value="" /> <input id="rev_replace_images" type="button" name="replace_images" value="<?php 
        _e('Replace', REVSLIDER_TEXTDOMAIN);
        ?>
" />
		</p>

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

		<script>
			jQuery('body').on('click','.copytoclip',function() {
				jQuery("#"+jQuery(this).data('idt')).select();
			});
		</script>
		</body>
		</html>
		<?php 
        exit;
    }
Ejemplo n.º 3
0
    /**
     *
     * preview slider output
     * if output object is null - create object
     */
    public function previewOutput($sliderID, $output = null)
    {
        if ($sliderID == "empty_output") {
            $this->loadingMessageOutput();
            exit;
        }
        if ($output == null) {
            $output = new RevSliderOutput();
        }
        $slider = new RevSlider();
        $slider->initByID($sliderID);
        $isWpmlExists = RevSliderWpml::isWpmlExists();
        $useWpml = $slider->getParam("use_wpml", "off");
        $wpmlActive = false;
        if ($isWpmlExists && $useWpml == "on") {
            $wpmlActive = true;
            $arrLanguages = RevSliderWpml::getArrLanguages(false);
            //set current lang to output
            $currentLang = RevSliderFunctions::getPostGetVariable("lang");
            if (empty($currentLang)) {
                $currentLang = RevSliderWpml::getCurrentLang();
            }
            if (empty($currentLang)) {
                $currentLang = $arrLanguages[0];
            }
            $output->setLang($currentLang);
            $selectLangChoose = RevSliderFunctions::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true);
        }
        $output->setPreviewMode();
        //put the output html
        $urlPlugin = RS_PLUGIN_URL . 'public/assets/';
        $urlPreviewPattern = RevSliderBase::$url_ajax_actions . "&client_action=preview_slider&sliderid=" . $sliderID . "&lang=[lang]&nonce=[nonce]";
        $nonce = wp_create_nonce("revslider_actions");
        $setBase = is_ssl() ? "https://" : "http://";
        ?>
			<html>
				<head>
					<link rel='stylesheet' href='<?php 
        echo $urlPlugin;
        ?>
css/settings.css?rev=<?php 
        echo RevSliderGlobals::SLIDER_REVISION;
        ?>
' type='text/css' media='all' />
					<link rel='stylesheet' href='<?php 
        echo $urlPlugin;
        ?>
fonts/font-awesome/css/font-awesome.css?rev=<?php 
        echo RevSliderGlobals::SLIDER_REVISION;
        ?>
' type='text/css' media='all' />
					<link rel='stylesheet' href='<?php 
        echo $urlPlugin;
        ?>
fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css?rev=<?php 
        echo RevSliderGlobals::SLIDER_REVISION;
        ?>
' type='text/css' media='all' />
					<?php 
        $db = new RevSliderDB();
        $styles = $db->fetch(RevSliderGlobals::$table_css);
        $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
        $styles = RevSliderCssParser::compress_css($styles);
        echo '<style type="text/css">' . $styles . '</style>';
        //.$stylesinnerlayers
        $http = is_ssl() ? 'https' : 'http';
        $operations = new RevSliderOperations();
        $arrValues = $operations->getGeneralSettingsValues();
        $set_diff_font = RevSliderFunctions::getVal($arrValues, "change_font_loading", '');
        if ($set_diff_font !== '') {
            $font_url = $set_diff_font;
        } else {
            $font_url = $http . '://fonts.googleapis.com/css?family=';
        }
        $custom_css = RevSliderOperations::getStaticCss();
        echo '<style type="text/css">' . RevSliderCssParser::compress_css($custom_css) . '</style>';
        ?>

					<script type='text/javascript' src='<?php 
        echo $setBase;
        ?>
code.jquery.com/jquery-latest.min.js'></script>

					<script type='text/javascript' src='<?php 
        echo $urlPlugin;
        ?>
js/jquery.themepunch.tools.min.js?rev=<?php 
        echo RevSliderGlobals::SLIDER_REVISION;
        ?>
'></script>
					<script type='text/javascript' src='<?php 
        echo $urlPlugin;
        ?>
js/jquery.themepunch.revolution.min.js?rev=<?php 
        echo RevSliderGlobals::SLIDER_REVISION;
        ?>
'></script>
					
				</head>
				<body style="padding:0px;margin:0px;width:100%;height:100%;position:relative;">
					<?php 
        if ($wpmlActive == true) {
            ?>
						<div style="margin-bottom:10px;text-align:center;">
						<?php 
            _e("Choose language", REVSLIDER_TEXTDOMAIN);
            ?>
: <?php 
            echo $selectLangChoose;
            ?>
						</div>

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

					<?php 
        $output->putSliderBase($sliderID);
        ?>
				</body>
			</html>
		<?php 
        exit;
    }
Ejemplo n.º 4
0
    /**
     * Output Dynamic Inline Styles
     */
    public function add_inline_styles()
    {
        if (!is_admin()) {
            echo '<script>var htmlDiv = document.getElementById("rs-plugin-settings-inline-css"); var htmlDivCss="';
        } else {
            echo "<style>";
        }
        $db = new RevSliderDB();
        $styles = $db->fetch(RevSliderGlobals::$table_css);
        foreach ($styles as $key => $style) {
            $handle = str_replace('.tp-caption', '', $style['handle']);
            if (!isset($this->class_include[$handle])) {
                unset($styles[$key]);
            }
        }
        $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
        $styles = RevSliderCssParser::compress_css($styles);
        if (!is_admin()) {
            echo addslashes($styles) . '";
				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 $styles . '</style>';
        }
    }
Ejemplo n.º 5
0
 /**
  * Output Dynamic Inline Styles
  */
 public function add_inline_styles()
 {
     if (!is_admin()) {
         echo '<script>var htmlDiv = document.getElementById("rs-plugin-settings-inline-css");htmlDiv.innerHTML = htmlDiv.innerHTML + unescape("';
     } else {
         echo "<style>";
     }
     $db = new RevSliderDB();
     $styles = $db->fetch(RevSliderGlobals::$table_css);
     foreach ($styles as $key => $style) {
         $handle = str_replace('.tp-caption', '', $style['handle']);
         if (!isset($this->class_include[$handle])) {
             unset($styles[$key]);
         }
     }
     $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
     $styles = RevSliderCssParser::compress_css($styles);
     if (!is_admin()) {
         echo addslashes($styles) . '");</script>' . "\n";
     } else {
         echo $styles . '</style>';
     }
 }
Ejemplo n.º 6
0
 /**
  * Output Dynamic Inline Styles
  */
 public function add_inline_styles()
 {
     if (!is_admin()) {
         echo '<script>document.write("<style type=\\"text/css\\">';
     } else {
         echo "<style>";
     }
     $db = new RevSliderDB();
     $styles = $db->fetch(RevSliderGlobals::$table_css);
     foreach ($styles as $key => $style) {
         $handle = str_replace('.tp-caption', '', $style['handle']);
         if (!isset($this->class_include[$handle])) {
             unset($styles[$key]);
         }
     }
     $styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
     $styles = RevSliderCssParser::compress_css($styles);
     if (!is_admin()) {
         echo addslashes($styles) . '</style>");</script>' . "\n";
     } else {
         echo $styles . '</style>';
     }
 }