Esempio n. 1
0
    function ut_needed_js()
    {
        global $detect;
        /* check for js cache */
        if (ot_get_option('ut_use_cache', 'off') == 'on' && is_front_page()) {
            $transient_prefix = $detect->isMobile() ? '_mobile' : '_desktop';
            $language_prefix = defined('ICL_LANGUAGE_CODE') ? '_' . ICL_LANGUAGE_CODE : '';
            $js = get_transient('ut_js_cache' . $transient_prefix . $language_prefix);
            if (!empty($js)) {
                echo apply_filters('ut-custom-js', $js);
                return;
            }
        }
        $accentcolor = get_option('ut_accentcolor', '#CC5E53');
        $ut_hero_type = ut_return_hero_config('ut_hero_type');
        $js = '(function($){
        	
				"use strict";
		
				$(document).ready(function(){ ';
        $js .= 'var brooklyn_scroll_offset = $("#header-section").outerHeight();';
        /*
        |--------------------------------------------------------------------------
        | Retina Logo
        |--------------------------------------------------------------------------
        */
        /* check if current page has an option tp show a hero */
        $ut_activate_page_hero = get_post_meta(get_the_ID(), 'ut_activate_page_hero', true);
        $sitelogo_retina = !is_front_page() && !is_home() && ($ut_activate_page_hero == 'off' || empty($ut_activate_page_hero)) ? get_theme_mod('ut_site_logo_alt_retina') : get_theme_mod('ut_site_logo_retina');
        $alternate_logo_retina = get_theme_mod('ut_site_logo_alt_retina') ? get_theme_mod('ut_site_logo_alt_retina') : get_theme_mod('ut_site_logo_retina');
        $js .= 'window.matchMedia||(window.matchMedia=function(){var c=window.styleMedia||window.media;if(!c){var a=document.createElement("style"),d=document.getElementsByTagName("script")[0],e=null;a.type="text/css";a.id="matchmediajs-test";d.parentNode.insertBefore(a,d);e="getComputedStyle"in window&&window.getComputedStyle(a,null)||a.currentStyle;c={matchMedium:function(b){b="@media "+b+"{ #matchmediajs-test { width: 1px; } }";a.styleSheet?a.styleSheet.cssText=b:a.textContent=b;return"1px"===e.width}}}return function(a){return{matches:c.matchMedium(a|| "all"),media:a||"all"}}}());';
        $js .= 'var ut_modern_media_query = window.matchMedia( "screen and (-webkit-min-device-pixel-ratio:2)");';
        if (!empty($sitelogo_retina)) {
            $js .= 'if( ut_modern_media_query.matches ) {
                        
                        var $logo = $(".site-logo img");
                        $logo.attr("src" , retina_logos.sitelogo_retina );
                                        
                    
                    }';
        }
        if (!empty($alternate_logo_retina)) {
            $js .= 'if( ut_modern_media_query.matches ) {
                        
                        var $logo = $(".site-logo img");
                        $logo.data("altlogo" , retina_logos.alternate_logo_retina );        
                            
                      
                      }';
        }
        /*
        |--------------------------------------------------------------------------
        | Pre Loader
        |--------------------------------------------------------------------------
        */
        if (ot_get_option('ut_use_image_loader') == 'on') {
            if (ut_dynamic_conditional('ut_use_image_loader_on')) {
                /* settings for pre loader */
                $loadercolor = ot_get_option('ut_image_loader_color', $accentcolor);
                $barcolor = ot_get_option('ut_image_loader_bar_color', $accentcolor);
                $loader_bg_color = ot_get_option('ut_image_loader_background', '#FFF');
                $bar_height = ot_get_option('ut_image_loader_barheight', 3);
                $ut_show_loader_bar = ot_get_option('ut_show_loader_bar', 'on');
                if ($detect->isMobile()) {
                    $js .= 'window.addEventListener("DOMContentLoaded", function() {
															
								$("body").queryLoader2({
									showbar: "' . $ut_show_loader_bar . '",					
									barColor: "' . $barcolor . '",
									textColor: "' . $loadercolor . '",
									backgroundColor: "' . $loader_bg_color . '",
									barHeight: ' . $bar_height . ',
									percentage: true,						
									completeAnimation: "fade",
									minimumTime: 500,
									onComplete : function() {
									
										$(".ut-loader-overlay").fadeOut( 600 , "easeInOutExpo" , function() {
											$(this).remove();
										});
										
									}
									
								});
							});';
                } else {
                    $js .= '$("body").queryLoader2({						
								showbar: "' . $ut_show_loader_bar . '",			
								barColor: "' . $barcolor . '",
								textColor: "' . $loadercolor . '",
								backgroundColor: "' . $loader_bg_color . '",
								barHeight: ' . $bar_height . ',
								
								percentage: true,						
								completeAnimation: "fade",
								minimumTime: 500,
								onComplete : function() {
								
									$(".ut-loader-overlay").fadeOut( 600 , "easeInOutExpo" , function() {
										$(this).remove();
									});
									
								}
								
							});';
                }
            }
        }
        /*
        |--------------------------------------------------------------------------
        | Slogan / Welcome Message Animation
        |--------------------------------------------------------------------------
        */
        if ($ut_hero_type != 'slider') {
            $js .= '
				$(window).load(function() {
					
					function show_slogan() {
						$(".hero-holder").animate({ opacity : 1 });
					}
								
					var execute_slogan = setTimeout ( show_slogan , 800 );
					
				});';
        }
        /*
        |--------------------------------------------------------------------------
        | Fittext for Hero Style 11
        |--------------------------------------------------------------------------
        */
        if (ut_return_hero_config('ut_hero_style', 'ut-hero-style-1') == 'ut-hero-style-11') {
            $js .= '
                    
                        $(".ut-hero-style-11 .hero-title").fitText(1.1, { minFontSize: "30px", maxFontSize: "130px" });
	                    $(".ut-hero-style-11 .hero-description").fitText(1.6, { minFontSize: "20px", maxFontSize: "72px" });
                        $(".ut-hero-style-11 .hero-description-bottom").fitText(2.0, { minFontSize: "14px", maxFontSize: "20px" });
                    
                    ';
        }
        /*
        |--------------------------------------------------------------------------
        | Call to Action Button Scoll Animation
        | only available if shortcode plugin has been installed
        |--------------------------------------------------------------------------
        */
        if (ut_is_plugin_active('ut-shortcodes/ut-shortcodes.php')) {
            $js .= '
                        $(".cta-btn a").click( function(event) { 
                    
                            if(this.hash) {
                                $.scrollTo( this.hash , 650, { easing: "easeInOutExpo" , offset: -brooklyn_scroll_offset-1 , "axis":"y" } );			
                                event.preventDefault();				
                            }
                            
                        });				
                    ';
        }
        /*
        |--------------------------------------------------------------------------
        | Main Navigation Animation ( only for blog and front page )
        |--------------------------------------------------------------------------
        */
        if ((is_home() || is_front_page() || is_singular('portfolio') || get_post_meta(get_the_ID(), 'ut_activate_page_hero', true) == 'on') && ot_get_option('ut_navigation_state', 'off') == 'off') {
            $ut_navigation_skin = ot_get_option('ut_navigation_skin', 'ut-header-light');
            $navigation_width = ot_get_option('ut_navigation_width', 'centered');
            $ut_site_border_header_class = ot_get_option('ut_site_border', 'hide') == 'show' ? 'bordered-navigation' : '';
            $js .= '				
					/* Header Animation
					================================================== */		
					var $header     = $("#header-section"),
						$logo	    = $(".site-logo img"),
						logo	    = $logo.attr("src"),
						logoalt     = $logo.data("altlogo"),
                        is_open     = false,
                        has_passed  = false;
					
                    var ut_nav_skin_changer = function( direction , animClassDown , animClassUp ) {
                        
                        if( direction === "down" && animClassDown ) {
                            
                            $header.attr("class", "ha-header ' . $ut_navigation_skin . ' ' . $navigation_width . '" + animClassDown + " ' . $ut_site_border_header_class . '" );
                            $logo.attr("src" , logoalt );
                            
                        } else if( direction === "up" && animClassUp ){
                            
                            $header.attr("class", "ha-header ' . $ut_navigation_skin . ' ' . $navigation_width . ' " + animClassUp + " ' . $ut_site_border_header_class . '");
                            $logo.attr("src" , logo );
                            
                        }
                        
                    };
                                      
                    					
					$( ".ha-waypoint" ).each( function(i) {
						
						/* needed vars */
						var $this = $( this ),
							animClassDown = $this.data( "animateDown" ),
							animClassUp   = $this.data( "animateUp" );
						
						$this.waypoint(function(direction) {
							
                            ut_nav_skin_changer( direction , animClassDown , animClassUp );
                            
						}, { offset: brooklyn_scroll_offset+1 } );
						
					});';
        }
        if ((is_home() || is_front_page() || is_singular('portfolio') || get_post_meta(get_the_ID(), 'ut_activate_page_hero', true) == 'on') && ot_get_option('ut_navigation_state', 'off') == 'on_transparent') {
            $ut_navigation_skin = ot_get_option('ut_navigation_skin', 'ut-header-light');
            $navigation_width = ot_get_option('ut_navigation_width', 'centered');
            $ut_site_border_header_class = ot_get_option('ut_site_border', 'hide') == 'show' ? 'bordered-navigation' : '';
            $js .= '				
					/* Header Animation
					================================================== */		
					var $header     = $("#header-section"),
						$logo	    = $(".site-logo img"),
						logo	    = $logo.attr("src"),
						logoalt     = $logo.data("altlogo"),
                        is_open     = false,
                        has_passed  = false;
					
                    var ut_update_header_skin = function() {
                        
                        if (($(window).width() > 979) && is_open ) {
                            
                            $(".ut-mm-trigger").trigger("click");
                            
                            if( has_passed ) {
                                
                                $header.attr("class", "ha-header ' . $ut_navigation_skin . ' ' . $navigation_width . ' ' . $ut_site_border_header_class . '");
                                
                            } else {
                                
                                $header.attr("class", "ha-header ha-transparent ' . $navigation_width . ' ' . $ut_site_border_header_class . '");
                                
                            }
                            
                        }
                           
                    };
                    
                    var ut_nav_skin_changer = function( direction ) {
                        
                        if( direction === "down" && !is_open ) {
                            
                            $header.attr("class", "ha-header ' . $ut_navigation_skin . ' ' . $navigation_width . ' ' . $ut_site_border_header_class . '");
                            $logo.attr("src" , logoalt );
                            
                            has_passed = true;                            
                            
                        } else if( direction === "up" && !is_open ) {
                            
                            $header.attr("class", "ha-header ha-transparent ' . $navigation_width . ' ' . $ut_site_border_header_class . '");
                            $logo.attr("src" , logo );
                            
                            has_passed = false;
                            
                        }	
                    
                   };
                    
                   $(".ut-mm-trigger").click(function(event){ 
                                                
                        if( $header.hasClass("ha-transparent") && !has_passed ) {
                            
                            $header.attr("class", "ha-header ' . $navigation_width . ' ' . $ut_navigation_skin . ' ' . $ut_site_border_header_class . '");
                            $logo.attr("src" , logoalt );                            
                                                        
                        } else if ( $header.hasClass("' . $ut_navigation_skin . '") && !has_passed ) {
                            
                            $header.attr("class", "ha-header ' . $navigation_width . ' ha-transparent ' . $ut_site_border_header_class . '");
                            $logo.attr("src" , logo );                            
                            
                        }
                                                                        
                        event.preventDefault();
                        
                    }).toggle(function(){ is_open = true; }, function() { is_open = false; });   
                                        
                    $(window).utresize(function(){
                        ut_update_header_skin();
                    });
                                    
					$( "#main-content" ).waypoint(function(direction) {
							
						ut_nav_skin_changer(direction);			
						
                        if( direction === "down" ) {
                            
                            has_passed = true;                           
                            
                        } else if( direction === "up" ) {
                                                        
                            has_passed = false;                           
                            
                        }	
                        
					}, { offset: brooklyn_scroll_offset+1 });';
        }
        /*
        |--------------------------------------------------------------------------
        | Rain Effect for images
        |--------------------------------------------------------------------------
        */
        if (ut_return_hero_config('ut_hero_rain_effect', 'off') == 'on' && ($ut_hero_type == 'image' || $ut_hero_type == 'tabs' || $ut_hero_type == 'splithero')) {
            $js .= '
					
					$.fn.utFullSize = function( callback ) {
						
						var fullsize = $(this);		
					
						function utResizeObject() {
						  
						  	var imgwidth = fullsize.width(),
						   		imgheight = fullsize.height(),
								winwidth = $(window).width(),
						  		winheight = $(window).height(),
								widthratio = winwidth / imgwidth,
						  		heightratio = winheight / imgheight,
								widthdiff = heightratio * imgwidth,
						  		heightdiff = widthratio * imgheight;
							
							if( heightdiff > winheight ) {
							
								fullsize.css({
									width: winwidth+"px",
									height: heightdiff+"px"
								});
							
							} else {
							
								fullsize.css({
									width: widthdiff+"px",
									height: winheight+"px"
								});		
								
							}
							
						} 
						
						utResizeObject();
						
						$(window).utresize(function(){
							utResizeObject();
						});
						
						if (callback && typeof(callback) === "function") {   
							callback();  
						}

					};
					
					
					function ut_init_RainyDay( callback ) {
												
						var $image = document.getElementById("ut-rain-background"),
							$hero  = document.getElementById("ut-hero");						
							
							var engine = new RainyDay({
								image: $image,
								parentElement : $hero,
								blur: 20,
								opacity: 1,
								fps: 24
							});
							
							engine.gravity = engine.GRAVITY_NON_LINEAR;
							engine.trail = engine.TRAIL_SMUDGE;
							engine.rain([ [6, 6, 0.1], [2, 2, 0.1] ], 50 );
						
						$image.crossOrigin = "anonymous";
						
						if (callback && typeof(callback) === "function") {   
							callback();  
						}
						
					}
										
					
					$(window).load(function(){
						
						$("#ut-rain-background").utFullSize( function() {
							
							/* play rainday sound and remove section image and adjust canvas */
							ut_init_RainyDay( function() {
								
								$("#ut-hero").css("background-image" , "none");
								$("#ut-hero canvas").utFullSize();
								
								if( $("#ut-hero-audio").length != 0 ) {
									$("#ut-hero-audio").find(".mejs-play button").click();
								}
								
							});
						
						});
						
					});';
            if (ut_return_hero_config('ut_hero_rain_sound', 'off') == 'on') {
                $js .= '
					
					$(".ut-audio-control").click(function(event){

						var $audioPlayer = $("#ut-hero-audio");
						
						if( $(".ut-audio-control").hasClass("ut-unmute") ) {
							
							$audioPlayer.find(".mejs-mute button").click();							
							$(this).removeClass("ut-unmute").addClass("ut-mute").text("MUTE");	
						
						} else {
							
							$audioPlayer.find(".mejs-unmute button").click();							
							$(this).removeClass("ut-mute").addClass("ut-unmute").text("UNMUTE");
							
						}
						
						event.preventDefault();
						
					});
					
					';
            }
        }
        /*
        |--------------------------------------------------------------------------
        | Video Player Call
        |--------------------------------------------------------------------------
        */
        if (!$detect->isMobile() && $ut_hero_type == 'video' || !$detect->isMobile() && $ut_hero_type == 'tabs' && ut_return_hero_config('ut_video_containment', 'hero') == 'body') {
            $volume = ut_return_hero_config('ut_video_volume', "5");
            $js .= '
						if( $("#ut-background-video-hero").length ) {						
							
							$("#ut-background-video-hero").mb_YTPlayer();
							
							/* player mute control */
							$("#ut-video-hero-control.youtube").click(function(event){
								
								if( $(this).hasClass("ut-unmute") ) {
									
									$(this).removeClass("ut-unmute").addClass("ut-mute").text("MUTE");														
									$("#ut-background-video-hero").unmuteYTPVolume();
									$("#ut-background-video-hero").setYTPVolume(' . $volume . ');
									
								} else {
									
									$(this).removeClass("ut-mute").addClass("ut-unmute").text("UNMUTE");
									$("#ut-background-video-hero").muteYTPVolume();							
									
								}
	                            
                                event.preventDefault();
                                
							});
							
						}';
        }
        /*
        |--------------------------------------------------------------------------
        | Slider Settings Hook
        |--------------------------------------------------------------------------
        */
        if ($ut_hero_type == 'slider' || is_singular("portfolio") && get_post_format() == 'gallery') {
            $animation = ut_return_hero_config('ut_background_slider_animation', 'fade');
            $slideshowSpeed = ut_return_hero_config('ut_background_slider_slideshow_speed', 7000);
            $animationSpeed = ut_return_hero_config('ut_background_slider_animation_speed', 600);
            if (is_singular("portfolio")) {
                $animation = 'fade';
                $slideshowSpeed = '7000';
                $animationSpeed = '600';
            }
            $js .= '
				 $(window).load(function(){
					 
					 var $hero_captions = $("#ut-hero-captions"),
					 	 animatingTo = 0;
					 
					 $hero_captions.find(".hero-holder").each(function() {						
						
						var pos = $(this).data("animation"),
							add = "-50%";
						
						if( pos==="left" || pos==="right" ) { add = "-25%" };						
						
						$(this).css( pos , add );	
												
					 });
					 
					 
                     $hero_captions.flexslider({
                        animation: "fade",
						animationSpeed: ' . $animationSpeed . ',
						slideshowSpeed: ' . $slideshowSpeed . ',
                        controlNav: false,
						directionNav: false,
                        animationLoop: true,
                        slideshow: true,
                        before: function(slider){                        	
							
							/* hide hero holder */
							$(".flex-active-slide").find(".hero-holder").fadeOut("fast", function() {
								
								var pos = $(this).data("animation"),
									anim = { opacity: 0 , display : "table" },
									add = "-50%";
								
								if( pos==="left" || pos==="right" ) { add = "-25%" };
								
								anim[pos] = add;
								
								$(this).css(anim);
								
							});
														
							/* animate background slider */
                            $("#ut-hero-slider").flexslider(slider.animatingTo);
						    
                        },
						after: function(slider) {
							
							/* change position of caption slider */
							slider.animate( { top : ( $(window).height() - $hero_captions.find(".flex-active-slide").height() ) / 2 } , 100 , function() {
							
								/* show hero holder */
								var pos = $(".flex-active-slide").find(".hero-holder").data("animation"),
									anim = { opacity: 1 };
								
								anim[pos] = 0;
								
								$(".flex-active-slide").find(".hero-holder").animate( anim );
							
							});
														
						},
						start: function(slider) {
							 
							/* create external navigation */
							$(".ut-flex-control").click(function(event){
								
								if ($(this).hasClass("next")) {
								
								  slider.flexAnimate(slider.getTarget("next"), true);
								
								} else {
								
								  slider.flexAnimate(slider.getTarget("prev"), true);
								
								}
								
								event.preventDefault();	
								
							});
							
							$(".hero.slider .parallax-overlay").fadeIn("fast");
														
							/* change position of caption slider */
							slider.animate( { top : ( $(window).height() - $hero_captions.find(".flex-active-slide").height() ) / 2 } , 100 , function() { 
								
								/* show hero holder */
								var pos = $(".flex-active-slide").find(".hero-holder").data("animation"),
									anim = { opacity: 1 };
					
								anim[pos] = 0;
									
								$(".flex-active-slide").find(".hero-holder").animate( anim );
							
							
							});
														
						}
					});
                    
                    var ut_trigger = 0;
                    
					$(window).utresize(function(){
                        
                        /* do not fire on window load resize event */    
                        if( ut_trigger > 0 ) {
                        
                            /* adjust first slide browser bug */
                            $hero_captions.find(".hero-holder").each(function() {
                                
                                $(this).find(".hero-title").width("");
                                
                                if( $(this).width() > $(this).parent().width() ) {
                                    
                                    $(this).find(".hero-title").width( $(this).parent().width()-20 );
                                
                                }
                            
                            });
                            
                            /* change slide */
                            $hero_captions.flexslider("next");
                            $hero_captions.flexslider("play");
                        
                        }
                        
                        ut_trigger++;
                            
					});
										
                    $("#ut-hero-slider").flexslider({
						animation: "fade",
						animationSpeed: ' . $animationSpeed . ',
						slideshowSpeed: ' . $slideshowSpeed . ', 
                        directionNav: false,
						controlNav: false,
    					animationLoop: true,
                        slideshow: true
					});
                                        
				});';
        }
        /*
        |--------------------------------------------------------------------------
        | Parallax Effect for Hero on Front Page
        |--------------------------------------------------------------------------
        */
        if (ut_return_hero_config('ut_hero_image_parallax') == 'on') {
            if (!$detect->isMobile()) {
                $js .= '$(".hero .parallax-scroll-container").parallax("50%", 0.6);';
            }
        }
        /*
        |--------------------------------------------------------------------------
        | Parallax Effect - disabled for mobile devices to much repaint cost
        |--------------------------------------------------------------------------
        */
        if (!$detect->isMobile()) {
            $js .= '$(".parallax-banner .parallax-scroll-container").each(function() {                
                            $(this).css({
                                "height" : $(window).height() * 1.1 + "px",
                                "width"  : $(window).width()  * 1.1 + "px",
                                "left"   : "-5%"                            
                            }).parallax( "50%", 0.6 ); 
                        });';
        }
        /*
        |--------------------------------------------------------------------------
        | Parallax Effect for Footer
        |--------------------------------------------------------------------------
        */
        $ut_csection_parallax = ot_get_option('ut_csection_parallax', 'on');
        if ($ut_csection_parallax == 'on') {
            if (!$detect->isMobile()) {
                $js .= '$(".contact-section .parallax-scroll-container").css({
                            "height" : $(window).height() * 1.1 + "px",
                            "width"  : $(window).width()  * 1.1 + "px",
                            "left"   : "-5%"                            
                        }).parallax("50%", 0.6,true);';
            }
        }
        /*
        |--------------------------------------------------------------------------
        | Lightbox
        |--------------------------------------------------------------------------
        */
        $ut_lightbox_script = ot_get_option('ut_lightbox_script', 'prettyphoto');
        if ($ut_lightbox_script == 'prettyphoto') {
            $js .= '$(".ut-lightbox").prettyPhoto({
                        social_tools : false,
                        markup: \'<div class="pp_pic_holder"> \\
                                    <div class="pp_top"> \\
                                        <div class="pp_left"></div> \\
                                        <div class="pp_middle"></div> \\
                                        <div class="pp_right"></div> \\
                                    </div> \\
                                    <div class="pp_content_container"> \\
                                        <div class="pp_left"> \\
                                        <div class="pp_right"> \\
                                            <div class="pp_content"> \\
                                                <div class="pp_loaderIcon"></div> \\
                                                <div class="pp_fade"> \\
                                                    <a href="#" class="pp_expand" title="Expand the image">Expand</a> \\
                                                    <div class="pp_hoverContainer"> \\
                                                        <a class="pp_next" href="#">next</a> \\
                                                        <a class="pp_previous" href="#">previous</a> \\
                                                    </div> \\
                                                    <div id="pp_full_res"></div> \\
                                                    <div class="pp_details"> \\
                                                        <div class="pp_nav"> \\
                                                            <a href="#" class="pp_arrow_previous">Previous</a> \\
                                                            <p class="currentTextHolder">0/0</p> \\
                                                            <a href="#" class="pp_arrow_next">Next</a> \\
                                                        </div> \\
                                                        <p class="pp_description"></p> \\
                                                        <div class="ppt">&nbsp;</div> \\
                                                        {pp_social} \\
                                                        <a class="pp_close" href="#">Close</a> \\
                                                    </div> \\
                                                </div> \\
                                            </div> \\
                                        </div> \\
                                        </div> \\
                                    </div> \\
                                    <div class="pp_bottom"> \\
                                        <div class="pp_left"></div> \\
                                        <div class="pp_middle"></div> \\
                                        <div class="pp_right"></div> \\
                                    </div> \\
                                </div> \\
                                <div class="pp_overlay"></div>\',
            
                    });';
        } else {
            $js .= '$(".ut-lightbox").lightGallery({
                        selector: "this",
                        hash: false
                   });';
        }
        /*
        |--------------------------------------------------------------------------
        | Section Animation
        |--------------------------------------------------------------------------
        */
        global $detect;
        if (!$detect->isMobile() && ot_get_option('ut_animate_sections', 'on') == 'on') {
            $csection_timer = ot_get_option('ut_animate_sections_timer', '1600');
            $js .= '$("section").each(function() {
															
							var outerHeight = $(this).outerHeight(),
								offset		= "90%",
								effect		= $(this).data("effect");
							
							if( outerHeight > $(window).height() / 2 ) {
								offset = "70%";
							}
							
                            $(this).waypoint("destroy");
							$(this).waypoint( function( direction ) {
								
								var $this = $(this);
												
								if( direction === "down" && !$(this).hasClass( "animated-" + effect ) ) {
									
									$this.find(".section-content").animate( { opacity: 1 } , ' . $csection_timer . ' );
									$this.find(".section-header-holder").animate( { opacity: 1 } , ' . $csection_timer . ' );
								    
                                    $this.addClass( "animated-" + effect );
                                    		
								}
								
							} , { offset: offset } );			
								
						});
                        
                        $(window).load(function(){
                            $(window).trigger("resize");
                        });';
        }
        $js .= '});
			
        })(jQuery);';
        /* check for css cache */
        if (ot_get_option('ut_use_cache', 'off') == 'on' && is_front_page()) {
            $transient_prefix = $detect->isMobile() ? '_mobile' : '_desktop';
            $language_prefix = defined('ICL_LANGUAGE_CODE') ? '_' . ICL_LANGUAGE_CODE : '';
            $cacheTime = ot_get_option('ut_cache_ltime', '10');
            set_transient('ut_js_cache' . $transient_prefix . $language_prefix, $js, 60 * $cacheTime);
        }
        //echo $js;
        echo apply_filters('ut-custom-js', $js);
    }
