Ejemplo n.º 1
0
 /**
  *
  * put html slider on the html page.
  * @param $data - mixed, can be ID ot Alias.
  */
 public function putSliderBase($sliderID, $gal_ids = array(), $markup_export = false, $settings = array(), $order = array())
 {
     $this->markup_export = $markup_export;
     try {
         $slver = apply_filters('revslider_remove_version', RevSliderGlobals::SLIDER_REVISION);
         self::$sliderSerial++;
         $this->slider = new RevSlider();
         if ($sliderID !== '-99') {
             $this->slider->initByMixed($sliderID);
         } else {
             //do default
             $this->slider->initByMixed($sliderID);
         }
         //modify settings if there are any special settings given through the shortcode
         if (!empty($settings)) {
             $this->modify_settings($settings);
         }
         //modify settings for admin preview mode
         if ($this->previewMode == true) {
             $this->modifyPreviewModeSettings();
         }
         //set slider language
         $isWpmlExists = RevSliderWpml::isWpmlExists();
         $useWpml = $this->slider->getParam("use_wpml", "off");
         if ($isWpmlExists && $useWpml == "on") {
             if ($this->previewMode == false) {
                 $this->sliderLang = RevSliderFunctionsWP::getCurrentLangCode();
             }
         }
         //edit html before slider
         $htmlBeforeSlider = "";
         if ($markup_export === true) {
             $htmlBeforeSlider .= '<!-- FONT -->';
         }
         if ($this->slider->getParam("load_googlefont", "false") == "true") {
             $googleFont = $this->slider->getParam("google_font");
             if (is_array($googleFont)) {
                 foreach ($googleFont as $key => $font) {
                 }
             } else {
                 $htmlBeforeSlider .= RevSliderOperations::getCleanFontImport($googleFont);
             }
         }
         $gfonts = $this->slider->getParam("google_font", array());
         if (!empty($gfonts) && is_array($gfonts)) {
             foreach ($gfonts as $gf) {
                 $gf = str_replace(array('"', '+'), array('', ' '), $gf);
                 $htmlBeforeSlider .= RevSliderOperations::getCleanFontImport($gf);
             }
         }
         //add all google fonts of layers
         $gfsubsets = $this->slider->getParam("subsets", array());
         $gf = $this->slider->getUsedFonts(false);
         foreach ($gf as $gfk => $gfv) {
             $tcf = $gfk . ':';
             if (!empty($gfv['variants'])) {
                 $mgfirst = true;
                 foreach ($gfv['variants'] as $mgvk => $mgvv) {
                     if (!$mgfirst) {
                         $tcf .= ',';
                     }
                     $tcf .= $mgvk;
                     $mgfirst = false;
                 }
             }
             if (!empty($gfv['subsets'])) {
                 $mgfirst = true;
                 foreach ($gfv['subsets'] as $ssk => $ssv) {
                     if (array_search(esc_attr($gfk . '+' . $ssv), $gfsubsets) !== false) {
                         if ($mgfirst) {
                             $tcf .= '&subset=';
                         }
                         if (!$mgfirst) {
                             $tcf .= ',';
                         }
                         $tcf .= $ssv;
                         $mgfirst = false;
                     }
                 }
             }
             $htmlBeforeSlider .= RevSliderOperations::getCleanFontImport($tcf);
         }
         if ($markup_export === true) {
             $htmlBeforeSlider .= '<!-- /FONT -->';
         }
         //pub js to body handle
         if ($this->slider->getParam("js_to_body", "false") == "true") {
             $operations = new RevSliderOperations();
             $arrValues = $operations->getGeneralSettingsValues();
             $enable_logs = RevSliderFunctions::getVal($arrValues, "enable_logs", 'off');
             if ($markup_export === true) {
                 $htmlBeforeSlider .= '<!-- SCRIPTINCLUDE -->';
             }
             if ($enable_logs == 'on') {
                 $urlIncludeJS = RS_PLUGIN_URL . 'public/assets/js/jquery.themepunch.enablelog.js?rev=' . $slver;
                 $htmlBeforeSlider .= '<script type="text/javascript" src="' . $urlIncludeJS . '"></script>';
             }
             $urlIncludeJS = RS_PLUGIN_URL . 'public/assets/js/jquery.themepunch.tools.min.js?rev=' . $slver;
             $htmlBeforeSlider .= '<script type="text/javascript" src="' . $urlIncludeJS . '"></script>';
             $urlIncludeJS = RS_PLUGIN_URL . 'public/assets/js/jquery.themepunch.revolution.min.js?rev=' . $slver;
             $htmlBeforeSlider .= '<script type="text/javascript" src="' . $urlIncludeJS . '"></script>';
             if ($markup_export === true) {
                 $htmlBeforeSlider .= '<!-- /SCRIPTINCLUDE -->';
             }
         }
         //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");
         $slider_type = $this->slider->getParam("slider-type");
         //set wrapper height
         $wrapperHeigh = 0;
         $wrapperHeigh += $this->slider->getParam("height");
         //add thumb height
         if ($this->slider->getParam('enable_thumbnails', 'off') == 'on') {
             $wrapperHeigh += $this->slider->getParam('thumb_height');
         }
         $slider_id = $this->slider->getParam('slider_id', '');
         if (trim($slider_id) !== '') {
             $this->sliderHtmlID = $slider_id;
         } else {
             $this->sliderHtmlID = 'rev_slider_' . $sliderID . '_' . self::$sliderSerial;
         }
         $this->sliderHtmlID_wrapper = $this->sliderHtmlID . '_wrapper';
         $containerStyle = "";
         $sliderPosition = $this->slider->getParam("position", "center");
         $do_overflow = '';
         //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;
             }
             if ($this->slider->getParam('main_overflow_hidden', 'on') == 'on') {
                 $do_overflow = ' tp-overflow-hidden';
             }
         }
         //add background color
         $backgroundColor = esc_attr(trim($this->slider->getParam('background_color')));
         if (!empty($backgroundColor)) {
             $containerStyle .= 'background-color:' . $backgroundColor . ';';
         }
         //set padding
         $containerStyle .= 'padding:' . esc_attr($this->slider->getParam('padding', '0')) . 'px;';
         //set margin:
         if ($sliderType != 'fullscreen') {
             if ($sliderPosition != 'center') {
                 $containerStyle .= 'margin-left:' . esc_attr($this->slider->getParam('margin_left', '0', RevSlider::FORCE_NUMERIC)) . 'px;';
                 $containerStyle .= 'margin-right:' . esc_attr($this->slider->getParam('margin_right', '0', RevSlider::FORCE_NUMERIC)) . 'px;';
             }
             $containerStyle .= 'margin-top:' . esc_attr($this->slider->getParam('margin_top', '0', RevSlider::FORCE_NUMERIC)) . 'px;';
             $containerStyle .= 'margin-bottom:' . esc_attr($this->slider->getParam('margin_bottom', '0', RevSlider::FORCE_NUMERIC)) . 'px;';
         }
         //set height and width:
         $bannerStyle = 'display:none;';
         //add background image (to banner style)
         $showBackgroundImage = $this->slider->getParam('show_background_image', 'off');
         if ($showBackgroundImage == 'true' || $showBackgroundImage == 'on') {
             $backgroundImage = esc_attr($this->slider->getParam('background_image'));
             $backgroundFit = esc_attr($this->slider->getParam('bg_fit', $this->slider->getParam('def-background_fit', 'cover')));
             $backgroundRepeat = esc_attr($this->slider->getParam('bg_repeat', $this->slider->getParam('def-bg_repeat', 'no-repeat')));
             $backgroundPosition = esc_attr($this->slider->getParam('bg_position', $this->slider->getParam('def-bg_position', 'center center')));
             if (!empty($backgroundImage)) {
                 $containerStyle .= "background-image:url(" . $backgroundImage . ");background-repeat:" . $backgroundRepeat . ";background-size:" . $backgroundFit . ";background-position:" . $backgroundPosition . ";";
             }
         }
         //set wrapper and slider class:
         $sliderWrapperClass = "rev_slider_wrapper";
         $sliderClass = "rev_slider";
         switch ($sliderType) {
             case "responsitive":
                 //@since 5.0: obsolete now, was custom
             //@since 5.0: obsolete now, was custom
             case "fixed":
                 //@since 5.0: obsolete now
             //@since 5.0: obsolete now
             case 'auto':
             case 'fullwidth':
                 $sliderWrapperClass .= " fullwidthbanner-container";
                 $sliderClass .= " fullwidthabanner";
                 // KRISZTIAN REMOVED SOME LINE
                 //$bannerStyle .= "max-height:".$bannerHeight."px;height:".$bannerHeight."px;";
                 //$containerStyle .= "max-height:".$bannerHeight."px;";
                 break;
             case 'fullscreen':
                 $sliderWrapperClass .= " fullscreen-container";
                 $sliderClass .= " fullscreenbanner";
                 break;
             default:
                 $bannerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 $containerStyle .= "height:" . $bannerHeight . "px;width:" . $bannerWidth . "px;";
                 break;
         }
         $maxWidth = $this->slider->getParam('max_width', '0', RevSlider::FORCE_NUMERIC);
         if ($maxWidth > 0 && $this->slider->getParam('slider_type') == 'auto') {
             $containerStyle .= 'max-width:' . $maxWidth . 'px;';
         }
         $htmlTimerBar = "";
         $enable_progressbar = $this->slider->getParam('enable_progressbar', 'on');
         $timerBar = $this->slider->getParam('show_timerbar', 'top');
         $progress_height = $this->slider->getParam('progress_height', '5');
         $progress_opa = $this->slider->getParam('progress_opa', '15');
         $progressbar_color = $this->slider->getParam('progressbar_color', '#000000');
         if ($enable_progressbar !== 'on' || $slider_type == 'hero') {
             $timerBar = 'hide';
         }
         $progress_style = ' style="height: ' . esc_attr($progress_height) . 'px; background-color: ' . RevSliderFunctions::hex2rgba($progressbar_color, $progress_opa) . ';"';
         switch ($timerBar) {
             case "top":
                 $htmlTimerBar = '<div class="tp-bannertimer"' . $progress_style . '></div>';
                 break;
             case "bottom":
                 $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"' . $progress_style . '></div>';
                 break;
             case "hide":
                 $htmlTimerBar = '<div class="tp-bannertimer tp-bottom" style="visibility: hidden !important;"></div>';
                 break;
         }
         //check inner / outer border
         $paddingType = $this->slider->getParam("padding_type", "outer");
         if ($paddingType == "inner") {
             $sliderWrapperClass .= " tp_inner_padding";
         }
         global $revSliderVersion;
         $add_alias = '';
         if (is_super_admin() || is_admin_bar_showing()) {
             if (current_user_can('edit_theme_options')) {
                 $add_alias = ' data-alias="' . esc_attr($this->slider->getAlias()) . '"';
             }
         }
         echo $htmlBeforeSlider . "\n";
         echo '<div id="' . $this->sliderHtmlID_wrapper . '" class="' . $sliderWrapperClass . '"' . $add_alias;
         $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 '<!-- START REVOLUTION SLIDER ' . $revSliderVersion . ' ' . $sliderType . ' mode -->' . "\n";
         echo '	<div id="' . $this->sliderHtmlID . '"';
         echo ' class="' . $sliderClass . $do_overflow . '"';
         echo ' style="' . $bannerStyle . '"';
         echo ' data-version="' . $revSliderVersion . '">' . "\n";
         echo $this->putSlides($gal_ids, $order);
         echo $htmlTimerBar;
         echo '	</div>' . "\n";
         $this->putJS($markup_export);
         echo '</div>';
         echo '<!-- END REVOLUTION SLIDER -->';
     } catch (Exception $e) {
         $message = $e->getMessage();
         $this->putErrorMessage($message);
     }
 }
Ejemplo n.º 2
0
 /**
  * 
  * get current language
  */
 public static function getCurrentLang()
 {
     self::validateWpmlExists();
     $wpml = new SitePress();
     if (is_admin()) {
         $lang = $wpml->get_default_language();
     } else {
         $lang = RevSliderFunctionsWP::getCurrentLangCode();
     }
     /* NEW:
     		if ( is_admin() ) {
                 return apply_filters( 'wpml_default_language', null );
             }
             return apply_filters( 'wpml_current_language', null );
     		*/
     return $lang;
 }
Ejemplo n.º 3
0
 /**
  * 
  * get current language
  */
 public static function getCurrentLang()
 {
     self::validateWpmlExists();
     $wpml = new SitePress();
     if (is_admin()) {
         $lang = $wpml->get_default_language();
     } else {
         $lang = RevSliderFunctionsWP::getCurrentLangCode();
     }
     return $lang;
 }