示例#1
0
 /**
  * 
  * a must function. you can not use it, but the function must stay there!.
  *   
  */
 public static function onAddScripts()
 {
     global $wp_version;
     $style_pre = '';
     $style_post = '';
     if ($wp_version < 3.7) {
         $style_pre = '<style type="text/css">';
         $style_post = '</style>';
     }
     $operations = new RevOperations();
     $arrValues = $operations->getGeneralSettingsValues();
     $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on");
     $includesFooter = UniteFunctionsRev::getVal($arrValues, "js_to_footer", "off");
     $strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes");
     $isPutIn = RevSliderOutput::isPutIn($strPutIn, true);
     //put the includes only on pages with active widget or shortcode
     // if the put in match, then include them always (ignore this if)
     if ($isPutIn == false && $includesGlobally == "off") {
         $isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true);
         $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider");
         if ($isWidgetActive == false && $hasShortcode == false) {
             return false;
         }
     }
     self::addStyle("settings", "rs-plugin-settings", "rs-plugin/css");
     $custom_css = RevOperations::getStaticCss();
     $custom_css = UniteCssParserRev::compress_css($custom_css);
     wp_add_inline_style('rs-plugin-settings', $style_pre . $custom_css . $style_post);
     /*
      */
     /*
     $styles = $db->fetch(GlobalsRevSlider::$table_css);
     $styles = UniteCssParserRev::parseDbArrayToCss($styles, "\n");
     $styles = UniteCssParserRev::compress_css($styles);
     wp_add_inline_style( 'rs-plugin-settings', $style_pre.$styles.$style_post );
     
     // KRISZTIAN MODIFICATION FOR INNERLAYERS
     $stylesinnerlayers = str_replace('.tp-caption', '',$styles);´
     wp_add_inline_style( 'rs-plugin-settings', $style_pre.$stylesinnerlayers.$style_post );
     // END MODIFICATION
     */
     $setBase = is_ssl() ? "https://" : "http://";
     $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution";
     self::addScriptAbsoluteUrl($url_jquery, "jquery");
     if ($includesFooter == "off") {
         $waitfor = array('jquery');
         $enable_logs = UniteFunctionsRev::getVal($arrValues, "enable_logs", 'off');
         if ($enable_logs == 'on') {
             self::addScriptWaitFor("jquery.themepunch.enablelog", "rs-plugin/js", 'enable-logs');
             $waitfor[] = 'enable-logs';
         }
         self::addScriptWaitFor("jquery.themepunch.tools.min", "rs-plugin/js", 'tp-tools', $waitfor);
         self::addScriptWaitFor("jquery.themepunch.revolution.min", "rs-plugin/js", 'revmin', 'tp-tools');
     } else {
         //put javascript to footer
         UniteBaseClassRev::addAction('wp_footer', 'putJavascript');
     }
 }
    /**
     * 
     * draw imaeg input:
     * @param $setting
     */
    protected function drawImageInput($setting)
    {
        $class = UniteFunctionsRev::getVal($setting, "class");
        if (!empty($class)) {
            $class = "class='{$class}'";
        }
        $settingsID = $setting["id"];
        $buttonID = $settingsID . "_button";
        $spanPreviewID = $buttonID . "_preview";
        $img = "";
        $value = UniteFunctionsRev::getVal($setting, "value");
        if (!empty($value)) {
            $urlImage = $value;
            $imagePath = UniteFunctionsWPRev::getImageRealPathFromUrl($urlImage);
            if (file_exists($realPath)) {
                $filepath = UniteFunctionsWPRev::getImagePathFromURL($urlImage);
                $urlImage = UniteBaseClassRev::getImageUrl($filepath, 100, 70, true);
            }
            $img = "<img width='100' height='70' src='{$urlImage}'></img>";
        }
        ?>

				<span id='<?php 
        echo $spanPreviewID;
        ?>
' class='setting-image-preview'><?php 
        echo $img;
        ?>
</span>
				
				<input type="hidden" id="<?php 
        echo $setting["id"];
        ?>
" name="<?php 
        echo $setting["name"];
        ?>
" value="<?php 
        echo $setting["value"];
        ?>
" />
				
				<input type="button" id="<?php 
        echo $buttonID;
        ?>
" class='button-image-select <?php 
        echo $class;
        ?>
' value="Choose Image"></input>
			<?php 
    }
