Ejemplo n.º 1
0
 public function output_grid_javascript($load_lightbox = false, $is_demo = false)
 {
     $base = new Essential_Grid_Base();
     $hide_markup_before_load = $base->getVar($this->grid_params, 'hide-markup-before-load', 'off');
     $layout = $base->getVar($this->grid_params, 'layout', 'even');
     $force_full_width = $base->getVar($this->grid_params, 'force_full_width', 'off');
     $content_push = $base->getVar($this->grid_params, 'content-push', 'off');
     $rows_unlimited = $base->getVar($this->grid_params, 'rows-unlimited', 'on');
     $load_more_type = $base->getVar($this->grid_params, 'load-more', 'on');
     $rows = $base->getVar($this->grid_params, 'rows', 4, 'i');
     $columns = $base->getVar($this->grid_params, 'columns', '');
     $columns = $base->set_basic_colums($columns);
     $columns_advanced = $base->getVar($this->grid_params, 'columns-advanced', 'off');
     if ($columns_advanced == 'on') {
         $columns_width = $base->getVar($this->grid_params, 'columns-width', '');
     } else {
         $columns_width = array();
         //get defaults
     }
     $columns_width = $base->set_basic_colums_width($columns_width);
     $space = $base->getVar($this->grid_params, 'spacings', 0, 'i');
     $page_animation = $base->getVar($this->grid_params, 'grid-animation', 'scale');
     $anim_speed = $base->getVar($this->grid_params, 'grid-animation-speed', 800, 'i');
     $delay_basic = $base->getVar($this->grid_params, 'grid-animation-delay', 1, 'i');
     $delay_hover = $base->getVar($this->grid_params, 'hover-animation-delay', 1, 'i');
     $filter_type = $base->getVar($this->grid_params, 'filter-arrows', 'single');
     $filter_logic = $base->getVar($this->grid_params, 'filter-logic', 'or');
     $filter_show_on = $base->getVar($this->grid_params, 'filter-show-on', 'hover');
     $lightbox_mode = $base->getVar($this->grid_params, 'lightbox-mode', 'single');
     $lightbox_mode = $lightbox_mode == 'content' || $lightbox_mode == 'content-gallery' || $lightbox_mode == 'woocommerce-gallery' ? 'contentgroup' : $lightbox_mode;
     $layout_sizing = $base->getVar($this->grid_params, 'layout-sizing', 'boxed');
     $layout_offset_container = $base->getVar($this->grid_params, 'fullscreen-offset-container', '');
     $aspect_ratio_x = $base->getVar($this->grid_params, 'x-ratio', 4, 'i');
     $aspect_ratio_y = $base->getVar($this->grid_params, 'y-ratio', 3, 'i');
     $lazy_load = $base->getVar($this->grid_params, 'lazy-loading', 'off');
     $lazy_load_color = $base->getVar($this->grid_params, 'lazy-load-color', '#FFFFFF');
     $spinner = $base->getVar($this->grid_params, 'use-spinner', '0');
     $spinner_color = $base->getVar($this->grid_params, 'spinner-color', '#FFFFFF');
     //LIGHTBOX VARIABLES
     $usetwitter = $base->getVar($this->grid_params, 'lightbox-twitter', 'off');
     $usefacebook = $base->getVar($this->grid_params, 'lightbox-facebook', 'off');
     $lightbox_title_type = $base->getVar($this->grid_params, 'lightbox-type', "null");
     $lightbox_position = $base->getVar($this->grid_params, 'lightbox-position', 'bottom');
     $lightbox_effect_open_close = $base->getVar($this->grid_params, 'lightbox-effect-open-close', 'fade');
     $lightbox_effect_next_prev = $base->getVar($this->grid_params, 'lightbox-effect-next-prev', 'fade');
     $lightbox_effect_open_close_speed = $base->getVar($this->grid_params, 'lightbox-effect-open-close-speed', 'normal');
     $lightbox_effect_next_prev_speed = $base->getVar($this->grid_params, 'lightbox-effect-next-prev-speed', 'normal');
     $lightbox_arrows = $base->getVar($this->grid_params, 'lightbox-arrows', 'on');
     $lightbox_thumbs = $base->getVar($this->grid_params, 'lightbox-thumbs', 'off');
     $lightbox_thumbs_w = $base->getVar($this->grid_params, 'lbox-thumb-w', '50');
     $lightbox_thumbs_h = $base->getVar($this->grid_params, 'lbox-thumb-h', '50');
     $linebreak = '\'<br />\'';
     $twitteraddon = '\'<a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="\'+this.href+\'">' . __('Tweet', EG_TEXTDOMAIN) . '</a>\'';
     $facebookaddon = '\'<iframe src="//www.facebook.com/plugins/like.php?href=\'+this.href+\'&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:23px;" allowTransparency="true"></iframe>\'';
     $lbox_padding = $base->getVar($this->grid_params, 'lbox-padding', array('0', '0', '0', '0'));
     $lbox_inpadding = $base->getVar($this->grid_params, 'lbox-inpadding', array('0', '0', '0', '0'));
     $rtl = $base->getVar($this->grid_params, 'rtl', 'off');
     $wait_for_fonts = get_option('tp_eg_wait_for_fonts', 'true');
     $pagination_numbers = $base->getVar($this->grid_params, 'pagination-numbers', 'smart');
     $pagination_scroll = $base->getVar($this->grid_params, 'pagination-scroll', 'off');
     $pagination_scroll_offset = $base->getVar($this->grid_params, 'pagination-scroll-offset', '0', 'i');
     $ajax_callback = $base->getVar($this->grid_params, 'ajax-callback', '');
     $ajax_css_url = $base->getVar($this->grid_params, 'ajax-css-url', '');
     $ajax_js_url = $base->getVar($this->grid_params, 'ajax-js-url', '');
     $ajax_scroll_onload = $base->getVar($this->grid_params, 'ajax-scroll-onload', 'on');
     $ajax_callback_argument = $base->getVar($this->grid_params, 'ajax-callback-arg', 'on');
     $ajax_content_id = $base->getVar($this->grid_params, 'ajax-container-id', '');
     $ajax_scrollto_offset = $base->getVar($this->grid_params, 'ajax-scrollto-offset', '0');
     $ajax_close_button = $base->getVar($this->grid_params, 'ajax-close-button', 'off');
     $ajax_button_nav = $base->getVar($this->grid_params, 'ajax-nav-button', 'off');
     $ajax_content_sliding = $base->getVar($this->grid_params, 'ajax-content-sliding', 'on');
     $ajax_button_type = $base->getVar($this->grid_params, 'ajax-button-type', 'button');
     if ($ajax_button_type == 'type2') {
         $ajax_button_text = $base->getVar($this->grid_params, 'ajax-button-text', __('Close', EG_TEXTDOMAIN));
     }
     $ajax_button_skin = $base->getVar($this->grid_params, 'ajax-button-skin', 'light');
     $ajax_button_inner = $base->getVar($this->grid_params, 'ajax-button-inner', 'false');
     $ajax_button_h_pos = $base->getVar($this->grid_params, 'ajax-button-h-pos', 'r');
     $ajax_button_v_pos = $base->getVar($this->grid_params, 'ajax-button-v-pos', 't');
     $cobbles_pattern = $base->getVar($this->grid_params, 'cobbles-pattern', array());
     $use_cobbles_pattern = $base->getVar($this->grid_params, 'use-cobbles-pattern', 'off');
     $cookie_time = intval($base->getVar($this->grid_params, 'cookie-save-time', '30'));
     $cookie_search = $base->getVar($this->grid_params, 'cookie-save-search', 'off');
     $cookie_filter = $base->getVar($this->grid_params, 'cookie-save-filter', 'off');
     $cookie_pagination = $base->getVar($this->grid_params, 'cookie-save-pagination', 'off');
     $js_to_footer = get_option('tp_eg_js_to_footer', 'false') == 'true' ? true : false;
     //add inline style into the footer
     if ($js_to_footer && $is_demo == false) {
         ob_start();
     }
     echo '<script type="text/javascript">' . "\n";
     if ($hide_markup_before_load == 'off') {
         echo 'function eggbfc(winw,resultoption) {' . "\n";
         echo '	var lasttop = winw,' . "\n";
         echo '	lastbottom = 0,' . "\n";
         echo '	smallest =9999,' . "\n";
         echo '	largest = 0,' . "\n";
         echo '	samount = 0,' . "\n";
         echo '	lamoung = 0,' . "\n";
         echo '	lastamount = 0,' . "\n";
         echo '	resultid = 0,' . "\n";
         echo '	resultidb = 0,' . "\n";
         echo '	responsiveEntries = [' . "\n";
         echo '						{ width:' . $columns_width['0'] . ',amount:' . $columns['0'] . '},' . "\n";
         echo '						{ width:' . $columns_width['1'] . ',amount:' . $columns['1'] . '},' . "\n";
         echo '						{ width:' . $columns_width['2'] . ',amount:' . $columns['2'] . '},' . "\n";
         echo '						{ width:' . $columns_width['3'] . ',amount:' . $columns['3'] . '},' . "\n";
         echo '						{ width:' . $columns_width['4'] . ',amount:' . $columns['4'] . '},' . "\n";
         echo '						{ width:' . $columns_width['5'] . ',amount:' . $columns['5'] . '},' . "\n";
         echo '						{ width:' . $columns_width['6'] . ',amount:' . $columns['6'] . '}' . "\n";
         echo '						];' . "\n";
         echo '	if (responsiveEntries!=undefined && responsiveEntries.length>0)' . "\n";
         echo '		jQuery.each(responsiveEntries, function(index,obj) {' . "\n";
         echo '			var curw = obj.width != undefined ? obj.width : 0,' . "\n";
         echo '				cura = obj.amount != undefined ? obj.amount : 0;' . "\n";
         echo '			if (smallest>curw) {' . "\n";
         echo '				smallest = curw;' . "\n";
         echo '				samount = cura;' . "\n";
         echo '				resultidb = index;' . "\n";
         echo '			}' . "\n";
         echo '			if (largest<curw) {' . "\n";
         echo '				largest = curw;' . "\n";
         echo '				lamount = cura;' . "\n";
         echo '			}' . "\n";
         echo '			if (curw>lastbottom && curw<=lasttop) {' . "\n";
         echo '				lastbottom = curw;' . "\n";
         echo '				lastamount = cura;' . "\n";
         echo '				resultid = index;' . "\n";
         echo '			}' . "\n";
         echo '		})' . "\n";
         echo '		if (smallest>winw) {' . "\n";
         echo '			lastamount = samount;' . "\n";
         echo '			resultid = resultidb;' . "\n";
         echo '		}' . "\n";
         echo '		var obj = new Object;' . "\n";
         echo '		obj.index = resultid;' . "\n";
         echo '		obj.column = lastamount;' . "\n";
         echo '		if (resultoption=="id")' . "\n";
         echo '			return obj;' . "\n";
         echo '		else' . "\n";
         echo '			return lastamount;' . "\n";
         echo '	}' . "\n";
         echo 'if ("' . $layout . '"=="even") {' . "\n";
         echo '	var coh=0,' . "\n";
         echo '		container = jQuery("#esg-grid-' . $this->grid_div_name . '-' . $this->grid_serial . '");' . "\n";
         if ($layout_sizing == 'fullscreen') {
             echo 'coh = jQuery(window).height();' . "\n";
             if ($layout_offset_container !== '') {
                 echo 'try{' . "\n";
                 echo '	var offcontainers = "' . $layout_offset_container . '".split(",");' . "\n";
                 echo '	jQuery.each(offcontainers,function(index,searchedcont) {' . "\n";
                 echo '		coh = coh - jQuery(searchedcont).outerHeight(true);' . "\n";
                 echo '	})' . "\n";
                 echo '} catch(e) {}' . "\n";
             }
         } else {
             echo '	var	cwidth = container.width(),' . "\n";
             echo '		ar = "' . $aspect_ratio_x . ':' . $aspect_ratio_y . '",' . "\n";
             echo '		gbfc = eggbfc(jQuery(window).width(),"id"),' . "\n";
             if ($rows_unlimited == 'on') {
                 echo '	row = 2;' . "\n";
             } else {
                 echo '	row = ' . $rows . ';' . "\n";
             }
             echo 'ar = ar.split(":");' . "\n";
             echo 'aratio=parseInt(ar[0],0) / parseInt(ar[1],0);' . "\n";
             echo 'coh = cwidth / aratio;' . "\n";
             echo 'coh = coh/gbfc.column*row;' . "\n";
         }
         echo '	var ul = container.find("ul").first();' . "\n";
         echo '	ul.css({display:"block",height:coh+"px"});' . "\n";
         echo '}' . "\n";
     }
     echo 'var essapi_' . $this->grid_api_name . ';' . "\n";
     echo 'jQuery(document).ready(function() {' . "\n";
     echo '	essapi_' . $this->grid_api_name . ' = jQuery("#esg-grid-' . $this->grid_div_name . '-' . $this->grid_serial . '").tpessential({' . "\n";
     echo '        gridID:' . $this->grid_id . ',' . "\n";
     echo '        layout:"' . $layout . '",' . "\n";
     if ($rtl == 'on') {
         echo '        rtl:"on",' . "\n";
     }
     echo '        forceFullWidth:"' . $force_full_width . '",' . "\n";
     echo '        lazyLoad:"' . $lazy_load . '",' . "\n";
     if ($lazy_load == 'on') {
         echo '        lazyLoadColor:"' . $lazy_load_color . '",' . "\n";
     }
     if ($rows_unlimited == 'on') {
         $load_more = $base->getVar($this->grid_params, 'load-more', 'button');
         $load_more_amount = $base->getVar($this->grid_params, 'load-more-amount', 3, 'i');
         $load_more_show_number = $base->getVar($this->grid_params, 'load-more-show-number', 'on');
         if ($load_more !== 'none') {
             $load_more_text = $base->getVar($this->grid_params, 'load-more-text', __('Load More', EG_TEXTDOMAIN));
             echo '        gridID:"' . $this->grid_id . '",' . "\n";
             echo '        loadMoreType:"' . $load_more . '",' . "\n";
             echo '        loadMoreAmount:' . $load_more_amount . ',' . "\n";
             echo '        loadMoreTxt:"' . $load_more_text . '",' . "\n";
             echo '        loadMoreNr:"' . $load_more_show_number . '",' . "\n";
             echo '        loadMoreEndTxt:"' . __('No More Items for the Selected Filter', EG_TEXTDOMAIN) . '",' . "\n";
             echo '        loadMoreItems:';
             $this->output_load_more_list();
             echo ',' . "\n";
         }
         echo '        row:9999,' . "\n";
     } else {
         echo '        row:' . $rows . ',' . "\n";
     }
     $token = wp_create_nonce('Essential_Grid_Front');
     echo '        loadMoreAjaxToken:"' . $token . '",' . "\n";
     echo '        loadMoreAjaxUrl:"' . admin_url('admin-ajax.php') . '",' . "\n";
     echo '        loadMoreAjaxAction:"Essential_Grid_Front_request_ajax",' . "\n";
     echo '        ajaxContentTarget:"' . $ajax_content_id . '",' . "\n";
     echo '        ajaxScrollToOffset:"' . $ajax_scrollto_offset . '",' . "\n";
     echo '        ajaxCloseButton:"' . $ajax_close_button . '",' . "\n";
     echo '        ajaxContentSliding:"' . $ajax_content_sliding . '",' . "\n";
     if ($ajax_callback !== '') {
         echo '        ajaxCallback:"' . stripslashes($ajax_callback) . '",' . "\n";
     }
     if ($ajax_css_url !== '') {
         echo '        ajaxCssUrl:"' . $ajax_css_url . '",' . "\n";
     }
     if ($ajax_js_url !== '') {
         echo '        ajaxJsUrl:"' . $ajax_js_url . '",' . "\n";
     }
     if ($ajax_scroll_onload !== 'off') {
         echo '        ajaxScrollToOnLoad:"on",' . "\n";
     }
     if ($ajax_callback_argument == 'on') {
         echo '        ajaxCallbackArgument:"on",' . "\n";
     }
     echo '        ajaxNavButton:"' . $ajax_button_nav . '",' . "\n";
     echo '        ajaxCloseType:"' . $ajax_button_type . '",' . "\n";
     if ($ajax_button_type == 'type2') {
         echo '        ajaxCloseTxt:"' . $ajax_button_text . '",' . "\n";
     }
     echo '        ajaxCloseInner:"' . $ajax_button_inner . '",' . "\n";
     echo '        ajaxCloseStyle:"' . $ajax_button_skin . '",' . "\n";
     $ajax_button_h_pos = $base->getVar($this->grid_params, 'ajax-button-h-pos', 'r');
     $ajax_button_v_pos = $base->getVar($this->grid_params, 'ajax-button-v-pos', 't');
     if ($ajax_button_h_pos == 'c') {
         echo '        ajaxClosePosition:"' . $ajax_button_v_pos . '",' . "\n";
     } else {
         echo '        ajaxClosePosition:"' . $ajax_button_v_pos . $ajax_button_h_pos . '",' . "\n";
     }
     echo '        space:' . $space . ',' . "\n";
     echo '        pageAnimation:"' . $page_animation . '",' . "\n";
     if ($pagination_numbers == 'full') {
         echo '        smartPagination:"off",' . "\n";
     }
     echo '        paginationScrollToTop:"' . $pagination_scroll . '",' . "\n";
     if ($pagination_scroll == 'on') {
         echo '        paginationScrollToOffset:' . $pagination_scroll_offset . ',' . "\n";
     }
     echo '        spinner:"spinner' . $spinner . '",' . "\n";
     if ($spinner != '0' && $spinner != '5') {
         echo '        spinnerColor:"' . $spinner_color . '",' . "\n";
     }
     if ($layout_sizing == 'fullwidth') {
         echo '        forceFullWidth:"on",' . "\n";
     } elseif ($layout_sizing == 'fullscreen') {
         echo '        forceFullScreen:"on",' . "\n";
         if ($layout_offset_container !== '') {
             echo '        fullScreenOffsetContainer:"' . $layout_offset_container . '",' . "\n";
         }
     }
     if ($layout == 'even') {
         echo '        evenGridMasonrySkinPusher:"' . $content_push . '",' . "\n";
     }
     echo '        lightBoxMode:"' . $lightbox_mode . '",' . "\n";
     if (!empty($cobbles_pattern) && $layout == 'cobbles' && $use_cobbles_pattern == 'on') {
         echo '        cobblesPattern:"' . implode(',', $cobbles_pattern) . '",' . "\n";
     }
     echo '        animSpeed:' . $anim_speed . ',' . "\n";
     echo '        delayBasic:' . $delay_basic . ',' . "\n";
     echo '        mainhoverdelay:' . $delay_hover . ',' . "\n";
     echo '        filterType:"' . $filter_type . '",' . "\n";
     if ($filter_type == 'multi') {
         echo '        filterLogic:"' . $filter_logic . '",' . "\n";
     }
     echo '        showDropFilter:"' . $filter_show_on . '",' . "\n";
     echo '        filterGroupClass:"esg-fgc-' . $this->grid_id . '",' . "\n";
     if ($wait_for_fonts === 'true') {
         $tf_fonts = new ThemePunch_Fonts();
         $fonts = $tf_fonts->get_all_fonts();
         if (!empty($fonts)) {
             $first = true;
             $font_string = '[';
             foreach ($fonts as $font) {
                 if ($first === false) {
                     $font_string .= ',';
                 }
                 $font_string .= "'" . esc_attr($font['url']) . "'";
                 $first = false;
             }
             $font_string .= ']';
             echo '        googleFonts:' . $font_string . ',' . "\n";
         }
     }
     if ($cookie_search === 'on' || $cookie_filter === 'on' || $cookie_pagination === 'on') {
         echo '        cookies: {' . "\n";
         if ($cookie_search == 'on') {
             echo '                search:"' . $cookie_search . '",' . "\n";
         }
         if ($cookie_filter == 'on') {
             echo '                filter:"' . $cookie_filter . '",' . "\n";
         }
         if ($cookie_pagination == 'on') {
             echo '                pagination:"' . $cookie_pagination . '",' . "\n";
         }
         echo '                timetosave:"' . $cookie_time . '"' . "\n";
         echo '        },' . "\n";
     }
     if ($layout != 'masonry') {
         echo '        aspectratio:"' . $aspect_ratio_x . ':' . $aspect_ratio_y . '",' . "\n";
     }
     echo '        responsiveEntries: [' . "\n";
     echo '						{ width:' . $columns_width['0'] . ',amount:' . $columns['0'] . '},' . "\n";
     echo '						{ width:' . $columns_width['1'] . ',amount:' . $columns['1'] . '},' . "\n";
     echo '						{ width:' . $columns_width['2'] . ',amount:' . $columns['2'] . '},' . "\n";
     echo '						{ width:' . $columns_width['3'] . ',amount:' . $columns['3'] . '},' . "\n";
     echo '						{ width:' . $columns_width['4'] . ',amount:' . $columns['4'] . '},' . "\n";
     echo '						{ width:' . $columns_width['5'] . ',amount:' . $columns['5'] . '},' . "\n";
     echo '						{ width:' . $columns_width['6'] . ',amount:' . $columns['6'] . '}' . "\n";
     echo '						]';
     if ($columns_advanced == 'on') {
         $this->output_ratio_list();
     }
     echo "\n";
     echo '	});' . "\n\n";
     //check if lightbox is active
     $opt = get_option('tp_eg_use_lightbox', 'false');
     if ($load_lightbox && !Essential_Grid_Jackbox::is_active() && !Essential_Grid_Social_Gallery::is_active() && $opt !== 'disabled') {
         echo '	try{' . "\n";
         echo '	jQuery("#esg-grid-' . $this->grid_div_name . '-' . $this->grid_serial . ' .esgbox").esgbox({' . "\n";
         echo '		padding : [' . $lbox_padding[0] . ',' . $lbox_padding[1] . ',' . $lbox_padding[2] . ',' . $lbox_padding[3] . '],' . "\n";
         echo '      afterLoad:function() { ' . "\n";
         echo ' 		if (this.element.hasClass("esgboxhtml5")) {' . "\n";
         echo '		   var mp = this.element.data("mp4"),' . "\n";
         echo '		      ogv = this.element.data("ogv"),' . "\n";
         echo '		      webm = this.element.data("webm");' . "\n";
         echo '         this.content =\'<div style="width:100%;height:100%;"><video autoplay="true" loop="" class="rowbgimage" poster="" width="100%" height="auto"><source src="\'+mp+\'" type="video/mp4"><source src="\'+webm+\'" type="video/webm"><source src="\'+ogv+\'" type="video/ogg"></video></div>\';	' . "\n";
         echo '		   var riint = setInterval(function() {jQuery(window).trigger("resize");},100); setTimeout(function() {clearInterval(riint);},2500);' . "\n";
         echo '		   };' . "\n";
         echo '		 },' . "\n";
         /*	echo '		ajax: { type:"post",url:'.admin_url('admin-ajax.php').',dataType:"json",data:{
         		 action: "Essential_Grid_Front_request_ajax",
         	     client_action: "load_more_content",
         	     token: '.$token.',
         	     postid:postid}, success:function(data) { jQuery.esgbox(data.data)} },'."\n";*/
         echo '		beforeShow : function () { ' . "\n";
         echo '			this.title = jQuery(this.element).attr(\'lgtitle\');' . "\n";
         echo '			if (this.title) {' . "\n";
         if ($lightbox_title_type == "null") {
             echo '				this.title="";' . "\n";
         }
         if ($usetwitter == "on" || $usefacebook == "on") {
             echo '				this.title += ' . $linebreak . ';' . "\n";
         }
         if ($usetwitter == "on") {
             echo '				this.title += ' . $twitteraddon . ';' . "\n";
         }
         if ($usefacebook == "on") {
             echo '				this.title += ' . $facebookaddon . ';' . "\n";
         }
         echo '   		this.title =  \'<div style="padding:' . $lbox_inpadding[0] . 'px ' . $lbox_inpadding[1] . 'px ' . $lbox_inpadding[2] . 'px ' . $lbox_inpadding[3] . 'px">\'+this.title+\'</div>\';' . "\n";
         echo '			}' . "\n";
         echo '		},' . "\n";
         echo '		afterShow : function() {' . "\n";
         if ($usetwitter == "on") {
             echo '			twttr.widgets.load();' . "\n";
         }
         echo '		},' . "\n";
         echo '		openEffect : \'' . $lightbox_effect_open_close . '\',' . "\n";
         echo '		closeEffect : \'' . $lightbox_effect_open_close . '\',' . "\n";
         echo '		nextEffect : \'' . $lightbox_effect_next_prev . '\',' . "\n";
         echo '		prevEffect : \'' . $lightbox_effect_next_prev . '\',' . "\n";
         echo '		openSpeed : \'' . $lightbox_effect_open_close_speed . '\',' . "\n";
         echo '		closeSpeed : \'' . $lightbox_effect_open_close_speed . '\',' . "\n";
         echo '		nextSpeed : \'' . $lightbox_effect_next_prev_speed . '\',' . "\n";
         echo '		prevSpeed : \'' . $lightbox_effect_next_prev_speed . '\',' . "\n";
         if ($lightbox_arrows == "off") {
             echo '		arrows : false,' . "\n";
         }
         echo '		helpers : {' . "\n";
         echo '			media : {},' . "\n";
         if ($lightbox_thumbs == "on") {
             echo '			thumbs: {' . "\n";
             echo '				width : ' . $lightbox_thumbs_w . ',' . "\n";
             echo '				height : ' . $lightbox_thumbs_h . "\n";
             echo '			},' . "\n";
         }
         echo '		    title : {' . "\n";
         if ($lightbox_title_type != "null") {
             echo '				type:"' . $lightbox_title_type . '",' . "\n";
         } else {
             echo '				type:""' . "\n";
         }
         if ($lightbox_title_type != "null") {
             echo '				position:"' . $lightbox_position . '",' . "\n";
         }
         echo '			}' . "\n";
         echo '		}' . "\n";
         echo '});' . "\n" . "\n";
         echo ' } catch (e) {}' . "\n" . "\n";
     }
     //output custom javascript if any is set
     $custom_javascript = stripslashes($base->getVar($this->grid_params, 'custom-javascript', ''));
     if ($custom_javascript !== '') {
         echo $custom_javascript;
     }
     echo '});' . "\n";
     echo '</script>' . "\n";
     if ($js_to_footer && $is_demo == false) {
         $js_content = ob_get_contents();
         ob_clean();
         ob_end_clean();
         $this->grid_inline_js = $js_content;
         add_action('wp_footer', array($this, 'add_inline_js'));
     }
 }
