/**
  * Search all Grids and change the term IDs set in the selected terms if needed
  * @since: 2.1.0
  **/
 static function split_terms_fix($old_term_id, $new_term_id, $term_taxonomy_id, $taxonomy)
 {
     $base = new Essential_Grid_Base();
     $lang = array();
     if (Essential_Grid_Wpml::is_wpml_exists()) {
         $lang = icl_get_languages();
     }
     $grids = Essential_Grid::get_essential_grids();
     if (!empty($grids)) {
         foreach ($grids as $grid) {
             $selected = json_decode($grid->postparams, true);
             $post_category = $base->getVar($selected, 'post_category');
             $cat_tax = $base->getCatAndTaxData($post_category);
             $cats = array();
             if (!empty($cat_tax['cats'])) {
                 $cats = explode(',', $cat_tax['cats']);
             }
             $taxes = array('post_tag');
             if (!empty($cat_tax['tax'])) {
                 $taxes = explode(',', $cat_tax['tax']);
             }
             $cont = false;
             if (!empty($cats)) {
                 foreach ($cats as $cat) {
                     if ($old_term_id == $cat && in_array($taxonomy, $taxes)) {
                         //ID needs to be changed
                         foreach ($taxes as $t) {
                             //replace all occuring old term id with the new term id and then Save the Grid
                             $post_category = str_replace($t . '_' . $old_term_id, $t . '_' . $new_term_id, $post_category);
                         }
                         $selected['post_category'] = $post_category;
                         $grid->postparams = $selected;
                         $grid->params = json_decode($grid->params, true);
                         $grid->layers = json_decode($grid->layers, true);
                         $new_grid = (array) $grid;
                         //cast to array as update_create_grid expects an array
                         Essential_Grid_Admin::update_create_grid($new_grid);
                         //now delete cache of the Grid so that changes take effect immediately
                         if (!empty($lang)) {
                             foreach ($lang as $code => $val) {
                                 delete_transient('ess_grid_trans_query_' . $grid->id . $val['language_code']);
                                 delete_transient('ess_grid_trans_full_grid_' . $grid->id . $val['language_code']);
                             }
                         } else {
                             delete_transient('ess_grid_trans_query_' . $grid->id);
                             delete_transient('ess_grid_trans_full_grid_' . $grid->id);
                         }
                         $cont = true;
                     }
                     if ($cont == true) {
                         break;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function __construct($force = false)
 {
     $base = new Essential_Grid_Base();
     $this->base = $base;
     $plugin = Essential_Grid::get_instance();
     $this->plugin_slug = $plugin->get_plugin_slug();
     $settings = get_option('esg-search-settings', array('settings' => array(), 'global' => array(), 'shortcode' => array()));
     if ($force) {
         //change settings to force inclusion by setting search-enable to on
         $settings['settings']['search-enable'] = 'on';
     }
     $settings = Essential_Grid_Base::stripslashes_deep($settings);
     $this->settings = $settings;
     if (!is_admin()) {
         //only for frondend
         if ($base->getVar($settings['settings'], 'search-enable', 'off') == 'on') {
             add_action('wp_footer', array($this, 'enqueue_styles'));
             //wp_enqueue_scripts
             add_action('wp_footer', array($this, 'enqueue_scripts'));
             //wp_enqueue_scripts
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * output the demo skin html
  */
 public static function output_demo_skin_html($data)
 {
     $grid = new Essential_Grid();
     $base = new Essential_Grid_Base();
     $item_skin = new Essential_Grid_Item_Skin();
     if (!isset($data['postparams']['source-type'])) {
         //something is wrong, print error
         return array('error' => __('Something went wrong, this may have to do with Server limitations', EG_TEXTDOMAIN));
     }
     $html = '';
     $preview = '';
     $preview_type = $data['postparams']['source-type'] == 'custom' ? 'custom' : 'preview';
     $grid_id = isset($data['id']) && intval($data['id']) > 0 ? intval($data['id']) : '-1';
     ob_start();
     $grid->output_essential_grid($grid_id, $data, $preview_type);
     $html = ob_get_contents();
     ob_clean();
     ob_end_clean();
     $skin = $base->getVar($data['params'], 'entry-skin', 0, 'i');
     if ($skin > 0) {
         ob_start();
         $item_skin->init_by_id($skin);
         $item_skin->output_item_skin('custom');
         $preview = ob_get_contents();
         ob_clean();
         ob_end_clean();
     }
     return array('html' => $html, 'preview' => $preview);
 }
Ejemplo n.º 4
0
function eg_filter_tab_function($id, $params)
{
    global $grid;
    global $categories;
    global $postTypesWithCats;
    $base = new Essential_Grid_Base();
    ?>
								<div class="eg-filter-options-wrap" style="display:inline-block">
									<div class="eg-filter-header-block"><i class="eg-icon-megaphone"></i><?php 
    _e('Filter -', EG_TEXTDOMAIN);
    ?>
 <span class="filter-header-id"><?php 
    echo $id;
    ?>
</span></div>
									<p class="eg-filter-label"><?php 
    _e('Filter "All" Text', EG_TEXTDOMAIN);
    ?>
</p>
									<p class="eg-filter-option-field">
										<input type="text" name="filter-all-text-<?php 
    echo $id;
    ?>
" data-origname="filter-all-text-#NR" class="eg-tooltip-wrap" title="<?php 
    _e('Visible Title on All Filter Button.', EG_TEXTDOMAIN);
    ?>
" value="<?php 
    echo $base->getVar($params, 'filter-all-text-' . $id, __('Filter - All', EG_TEXTDOMAIN));
    ?>
" class="firstinput">
										<span class="eg-remove-filter-tab" style="display: none;"><i class="eg-icon-cancel"></i></span>
									</p>
									<p class="eg-filter-label"><?php 
    _e('Layout Option', EG_TEXTDOMAIN);
    ?>
</p>
									<p class="eg-filter-option-field">
										<?php 
    $filter_listing = $base->getVar($params, 'filter-listing-' . $id, 'list');
    ?>
										<select class="firstinput" name="filter-listing-<?php 
    echo $id;
    ?>
" data-origname="filter-listing-#NR">
											<option value="list" <?php 
    checked($filter_listing, 'list');
    ?>
><?php 
    _e('In Line', EG_TEXTDOMAIN);
    ?>
</option>
											<option value="dropdown" <?php 
    selected($filter_listing, 'dropdown');
    ?>
><?php 
    _e('Dropdown', EG_TEXTDOMAIN);
    ?>
</option>
										</select>
									</p>
									<p class="eg-filter-label"><?php 
    _e('Dropdown Start Text', EG_TEXTDOMAIN);
    ?>
</p>
									<p class="filter-only-if-dropdown eg-filter-option-field">
										<?php 
    $filter_dropdown_text = $base->getVar($params, 'filter-dropdown-text-' . $id, __('Filter Categories', EG_TEXTDOMAIN));
    ?>
										<input class="firstinput" type="text" data-origname="filter-dropdown-text-#NR" name="filter-dropdown-text-<?php 
    echo $id;
    ?>
" title="<?php 
    _e('Default Text on the Filter Dropdown List.', EG_TEXTDOMAIN);
    ?>
" value="<?php 
    echo $filter_dropdown_text;
    ?>
" />
									</p>
									<p class="eg-filter-label"><?php 
    _e('Available Filters in Group', EG_TEXTDOMAIN);
    ?>
</p>
									<div class="filter-only-for-post">
										<?php 
    $filter_selected = $base->getVar($params, 'filter-selected-' . $id, '');
    ?>
										<div class="eg-media-source-order-wrap eg-filter-selected-order-wrap-<?php 
    echo $id;
    ?>
">
											<?php 
    if (!empty($filter_selected)) {
        if (!isset($params['filter-selected-' . $id])) {
            //we are either a new Grid or old Grid that had not this option (since 1.1.0)
            if ($grid !== false) {
                //set the values
                $use_cat = @$categories;
            } else {
                $use_cat = @$postTypesWithCats['post'];
            }
            if (!empty($use_cat)) {
                foreach ($use_cat as $handle => $cat) {
                    if (strpos($handle, 'option_disabled_') !== false) {
                        continue;
                    }
                    ?>
															<div class="eg-media-source-order revblue button-primary">
																<span style="float:left"><?php 
                    echo $cat;
                    ?>
</span>														
																<input class="eg-get-val eg-filter-input eg-filter-selected-<?php 
                    echo $id;
                    ?>
" type="checkbox" name="filter-selected-<?php 
                    echo $id;
                    ?>
[]" data-origname="filter-selected-#NR[]" checked="checked" value="<?php 
                    echo $handle;
                    ?>
" />
																<div style="clear:both"></div>
															</div>
															<?php 
                }
            }
        } else {
            foreach ($filter_selected as $fs) {
                ?>
														<div class="eg-media-source-order revblue button-primary">
															<span style="float:left"><?php 
                echo $fs;
                ?>
</span>														
															<input class="eg-get-val eg-filter-input eg-filter-selected-<?php 
                echo $id;
                ?>
" type="checkbox" name="filter-selected-<?php 
                echo $id;
                ?>
[]" data-origname="filter-selected-#NR[]" checked="checked" value="<?php 
                echo $fs;
                ?>
" />
															<div style="clear:both"></div>
														</div>
														<?php 
            }
        }
    }
    ?>
										</div>
									</div>
								</div>
								<?php 
}
Ejemplo n.º 5
0
" style="margin-right: 15px;" /> <span style="font-size:12px;font-weight:600;"><?php 
_e('Class Prefix = ', EG_TEXTDOMAIN);
?>
 .eg-<span class="eg-tooltip-wrap" title="<?php 
_e('Each element in the Skin becomes this CSS Prefix', EG_TEXTDOMAIN);
?>
" id="eg-item-skin-slug"></span>-</span></h2>

	<div style="width:100%;height:15px"></div>
	<div style="width:1085px">

		<div style="float:left; width:600px;margin-right:15px;">
			<!-- START OF SETTINGS ON THE LEFT SIDE  border: 2px solid #27AE60; -->
			<form id="eg-form-item-skin-layout-settings">
				<input type="hidden" value="<?php 
echo $base->getVar($skin['params'], 'eg-item-skin-element-last-id', 0, 'i');
?>
" name="eg-item-skin-element-last-id" />
				<div class="postbox eg-postbox" style=""><h3 style="padding:10px"><span><i style="background-color:#27AE60; padding:3px; margin-right:10px;border-radius:50%;-moz-border-radius:50%;-webkit-border-radius:50%;color:#fff;" class="eg-icon-menu"></i><?php 
_e('Layout Composition', EG_TEXTDOMAIN);
?>
</span><div class="postbox-arrow"></div></h3>
					<div class="inside" style="padding:0px;margin:0px;height:415px">

						<div class="eg-lc-menu-wrapper" style="height:100%;">
							<div class="eg-lc-vertical-menu" style="height:100%;">
								<ul>
									<li class="selected-lc-setting" data-toshow="eg-lc-layout"><i class="eg-icon-th-large"></i><p><?php 
_e('Layout', EG_TEXTDOMAIN);
?>
</p></li>
 /**
  * This function deletes transient of certain grids where the Post is included in
  * @since: 1.2.0
  */
 public static function check_for_transient_deletion($post_id)
 {
     $base = new Essential_Grid_Base();
     $categories = $base->get_custom_taxonomies_by_post_id($post_id);
     $tags = get_the_tags($post_id);
     $lang = array();
     if (Essential_Grid_Wpml::is_wpml_exists()) {
         $lang = icl_get_languages();
     }
     $cat = array();
     if (!empty($categories) || !empty($tags)) {
         if (!empty($categories)) {
             foreach ($categories as $c) {
                 $cat[$c->taxonomy][$c->term_id] = true;
             }
         }
         if (!empty($tags)) {
             foreach ($categories as $c) {
                 $cat[$c->taxonomy][$c->term_id] = true;
             }
         }
         //get all grids, then check all grids
         $grids = Essential_Grid::get_essential_grids();
         if (!empty($grids)) {
             foreach ($grids as $grid) {
                 $selected = json_decode($grid->postparams, true);
                 $post_category = $base->getVar($selected, 'post_category');
                 $cat_tax = $base->getCatAndTaxData($post_category);
                 $cats = array();
                 if (!empty($cat_tax['cats'])) {
                     $cats = explode(',', $cat_tax['cats']);
                 }
                 $taxes = array('post_tag');
                 if (!empty($cat_tax['tax'])) {
                     $taxes = explode(',', $cat_tax['tax']);
                 }
                 $cont = false;
                 if (!empty($cats)) {
                     foreach ($taxes as $tax) {
                         foreach ($cats as $c) {
                             if (isset($cat[$tax][$c])) {
                                 //if set, cache of grid needs to be killed
                                 if (!empty($lang)) {
                                     foreach ($lang as $code => $val) {
                                         delete_transient('ess_grid_trans_query_' . $grid->id . $val['language_code']);
                                         delete_transient('ess_grid_trans_full_grid_' . $grid->id . $val['language_code']);
                                     }
                                 } else {
                                     delete_transient('ess_grid_trans_query_' . $grid->id);
                                     delete_transient('ess_grid_trans_full_grid_' . $grid->id);
                                 }
                                 $cont = true;
                             }
                             if ($cont == true) {
                                 break;
                             }
                         }
                         if ($cont == true) {
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
 /**
  * replace all metas with corresponding text
  */
 public function replace_all_meta_in_text($post_id, $text)
 {
     if (trim($text) === '' || intval($post_id) === 0) {
         return '';
     }
     $base = new Essential_Grid_Base();
     $meta_link = new Essential_Grid_Meta_Linking();
     $cmeta = $this->get_all_meta();
     //process meta tags:
     $arr_matches = array();
     preg_match_all("/%[^%]*%/", $text, $arr_matches);
     if (!empty($arr_matches)) {
         $my_post = get_post($post_id, ARRAY_A);
         foreach ($arr_matches as $matches) {
             if (is_array($matches)) {
                 foreach ($matches as $match) {
                     $meta = trim(str_replace('%', '', $match));
                     $meta_value = get_post_meta($post_id, $meta, true);
                     if (!empty($cmeta)) {
                         foreach ($cmeta as $me) {
                             if ('eg-' . $me['handle'] == $meta) {
                                 if ($me['type'] == 'image') {
                                     if (intval($meta_value) > 0) {
                                         //get URL to Image
                                         $img = wp_get_attachment_image_src($meta_value, 'full');
                                         if ($img !== false) {
                                             $meta_value = $img[0];
                                         } else {
                                             $meta_value = '';
                                         }
                                     } else {
                                         $meta_value = '';
                                     }
                                 }
                                 if ($meta_value == '' && isset($me['default'])) {
                                     $meta_value = $me['default'];
                                 }
                                 break;
                             }
                         }
                     }
                     //check woocommerce
                     if (Essential_Grid_Woocommerce::is_woo_exists()) {
                         $wc_text = Essential_Grid_Woocommerce::get_value_by_meta($post_id, $meta);
                         if ($wc_text !== '') {
                             $meta_value = $wc_text;
                         }
                     }
                     if (empty($meta_value) && !empty($my_post)) {
                         //try to get from post
                         switch ($meta) {
                             //Post elements
                             case 'post_url':
                                 $post_id = $base->getVar($my_post, 'ID', '');
                                 $meta_value = get_permalink($post_id);
                                 break;
                             case 'post_id':
                                 $meta_value = $base->getVar($my_post, 'ID', '');
                                 break;
                             case 'title':
                                 $meta_value = $base->getVar($my_post, 'post_title', '');
                                 break;
                             case 'excerpt':
                                 $meta_value = trim($base->getVar($my_post, 'post_excerpt'));
                                 if (empty($meta_value)) {
                                     $meta_value = trim($base->getVar($my_post, 'post_content'));
                                 }
                                 $meta_value = strip_tags($meta_value);
                                 //,"<b><br><br/><i><strong><small>"
                                 break;
                             case 'meta':
                                 $m = new Essential_Grid_Meta();
                                 $meta_value = $m->get_meta_value_by_handle($my_post['ID'], $meta);
                                 break;
                             case 'alias':
                                 $meta_value = $base->getVar($my_post, 'post_name');
                                 break;
                             case 'content':
                                 $meta_value = $base->getVar($my_post, 'post_content');
                                 break;
                             case 'link':
                                 $meta_value = get_permalink($my_post['ID']);
                                 break;
                             case 'date':
                                 $postDate = $base->getVar($my_post, "post_date_gmt");
                                 $meta_value = $base->convert_post_date($postDate);
                                 break;
                             case 'date_modified':
                                 $dateModified = $base->getVar($my_post, "post_modified");
                                 $meta_value = $base->convert_post_date($dateModified);
                                 break;
                             case 'author_name':
                                 $authorID = $base->getVar($my_post, 'post_author');
                                 $meta_value = get_the_author_meta('display_name', $authorID);
                                 break;
                             case 'num_comments':
                                 $meta_value = $base->getVar($my_post, 'comment_count');
                                 break;
                             case 'cat_list':
                                 $use_taxonomies = false;
                                 $postCatsIDs = $base->getVar($my_post, 'post_category');
                                 if (empty($postCatsIDs) && isset($my_post['post_type'])) {
                                     $postCatsIDs = array();
                                     $obj = get_object_taxonomies($my_post['post_type']);
                                     if (!empty($obj) && is_array($obj)) {
                                         foreach ($obj as $tax) {
                                             $use_taxonomies[] = $tax;
                                             $new_terms = get_the_terms($my_post['ID'], $tax);
                                             if (is_array($new_terms) && !empty($new_terms)) {
                                                 foreach ($new_terms as $term) {
                                                     $postCatsIDs[$term->term_id] = $term->term_id;
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 $meta_value = $base->get_categories_html_list($postCatsIDs, true, ',', $use_taxonomies);
                                 break;
                             case 'tag_list':
                                 $meta_value = $base->get_tags_html_list($my_post['ID']);
                                 break;
                             default:
                                 $meta_value = apply_filters('essgrid_post_meta_content', $meta_value, $meta, $my_post['ID'], $my_post);
                                 break;
                                 break;
                         }
                         if (empty($meta_value)) {
                             //check if its linking
                             $meta_value = $meta_link->get_link_meta_value_by_handle($my_post['ID'], $meta);
                         }
                     }
                     $text = str_replace($match, $meta_value, $text);
                 }
             }
         }
     }
     return $text;
 }
Ejemplo n.º 8
0
 /**
  * Handle Ajax Requests
  */
 public static function on_front_ajax_action()
 {
     $base = new Essential_Grid_Base();
     $token = $base->getPostVar("token", false);
     //verify the token
     $isVerified = wp_verify_nonce($token, 'Essential_Grid_Front');
     $error = false;
     if ($isVerified) {
         $data = $base->getPostVar('data', false);
         //client_action: load_more_items
         switch ($base->getPostVar('client_action', false)) {
             case 'load_more_items':
                 $gridid = $base->getPostVar('gridid', 0, 'i');
                 if (!empty($data) && $gridid > 0) {
                     $grid = new Essential_Grid();
                     $result = $grid->init_by_id($gridid);
                     if (!$result) {
                         $error = __('Grid not found', EG_TEXTDOMAIN);
                     } else {
                         $grid->set_loading_ids($data);
                         //set to only load choosen items
                         $html = false;
                         //check if we are custom grid
                         if ($grid->is_custom_grid()) {
                             $html = $grid->output_by_specific_ids();
                         } else {
                             $html = $grid->output_by_specific_posts();
                         }
                         if ($html !== false) {
                             self::ajaxResponseData($html);
                         } else {
                             $error = __('Items Not Found', EG_TEXTDOMAIN);
                         }
                     }
                 } else {
                     $error = __('No Data Received', EG_TEXTDOMAIN);
                 }
                 break;
             case 'load_more_content':
                 $postid = $base->getPostVar('postid', 0, 'i');
                 if ($postid > 0) {
                     $raw_content = get_post_field('post_content', $postid);
                     if (!is_wp_error($raw_content)) {
                         $content = apply_filters('the_content', $raw_content);
                         //filter apply for qTranslate and other
                         self::ajaxResponseData($content);
                     }
                 }
                 $error = __('Post Not Found', EG_TEXTDOMAIN);
                 break;
             case 'get_search_results':
                 $search_string = $base->getVar($data, 'search', '');
                 $search_skin = $base->getVar($data, 'skin', 0, 'i');
                 if ($search_string !== '' && $search_skin > 0) {
                     $search = new Essential_Grid_Search();
                     $return = $search->output_search_result($search_string, $search_skin);
                     self::ajaxResponseData($return);
                 }
                 $error = __('Not found', EG_TEXTDOMAIN);
                 break;
             case 'get_grid_search_ids':
                 $search_string = $base->getVar($data, 'search', '');
                 $grid_id = $base->getVar($data, 'id', 0, 'i');
                 if ($search_string !== '' && $grid_id > 0) {
                     $return = Essential_Grid_Search::output_search_result_ids($search_string, $grid_id);
                     if (!is_array($return)) {
                         $error = $return;
                     } else {
                         self::ajaxResponseSuccess('', $return);
                     }
                 }
                 $error = __('Not found', EG_TEXTDOMAIN);
                 break;
         }
     } else {
         $error = true;
     }
     if ($error !== false) {
         $showError = __('Loading Error', EG_TEXTDOMAIN);
         if ($error !== true) {
             $showError = $error;
         }
         self::ajaxResponseError($showError, false);
     }
     exit;
 }
 /**
  * Retrieve the value of post elements
  */
 public function get_custom_element_value($handle, $separator, $meta = '')
 {
     $base = new Essential_Grid_Base();
     $m = new Essential_Grid_Meta();
     $text = '';
     $text = $base->getVar($this->layer_values, $handle, '');
     if ($text == '' && $meta != '') {
         $text = $base->getVar($this->layer_values, $meta, '');
     }
     if (intval($text) > 0) {
         //we may be an image from the metas
         $custom_meta = $m->get_all_meta(false);
         if (!empty($custom_meta)) {
             foreach ($custom_meta as $cmeta) {
                 if ($cmeta['handle'] == $handle) {
                     if ($cmeta['type'] == 'image') {
                         $img = wp_get_attachment_image_src($text, $this->media_sources_type);
                         if ($img !== false) {
                             $text = $img[0];
                             //replace with URL
                         }
                     }
                     break;
                 }
             }
         }
     }
     return $text;
 }
Ejemplo n.º 10
0
$save = __('Save Grid', EG_TEXTDOMAIN);
$layers = false;
if (intval($isCreate) > 0) {
    //currently editing
    $grid = Essential_Grid::get_essential_grid_by_id(intval($isCreate));
    if (!empty($grid)) {
        $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', '');
Ejemplo n.º 11
0
 public function import_global_styles($import_global_styles, $check_append = true)
 {
     $base = new Essential_Grid_Base();
     $c_css = new Essential_Grid_Global_Css();
     $append = true;
     if ($check_append) {
         //check in $_POST if append or overwrite
         $do = $base->getVar($this->overwrite_data, 'global-styles-overwrite', 'append');
         $append = $do == 'append' ? true : false;
     }
     if ($append) {
         //append
         $global_styles = $c_css->get_global_css_styles();
         $import_global_styles = $global_styles . "\n" . $import_global_styles;
     }
     $c_css->set_global_css_styles($import_global_styles);
 }
Ejemplo n.º 12
0
<div id="eg-grid-search-wrapper">
	<ul class="es-grid-search-tabs">
		<li><a href="#eg-search-settings-wrap"><?php 
_e('Global Settings', EG_TEXTDOMAIN);
?>
</a></li>
		<li><a href="#eg-shortcode-search-wrap"><?php 
_e('ShortCode Search', EG_TEXTDOMAIN);
?>
</a></li>
	</ul>
	
	<div id="eg-search-settings-wrap">
		<p>
			<?php 
$search_enable = $base->getVar(@$settings['settings'], 'search-enable', 'off');
?>
			<label for="search-enable"><?php 
_e('Enable Search Globally', EG_TEXTDOMAIN);
?>
</label>
			<input type="radio" name="search-enable" value="on" <?php 
checked($search_enable, 'on');
?>
 /> <?php 
_e('On', EG_TEXTDOMAIN);
?>
			<input type="radio" name="search-enable" value="off" <?php 
checked($search_enable, 'off');
?>
 /> <?php 
Ejemplo n.º 13
0
 public function import_global_styles($import_global_styles, $check_append = true)
 {
     $base = new Essential_Grid_Base();
     $c_css = new Essential_Grid_Global_Css();
     $append = true;
     if ($check_append) {
         //check in $_POST if append or overwrite
         $do = $base->getVar($this->overwrite_data, 'global-styles-overwrite', 'append');
         $append = $do == 'append' ? true : false;
     }
     $import_global_styles = str_replace(array('\\n', '\\t'), array(chr(13), chr(9)), $import_global_styles);
     //remove first and last "
     if (substr($import_global_styles, 0, 1) == '"') {
         $import_global_styles = substr($import_global_styles, 1);
     }
     if (substr($import_global_styles, -1) == '"') {
         $import_global_styles = substr($import_global_styles, 0, -1);
     }
     $import_global_styles = preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) {
         return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
     }, $import_global_styles);
     if ($append) {
         //append
         $global_styles = $c_css->get_global_css_styles();
         $import_global_styles = $global_styles . $import_global_styles;
     }
     $c_css->set_global_css_styles($import_global_styles);
 }
Ejemplo n.º 14
0
 /**
  * Check the maximum entries that should be loaded
  * @since: 1.5.3
  */
 public function get_maximum_entries($grid)
 {
     $base = new Essential_Grid_Base();
     $max_entries = intval($grid->get_postparam_by_handle('max_entries', '-1'));
     if ($max_entries !== -1) {
         return $max_entries;
     }
     $layout = $grid->get_param_by_handle('navigation-layout', array());
     if (isset($layout['pagination']) || isset($layout['left']) || isset($layout['right'])) {
         return $max_entries;
     }
     $rows_unlimited = $grid->get_param_by_handle('rows-unlimited', 'on');
     $load_more = $grid->get_param_by_handle('load-more', 'none');
     $rows = intval($grid->get_param_by_handle('rows', '3'));
     $columns_advanced = $grid->get_param_by_handle('columns-advanced', 'off');
     $columns = $grid->get_param_by_handle('columns', '');
     //this is the first line
     $columns = $base->set_basic_colums($columns);
     $max_column = 0;
     foreach ($columns as $column) {
         if ($max_column < $column) {
             $max_column = $column;
         }
     }
     if ($columns_advanced === 'on') {
         $columns_advanced = array();
         $columns_advanced[] = $columns;
         $columns_advanced[] = $base->getVar($this->grid_params, 'columns-advanced-rows-0', '');
         $columns_advanced[] = $base->getVar($this->grid_params, 'columns-advanced-rows-1', '');
         $columns_advanced[] = $base->getVar($this->grid_params, 'columns-advanced-rows-2', '');
         $columns_advanced[] = $base->getVar($this->grid_params, 'columns-advanced-rows-3', '');
         $columns_advanced[] = $base->getVar($this->grid_params, 'columns-advanced-rows-4', '');
         $columns_advanced[] = $base->getVar($this->grid_params, 'columns-advanced-rows-5', '');
         $columns_advanced[] = $base->getVar($this->grid_params, 'columns-advanced-rows-6', '');
         $columns_advanced[] = $base->getVar($this->grid_params, 'columns-advanced-rows-7', '');
         $columns_advanced[] = $base->getVar($this->grid_params, 'columns-advanced-rows-8', '');
         $match = array(0, 0, 0, 0, 0, 0, 0);
         for ($i = 0; $i <= $rows; $i++) {
             foreach ($columns_advanced as $col_adv) {
                 if (!empty($col_adv)) {
                     foreach ($col_adv as $key => $val) {
                         $match[$key] += $val;
                     }
                     $i++;
                 }
                 if ($i >= $rows) {
                     break;
                 }
             }
         }
         foreach ($match as $highest) {
             if ($max_column < $highest) {
                 $max_column = $highest;
             }
         }
     }
     if ($rows_unlimited === 'off') {
         if ($columns_advanced === 'off') {
             $max_entries = $max_column * $rows;
         } else {
             $max_entries = $max_column;
         }
     } elseif ($rows_unlimited === 'on' && $load_more === 'none') {
         $max_entries = $max_column;
     }
     return $max_entries;
 }