示例#3
0
 /**
  * 
  * main constructor		 
  */
 public function __construct($mainFile, $t, $defaultView)
 {
     parent::__construct($mainFile, $t);
     //set view
     self::$view = self::getGetVar("view");
     if (empty(self::$view)) {
         self::$view = $defaultView;
     }
     //add internal hook for adding a menu in arrMenus
     self::addAction(self::ACTION_ADMIN_MENU, "addAdminMenu");
     //if not inside plugin don't continue
     if ($this->isInsidePlugin() == true) {
         self::addAction(self::ACTION_ADD_SCRIPTS, "addCommonScripts");
         self::addAction(self::ACTION_ADD_SCRIPTS, "onAddScripts");
     }
     //a must event for any admin. call onActivate function.
     $this->addEvent_onActivate();
     self::addActionAjax("show_image", "onShowImage");
 }
 /**
  * 
  * a must function. you can not use it, but the function must stay there!.
  *   
  */
 public static function onAddScripts()
 {
     $operations = new RevOperations();
     $arrValues = $operations->getGeneralSettingsValues();
     $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on");
     $includesFooter = UniteFunctionsRev::getVal($arrValues, "js_to_footer", "off");
     $strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes");
     $isPutIn = RevSliderOutput::isPutIn($strPutIn, true);
     //put the includes only on pages with active widget or shortcode
     // if the put in match, then include them always (ignore this if)
     if ($isPutIn == false && $includesGlobally == "off") {
         $isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true);
         $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider");
         if ($isWidgetActive == false && $hasShortcode == false) {
             return false;
         }
     }
     self::addStyle("settings", "rs-plugin-settings", "rs-plugin/css");
     //check if dynamic-captions.css exists. If not, include captions.php
     if (file_exists(self::$path_plugin . "rs-plugin/css/dynamic-captions.css") == false) {
         self::addDynamicStyle("captions", "rs-plugin-captions", "rs-plugin/css");
     } else {
         $db = new UniteDBRev();
         $styles = $db->fetch(GlobalsRevSlider::$table_css);
         $styles = UniteCssParserRev::parseDbArrayToCss($styles, "\n");
         wp_add_inline_style('rs-plugin-settings', $styles);
         //self::addStyle("dynamic-captions","rs-captions","rs-plugin/css");
     }
     $custom_css = RevOperations::getStaticCss();
     wp_add_inline_style('rs-plugin-settings', $custom_css);
     //self::addStyle("static-captions","rs-plugin-static","rs-plugin/css");
     $setBase = is_ssl() ? "https://" : "http://";
     $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution";
     self::addScriptAbsoluteUrl($url_jquery, "jquery");
     if ($includesFooter == "off") {
         self::addScriptWaitFor("jquery.themepunch.plugins.min", "rs-plugin/js", 'themepunchtools', 'jquery');
         self::addScriptWaitFor("jquery.themepunch.revolution.min", "rs-plugin/js", 'revmin', 'jquery');
     } else {
         //put javascript to footer
         UniteBaseClassRev::addAction('wp_footer', 'putJavascript');
     }
 }
 public static function onAddScripts()
 {
     global $wp_version;
     $style_pre = '';
     $style_post = '';
     if ($wp_version < 3.7) {
         $style_pre = '<style type="text/css">';
         $style_post = '</style>';
     }
     $operations = new RevOperations();
     $arrValues = $operations->getGeneralSettingsValues();
     $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on");
     $includesFooter = UniteFunctionsRev::getVal($arrValues, "js_to_footer", "off");
     $strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes");
     $isPutIn = RevSliderOutput::isPutIn($strPutIn, true);
     if ($isPutIn == false && $includesGlobally == "off") {
         $isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true);
         $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider");
         if ($isWidgetActive == false && $hasShortcode == false) {
             return false;
         }
     }
     self::addStyle("settings", "rs-plugin-settings", "rs-plugin/css");
     $custom_css = RevOperations::getStaticCss();
     $custom_css = UniteCssParserRev::compress_css($custom_css);
     wp_add_inline_style('rs-plugin-settings', $style_pre . $custom_css . $style_post);
     $setBase = get_http();
     $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution";
     self::addScriptAbsoluteUrl($url_jquery, "jquery");
     if ($includesFooter == "off") {
         $waitfor = array('jquery');
         $enable_logs = UniteFunctionsRev::getVal($arrValues, "enable_logs", 'off');
         if ($enable_logs == 'on') {
             self::addScriptWaitFor("jquery.themepunch.enablelog", "rs-plugin/js", 'enable-logs');
             $waitfor[] = 'enable-logs';
         }
         self::addScriptWaitFor("jquery.themepunch.tools.min", "rs-plugin/js", 'tp-tools', $waitfor);
         self::addScriptWaitFor("jquery.themepunch.revolution.min", "rs-plugin/js", 'revmin', 'tp-tools');
     } else {
         UniteBaseClassRev::addAction('wp_footer', 'putJavascript');
     }
 }
示例#6
0
 /**
  *
  * the constructor
  */
 public function __construct()
 {
     UniteBaseClassRev::__construct('', $this);
     //set table names
     GlobalsRevSlider::$table_sliders = GlobalsRevSlider::TABLE_SLIDERS_NAME;
     GlobalsRevSlider::$table_slides = GlobalsRevSlider::TABLE_SLIDES_NAME;
     GlobalsRevSlider::$table_static_slides = GlobalsRevSlider::TABLE_STATIC_SLIDES_NAME;
     GlobalsRevSlider::$table_settings = GlobalsRevSlider::TABLE_SETTINGS_NAME;
     GlobalsRevSlider::$table_css = GlobalsRevSlider::TABLE_CSS_NAME;
     GlobalsRevSlider::$table_layer_anims = GlobalsRevSlider::TABLE_LAYER_ANIMS_NAME;
     GlobalsRevSlider::$filepath_backup = self::$path_plugin . "backup/";
     GlobalsRevSlider::$filepath_captions = self::$path_plugin . "rs-plugin/css/captions.css";
     GlobalsRevSlider::$urlCaptionsCSS = Mage::getDesign()->getSkinUrl('css/nwdthemes/revslider/dynamic.css');
     GlobalsRevSlider::$urlStaticCaptionsCSS = Mage::getDesign()->getSkinUrl('css/nwdthemes/revslider/static.css');
     GlobalsRevSlider::$filepath_dynamic_captions = Mage::getDesign()->getSkinBaseDir() . "/revslider/css/dynamic-captions.css";
     GlobalsRevSlider::$filepath_static_captions = Mage::getDesign()->getSkinBaseDir() . "/revslider/css/static-captions.css";
     GlobalsRevSlider::$filepath_captions_original = Mage::getDesign()->getSkinBaseDir() . "/revslider/css/captions-original.css";
     GlobalsRevSlider::$urlExportZip = Mage::getBaseDir('tmp') . '/revslider_export.zip';
     $this->init();
 }
