Example #1
0
    /**
     * Insert Global Settings Dialog
     * @since    1.0.0
     */
    public static function globalSettingsDialog()
    {
        $curPermission = Essential_Grid_Admin::getPluginPermissionValue();
        $output_protection = get_option('tp_eg_output_protection', 'none');
        $tooltips = get_option('tp_eg_tooltips', 'true');
        $wait_for_fonts = get_option('tp_eg_wait_for_fonts', 'true');
        $js_to_footer = get_option('tp_eg_js_to_footer', 'false');
        $use_cache = get_option('tp_eg_use_cache', 'false');
        $query_type = get_option('tp_eg_query_type', 'wp_query');
        $enable_log = get_option('tp_eg_enable_log', 'false');
        $use_lightbox = get_option('tp_eg_use_lightbox', 'false');
        if (Essential_Grid_Jackbox::jb_exists()) {
            $jb_active = true;
        } else {
            //disable jackbox and reset to default if it was set until now
            if ($use_lightbox == 'jackbox') {
                update_option('tp_eg_use_lightbox', 'false');
            }
            $jb_active = false;
        }
        if (Essential_Grid_Social_Gallery::sg_exists()) {
            $sg_active = true;
        } else {
            //disable jackbox and reset to default if it was set until now
            if ($use_lightbox == 'sg') {
                update_option('tp_eg_use_lightbox', 'false');
            }
            $sg_active = false;
        }
        ?>
		<div id="global-settings-dialog-wrap" class="essential-dialog-wrap" title="<?php 
        _e('Global Settings', EG_TEXTDOMAIN);
        ?>
"  style="display: none;">
			<p>
				<label><?php 
        echo _e('View Plugin Permissions', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="plugin_permissions">
					<option <?php 
        echo $curPermission == Essential_Grid_Admin::ROLE_ADMIN ? 'selected="selected" ' : '';
        ?>
value="admin"><?php 
        _e('Admin', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $curPermission == Essential_Grid_Admin::ROLE_EDITOR ? 'selected="selected" ' : '';
        ?>
value="editor"><?php 
        _e('Editor, Admin', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $curPermission == Essential_Grid_Admin::ROLE_AUTHOR ? 'selected="selected" ' : '';
        ?>
value="author"><?php 
        _e('Author, Editor, Admin', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
			</p>
			<p>
				<label><?php 
        echo _e('Advanced Tooltips', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="plugin_tooltips">
					<option <?php 
        echo $tooltips == 'true' ? 'selected="selected" ' : '';
        ?>
value="true"><?php 
        _e('On', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $tooltips == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Off', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('Show or Hide the Tooltips on Hover over the Settings in Essential Grid Backend. ', EG_TEXTDOMAIN);
        ?>
</i>
			</p>
			<p>
				<label><?php 
        echo _e('Wait for Fonts', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="wait_for_fonts">
					<option <?php 
        echo $wait_for_fonts == 'true' ? 'selected="selected" ' : '';
        ?>
value="true"><?php 
        _e('On', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $wait_for_fonts == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Off', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('In case Options is enabled, the Grid will always wait till the Google Fonts has been loaded, before the grid starts.', EG_TEXTDOMAIN);
        ?>
</i>
			</p>
			<p>
				<label><?php 
        echo _e('Output Filter Protection', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="output_protection">
					<option <?php 
        echo $output_protection == 'none' ? 'selected="selected" ' : '';
        ?>
value="none"><?php 
        _e('None', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $output_protection == 'compress' ? 'selected="selected" ' : '';
        ?>
value="compress"><?php 
        _e('By Compressing Output', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $output_protection == 'echo' ? 'selected="selected" ' : '';
        ?>
value="echo"><?php 
        _e('By Echo Output', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('The HTML Markup is printed in compressed form, or it is written due Echo instead of Reutrn. In some case Echo will move the full Grid to the top/bottom of the page ! ', EG_TEXTDOMAIN);
        ?>
</i>				
			</p>
			<p>
				<label><?php 
        echo _e('JS To Footer', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="js_to_footer">
					<option <?php 
        echo $js_to_footer == 'true' ? 'selected="selected" ' : '';
        ?>
value="true"><?php 
        _e('On', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $js_to_footer == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Off', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('Defines where the jQuery files should be loaded in the DOM.', EG_TEXTDOMAIN);
        ?>
</i>				
			</p>
			<p>
				<label><?php 
        echo _e('Select LightBox Type', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="use_lightbox">
					<option <?php 
        echo $use_lightbox == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Default LightBox', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $use_lightbox == 'jackbox' ? 'selected="selected" ' : '';
        ?>
value="jackbox" <?php 
        echo $jb_active === true ? '' : ' disabled="disabled"';
        ?>
><?php 
        _e('JackBox', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $use_lightbox == 'sg' ? 'selected="selected" ' : '';
        ?>
value="sg" <?php 
        echo $sg_active === true ? '' : ' disabled="disabled"';
        ?>
><?php 
        _e('Social Gallery', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $use_lightbox == 'disabled' ? 'selected="selected" ' : '';
        ?>
value="disabled"><?php 
        _e('Disable LightBox', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('Select the default LightBox to be used.<br>- The JackBox WordPress plugin is available <a href="http://codecanyon.net/item/jackbox-responsive-lightbox-wordpress-plugin/3357551" target="_blank">here</a>,<br>- The Social Gallery plugin can be found <a href="http://codecanyon.net/item/social-gallery-wordpress-photo-viewer-plugin/2665332" target="_blank">here</a>', EG_TEXTDOMAIN);
        ?>
</i>				
			</p>
			<p>
				<label><?php 
        echo _e('Use Own Caching System', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="use_cache">
					<option <?php 
        echo $use_cache == 'true' ? 'selected="selected" ' : '';
        ?>
value="true"><?php 
        _e('On', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $use_cache == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Off', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<a href="#" id="ess-grid-delete-cache" class="button-primary revblue"><?php 
        echo _e('delete cache', EG_TEXTDOMAIN);
        ?>
</a>
				<i style=""><?php 
        echo _e('Essential Grid has two Caching Engines !  The Primary cache will precache Post Queries to provide a quicker result of queries.  The "Own" Caching system will additional allow to cache the Grid HTML Markup also, to provide an extreme quick Result of output. This cache should be deleted after any changes ! Only for advanced users.', EG_TEXTDOMAIN);
        ?>
</i>								 
			</p>
			<p>
				<label><?php 
        echo _e('Set Query Type Used', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="query_type">
					<option <?php 
        echo $query_type == 'wp_query' ? 'selected="selected" ' : '';
        ?>
value="wp_query"><?php 
        _e('WP_Query()', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $query_type == 'get_posts' ? 'selected="selected" ' : '';
        ?>
value="get_posts"><?php 
        _e('get_posts()', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('If this is changed, caching of Essential Grid may be required to be deleted!', EG_TEXTDOMAIN);
        ?>
</i>
			</p>
			<p>
				<label><?php 
        echo _e('Enable Debug Log', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="enable_log">
					<option <?php 
        echo $enable_log == 'true' ? 'selected="selected" ' : '';
        ?>
value="true"><?php 
        _e('On', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $enable_log == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Off', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('This enables console logs for debugging purposes.', EG_TEXTDOMAIN);
        ?>
</i>								 
			</p>
		</div>
		<?php 
    }
 /**
  * insert layer
  */
 public function insert_layer($layer, $demo = false, $masonry = false)
 {
     $base = new Essential_Grid_Base();
     $m = new Essential_Grid_Meta();
     $is_post = !empty($this->layer_values) ? false : true;
     if ($demo === false) {
         $post = $this->post;
         $layer_values = $this->layer_values;
     } else {
         $post['ID'] = '0';
         //set default if we are in demo mode
     }
     //check advanced rules
     $show = $this->check_advanced_rules($layer, $post);
     if ($show === false) {
         return false;
     }
     $position = $base->getVar($layer, 'container', 'tl');
     $class = 'top';
     switch ($position) {
         case 'tl':
             $class = 'top';
             break;
         case 'br':
             $class = 'bottom';
             break;
         case 'c':
             $class = 'center';
             break;
         case 'm':
             $class = 'content';
             break;
     }
     if (!isset($layer['settings'])) {
         return false;
     }
     $this->register_layer_css($layer, $demo);
     $unique_class = 'eg-' . esc_attr($this->handle) . '-element-' . $layer['id'];
     $special_item = $base->getVar($layer['settings'], 'special', 'false');
     $special_item_type = $base->getVar($layer['settings'], 'special-type', 'line-break');
     /*if($special_item != 'true'){
     			$this->add_element_css($layer['settings'], $unique_class); //add css to queue
     		}*/
     //check if absolute positioned, remove class depending on it
     $absolute = $this->is_absolute_position($unique_class);
     if ($absolute) {
         $class = 'absolute';
     }
     $hideunderHTML = '';
     $hideunderClass = '';
     $hideunder = $base->getVar($layer['settings'], 'hideunder', 0, 'i');
     $hideunderheight = $base->getVar($layer['settings'], 'hideunderheight', 0, 'i');
     $hideundertype = $base->getVar($layer['settings'], 'hidetype', 'visibility');
     if ($hideunder > 0) {
         $hideunderHTML .= ' data-hideunder="' . $hideunder . '"';
         $hideunderClass = 'eg-handlehideunder ';
     }
     if ($hideunderheight > 0) {
         $hideunderHTML .= ' data-hideunderheight="' . $hideunderheight . '"';
         $hideunderClass = 'eg-handlehideunder ';
     }
     if ($hideunderHTML !== '') {
         $hideunderHTML .= ' data-hidetype="' . $hideundertype . '"';
     }
     $delay = '';
     $transition_split = '';
     if ($masonry) {
         $transition = '';
         //$transition_split = '';
     } else {
         $transition = ' esg-' . $base->getVar($layer['settings'], 'transition', 'fade') . $base->getVar($layer['settings'], 'transition-type', '');
         //$transition_split = ' data-split="'.$base->getVar($layer['settings'], 'split', 'line').'"';
         $meta_tran = $this->get_meta_element_change($layer['id'], 'transition');
         //check if we have meta transition set
         if ($meta_tran !== false) {
             $transition = ' esg-' . $meta_tran;
         }
         if ($transition == ' esg-none' || $transition == ' esg-noneout' || $base->getVar($layer['settings'], 'transition-type', '') == 'always') {
             //no transition
             $transition = '';
             //$transition_split = '';
         } else {
             $delay = ' data-delay="' . round($base->getVar($layer['settings'], 'delay', 0) / 100, 2) . '"';
             $meta_tran_delay = $this->get_meta_element_change($layer['id'], 'transition-delay');
             //check if we have meta transition-delay set
             if ($meta_tran_delay !== false) {
                 $delay = ' data-delay="' . round($meta_tran_delay / 100, 2) . '"';
             }
         }
     }
     $text = '';
     $do_limit = true;
     $do_display = true;
     $do_full = false;
     $do_ignore_styles = false;
     $is_woo_cats = false;
     $is_woo_button = false;
     $is_html_source = false;
     $is_filter_cat = false;
     $demo_element_type = ' data-custom-type="%s"';
     if (isset($layer['settings']['source'])) {
         $separator = $base->getVar($layer['settings'], 'source-separate', ',');
         $meta = $base->getVar($layer['settings'], 'source-meta', '');
         $func = $base->getVar($layer['settings'], 'source-function', 'link');
         switch ($layer['settings']['source']) {
             case 'post':
                 if ($demo === false) {
                     if ($is_post) {
                         $text = $this->get_post_value($layer['settings']['source-post'], $separator, $func, $meta);
                     } else {
                         $text = $this->get_custom_element_value($layer['settings']['source-post'], $separator, $meta);
                     }
                     if ($func == 'filter') {
                         $is_filter_cat = true;
                     }
                 } elseif ($demo === 'custom') {
                     $text = $this->get_custom_element_value($layer['settings']['source-post'], $separator, $meta);
                 } else {
                     $post_text = Essential_Grid_Item_Element::getPostElementsArray();
                     if (array_key_exists(@$layer['settings']['source-post'], $post_text)) {
                         $text = $post_text[@$layer['settings']['source-post']]['name'];
                     }
                     if ($layer['settings']['source-post'] == 'date') {
                         $da = get_option('date_format');
                         if ($da !== false) {
                             $text = date(get_option('date_format'));
                         } else {
                             $text = date('Y.m.d');
                         }
                     }
                 }
                 $demo_element_type = str_replace('%s', $layer['settings']['source-post'], $demo_element_type);
                 if ($layer['settings']['source-post'] == 'cat_list' || $layer['settings']['source-post'] == 'tag_list') {
                     //no limiting if category or tag list
                     $do_limit = false;
                     $do_display = false;
                     $do_full = true;
                 }
                 break;
             case 'event':
                 if ($demo === false) {
                 } else {
                     $event = Essential_Grid_Item_Element::getEventElementsArray();
                     if (array_key_exists(@$layer['settings']['source-event'], $event)) {
                         $text = $event[@$layer['settings']['source-event']]['name'];
                     }
                 }
                 $demo_element_type = str_replace('%s', $layer['settings']['source-event'], $demo_element_type);
                 break;
             case 'woocommerce':
                 //check if woocommerce is installed
                 if ($demo === false) {
                     if (Essential_Grid_Woocommerce::is_woo_exists()) {
                         if ($is_post) {
                             $text = $this->get_woocommerce_value($layer['settings']['source-woocommerce'], $separator);
                         } else {
                             $text = $this->get_custom_element_value($layer['settings']['source-woocommerce'], $separator, '');
                         }
                         if ($layer['settings']['source-woocommerce'] == 'wc_categories') {
                             $do_limit = false;
                             $do_display = false;
                             $do_full = true;
                             $is_woo_cats = true;
                         } elseif ($layer['settings']['source-woocommerce'] == 'wc_add_to_cart_button') {
                             $do_limit = false;
                             $is_woo_button = true;
                         }
                     }
                 } elseif ($demo === 'custom') {
                     if (Essential_Grid_Woocommerce::is_woo_exists()) {
                         $text = $this->get_custom_element_value($layer['settings']['source-woocommerce'], $separator, '');
                         if ($layer['settings']['source-woocommerce'] == 'wc_categories') {
                             $do_limit = false;
                             $do_display = false;
                             $do_full = true;
                             $is_woo_cats = true;
                         } elseif ($layer['settings']['source-woocommerce'] == 'wc_add_to_cart_button') {
                             $do_limit = false;
                             $is_woo_button = true;
                         }
                     }
                 } else {
                     if (Essential_Grid_Woocommerce::is_woo_exists()) {
                         $tmp_wc = Essential_Grid_Woocommerce::get_meta_array();
                         foreach ($tmp_wc as $handle => $name) {
                             $woocommerce[$handle]['name'] = $name;
                         }
                         if (array_key_exists(@$layer['settings']['source-woocommerce'], $woocommerce)) {
                             $text = $woocommerce[@$layer['settings']['source-woocommerce']]['name'];
                         }
                     }
                 }
                 $demo_element_type = str_replace('%s', $layer['settings']['source-woocommerce'], $demo_element_type);
                 break;
             case 'icon':
                 $text = '<i class="' . @$layer['settings']['source-icon'] . '"></i>';
                 $demo_element_type = '';
                 break;
             case 'text':
                 $text = @$layer['settings']['source-text'];
                 if ($demo === false) {
                     //check for metas by %meta%
                     if ($is_post) {
                         $text = $m->replace_all_meta_in_text($this->post['ID'], $text);
                     } else {
                         $text = $m->replace_all_custom_element_meta_in_text($this->layer_values, $text);
                     }
                 }
                 if (@$layer['settings']['source-text-style-disable']) {
                     $do_ignore_styles = true;
                 }
                 $do_display = false;
                 $demo_element_type = '';
                 $is_html_source = true;
                 break;
             default:
                 $demo_element_type = '';
         }
         if ($do_limit) {
             $limit_by = $base->getVar($layer['settings'], 'limit-type', 'none');
             if ($limit_by !== 'none') {
                 switch ($layer['settings']['source']) {
                     case 'post':
                     case 'event':
                     case 'woocommerce':
                         $text = $base->get_text_intro($text, $base->getVar($layer['settings'], 'limit-num', 10, 'i'), $limit_by);
                         break;
                 }
             }
         }
     }
     $link_to = $base->getVar($layer['settings'], 'link-type', 'none');
     $link_target = $base->getVar($layer['settings'], 'link-target', '_self');
     if ($link_target !== 'disabled') {
         $link_target = ' target="' . $link_target . '"';
     } else {
         $link_target = '';
     }
     $video_play = '';
     $ajax_class = '';
     $ajax_attr = '';
     $lb_class = '';
     switch ($link_to) {
         case 'post':
             if ($demo === false) {
                 if ($is_post) {
                     $text = '<a href="' . get_permalink($post['ID']) . '"' . $link_target . '>' . $text . '</a>';
                 } else {
                     $get_link = $this->get_custom_element_value('post-link', $separator, '');
                     //get the post link
                     if ($get_link == '') {
                         $text = '<a href="javascript:void(0);"' . $link_target . '>' . $text . '</a>';
                     } else {
                         $text = '<a href="' . $get_link . '"' . $link_target . '>' . $text . '</a>';
                     }
                 }
             } else {
                 $text = '<a href="javasccript:void(0);"' . $link_target . '>' . $text . '</a>';
             }
             break;
         case 'url':
             $lurl = $base->getVar($layer['settings'], 'link-type-url', 'javascript:void(0);');
             if (strpos($lurl, '://') === false && trim($lurl) !== '' && $lurl !== 'javascript:void(0);') {
                 $lurl = is_ssl() ? 'https://' . $lurl : 'http://' . $lurl;
             }
             $text = '<a href="' . $lurl . '"' . $link_target . '>' . $text . '</a>';
             break;
         case 'meta':
             if ($demo === false) {
                 if ($is_post) {
                     $meta_key = $base->getVar($layer['settings'], 'link-type-meta', 'javascript:void(0);');
                     $meta_link = $m->get_meta_value_by_handle($post['ID'], $meta_key);
                     if ($meta_link == '') {
                         // if empty, link to nothing
                         $text = '<a href="javascript:void(0);"' . $link_target . '>' . $text . '</a>';
                     } else {
                         $text = '<a href="' . $meta_link . '"' . $link_target . '>' . $text . '</a>';
                     }
                 } else {
                     $meta_key = $base->getVar($layer['settings'], 'link-type-meta', '');
                     $get_link = $this->get_custom_element_value('post-link', $separator, $meta_key);
                     //get the post link
                     if ($get_link == '') {
                         $text = '<a href="javascript:void(0);"' . $link_target . '>' . $text . '</a>';
                     } else {
                         $text = '<a href="' . $get_link . '"' . $link_target . '>' . $text . '</a>';
                     }
                 }
             } else {
                 $text = '<a href="javascript:void(0);"' . $link_target . '>' . $text . '</a>';
             }
             break;
         case 'javascript':
             $text = '<a href="javascript:' . $base->getVar($layer['settings'], 'link-type-javascript', 'void(0);') . '"' . $link_target . '>' . $text . '</a>';
             //javascript-link
             break;
         case 'lightbox':
             if (!Essential_Grid_Jackbox::is_active() && !Essential_Grid_Social_Gallery::is_active()) {
                 //enqueue only if default LightBox is selected
                 wp_enqueue_script('themepunchboxext');
                 wp_enqueue_style('themepunchboxextcss');
             }
             $lb_source = '#';
             $lb_addition = '';
             $lb_rel = $this->lb_rel !== false ? ' rel="' . $this->lb_rel . '"' : '';
             if (!empty($this->default_lightbox_source_order)) {
                 //only show if something is checked
                 foreach ($this->default_lightbox_source_order as $order) {
                     //go through the order and set media as wished
                     if (isset($this->media_sources[$order]) && $this->media_sources[$order] !== '' && $this->media_sources[$order] !== false) {
                         //found entry
                         $do_continue = false;
                         if (!empty($this->lightbox_additions['items']) && $this->lightbox_additions['base'] == 'on') {
                             $lb_source = $this->lightbox_additions['items'][0];
                             $lb_class = ' esgbox';
                         } else {
                             switch ($order) {
                                 case 'featured-image':
                                 case 'alternate-image':
                                 case 'content-image':
                                     if ($order == 'content-image') {
                                         $lb_source = $this->media_sources[$order];
                                     } else {
                                         $lb_source = $this->media_sources[$order . '-full'];
                                     }
                                     $lb_class = ' esgbox';
                                     break;
                                 case 'youtube':
                                     $http = is_ssl() ? 'https' : 'http';
                                     $lb_source = $http . '://www.youtube.com/watch?v=' . $this->media_sources[$order];
                                     $lb_class = ' esgbox';
                                     break;
                                 case 'vimeo':
                                     $http = is_ssl() ? 'https' : 'http';
                                     $lb_source = $http . '://vimeo.com/' . $this->media_sources[$order];
                                     $lb_class = ' esgbox';
                                     break;
                                 case 'iframe':
                                     //$lb_source = html_entity_decode($this->media_sources[$order]);
                                     //$lb_class = ' esgbox';
                                     $do_continue = true;
                                     break;
                                 case 'html5':
                                     if (trim($this->media_sources[$order]['mp4']) === '' && trim($this->media_sources[$order]['ogv']) === '' && trim($this->media_sources[$order]['webm'] === '')) {
                                         $do_continue = true;
                                     } else {
                                         $lb_mp4 = $this->media_sources[$order]['mp4'];
                                         $lb_ogv = $this->media_sources[$order]['ogv'];
                                         $lb_webm = $this->media_sources[$order]['webm'];
                                         $lb_source = "#";
                                         $lb_class = ' esgbox esgboxhtml5';
                                         $lb_addition = ' data-mp4="' . $lb_mp4 . '" data-ogv="' . $lb_ogv . '" data-webm="' . $lb_webm . '"';
                                     }
                                     break;
                                 default:
                                     $do_continue = true;
                                     break;
                             }
                         }
                         if ($do_continue) {
                             continue;
                         }
                         break;
                     }
                 }
             }
             if ($demo !== false) {
                 $lb_title = __('demo mode', EG_TEXTDOMAIN);
             } else {
                 if ($is_post) {
                     $lb_title = $base->getVar($this->post, 'post_title', '');
                 } else {
                     $lb_title = $this->get_custom_element_value('title', $separator, '');
                 }
                 //the title from Post Title will be used
             }
             $text = '<a href="' . $lb_source . '"' . $lb_addition . ' lgtitle="' . $lb_title . '"' . $lb_rel . '>' . $text . '</a>';
             $this->load_lightbox = true;
             //set that jQuery is written
             break;
         case 'embedded_video':
             $video_play = ' esg-click-to-play-video';
             break;
         case 'ajax':
             $ajax_class = '';
             if (!empty($this->default_ajax_source_order)) {
                 //only show if something is checked
                 $ajax_class = ' eg-ajaxclicklistener';
                 foreach ($this->default_ajax_source_order as $order) {
                     //go through the order and set media as wished
                     $do_continue = false;
                     if (isset($this->media_sources[$order]) && $this->media_sources[$order] !== '' && $this->media_sources[$order] !== false || $order == 'post-content') {
                         //found entry
                         switch ($order) {
                             case 'youtube':
                                 $vid_ratio = $this->video_ratios['youtube'] == '0' ? '4:3' : '16:9';
                                 $ajax_attr = ' data-ajaxtype="youtubeid"';
                                 // postid, html5vid youtubeid vimeoid soundcloud revslider
                                 $ajax_attr .= ' data-ajaxsource="' . $this->media_sources[$order] . '"';
                                 //depending on type
                                 $ajax_attr .= ' data-ajaxvideoaspect="' . $vid_ratio . '"';
                                 //depending on type
                                 break;
                             case 'vimeo':
                                 $vid_ratio = $this->video_ratios['vimeo'] == '0' ? '4:3' : '16:9';
                                 $ajax_attr = ' data-ajaxtype="vimeoid"';
                                 // postid, html5vid youtubeid vimeoid soundcloud revslider
                                 $ajax_attr .= ' data-ajaxsource="' . $this->media_sources[$order] . '"';
                                 //depending on type
                                 $ajax_attr .= ' data-ajaxvideoaspect="' . $vid_ratio . '"';
                                 //depending on type
                                 break;
                             case 'html5':
                                 if ($this->media_sources[$order]['mp4'] == '' && $this->media_sources[$order]['webm'] == '' && $this->media_sources[$order]['ogv'] == '') {
                                     $do_continue = true;
                                 } else {
                                     //mp4/webm/ogv
                                     $vid_ratio = $this->video_ratios['html5'] == '0' ? '4:3' : '16:9';
                                     $ajax_attr = ' data-ajaxtype="html5vid"';
                                     // postid, html5vid youtubeid vimeoid soundcloud revslider
                                     $ajax_attr .= ' data-ajaxsource="';
                                     $ajax_attr .= @$this->media_sources[$order]['mp4'] . '|';
                                     $ajax_attr .= @$this->media_sources[$order]['webm'] . '|';
                                     $ajax_attr .= @$this->media_sources[$order]['ogv'];
                                     $ajax_attr .= '"';
                                     $ajax_attr .= ' data-ajaxvideoaspect="' . $vid_ratio . '"';
                                     //depending on type
                                 }
                                 break;
                             case 'soundcloud':
                                 $ajax_attr = ' data-ajaxtype="soundcloudid"';
                                 // postid, html5vid youtubeid vimeoid soundcloud revslider
                                 $ajax_attr .= ' data-ajaxsource="' . $this->media_sources[$order] . '"';
                                 //depending on type
                                 break;
                             case 'post-content':
                                 if ($is_post) {
                                     $ajax_attr = ' data-ajaxtype="postid"';
                                     // postid, html5vid youtubeid vimeoid soundcloud revslider
                                     $ajax_attr .= ' data-ajaxsource="' . @$this->post['ID'] . '"';
                                     //depending on type
                                 } else {
                                     $do_continue = true;
                                     //$ajax_class = '';
                                 }
                                 break;
                             case 'featured-image':
                             case 'alternate-image':
                             case 'content-image':
                                 $img_url = '';
                                 if ($order == 'content-image') {
                                     $img_url = $this->media_sources[$order];
                                 } else {
                                     $img_url = $this->media_sources[$order . '-full'];
                                 }
                                 $ajax_attr = ' data-ajaxtype="imageurl"';
                                 // postid, html5vid youtubeid vimeoid soundcloud revslider
                                 $ajax_attr .= ' data-ajaxsource="' . $img_url . '"';
                                 //depending on type
                                 break;
                             default:
                                 $ajax_class = '';
                                 $do_continue = true;
                                 break;
                         }
                         if ($do_continue) {
                             continue;
                         }
                         break;
                     } else {
                         //some custom entry maybe
                         $postobj = $is_post ? $this->post : false;
                         $ajax_attr = apply_filters('essgrid_handle_ajax_content', $order, $this->media_sources, $postobj, $this->grid_id);
                         if (empty($ajax_attr)) {
                             //$ajax_class = '';
                             $do_continue = true;
                         }
                         if ($do_continue) {
                             continue;
                         }
                         break;
                     }
                 }
             }
             //$ajax_attr .= ' data-ajaxcallback=""'; //functionname
             //$ajax_attr .= ' data-ajaxcsstoload=""'; //css source
             //$ajax_attr .= ' data-ajaxjstoload=""'; //js source
             if ($ajax_class !== '') {
                 //set ajax loading to true so that the grid can decide to put ajax container in top/bottom
                 $this->ajax_loading = true;
             }
             break;
     }
     if ($link_to !== 'none') {
         $do_display = true;
     }
     //set back to true if a link is set on layer
     $text = trim($text);
     //check for special styling coming from post option and set css to the queue
     $this->set_meta_element_changes($layer['id'], $unique_class);
     $post_class = !isset($post['ID']) ? '' : ' eg-post-' . $post['ID'];
     if ($base->text_has_certain_tag($text, 'a') && !$do_ignore_styles) {
         //check if a tag exists, if yes, class will be set to a tags and not the wrapping div, also the div will receive the position and other stylings // && @$layer['settings']['source'] !== 'text'
         if ($is_woo_cats && strpos($text, 'class="') !== false || $is_woo_button || $is_filter_cat && strpos($text, 'class="') !== false) {
             //add to the classes instead of creating own class attribute if it is woocommerce cats AND a class can be found
             $text = str_replace('class="', 'class="' . $unique_class . $post_class . $lb_class . ' ', $text);
         } elseif ($is_html_source && strpos($text, 'class="') !== false) {
             $text = str_replace('<a', '<a class="' . $unique_class . $post_class . $lb_class . '"', $text);
         } else {
             $text = str_replace('<a', '<a class="' . $unique_class . $post_class . $lb_class . '"', $text);
         }
         //moved to more global css generation process @version: 2.0
         //$this->add_css_wrap[$unique_class]['a']['display'] = $do_display; //do_display defines if we should write display: block;
         //$this->add_css_wrap[$unique_class]['a']['full'] = $do_full; //do full styles (for categories and tags separator)
         $unique_class .= '-a';
     }
     if ($do_ignore_styles) {
         $unique_class = 'eg-' . esc_attr($this->handle) . '-nostyle-element-' . $layer['id'];
     }
     //replace all the normal shortcodes
     $text = do_shortcode($text);
     if ($special_item == 'true' && $special_item_type == 'line-break') {
         //line break element
         echo '              <div class="esg-' . $class . ' ' . $unique_class . ' esg-none esg-clear" style="height: 5px; visibility: hidden;"></div>' . "\n";
     } elseif (trim($text) !== '') {
         //}elseif(!empty($text)){
         $use_tag = $base->getVar($layer['settings'], 'tag-type', 'div');
         echo '				<' . $use_tag . ' class="esg-' . $class . $post_class . $video_play . $ajax_class . ' ' . $hideunderClass . $unique_class . $transition . '"' . $ajax_attr . $transition_split . $delay . $hideunderHTML;
         echo $demo == 'custom' ? $demo_element_type : '';
         echo '>';
         echo $text;
         echo '</' . $use_tag . '>' . "\n";
     }
 }
Example #3
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'));
     }
 }
Example #4
0
							</p>
						</div>
						<div style="clear:both"></div>
					</div>
				</div>
			</div>

			<div class="divider1"></div>
			
			<?php 
$use_lightbox = get_option('tp_eg_use_lightbox', 'false');
if ($use_lightbox == 'jackbox' && !Essential_Grid_Jackbox::jb_exists()) {
    $use_lightbox = 'false';
    update_option('tp_eg_use_lightbox', 'false');
}
if ($use_lightbox == 'sg' && !Essential_Grid_Social_Gallery::sg_exists()) {
    $use_lightbox = 'false';
    update_option('tp_eg_use_lightbox', 'false');
}
?>
			<div class="eg-hide-if-social-gallery-is-enabled" <?php 
echo $use_lightbox == 'sg' ? ' style="display: none;"' : '';
?>
>
				<div class="eg-creative-settings">
					<div class="eg-cs-tbc-left">
						<h3 class="box-closed"><span><?php 
_e('Lightbox Gallery', EG_TEXTDOMAIN);
?>
</span></h3>
					</div>