public function putSliderBase($sliderID) { try { self::$sliderSerial++; $this->slider = new BannerRotator(); $this->slider->initByMixed($sliderID); //Modify settings for admin preview mode if ($this->previewMode == true) { $this->modifyPreviewModeSettings(); } //Set slider language $isWpmlExists = UniteWpmlBanner::isWpmlExists(); $useWpml = $this->slider->getParam("useWpml", "false"); if ($isWpmlExists && $useWpml == "true") { if ($this->previewMode == false) { $this->sliderLang = UniteFunctionsWPBanner::getCurrentLangCode(); } } //Edit html before slider $htmlBeforeSlider = ""; if ($this->slider->getParam("loadGoogleFont", "false") == "true") { $googleFont = $this->slider->getParam("googleFont"); $htmlBeforeSlider = BannerOperations::getCleanFontImport($googleFont); } //Put js to body handle if ($this->slider->getParam("js_to_body", "false") == "true") { $urlIncludeJS1 = UniteBaseClassBanner::$url_plugin . "js/jquery.flashblue-plugins.js"; $urlIncludeJS2 = UniteBaseClassBanner::$url_plugin . "js/jquery.banner-rotator.js"; $htmlBeforeSlider .= "<script type='text/javascript' src='../inc_php/{$urlIncludeJS1}'></script>"; $htmlBeforeSlider .= "<script type='text/javascript' src='../inc_php/{$urlIncludeJS2}'></script>"; } //The initial id can be alias $sliderID = $this->slider->getID(); $bannerWidth = $this->slider->getParam("width", null, BannerRotator::VALIDATE_NUMERIC, "Slider Width"); $bannerHeight = $this->slider->getParam("height", null, BannerRotator::VALIDATE_NUMERIC, "Slider Height"); $sliderType = $this->slider->getParam("sliderType"); //Slider id $this->sliderHtmlID = "banner_rotator_" . $sliderID . "_" . self::$sliderSerial; //Slider wrapper $this->sliderHtmlID_wrapper = $this->sliderHtmlID . "_wrapper"; $containerStyle = ""; $sliderPosition = $this->slider->getParam("position", "center"); //Set position if ($sliderType != "fullscreen") { switch ($sliderPosition) { case "center": default: $containerStyle .= "margin:0px auto;"; break; case "left": $containerStyle .= "float:left;"; break; case "right": $containerStyle .= "float:right;"; break; } } //Add background color $backgrondColor = trim($this->slider->getParam("backgroundColor")); if (!empty($backgrondColor)) { $containerStyle .= "background-color:{$backgrondColor};"; } //Set padding //$containerStyle .= "padding:".$this->slider->getParam("padding","0")."px;"; //Set margin if ($sliderType != "fullscreen") { if ($sliderPosition != "center") { $containerStyle .= "margin-left:" . $this->slider->getParam("marginLeft", "0") . "px;" . "margin-right:" . $this->slider->getParam("marginRight", "0") . "px;"; } $containerStyle .= "margin-top:" . $this->slider->getParam("marginTop", "0") . "px;" . "margin-bottom:" . $this->slider->getParam("marginBottom", "0") . "px;"; } //Set height and width $bannerStyle = "display:none;"; //Add background image (to banner style) $showBackgroundImage = $this->slider->getParam("showBackgroundImage", "false"); if ($showBackgroundImage == "true") { $backgroundImage = $this->slider->getParam("backgroundImage"); if (!empty($backgroundImage)) { $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:no-repeat;"; } } //Set wrapper and slider class $sliderWrapperClass = "banner-rotator-wrapper"; $sliderClass = "banner-rotator"; $putResponsiveStyles = false; switch ($sliderType) { default: case "fixed": $bannerStyle .= "height:{$bannerHeight}px;width:{$bannerWidth}px;"; $containerStyle .= "height:{$bannerHeight}px;width:{$bannerWidth}px;"; break; case "responsitive": $putResponsiveStyles = true; break; case "fullwidth": $sliderWrapperClass .= " fullwidthbanner-container"; $sliderClass .= " fullwidthbanner"; $bannerStyle .= "max-height:{$bannerHeight}px;height:{$bannerHeight};"; $containerStyle .= "max-height:{$bannerHeight}px;"; break; case "fullscreen": $sliderWrapperClass .= " fullscreen-container"; $sliderClass .= " fullscreenbanner"; break; } //Check inner / outer border $paddingType = $this->slider->getParam("padding_type", "outter"); if ($paddingType == "inner") { $sliderWrapperClass .= " tp_inner_padding"; } global $bannerRotatorVersion; ?> <!-- START BANNER ROTATOR <?php echo $bannerRotatorVersion; ?> <?php echo $sliderType; ?> mode --> <?php if ($putResponsiveStyles == true) { $this->putResponsitiveStyles(); } ?> <?php echo $htmlBeforeSlider; ?> <div id="<?php echo $this->sliderHtmlID_wrapper; ?> " class="<?php echo $sliderWrapperClass; ?> " style="<?php echo $containerStyle; ?> "> <div id="<?php echo $this->sliderHtmlID; ?> " class="<?php echo $sliderClass; ?> " style="<?php echo $bannerStyle; ?> "> <?php $this->putSlides(); ?> </div> </div> <?php $this->putJS(); ?> <!-- END BANNER ROTATOR --> <?php } catch (Exception $e) { $message = $e->getMessage(); $this->putErrorMessage($message); } }
?> <?php _e("No Slides Found", BANNERROTATOR_TEXTDOMAIN); ?> <?php } ?> <ul id="list_slides" class="list_slides ui-sortable"> <?php foreach ($arrSlides as $slide) { $bgType = $slide->getParam("background_type", "image"); $order = $slide->getOrder(); //Set language flag url $isWpmlExists = UniteWpmlBanner::isWpmlExists(); $useWpml = $slider->getParam("useWpml", "false"); $showLangs = false; $addItemStyle = ""; if ($isWpmlExists && $useWpml == "true") { $showLangs = true; $arrChildLangs = $slide->getArrChildrenLangs(); $arrSlideLangCodes = $slide->getArrChildLangCodes(); if (UniteWpmlBanner::isAllLangsInArray($arrSlideLangCodes)) { $addItemStyle = "style='display:none'"; } } $imageFilepath = $slide->getImageFilepath(); $urlImageForView = $slide->getThumbUrl(); $slideTitle = $slide->getParam("title", "Slide"); $title = $slideTitle;
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; }