示例#7
0
 /**
  * 
  * a must function. you can not use it, but the function must stay there!.
  *   
  */
 public static function onAddScripts()
 {
     $operations = new RevOperations();
     $arrValues = $operations->getGeneralSettingsValues();
     $includesGlobally = UniteFunctionsRev::getVal($arrValues, "includes_globally", "on");
     $includesFooter = UniteFunctionsRev::getVal($arrValues, "js_to_footer", "off");
     $strPutIn = UniteFunctionsRev::getVal($arrValues, "pages_for_includes");
     $isPutIn = RevSliderOutput::isPutIn($strPutIn, true);
     //put the includes only on pages with active widget or shortcode
     // if the put in match, then include them always (ignore this if)
     if ($isPutIn == false && $includesGlobally == "off") {
         $isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true);
         $hasShortcode = UniteFunctionsWPRev::hasShortcode("rev_slider");
         if ($isWidgetActive == false && $hasShortcode == false) {
             return false;
         }
     }
     self::addStyle("settings", "rs-plugin-settings", "rs-plugin/css");
     $custom_css = RevOperations::getStaticCss();
     $custom_css = UniteCssParserRev::compress_css($custom_css);
     wp_add_inline_style('rs-plugin-settings', $custom_css);
     $setBase = is_ssl() ? "https://" : "http://";
     $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=revolution";
     self::addScriptAbsoluteUrl($url_jquery, "jquery");
     if ($includesFooter == "off") {
         $use_hammer = UniteFunctionsRev::getVal($arrValues, "use_hammer_js", 'on');
         $waitfor = array('jquery');
         if ($use_hammer == 'off') {
             self::addScriptWaitFor("jquery.themepunch.disablehammer", "rs-plugin/js", 'disable-hammer');
             $waitfor[] = 'disable-hammer';
         }
         self::addScriptWaitFor("jquery.themepunch.tools.min", "rs-plugin/js", 'tp-tools', $waitfor);
         self::addScriptWaitFor("jquery.themepunch.revolution.min", "rs-plugin/js", 'revmin', 'tp-tools');
     } else {
         //put javascript to footer
         UniteBaseClassRev::addAction('wp_footer', 'putJavascript');
     }
 }
示例#8
0
 public function __construct($mainFile, $t)
 {
     parent::__construct($mainFile, $t);
     self::addAction(self::ACTION_ENQUEUE_SCRIPTS, "onAddScripts");
 }
