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); } }
public static function getCurrentLang() { self::validateWpmlExists(); $wpml = new SitePress(); if (is_admin()) { $lang = $wpml->get_default_language(); } else { $lang = UniteFunctionsWPBanner::getCurrentLangCode(); } return $lang; }