Esempio n. 2
0
 function unitedthemes_widgets_init()
 {
     $sidebars = get_option('ut_theme_sidebars');
     if (!empty($sidebars) && is_array($sidebars)) {
         foreach ($sidebars as $num => $sidebar_options) {
             if (!empty($sidebar_options['sidebar_id'])) {
                 register_sidebar(array('name' => isset($sidebar_options['sidebarname']) ? $sidebar_options['sidebarname'] : __('Sidebar without Name', 'unitedthemes'), 'id' => $sidebar_options['sidebar_id'], 'description' => isset($sidebar_options['sidebardesc']) ? $sidebar_options['sidebardesc'] : '', 'before_widget' => '<li id="%1$s" class="clearfix widget-container %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title"><span>', 'after_title' => '</span></h3>'));
             }
         }
     }
     register_sidebar(array('name' => __('Blog Sidebar', 'unitedthemes'), 'id' => 'blog-widget-area', 'before_widget' => '<li class="clearfix widget-container %1$s %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title"><span>', 'after_title' => '</span></h3>'));
     register_sidebar(array('name' => __('First Footer Widget Area', 'unitedthemes'), 'id' => 'first-footer-widget-area', 'description' => __('The first footer widget area', 'unitedthemes'), 'before_widget' => '<li class="clearfix widget-container %1$s %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title"><span>', 'after_title' => '</span></h3>'));
     register_sidebar(array('name' => __('Second Footer Widget Area', 'unitedthemes'), 'id' => 'second-footer-widget-area', 'description' => __('The second footer widget area', 'unitedthemes'), 'before_widget' => '<li class="clearfix widget-container %1$s %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title"><span>', 'after_title' => '</span></h3>'));
     register_sidebar(array('name' => __('Third Footer Widget Area', 'unitedthemes'), 'id' => 'third-footer-widget-area', 'description' => __('The third footer widget area', 'unitedthemes'), 'before_widget' => '<li class="clearfix widget-container %1$s %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title"><span>', 'after_title' => '</span></h3>'));
     register_sidebar(array('name' => __('Fourth Footer Widget Area', 'unitedthemes'), 'id' => 'fourth-footer-widget-area', 'description' => __('The fourth footer widget area', 'unitedthemes'), 'before_widget' => '<li class="clearfix widget-container %1$s %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title"><span>', 'after_title' => '</span></h3>'));
     register_sidebar(array('name' => __('Page Default Sidebar', 'unitedthemes'), 'id' => 'page-widget-area', 'before_widget' => '<li class="clearfix widget-container %1$s %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title"><span>', 'after_title' => '</span></h3>'));
     /* woocommerce sidebar */
     if (ut_is_plugin_active('woocommerce/woocommerce.php')) {
         register_sidebar(array('name' => __('Shop Sidebar', 'unitedthemes'), 'id' => 'shop-widget-area', 'before_widget' => '<li class="clearfix widget-container %1$s %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title"><span>', 'after_title' => '</span></h3>'));
     }
 }
        extract(shortcode_atts(array('cite' => '', 'class' => ''), $atts));
        $blockquote = '<div class="ut-parallax-quote"><h2 class="ut-parallax-quote-title ' . $class . '"><i class="fa fa-quote-left"></i>';
        $blockquote .= do_shortcode($content);
        $blockquote .= '<i class="fa fa-quote-right"></i></h2>';
        if (!empty($cite)) {
            $blockquote .= '<span class="ut-parallax-quote-name">' . $cite . '</span>';
        }
        $blockquote .= '</div>';
        return $blockquote;
    }
    add_shortcode('ut_parallax_quote', 'ut_parallax_quote');
}
/*
 * Tweet Rotator , only available if ut witter plugin has been installed
 */