示例#9
0
    /**
     * 
     * put the slider slides
     */
    private function putSlides()
    {
        $sliderType = $this->slider->getParam("slider_type");
        $publishedOnly = true;
        if ($this->previewMode == true && $this->oneSlideMode == true) {
            $previewSlideID = UniteFunctionsRev::getVal($this->oneSlideData, "slideid");
            $previewSlide = new RevSlide();
            $previewSlide->initByID($previewSlideID);
            $slides = array($previewSlide);
        } else {
            $slides = $this->slider->getSlidesForOutput($publishedOnly, $this->sliderLang);
        }
        $this->slidesNumIndex = $this->slider->getSlidesNumbersByIDs(true);
        if (empty($slides)) {
            ?>
				<div class="no-slides-text">
					No slides found, please add some slides
				</div>
				<?php 
        }
        $thumbWidth = $this->slider->getParam("thumb_width", 100);
        $thumbHeight = $this->slider->getParam("thumb_height", 50);
        $slideWidth = $this->slider->getParam("width", 900);
        $slideHeight = $this->slider->getParam("height", 300);
        $navigationType = $this->slider->getParam("navigaion_type", "none");
        $isThumbsActive = $navigationType == "thumb" ? true : false;
        //for one slide preview
        if ($this->oneSlideMode == true) {
            $slides = $this->filterOneSlide($slides);
        }
        ?>
				<ul>
			<?php 
        foreach ($slides as $index => $slide) {
            $params = $slide->getParams();
            //check if date is set
            $date_from = $slide->getParam("date_from", "");
            $date_to = $slide->getParam("date_to", "");
            if ($date_from != "") {
                $date_from = strtotime($date_from);
                if (time() < $date_from) {
                    continue;
                }
            }
            if ($date_to != "") {
                $date_to = strtotime($date_to);
                if (time() > $date_to) {
                    continue;
                }
            }
            $transition = $slide->getParam("slide_transition", "random");
            $slotAmount = $slide->getParam("slot_amount", "7");
            $urlSlideImage = $slide->getImageUrl();
            //get image alt
            $imageFilename = $slide->getImageFilename();
            $info = pathinfo($imageFilename);
            $alt = $info["filename"];
            //get thumb url
            $htmlThumb = "";
            if ($isThumbsActive == true) {
                $urlThumb = $slide->getParam("slide_thumb", "");
                if (empty($urlThumb)) {
                    //try to get resized thumb
                    $pathThumb = $slide->getImageFilepath();
                    if (!empty($pathThumb)) {
                        $urlThumb = UniteBaseClassRev::getImageUrl($pathThumb, $thumbWidth, $thumbHeight, true);
                    }
                }
                //if not - put regular image:
                if (empty($urlThumb)) {
                    $urlThumb = $slide->getImageUrl();
                }
                $htmlThumb = 'data-thumb="' . $urlThumb . '" ';
            }
            //get link
            $htmlLink = "";
            $enableLink = $slide->getParam("enable_link", "false");
            if ($enableLink == "true") {
                $linkType = $slide->getParam("link_type", "regular");
                switch ($linkType) {
                    //---- normal link
                    default:
                    case "regular":
                        $link = $slide->getParam("link", "");
                        $linkOpenIn = $slide->getParam("link_open_in", "same");
                        $htmlTarget = "";
                        if ($linkOpenIn == "new") {
                            $htmlTarget = ' data-target="_blank"';
                        }
                        $htmlLink = "data-link=\"{$link}\" {$htmlTarget} ";
                        break;
                        //---- link to slide
                    //---- link to slide
                    case "slide":
                        $slideLink = UniteFunctionsRev::getVal($params, "slide_link");
                        if (!empty($slideLink) && $slideLink != "nothing") {
                            //get slide index from id
                            if (is_numeric($slideLink)) {
                                $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink);
                            }
                            if (!empty($slideLink)) {
                                $htmlLink = "data-link=\"slide\" data-linktoslide=\"{$slideLink}\" ";
                            }
                        }
                        break;
                }
                //set link position:
                $linkPos = UniteFunctionsRev::getVal($params, "link_pos", "front");
                if ($linkPos == "back") {
                    $htmlLink .= ' data-slideindex="back"';
                }
            }
            //set delay
            $htmlDelay = "";
            $delay = $slide->getParam("delay", "");
            if (!empty($delay) && is_numeric($delay)) {
                $htmlDelay = "data-delay=\"{$delay}\" ";
            }
            //get duration
            $htmlDuration = "";
            $duration = $slide->getParam("transition_duration", "");
            if (!empty($duration) && is_numeric($duration)) {
                $htmlDuration = "data-masterspeed=\"{$duration}\" ";
            }
            //get rotation
            $htmlRotation = "";
            $rotation = $slide->getParam("transition_rotation", "");
            if (!empty($rotation)) {
                $rotation = (int) $rotation;
                if ($rotation != 0) {
                    if ($rotation > 720 && $rotation != 999) {
                        $rotation = 720;
                    }
                    if ($rotation < -720) {
                        $rotation = -720;
                    }
                }
                $htmlRotation = "data-rotate=\"{$rotation}\" ";
            }
            $fullWidthVideoData = $this->getSlideFullWidthVideoData($slide);
            //set full width centering.
            $htmlImageCentering = "";
            $fullWidthCentering = $slide->getParam("fullwidth_centering", "false");
            if ($sliderType == "fullwidth" && $fullWidthCentering == "true") {
                $htmlImageCentering = ' data-fullwidthcentering="on"';
            }
            //set first slide transition
            $htmlFirstTrans = "";
            $startWithSlide = $this->slider->getStartWithSlideSetting();
            if ($index == $startWithSlide) {
                $firstTransActive = $this->slider->getParam("first_transition_active", "false");
                if ($firstTransActive == "true") {
                    $firstTransition = $this->slider->getParam("first_transition_type", "fade");
                    $htmlFirstTrans .= " data-fstransition=\"{$firstTransition}\"";
                    $firstDuration = $this->slider->getParam("first_transition_duration", "300");
                    if (!empty($firstDuration) && is_numeric($firstDuration)) {
                        $htmlFirstTrans .= " data-fsmasterspeed=\"{$firstDuration}\"";
                    }
                    $firstSlotAmount = $this->slider->getParam("first_transition_slot_amount", "7");
                    if (!empty($firstSlotAmount) && is_numeric($firstSlotAmount)) {
                        $htmlFirstTrans .= " data-fsslotamount=\"{$firstSlotAmount}\"";
                    }
                }
            }
            //first trans
            $htmlParams = $htmlDuration . $htmlLink . $htmlThumb . $htmlDelay . $htmlRotation . $htmlFirstTrans;
            $bgType = $slide->getParam("background_type", "image");
            $styleImage = "";
            $urlImageTransparent = UniteBaseClassRev::$url_plugin . "images/transparent.png";
            switch ($bgType) {
                case "trans":
                    $urlSlideImage = $urlImageTransparent;
                    break;
                case "solid":
                    $urlSlideImage = $urlImageTransparent;
                    $slideBGColor = $slide->getParam("slide_bg_color", "#d0d0d0");
                    $styleImage = "style='background-color:{$slideBGColor}'";
                    break;
            }
            //additional params
            $imageAddParams = "";
            $lazyLoad = $this->slider->getParam("lazy_load", "off");
            if ($lazyLoad == "on") {
                $imageAddParams .= "data-lazyload=\"{$urlSlideImage}\"";
                $urlSlideImage = UniteBaseClassRev::$url_plugin . "images/dummy.png";
            }
            $imageAddParams .= $htmlImageCentering;
            //Html
            ?>
					<li data-transition="<?php 
            echo $transition;
            ?>
" data-slotamount="<?php 
            echo $slotAmount;
            ?>
" <?php 
            echo $htmlParams;
            ?>
>
						<img src="<?php 
            echo $urlSlideImage;
            ?>
" <?php 
            echo $styleImage;
            ?>
 alt="<?php 
            echo $alt;
            ?>
" <?php 
            echo $imageAddParams;
            ?>
>
						<?php 
            //put video:
            if ($fullWidthVideoData["found"] == true) {
                //backward compatability
                $this->putFullWidthVideoLayer($fullWidthVideoData);
            }
            $this->putCreativeLayer($slide);
            ?>
					</li>
				<?php 
        }
        //get foreach
        ?>
				</ul>
			<?php 
    }
    /**
     * 
     * put the slider slides
     */
    private function putSlides($doWrapFromTemplate)
    {
        //go to template slider if post template
        if ($doWrapFromTemplate !== false) {
            $this->slider->initByMixed($doWrapFromTemplate);
        }
        //back to original Slider
        $sliderType = $this->slider->getParam("slider_type");
        $publishedOnly = true;
        if ($this->previewMode == true && $this->oneSlideMode == true) {
            $previewSlideID = UniteFunctionsRev::getVal($this->oneSlideData, "slideid");
            $previewSlide = new RevSlide();
            $previewSlide->initByID($previewSlideID);
            $slides = array($previewSlide);
        } else {
            $slides = $this->slider->getSlidesForOutput($publishedOnly, $this->sliderLang);
        }
        $this->slidesNumIndex = $this->slider->getSlidesNumbersByIDs(true);
        if (empty($slides)) {
            ?>
				<div class="no-slides-text">
					No slides found, please add some slides
				</div>
				<?php 
        }
        //go back to normal slider if post template
        if ($doWrapFromTemplate) {
            $this->slider->initByMixed($this->slider->getParam("slider_template_id", false));
        }
        //back to template for JS
        $thumbWidth = $this->slider->getParam("thumb_width", 100);
        $thumbHeight = $this->slider->getParam("thumb_height", 50);
        $slideWidth = $this->slider->getParam("width", 900);
        $slideHeight = $this->slider->getParam("height", 300);
        $navigationType = $this->slider->getParam("navigaion_type", "none");
        $isThumbsActive = $navigationType == "thumb" ? true : false;
        $lazyLoad = $this->slider->getParam("lazy_load", "off");
        //for one slide preview
        if ($this->oneSlideMode == true) {
            $slides = $this->filterOneSlide($slides);
        }
        echo "<ul>";
        $htmlFirstTransWrap = "";
        $startWithSlide = $this->slider->getStartWithSlideSetting();
        $firstTransActive = $this->slider->getParam("first_transition_active", "false");
        if ($firstTransActive == "true") {
            $firstTransition = $this->slider->getParam("first_transition_type", "fade");
            $htmlFirstTransWrap .= " data-fstransition=\"{$firstTransition}\"";
            $firstDuration = $this->slider->getParam("first_transition_duration", "300");
            if (!empty($firstDuration) && is_numeric($firstDuration)) {
                $htmlFirstTransWrap .= " data-fsmasterspeed=\"{$firstDuration}\"";
            }
            $firstSlotAmount = $this->slider->getParam("first_transition_slot_amount", "7");
            if (!empty($firstSlotAmount) && is_numeric($firstSlotAmount)) {
                $htmlFirstTransWrap .= " data-fsslotamount=\"{$firstSlotAmount}\"";
            }
        }
        if (count($slides) == 1 && $this->oneSlideMode == false) {
            $slides[] = $slides[0];
            $this->hasOnlyOneSlide = true;
        }
        foreach ($slides as $index => $slide) {
            $params = $slide->getParams();
            //check if date is set
            $date_from = $slide->getParam("date_from", "");
            $date_to = $slide->getParam("date_to", "");
            if ($date_from != "") {
                $date_from = strtotime($date_from);
                if (time() < $date_from) {
                    continue;
                }
            }
            if ($date_to != "") {
                $date_to = strtotime($date_to);
                if (time() > $date_to) {
                    continue;
                }
            }
            $transition = $slide->getParam("slide_transition", "random");
            //if($transition == "fade") $transition = "tp-fade";
            //$transitionPremium = $slide->getParam("slide_transition_premium","random");
            //if(trim($transition) == '')
            //	$transition = $transitionPremium;
            //else
            //	if(trim($transitionPremium) != '') $transition .= ','.$transitionPremium;
            $slotAmount = $slide->getParam("slot_amount", "7");
            $isExternal = $slide->getParam("background_type", "image");
            if ($isExternal != "external") {
                $urlSlideImage = $slide->getImageUrl();
                //get image alt
                $imageFilename = $slide->getImageFilename();
                $info = pathinfo($imageFilename);
                $alt = $info["filename"];
            } else {
                $urlSlideImage = $slide->getParam("slide_bg_external", "");
                $info = '';
                $alt = '';
            }
            $bgType = $slide->getParam("background_type", "image");
            //get thumb url
            $htmlThumb = "";
            if ($isThumbsActive == true) {
                $urlThumb = null;
                //check if post slider, if yes, get thumb from featured image
                //if($this->slider->isSlidesFromPosts())
                //	$urlThumb = '';
                if (empty($urlThumb)) {
                    $urlThumb = $slide->getParam("slide_thumb", "");
                }
                if ($bgType == 'image') {
                    if (empty($urlThumb)) {
                        //try to get resized thumb
                        $pathThumb = $slide->getImageFilepath();
                        if (!empty($pathThumb)) {
                            $urlThumb = UniteBaseClassRev::getImageUrl($pathThumb, $thumbWidth, $thumbHeight, true);
                        }
                    }
                    //if not - put regular image:
                    if (empty($urlThumb)) {
                        $urlThumb = $slide->getImageUrl();
                    }
                }
                $htmlThumb = 'data-thumb="' . $urlThumb . '" ';
            }
            //get link
            $htmlLink = "";
            $enableLink = $slide->getParam("enable_link", "false");
            if ($enableLink == "true") {
                $linkType = $slide->getParam("link_type", "regular");
                switch ($linkType) {
                    //---- normal link
                    default:
                    case "regular":
                        $link = $slide->getParam("link", "");
                        $linkOpenIn = $slide->getParam("link_open_in", "same");
                        $htmlTarget = "";
                        if ($linkOpenIn == "new") {
                            $htmlTarget = ' data-target="_blank"';
                        }
                        $htmlLink = "data-link=\"{$link}\" {$htmlTarget} ";
                        break;
                        //---- link to slide
                    //---- link to slide
                    case "slide":
                        $slideLink = UniteFunctionsRev::getVal($params, "slide_link");
                        if (!empty($slideLink) && $slideLink != "nothing") {
                            //get slide index from id
                            if (is_numeric($slideLink)) {
                                $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink);
                            }
                            if (!empty($slideLink)) {
                                $htmlLink = "data-link=\"slide\" data-linktoslide=\"{$slideLink}\" ";
                            }
                        }
                        break;
                }
                //set link position:
                $linkPos = UniteFunctionsRev::getVal($params, "link_pos", "front");
                if ($linkPos == "back") {
                    $htmlLink .= ' data-slideindex="back"';
                }
            }
            //set delay
            $htmlDelay = "";
            $delay = $slide->getParam("delay", "");
            if (!empty($delay) && is_numeric($delay)) {
                $htmlDelay = "data-delay=\"{$delay}\" ";
            }
            //get duration
            $htmlDuration = "";
            $duration = $slide->getParam("transition_duration", "");
            if (!empty($duration) && is_numeric($duration)) {
                $htmlDuration = "data-masterspeed=\"{$duration}\" ";
            }
            //get rotation
            $htmlRotation = "";
            $rotation = $slide->getParam("transition_rotation", "");
            if (!empty($rotation)) {
                $rotation = (int) $rotation;
                if ($rotation != 0) {
                    if ($rotation > 720 && $rotation != 999) {
                        $rotation = 720;
                    }
                    if ($rotation < -720) {
                        $rotation = -720;
                    }
                }
                $htmlRotation = "data-rotate=\"{$rotation}\" ";
            }
            $fullWidthVideoData = $this->getSlideFullWidthVideoData($slide);
            //set full width centering.
            /*$htmlImageCentering = "";
            		$fullWidthCentering = $slide->getParam("fullwidth_centering","false");
            		if($sliderType == "fullwidth" && $fullWidthCentering == "true")
            			$htmlImageCentering = ' data-fullwidthcentering="on"';
            		*/
            //set first slide transition
            $htmlFirstTrans = "";
            if ($index == $startWithSlide) {
                $htmlFirstTrans = $htmlFirstTransWrap;
            }
            //first trans
            $htmlParams = $htmlDuration . $htmlLink . $htmlThumb . $htmlDelay . $htmlRotation . $htmlFirstTrans;
            $styleImage = "";
            $urlImageTransparent = UniteBaseClassRev::$url_plugin . "images/transparent.png";
            switch ($bgType) {
                case "trans":
                    $urlSlideImage = $urlImageTransparent;
                    break;
                case "solid":
                    $urlSlideImage = $urlImageTransparent;
                    $slideBGColor = $slide->getParam("slide_bg_color", "#d0d0d0");
                    $styleImage = "style='background-color:" . $slideBGColor . "'";
                    break;
            }
            //additional params
            $imageAddParams = "";
            if ($lazyLoad == "on") {
                $imageAddParams .= "data-lazyload=\"{$urlSlideImage}\"";
                $urlSlideImage = UniteBaseClassRev::$url_plugin . "images/dummy.png";
            }
            //$imageAddParams .= $htmlImageCentering;
            //additional background params
            $bgFit = $slide->getParam("bg_fit", "cover");
            $bgFitX = intval($slide->getParam("bg_fit_x", "100"));
            $bgFitY = intval($slide->getParam("bg_fit_y", "100"));
            $bgPosition = $slide->getParam("bg_position", "center top");
            $bgPositionX = intval($slide->getParam("bg_position_x", "0"));
            $bgPositionY = intval($slide->getParam("bg_position_y", "0"));
            $bgRepeat = $slide->getParam("bg_repeat", "no-repeat");
            if ($bgPosition == 'percentage') {
                $imageAddParams .= ' data-bgposition="' . $bgPositionX . '% ' . $bgPositionY . '%"';
            } else {
                $imageAddParams .= ' data-bgposition="' . $bgPosition . '"';
            }
            //check for kenburn & pan zoom
            $kenburn_effect = $slide->getParam("kenburn_effect", "off");
            //$kb_rotation_start = intval($slide->getParam("kb_rotation_start","0"));
            //$kb_rotation_end = intval($slide->getParam("kb_rotation_end","0"));
            $kb_duration = intval($slide->getParam("kb_duration", $this->slider->getParam("delay", 9000)));
            $kb_ease = $slide->getParam("kb_easing", "Linear.easeNone");
            $kb_start_fit = $slide->getParam("kb_start_fit", "100");
            $kb_end_fit = $slide->getParam("kb_end_fit", "100");
            $kb_pz = '';
            if ($kenburn_effect == "on" && ($bgType == 'image' || $bgType == 'external')) {
                $kb_pz .= ' data-kenburns="on"';
                //$kb_pz.= ' data-rotationstart="'.$kb_rotation_start.'"';
                //$kb_pz.= ' data-rotationend="'.$kb_rotation_end.'"';
                $kb_pz .= ' data-duration="' . $kb_duration . '"';
                $kb_pz .= ' data-ease="' . $kb_ease . '"';
                $kb_pz .= ' data-bgfit="' . $kb_start_fit . '"';
                $kb_pz .= ' data-bgfitend="' . $kb_end_fit . '"';
                $bgEndPosition = $slide->getParam("bg_end_position", "center top");
                $bgEndPositionX = intval($slide->getParam("bg_end_position_x", "0"));
                $bgEndPositionY = intval($slide->getParam("bg_end_position_y", "0"));
                if ($bgEndPosition == 'percentage') {
                    $kb_pz .= ' data-bgpositionend="' . $bgEndPositionX . '% ' . $bgEndPositionY . '%"';
                } else {
                    $kb_pz .= ' data-bgpositionend="' . $bgEndPosition . '"';
                }
                //set image original width and height
                //$imgSize = @getimagesize($urlSlideImage);
                //if(is_array($imgSize) && !empty($imgSize)){
                //	$kb_pz.= ' data-owidth="'.$imgSize[0].'"';
                //	$kb_pz.= ' data-oheight="'.$imgSize[1].'"';
                //}
            } else {
                //only set if kenburner is off
                if ($bgFit == 'percentage') {
                    $imageAddParams .= ' data-bgfit="' . $bgFitX . '% ' . $bgFitY . '%"';
                } else {
                    $imageAddParams .= ' data-bgfit="' . $bgFit . '"';
                }
                $imageAddParams .= ' data-bgrepeat="' . $bgRepeat . '"';
            }
            //Html
            echo "\t<!-- SLIDE  -->\n";
            echo "\t<li data-transition=\"" . $transition . "\" data-slotamount=\"" . $slotAmount . "\" " . $htmlParams . ">\n";
            echo "\t\t<!-- MAIN IMAGE -->\n";
            echo "\t\t<img src=\"" . $urlSlideImage . "\" " . $styleImage . " alt=\"" . $alt . "\" " . $imageAddParams . $kb_pz . ">\n";
            echo "\t\t<!-- LAYERS -->\n";
            //put video:
            if ($fullWidthVideoData["found"] == true) {
                //backward compatability
                $this->putFullWidthVideoLayer($fullWidthVideoData);
            }
            $this->putCreativeLayer($slide);
            echo "\t</li>\n";
        }
        //get foreach
        echo "</ul>\n";
    }
