public function previewOutput($sliderID, $output = null) { if ($sliderID == "empty_output") { $this->loadingMessageOutput(); exit; } if ($output == null) { $output = new BannerRotatorOutput(); } $output->setPreviewMode(); $slider = new BannerRotator(); $slider->initByID($sliderID); $isWpmlExists = UniteWpmlBanner::isWpmlExists(); $useWpml = $slider->getParam("useWpml", "false"); $wpmlActive = false; if ($isWpmlExists && $useWpml == "true") { $wpmlActive = true; $arrLanguages = UniteWpmlBanner::getArrLanguages(false); //Set current lang to output $currentLang = UniteFunctionsBanner::getPostGetVariable("lang"); if (empty($currentLang)) { $currentLang = UniteWpmlBanner::getCurrentLang(); } if (empty($currentLang)) { $currentLang = $arrLanguages[0]; } $output->setLang($currentLang); $selectLangChoose = UniteFunctionsBanner::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true); } //Put the output html $urlPlugin = BannerRotatorAdmin::$url_plugin; $urlPreviewPattern = UniteBaseClassBanner::$url_ajax_actions . "&client_action=preview_slider&sliderid={$sliderID}&lang=[lang]&nonce=[nonce]"; $nonce = wp_create_nonce("bannerrotator_actions"); $setBase = is_ssl() ? "https://" : "http://"; ?> <html> <head> <link rel='stylesheet' href='<?php echo $urlPlugin; ?> css/banner-rotator.css' type='text/css' media='all' /> <link rel='stylesheet' href='<?php echo $urlPlugin; ?> css/caption.css' type='text/css' media='all' /> <script type='text/javascript' src='<?php echo $setBase; ?> ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'></script> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.flashblue-plugins.js'></script> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.banner-rotator.js'></script> </head> <body style="padding:0px;margin:0px;"> <?php if ($wpmlActive) { ?> <div style="margin-bottom:10px;text-align:center;"> <?php _e("Choose language"); ?> : <?php echo $selectLangChoose; ?> </div> <script type="text/javascript"> var g_previewPattern = '<?php echo $urlPreviewPattern; ?> '; jQuery("#select_langs").change(function(){ var lang = this.value; var 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; }