if (ut_is_plugin_active('ut-twitter/ut-twitter.php')) {
    if (!function_exists('ut_twitter_rotator')) {
        function ut_twitter_rotator($atts, $content = null)
        {
            extract(shortcode_atts(array('avatar' => 'off', 'width' => '', 'count' => '3', 'speed' => '9000', 'class' => '', 'last' => 'false', '' => ''), $atts));
            /* grid settings */
            $grid = array('third' => 'ut-one-third', 'fourth' => 'ut-one-fourth', 'half' => 'ut-one-half', 'fullwdith' => '');
            $last = $last == 'true' ? 'ut-column-last' : '';
            /* fallback */
            $gridwidth = !empty($grid[$width]) ? $grid[$width] : '';
            $twitter_options = is_array(get_option('ut_twitter_options')) ? get_option('ut_twitter_options') : array();
            /** Set access tokens here - see: https://dev.twitter.com/apps/ **/
            $settings = array('oauth_access_token' => $twitter_options['oauth_access_token'], 'oauth_access_token_secret' => $twitter_options['oauth_access_token_secret'], 'consumer_key' => $twitter_options['consumer_key'], 'consumer_secret' => $twitter_options['consumer_secret']);
            if (empty($twitter_options['oauth_access_token']) || empty($twitter_options['oauth_access_token_secret']) || empty($twitter_options['consumer_key']) || empty($twitter_options['consumer_secret'])) {
                return '<div class="ut-alert themecolor">' . __('Please make sure you have entered all necessary Twitter API Keys under Dashboard -> Settings -> Twitter', 'ut_shortcodes') . '</div>';
            } else {
Esempio n. 4
0
    function ut_view_updater()
    {
        ?>
		
		<div id="ut-importer" class="wrap">
		
			<div class="icon32" id="icon-options-general"><br></div>
            <h2><?php 
        _e('Theme Demo Importer', 'unitedthemes');
        ?>
</h2>
            
			<?php 
        /*
        |--------------------------------------------------------------------------
        | Notifications
        |--------------------------------------------------------------------------
        */
        if (file_exists(ABSPATH . 'wp-content/uploads/')) {
            /* wp-content upload folder not writeable  */
            if (!ut_is_writable(ABSPATH . 'wp-content/uploads/')) {
                echo '<div class="error"><p>';
                echo '<strong>' . __('Your upload folder is not writeable! The importer won\'t be able to import the placeholder images. Please check the folder permissions for', 'unitedthemes') . '</strong><br />';
                echo ABSPATH . 'wp-content/uploads/';
                echo '</p></div>';
            }
        } else {
            /* wp-content folder not writeable  */
            if (!ut_is_writable(ABSPATH . 'wp-content/')) {
                echo '<div class="error"><p>';
                echo '<strong>' . __('Your wp-content folder is not writeable! The importer won\'t be able to import the placeholder images. Please check the folder permissions for', 'unitedthemes') . '</strong><br />';
                echo ABSPATH . 'wp-content/';
                echo '</p></div>';
            }
        }
        /* some plugins need to be installed before the importer can be executed */
        if (!ut_is_plugin_active('ut-portfolio/ut-portfolio.php')) {
            echo '<div class="error"><p>' . __('Portfolio Management by UnitedThemes Plugin is not active, please activate it before importing the demo content.', 'unitedthemes') . '</p></div>';
        }
        if (!ut_is_plugin_active('ut-pricing/ut-pricing.php')) {
            echo '<div class="error"><p>' . __('Pricing Table Management by UnitedThemes Plugin is not active, please activate it before importing the demo content.', 'unitedthemes') . '</p></div>';
        }
        /* importer has been used before */
        if (get_option('ut_import_loaded') == 'active') {
            echo '<div class="error"><p>' . __('You already have imported the demo content before. Running this operation twice will result in double content!', 'unitedthemes') . '</p></div>';
        }
        /* import was successful */
        if (isset($_GET['ut-import']) && $_GET['ut-import'] == 'success') {
            echo '<div class="updated"><p>' . __('Import was successful, have fun!', 'unitedthemes') . '</p></div>';
        }
        ?>
            
            <form id="ut-importer-form" method="POST" action="?page=ut_view_updater" class="form-horizontal">
            
            <div class="xml">
                <input type="radio" id="demo_one" name="ut_demo_file" value="demo_one" checked class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_one">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo1.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 1</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/basic" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_two" name="ut_demo_file" value="demo_two" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_two">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo2.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 2a (dark skin)</h3>
               	<div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/extended" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_two_b" name="ut_demo_file" value="demo_two_b" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_two_b">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo2b.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 2b (light skin)</h3>
               	<div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/extended/?skin=light" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_three" name="ut_demo_file" value="demo_three" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_three">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo3.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 3</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/elegant" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_four" name="ut_demo_file" value="demo_four" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_four">
                   <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo4.jpg" />                   
                </label>
                 <h3 class="xml-name">Brooklyn Demo 4</h3>
                 <div class="xml-actions">
                 	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/business" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                 </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_five" name="ut_demo_file" value="demo_five" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_five">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo5.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 5</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/demo5" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_six" name="ut_demo_file" value="demo_six" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_six">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo6.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 6</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/demo6" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>                    
            
            <div class="xml">
                <input type="radio" id="demo_seven" name="ut_demo_file" value="demo_seven" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_seven">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo7.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 7</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/demo7" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_eight" name="ut_demo_file" value="demo_eight" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_eight">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo8.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 8a (New Landing Page)</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/landing" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>            
            
            <div class="xml">
                <input type="radio" id="demo_eight_b" name="ut_demo_file" value="demo_eight_b" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_eight_b">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo8b.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 8b (Old Landing Page)</h3>
                <div class="xml-actions">
                    <?php 
        _e('Not available anymore', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_nine" name="ut_demo_file" value="demo_nine" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_nine">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo9.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 9</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/demo9" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_ten" name="ut_demo_file" value="demo_ten" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_ten">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo10.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 10</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/demo10" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div> 
            
            <div class="xml">
                <input type="radio" id="demo_eleven" name="ut_demo_file" value="demo_eleven" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_eleven">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo11.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 11</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/demo11" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_twelve" name="ut_demo_file" value="demo_twelve" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_twelve">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo12.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 12</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/demo12" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
            
            <div class="xml">
                <input type="radio" id="demo_thirteen" name="ut_demo_file" value="demo_thirteen" class="ut-choose-demo-radio">
                <label class="ut-choose-demo-img" for="demo_thirteen">
                    <img src="<?php 
        echo THEME_WEB_ROOT;
        ?>
/admin/assets/images/importer/brooklyn-demo13.jpg" />                    
                </label>
                <h3 class="xml-name">Brooklyn Demo 13</h3>
                <div class="xml-actions">
                	<a target="_blank" href="http://themeforest.unitedthemes.com/wpversions/brooklyn/demo13" class="button button-primary"><?php 
        _e('Preview', 'unitedthemes');
        ?>
</a>
                </div>
            </div>
                        
            <div class="clear"></div>
            
            <div class="ut-import-options">
            
            <table class="form-table">
            	<tbody>
                    
                    <tr valign="top">
                    	
                        <th scope="row">
							<?php 
        _e('Import Revolution Sliders?', 'unitedthemes');
        ?>
                        </th>
                      	
                        <td>
                            <input type="checkbox" value="yes" id="ut-import-revslider" name="ut-import-revslider">
                        </td>                       
                    
                    </tr> 
                    
                    <tr valign="top">
                    	
                        <th scope="row">
							<?php 
        _e('Import Theme Options?', 'unitedthemes');
        ?>
                        </th>
                      	
                        <td>
                            <input type="checkbox" value="yes" id="ut-import-options" name="ut-import-options">
                        </td>                       
                    
                    </tr> 
                    
                    <tr valign="top">
                    	
                        <th scope="row">
							<?php 
        _e('Important Notes:', 'unitedthemes');
        ?>
                        </th>
                      	
                        <td>
                            <ol>
                                <li><?php 
        _e('We recommend to run this importer on a clean WordPress installation.', 'unitedthemes');
        ?>
</li>
                                <li><?php 
        _e('To reset your installation we can recommend this plugin here:', 'unitedthemes');
        ?>
 <a href="http://wordpress.org/plugins/wordpress-database-reset/">Wordpress Database Reset</a></li>
                                <li><?php 
        _e('The Demo Importer will not import the images we have used in our live demos, due to copyright / license reasons', 'unitedthemes');
        ?>
</li>
                                <li><?php 
        _e('Do not run the importer multiple times one after another, it will result in double content.', 'unitedthemes');
        ?>
</li>
                            </ol>
                        </td>                       
                    
                    </tr>  
                                        
            	</tbody>
            </table>
            
            </div>
            
            <div class="clear"></div>
            
            <div class="ut-import-bar">
                
                <input type="hidden" name="ut_import_demo_content" value="true" />
                <input type="submit" value="<?php 
        _e('Import', 'unitedthemes');
        ?>
" class="button button-primary" id="submit" name="submit">
                
            </div>
            
            </form>
		
		</div>
		
	<?php 
    }