示例#11
0
 /**
  *
  * set cache path for images. for multisite it will be current blog content folder
  */
 private static function setPathCache()
 {
     self::$path_cache = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
 }
    /**
     * 
     * put the slider slides
     */
    private function putSlides()
    {
        $sliderType = $this->slider->getParam("slider_type");
        $slides = $this->slider->getSlides();
        $this->slidesNumIndex = $this->slider->getSlidesNumbersByIDs();
        if (empty($slides)) {
            ?>
				<div class="no-slides-text">
					No slides found, please add some slides
				</div>
				<?php 
        }
        $thumbWidth = $this->slider->getParam("thumb_width", 100);
        $thumbHeight = $this->slider->getParam("thumb_height", 50);
        $slideWidth = $this->slider->getParam("width", 900);
        $slideHeight = $this->slider->getParam("height", 300);
        $navigationType = $this->slider->getParam("navigaion_type", "none");
        $isThumbsActive = $navigationType == "thumb" ? true : false;
        //for one slide preview
        if ($this->oneSlideMode == true) {
            $slides = $this->filterOneSlide($slides);
        }
        ?>
				<ul>
			<?php 
        foreach ($slides as $slide) {
            $params = $slide->getParams();
            $transition = $slide->getParam("slide_transition", "random");
            $slotAmount = $slide->getParam("slot_amount", "7");
            $urlSlideImage = $slide->getImageUrl();
            //get image alt
            $imageFilename = $slide->getImageFilename();
            $info = pathinfo($imageFilename);
            $alt = $info["filename"];
            //get thumb url
            $htmlThumb = "";
            if ($isThumbsActive == true) {
                $urlThumb = $slide->getParam("slide_thumb", "");
                if (empty($urlThumb)) {
                    //try to get resized thumb
                    $pathThumb = $slide->getImageFilepath();
                    if (!empty($pathThumb)) {
                        $urlThumb = UniteBaseClassRev::getImageUrl($pathThumb, $thumbWidth, $thumbHeight, true);
                    }
                }
                //if not - put regular image:
                if (empty($urlThumb)) {
                    $urlThumb = $slide->getImageUrl();
                }
                $htmlThumb = 'data-thumb="' . $urlThumb . '" ';
            }
            //get link
            $htmlLink = "";
            $enableLink = $slide->getParam("enable_link", "false");
            if ($enableLink == "true") {
                $linkType = $slide->getParam("link_type", "regular");
                switch ($linkType) {
                    //---- normal link
                    default:
                    case "regular":
                        $link = $slide->getParam("link", "");
                        $linkOpenIn = $slide->getParam("link_open_in", "same");
                        $htmlTarget = "";
                        if ($linkOpenIn == "new") {
                            $htmlTarget = ' data-target="_blank"';
                        }
                        $htmlLink = "data-link=\"{$link}\" {$htmlTarget} ";
                        break;
                        //---- link to slide
                    //---- link to slide
                    case "slide":
                        $slideLink = UniteFunctionsRev::getVal($params, "slide_link");
                        if (!empty($slideLink) && $slideLink != "nothing") {
                            //get slide index from id
                            if (is_numeric($slideLink)) {
                                $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink);
                            }
                            if (!empty($slideLink)) {
                                $htmlLink = "data-link=\"slide\" data-linktoslide=\"{$slideLink}\" ";
                            }
                        }
                        break;
                }
                //set link position:
                $linkPos = UniteFunctionsRev::getVal($params, "link_pos", "front");
                if ($linkPos == "back") {
                    $htmlLink .= ' data-slideindex="back"';
                }
            }
            //set delay
            $htmlDelay = "";
            $delay = $slide->getParam("delay", "");
            if (!empty($delay) && is_numeric($delay)) {
                $htmlDelay = "data-delay=\"{$delay}\" ";
            }
            //get duration
            $htmlDuration = "";
            $duration = $slide->getParam("transition_duration", "");
            if (!empty($duration) && is_numeric($duration)) {
                $htmlDuration = "data-masterspeed=\"{$duration}\" ";
            }
            //get rotation
            $htmlRotation = "";
            $rotation = $slide->getParam("transition_rotation", "");
            if (!empty($rotation)) {
                $rotation = (int) $rotation;
                if ($rotation != 0) {
                    if ($rotation > 720 && $rotation != 999) {
                        $rotation = 720;
                    }
                    if ($rotation < -720) {
                        $rotation = -720;
                    }
                }
                $htmlRotation = "data-rotate=\"{$rotation}\" ";
            }
            $videoData = $this->getSlideFullWidthVideoData($slide);
            //set full width centering.
            $htmlImageCentering = "";
            $fullWidthCentering = $slide->getParam("fullwidth_centering", "false");
            if ($sliderType == "fullwidth" && $fullWidthCentering == "true") {
                $htmlImageCentering = 'data-fullwidthcentering="true"';
            }
            $htmlParams = $htmlDuration . $htmlLink . $htmlThumb . $htmlDelay . $htmlRotation;
            //Html
            ?>
					<li data-transition="<?php 
            echo $transition;
            ?>
" data-slotamount="<?php 
            echo $slotAmount;
            ?>
" <?php 
            echo $htmlParams;
            ?>
>
						<img src="<?php 
            echo $urlSlideImage;
            ?>
" alt="<?php 
            echo $alt;
            ?>
" <?php 
            echo $htmlImageCentering;
            ?>
>
						<?php 
            //put video:
            if ($videoData["found"] == true) {
                $this->putFullWidthVideoLayer($videoData);
            }
            $this->putCreativeLayer($slide);
            ?>
					</li>
				<?php 
        }
        //get foreach
        ?>
				</ul>
			<?php 
    }
    /**
     * 
     * put the slider slides
     */
    private function putSlides()
    {
        $slides = $this->slider->getSlides();
        if (empty($slides)) {
            ?>
				<div class="no-slides-text">
					No slides found, please add some slides
				</div>
				<?php 
        }
        $thumbWidth = $this->slider->getParam("thumb_width", 100);
        $thumbHeight = $this->slider->getParam("thumb_height", 50);
        $slideWidth = $this->slider->getParam("width", 900);
        $slideHeight = $this->slider->getParam("height", 300);
        $navigationType = $this->slider->getParam("navigaion_type", "none");
        $isThumbsActive = $navigationType == "thumb" ? true : false;
        $flagReize = $this->slider->getParam("php_resize", "none");
        $flagReize = $flagReize == "on" ? true : false;
        ?>
				<ul>
			<?php 
        foreach ($slides as $slide) {
            $params = $slide->getParams();
            $transition = $slide->getParam("slide_transition", "random");
            $slotAmount = $slide->getParam("slot_amount", "7");
            $urlSlideImage = $slide->getImageUrl();
            if ($flagReize == true) {
                $pathSlideImage = $slide->getImageFilepath();
                if (!empty($pathSlideImage)) {
                    $urlSlideImage = UniteBaseClassRev::getImageUrl($pathSlideImage, $slideWidth, $slideHeight, true);
                }
            }
            //get thumb url
            $htmlThumb = "";
            if ($isThumbsActive == true) {
                $urlThumb = $slide->getParam("slide_thumb", "");
                if (empty($urlThumb)) {
                    //try to get resized thumb
                    $pathThumb = $slide->getImageFilepath();
                    if (!empty($pathThumb)) {
                        $urlThumb = UniteBaseClassRev::getImageUrl($pathThumb, $thumbWidth, $thumbHeight, true);
                    }
                }
                //if not - put regular image:
                if (empty($urlThumb)) {
                    $urlThumb = $slide->getImageUrl();
                }
                $htmlThumb = 'data-thumb="' . $urlThumb . '" ';
            }
            //get link
            $htmlLink = "";
            $enableLink = $slide->getParam("enable_link", "false");
            if ($enableLink == "true") {
                $link = $slide->getParam("link", "");
                $linkOpenIn = $slide->getParam("link_open_in", "same");
                $htmlTarget = "";
                if ($linkOpenIn == "new") {
                    $htmlTarget = ' data-target="_blank"';
                }
                $htmlLink = "data-link=\"{$link}\" {$htmlTarget} ";
            }
            //set delay
            $htmlDelay = "";
            $delay = $slide->getParam("delay", "");
            if (!empty($delay) && is_numeric($delay)) {
                $htmlDelay = "data-delay=\"{$delay}\" ";
            }
            //get duration
            $htmlDuration = "";
            $duration = $slide->getParam("transition_duration", "");
            if (!empty($duration) && is_numeric($duration)) {
                $htmlDuration = "data-masterspeed=\"{$duration}\" ";
            }
            //get rotation
            $htmlRotation = "";
            $rotation = $slide->getParam("transition_rotation", "");
            if (!empty($rotation)) {
                $rotation = (int) $rotation;
                if ($rotation != 0) {
                    if ($rotation > 720 && $rotation != 999) {
                        $rotation = 720;
                    }
                    if ($rotation < -720) {
                        $rotation = -720;
                    }
                }
                $htmlRotation = "data-rotate=\"{$rotation}\" ";
            }
            $videoData = $this->getSlideFullWidthVideoData($slide);
            $htmlParams = $htmlDuration . $htmlLink . $htmlThumb . $htmlDelay . $htmlRotation;
            //Html
            ?>
					<li data-transition="<?php 
            echo $transition;
            ?>
" data-slotamount="<?php 
            echo $slotAmount;
            ?>
" <?php 
            echo $htmlParams;
            ?>
>
						<img src="<?php 
            echo $urlSlideImage;
            ?>
" alt="alt" />
						<?php 
            //put video:
            if ($videoData["found"] == true) {
                $this->putFullWidthVideoLayer($videoData);
            }
            $this->putCreativeLayer($slide);
            ?>
					</li>
				<?php 
        }
        //get foreach
        ?>
				</ul>
			<?php 
    }