Ejemplo n.º 2
0
        $title = __('Settings', EG_TEXTDOMAIN);
        $layers = $grid['layers'];
    }
}
$postTypesWithCats = $base->getPostTypesWithCatsForClient();
$jsonTaxWithCats = $base->jsonEncodeForClientSide($postTypesWithCats);
$base = new Essential_Grid_Base();
$pages = get_pages(array('sort_column' => 'post_name'));
$post_elements = $base->getPostTypesAssoc();
$postTypes = $base->getVar($grid['postparams'], 'post_category', 'post');
$categories = $base->setCategoryByPostTypes($postTypes, $postTypesWithCats);
$selected_pages = explode(',', $base->getVar($grid['postparams'], 'selected_pages', '-1', 's'));
$columns = $base->getVar($grid['params'], 'columns', '');
$columns = $base->set_basic_colums($columns);
$columns_width = $base->getVar($grid['params'], 'columns-width', '');
$columns_width = $base->set_basic_colums_width($columns_width);
$columns_height = $base->getVar($grid['params'], 'columns-height', '');
$columns_height = $base->set_basic_colums_height($columns_height);
$columns_advanced[] = $base->getVar($grid['params'], 'columns-advanced-rows-0', '');
$columns_advanced[] = $base->getVar($grid['params'], 'columns-advanced-rows-1', '');
$columns_advanced[] = $base->getVar($grid['params'], 'columns-advanced-rows-2', '');
$columns_advanced[] = $base->getVar($grid['params'], 'columns-advanced-rows-3', '');
$columns_advanced[] = $base->getVar($grid['params'], 'columns-advanced-rows-4', '');
$columns_advanced[] = $base->getVar($grid['params'], 'columns-advanced-rows-5', '');
$columns_advanced[] = $base->getVar($grid['params'], 'columns-advanced-rows-6', '');
$columns_advanced[] = $base->getVar($grid['params'], 'columns-advanced-rows-7', '');
$columns_advanced[] = $base->getVar($grid['params'], 'columns-advanced-rows-8', '');
$columns_advanced[] = $base->getVar($grid['params'], 'columns-advanced-rows-9', '');
$nav_skin_choosen = $base->getVar($grid['params'], 'navigation-skin', 'minimal-light');
$navigation_skins = $nav_skin->get_essential_navigation_skins();
$navigation_skin_css = $base->jsonEncodeForClientSide($navigation_skins);