/** * * put html slider on the html page. * @param $data - mixed, can be ID ot Alias. */ public function putSliderBase($sliderID) { try { self::$sliderSerial++; $this->slider = new RevSlider(); $this->slider->initByMixed($sliderID); // Do not output Slider if we are on mobile $disable_on_mobile = $this->slider->getParam("disable_on_mobile", "off"); $isMobile = strstr($_SERVER['HTTP_USER_AGENT'], 'Android') || strstr($_SERVER['HTTP_USER_AGENT'], 'webOS') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') ? true : false; if ($disable_on_mobile == 'on' && $isMobile) { return false; } $show_alternate = $this->slider->getParam("show_alternative_type", "off"); if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') { if ($isMobile) { $show_alternate_image = $this->slider->getParam("show_alternate_image", ""); echo '<img class="tp-slider-alternative-image" src="' . $show_alternate_image . '">'; return false; } } $doWrapFromTemplate = false; if ($this->slider->isSlidesFromPosts() && $this->slider->getParam("slider_template_id", false) !== false) { //need to use general settings from the Template Slider $this->slider->initByMixed($this->slider->getParam("slider_template_id", false)); $doWrapFromTemplate = $sliderID; } //modify settings for admin preview mode if ($this->previewMode == true) { $this->modifyPreviewModeSettings(); } //set slider language $isWpmlExists = UniteWpmlRev::isWpmlExists(); $useWpml = $this->slider->getParam("use_wpml", "off"); if ($isWpmlExists && $useWpml == "on") { if ($this->previewMode == false) { $this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode(); } } //edit html before slider $htmlBeforeSlider = ""; if ($this->slider->getParam("load_googlefont", "false") == "true") { $googleFont = $this->slider->getParam("google_font"); if (is_array($googleFont)) { foreach ($googleFont as $key => $font) { $htmlBeforeSlider .= RevOperations::getCleanFontImport($font); } } else { $htmlBeforeSlider .= RevOperations::getCleanFontImport($googleFont); } } //pub js to body handle if ($this->jsToBody == true) { //$operations = new RevOperations(); //$arrValues = $operations->getGeneralSettingsValues(); $urlIncludeJSTools = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.tools.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJSTools}'></script>\n"; //$enable_logs = UniteFunctionsRev::getVal($arrValues, "enable_logs",'off'); $enable_logs = "off"; if ($enable_logs == 'on') { $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.enablelog.js?rev=" . GlobalsRevSlider::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>"; } $useHammer = 'on'; if ($useHammer == 'off') { $urlIncludeJS = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.disablehammer.js?rev=" . GlobalsRevSlider::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>\n"; } $urlIncludeJS = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.revolution.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>\n"; } //the initial id can be alias $sliderID = $this->slider->getID(); $bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width"); $bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height"); $sliderType = $this->slider->getParam("slider_type"); //set wrapper height $wrapperHeigh = 0; $wrapperHeigh += $this->slider->getParam("height"); //add thumb height if ($this->slider->getParam("navigaion_type") == "thumb") { $wrapperHeigh += $this->slider->getParam("thumb_height"); } $this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial; $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("background_color")); 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("margin_left", "0") . "px;"; $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;"; } $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;"; $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;"; } //set height and width: $bannerStyle = "display:none;"; //add background image (to banner style) $showBackgroundImage = $this->slider->getParam("show_background_image", "false"); if ($showBackgroundImage == "true") { $backgroundImage = $this->slider->getParam("background_image"); $backgroundFit = $this->slider->getParam("bg_fit", "cover"); $backgroundRepeat = $this->slider->getParam("bg_repeat", "no-repeat"); $backgroundPosition = $this->slider->getParam("bg_position", "center top"); if (!empty($backgroundImage)) { $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:" . $backgroundRepeat . ";background-fit:" . $backgroundFit . ";background-position:" . $backgroundPosition . ";"; } } //set wrapper and slider class: $sliderWrapperClass = "rev_slider_wrapper"; $sliderClass = "rev_slider"; $putResponsiveStyles = false; switch ($sliderType) { default: case "fixed": $bannerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;"; $containerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;"; break; case "responsitive": //$containerStyle .= "height:".$bannerHeight."px;"; $putResponsiveStyles = true; break; case "fullwidth": $sliderWrapperClass .= " fullwidthbanner-container"; $sliderClass .= " fullwidthabanner"; $bannerStyle .= "max-height:" . $bannerHeight . "px;height:" . $bannerHeight . "px;"; $containerStyle .= "max-height:" . $bannerHeight . "px;"; break; case "fullscreen": //$containerStyle .= "height:".$bannerHeight."px;"; $sliderWrapperClass .= " fullscreen-container"; $sliderClass .= " fullscreenbanner"; break; } //handle position behind $posBehind = $this->slider->getParam("position_behind", "false"); $posBehind = UniteFunctionsRev::strToBool($posBehind); if ($posBehind == true) { $containerStyle .= "position:relative;z-index:0;"; } $htmlTimerBar = ""; $timerBar = $this->slider->getParam("show_timerbar", "top"); if ($timerBar == "true") { $timerBar = $this->slider->getParam("timebar_position", "top"); } switch ($timerBar) { case "top": $htmlTimerBar = '<div class="tp-bannertimer"></div>'; break; case "bottom": $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>'; break; case "hide": $htmlTimerBar = '<div class="tp-bannertimer tp-bottom" style="display:none; visibility: hidden !important;"></div>'; break; } //check inner / outer border $paddingType = $this->slider->getParam("padding_type", "outter"); if ($paddingType == "inner") { $sliderWrapperClass .= " tp_inner_padding"; } global $revSliderVersion; echo "<!-- START REVOLUTION SLIDER " . $revSliderVersion . " " . $sliderType . " mode -->\n"; if ($putResponsiveStyles == true) { $this->putResponsitiveStyles(); } echo $htmlBeforeSlider . "\n"; echo "<div id=\""; echo $this->sliderHtmlID_wrapper; echo "\" "; echo "class=\"" . $sliderWrapperClass . "\""; $show_alternate = $this->slider->getParam("show_alternative_type", "off"); if ($show_alternate !== 'off') { $show_alternate_image = $this->slider->getParam("show_alternate_image", ""); echo ' data-aimg="' . $show_alternate_image . '" '; if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') { echo ' data-amobile="enabled" '; } else { echo ' data-amobile="disabled" '; } if ($show_alternate == 'mobile-ie8' || $show_alternate == 'ie8') { echo ' data-aie8="enabled" '; } else { echo ' data-aie8="disabled" '; } } echo " style=\"" . $containerStyle . "\">\n"; echo "\t<div id=\""; echo $this->sliderHtmlID; echo "\" "; echo "class=\"" . $sliderClass . "\""; echo " style=\"" . $bannerStyle . "\">\n"; echo $this->putSlides($doWrapFromTemplate); echo $htmlTimerBar; echo "\t</div>\n"; $this->putJS(); echo "</div>\n"; echo "<!-- END REVOLUTION SLIDER -->"; } catch (Exception $e) { $message = $e->getMessage(); $this->putErrorMessage($message); } }
public function putSliderBase($sliderID) { try { self::$sliderSerial++; $this->slider = new RevSlider(); $this->slider->initByMixed($sliderID); $doWrapFromTemplate = false; if ($this->slider->isSlidesFromPosts() && $this->slider->getParam("slider_template_id", false) !== false) { //need to use general settings from the Template Slider $this->slider->initByMixed($this->slider->getParam("slider_template_id", false)); $doWrapFromTemplate = $sliderID; } //modify settings for admin preview mode if ($this->previewMode == true) { $this->modifyPreviewModeSettings(); } //set slider language $isWpmlExists = UniteWpmlRev::isWpmlExists(); $useWpml = $this->slider->getParam("use_wpml", "off"); if ($isWpmlExists && $useWpml == "on") { if ($this->previewMode == false) { $this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode(); } } //edit html before slider $htmlBeforeSlider = ""; if ($this->slider->getParam("load_googlefont", "false") == "true") { $googleFont = $this->slider->getParam("google_font"); if (is_array($googleFont)) { foreach ($googleFont as $key => $font) { $htmlBeforeSlider .= RevOperations::getCleanFontImport($font); } } else { $htmlBeforeSlider .= RevOperations::getCleanFontImport($googleFont); } } //pub js to body handle if ($this->slider->getParam("js_to_body", "false") == "true") { $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.plugins.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>"; $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.revolution.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>"; } //the initial id can be alias $sliderID = $this->slider->getID(); $bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width"); $bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height"); $sliderType = $this->slider->getParam("slider_type"); //set wrapper height $wrapperHeigh = 0; $wrapperHeigh += $this->slider->getParam("height"); //add thumb height if ($this->slider->getParam("navigaion_type") == "thumb") { $wrapperHeigh += $this->slider->getParam("thumb_height"); } $this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial; $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("background_color")); 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("margin_left", "0") . "px;"; $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;"; } $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;"; $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;"; } //set height and width: $bannerStyle = "display:none;"; //add background image (to banner style) $showBackgroundImage = $this->slider->getParam("show_background_image", "false"); if ($showBackgroundImage == "true") { $backgroundImage = $this->slider->getParam("background_image"); $backgroundFit = $this->slider->getParam("bg_fit", "cover"); $backgroundRepeat = $this->slider->getParam("bg_repeat", "no-repeat"); $backgroundPosition = $this->slider->getParam("bg_position", "center top"); if (!empty($backgroundImage)) { $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:" . $backgroundRepeat . ";background-fit:" . $backgroundFit . ";background-position:" . $backgroundPosition . ";"; } } //set wrapper and slider class: $sliderWrapperClass = "rev_slider_wrapper"; $sliderClass = "rev_slider"; $putResponsiveStyles = false; switch ($sliderType) { default: case "fixed": $bannerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;"; $containerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;"; break; case "responsitive": //$containerStyle .= "height:".$bannerHeight."px;"; $putResponsiveStyles = true; break; case "fullwidth": $sliderWrapperClass .= " fullwidthbanner-container"; $sliderClass .= " fullwidthabanner"; $bannerStyle .= "max-height:" . $bannerHeight . "px;height:" . $bannerHeight . ";"; $containerStyle .= "max-height:" . $bannerHeight . "px;"; break; case "fullscreen": //$containerStyle .= "height:".$bannerHeight."px;"; $sliderWrapperClass .= " fullscreen-container"; $sliderClass .= " fullscreenbanner"; break; } $htmlTimerBar = ""; $timerBar = $this->slider->getParam("show_timerbar", "top"); if ($timerBar == "true") { $timerBar = $this->slider->getParam("timebar_position", "top"); } switch ($timerBar) { case "top": $htmlTimerBar = '<div class="tp-bannertimer"></div>'; break; case "bottom": $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>'; break; } //check inner / outer border $paddingType = $this->slider->getParam("padding_type", "outter"); if ($paddingType == "inner") { $sliderWrapperClass .= " tp_inner_padding"; } global $revSliderVersion; echo "<!-- START REVOLUTION SLIDER " . $revSliderVersion . " " . $sliderType . " mode -->\n"; if ($putResponsiveStyles == true) { $this->putResponsitiveStyles(); } echo $htmlBeforeSlider . "\n"; echo "<div id=\""; echo $this->sliderHtmlID_wrapper; echo "\" "; echo "class=\"" . $sliderWrapperClass . "\""; echo " style=\"" . $containerStyle . "\">\n"; echo "\t<div id=\""; echo $this->sliderHtmlID; echo "\" "; echo "class=\"" . $sliderClass . "\""; echo " style=\"" . $bannerStyle . "\">\n"; echo $this->putSlides($doWrapFromTemplate); echo $htmlTimerBar; echo "\t</div>\n"; echo "</div>"; $this->putJS(); echo "<!-- END REVOLUTION SLIDER -->"; } catch (Exception $e) { $message = $e->getMessage(); $this->putErrorMessage($message); } }
public function putSliderBase($sliderID) { try { self::$sliderSerial++; $this->slider = new RevSlider(); $this->slider->initByMixed($sliderID); //modify settings for admin preview mode if ($this->previewMode == true) { $this->modifyPreviewModeSettings(); } //set slider language $isWpmlExists = UniteWpmlRev::isWpmlExists(); $useWpml = $this->slider->getParam("use_wpml", "off"); if ($isWpmlExists && $useWpml == "on") { if ($this->previewMode == false) { $this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode(); } } //edit html before slider $htmlBeforeSlider = ""; if ($this->slider->getParam("load_googlefont", "false") == "true") { $googleFont = $this->slider->getParam("google_font"); $htmlBeforeSlider = "<link rel='stylesheet' id='rev-google-font' href='http://fonts.googleapis.com/css?family={$googleFont}' type='text/css' media='all' />"; } //pub js to body handle if ($this->slider->getParam("js_to_body", "false") == "true") { $urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.revolution.min.js"; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>"; } //the initial id can be alias $sliderID = $this->slider->getID(); $bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width"); $bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height"); $sliderType = $this->slider->getParam("slider_type"); //set wrapper height $wrapperHeigh = 0; $wrapperHeigh += $this->slider->getParam("height"); //add thumb height if ($this->slider->getParam("navigaion_type") == "thumb") { $wrapperHeigh += $this->slider->getParam("thumb_height"); } $this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial; $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("background_color")); 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("margin_left", "0") . "px;"; $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;"; } $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;"; $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;"; } //set height and width: $bannerStyle = "display:none;"; //add background image (to banner style) $showBackgroundImage = $this->slider->getParam("show_background_image", "false"); if ($showBackgroundImage == "true") { $backgroundImage = $this->slider->getParam("background_image"); if (!empty($backgroundImage)) { $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:no-repeat;"; } } //set wrapper and slider class: $sliderWrapperClass = "rev_slider_wrapper"; $sliderClass = "rev_slider"; $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 .= " fullwidthabanner"; $bannerStyle .= "max-height:{$bannerHeight}px;height:{$bannerHeight};"; $containerStyle .= "max-height:{$bannerHeight}px;"; break; case "fullscreen": $sliderWrapperClass .= " fullscreen-container"; $sliderClass .= " fullscreenbanner"; break; } $htmlTimerBar = ""; $timerBar = $this->slider->getParam("show_timerbar", "top"); if ($timerBar == "true") { $timerBar = $this->slider->getParam("timebar_position", "top"); } switch ($timerBar) { case "top": $htmlTimerBar = '<div class="tp-bannertimer"></div>'; break; case "bottom": $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>'; break; } //check inner / outer border $paddingType = $this->slider->getParam("padding_type", "outter"); if ($paddingType == "inner") { $sliderWrapperClass .= " tp_inner_padding"; } global $revSliderVersion; ?> <!-- START REVOLUTION SLIDER <?php echo $revSliderVersion; ?> <?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(); ?> <?php echo $htmlTimerBar; ?> </div> </div> <?php $this->putJS(); ?> <!-- END REVOLUTION SLIDER --> <?php } catch (Exception $e) { $message = $e->getMessage(); $this->putErrorMessage($message); } }
/** * * get current language */ public static function getCurrentLang() { self::validateWpmlExists(); $wpml = new SitePress(); if (is_admin()) { $lang = $wpml->get_default_language(); } else { $lang = UniteFunctionsWPRev::getCurrentLangCode(); } return $lang; }