示例#14
0
function add_shortcode($tag, $func)
{
    UniteBaseClassRev::add_shortcode($tag, $func);
}
function do_shortcode($str)
{
    return UniteBaseClassRev::parse($str);
}
示例#16
0
 /**
  * 
  * set debug mode.
  */
 public static function setDebugMode()
 {
     self::$debugMode = true;
 }
 /**
  * 
  * get thumb url
  */
 public function getUrlImageThumb()
 {
     //get image url by thumb
     if (!empty($this->imageID)) {
         $urlImage = UniteFunctionsWPRev::getUrlAttachmentImage($this->imageID, UniteFunctionsWPRev::THUMB_MEDIUM);
     } else {
         //get from cache
         if (!empty($this->imageFilepath)) {
             $urlImage = UniteBaseClassRev::getImageUrl($this->imageFilepath, 200, 100, true);
         } else {
             $urlImage = $this->imageUrl;
         }
     }
     if (empty($urlImage)) {
         $urlImage = $this->imageUrl;
     }
     return $urlImage;
 }
示例#18
0
 /**
  * 
  * main constructor		 
  */
 public function __construct($mainFile, $t)
 {
     parent::__construct($mainFile, $t);
     self::addAction(self::ACTION_ENQUEUE_SCRIPTS, "onAddScripts");
     add_filter('wp_footer', array($this, 'onAddScriptsHtml'));
 }