public function export_grids($export_grids) { $return_grids = array(); if ($export_grids !== false && !empty($export_grids)) { $c_grid = new Essential_Grid(); $base = new Essential_Grid_Base(); $item_skin = new Essential_Grid_Item_Skin(); $grids = $c_grid->get_essential_grids(); if (!empty($grids)) { foreach ($export_grids as $e_grid_id) { foreach ($grids as $grid) { $grid = (array) $grid; if ($e_grid_id == $grid['id']) { //change categories/tags id to slug $check = json_decode($grid['postparams'], true); if (isset($check['post_category']) && !empty($check['post_category'])) { $slug_cats = array(); $the_cats = explode(',', $check['post_category']); foreach ($the_cats as $cat) { $raw = explode('_', $cat); $catSlug = $raw[count($raw) - 1]; unset($raw[count($raw) - 1]); $cat = implode('_', $raw); $category = $base->get_categories_by_ids((array) $catSlug, $cat); foreach ($category as $cat_obj) { $slug_cats[] = $cat . '_' . $cat_obj->slug; } } $check['post_category'] = implode(',', $slug_cats); $grid['postparams'] = json_encode($check); } //change choosen skinid to skinhandle $check = json_decode($grid['params'], true); if (isset($check['entry-skin']) && !empty($check['entry-skin']) && intval($check['entry-skin']) != 0) { $skin = $item_skin->get_handle_by_id($check['entry-skin']); if (!empty($skin)) { $check['entry-skin'] = $skin['handle']; } $grid['params'] = json_encode($check); } $return_grids[] = $grid; break; } } } } } return $return_grids; }
/** * 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; } } } } } }
<div class="divider1"></div> <div class="eg-creative-settings"> <div class="eg-cs-tbc-left"> <h3><span><?php _e('Item Skins', EG_TEXTDOMAIN); ?> </span></h3> </div> <div class="eg-cs-tbc eg-photoshop-bg"> <div id="eg-selected-skins-wrapper"> <div id="eg-selected-skins-default"> <?php $skins_c = new Essential_Grid_Item_Skin(); $navigation_c = new Essential_Grid_Navigation(); $grid_c = new Essential_Grid(); $grid_skin_sel['id'] = 'even'; $grid_skin_sel['name'] = __('Skin Selector', EG_TEXTDOMAIN); $grid_skin_sel['handle'] = 'skin-selector'; $grid_skin_sel['postparams'] = array(); $grid_skin_sel['layers'] = array(); $grid_skin_sel['params'] = array('navigation-skin' => ''); //leave empty, we use no skin $skins_html = ''; $skins_css = ''; $filters = array(); $skins = $skins_c->get_essential_item_skins(); $demo_img = array(); for ($i = 1; $i <= 18; $i++) { $demo_img[] = 'demoimage1.jpg'; }
/** * Handle Ajax Requests */ public static function on_ajax_action() { try { $token = self::getPostVar('token', false); //verify the token $isVerified = wp_verify_nonce($token, 'Essential_Grid_actions'); $error = false; if ($isVerified) { $data = self::getPostVar("data", false); switch (self::getPostVar("client_action", false)) { case 'add_google_fonts': $f = new ThemePunch_Fonts(); $result = $f->add_new_font($data); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Font successfully created!", EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getFontsUrl())); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'remove_google_fonts': if (!isset($data['handle'])) { Essential_Grid::ajaxResponseError(__('Font not found', EG_TEXTDOMAIN), false); } $f = new ThemePunch_Fonts(); $result = $f->remove_font_by_handle($data['handle']); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Font successfully removed!", EG_TEXTDOMAIN), array('data' => $result)); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'edit_google_fonts': if (!isset($data['handle'])) { Essential_Grid::ajaxResponseError(__('No handle given', EG_TEXTDOMAIN), false); } if (!isset($data['url'])) { Essential_Grid::ajaxResponseError(__('No parameters given', EG_TEXTDOMAIN), false); } $f = new ThemePunch_Fonts(); $result = $f->edit_font_by_handle($data); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Font successfully changed!", EG_TEXTDOMAIN), array('data' => $result)); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'add_custom_meta': $m = new Essential_Grid_Meta(); $result = $m->add_new_meta($data); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Meta successfully created!", EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getSubViewUrl(Essential_Grid_Admin::VIEW_SUB_CUSTOM_META_AJAX))); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'remove_custom_meta': if (!isset($data['handle'])) { Essential_Grid::ajaxResponseError(__('Meta not found', EG_TEXTDOMAIN), false); } $m = new Essential_Grid_Meta(); $result = $m->remove_meta_by_handle($data['handle']); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Meta successfully removed!", EG_TEXTDOMAIN), array('data' => $result)); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'edit_custom_meta': if (!isset($data['handle'])) { Essential_Grid::ajaxResponseError(__('No handle given', EG_TEXTDOMAIN), false); } if (!isset($data['name'])) { Essential_Grid::ajaxResponseError(__('No name given', EG_TEXTDOMAIN), false); } $m = new Essential_Grid_Meta(); $result = $m->edit_meta_by_handle($data); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Meta successfully changed!", EG_TEXTDOMAIN), array('data' => $result)); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'add_link_meta': $m = new Essential_Grid_Meta_Linking(); $result = $m->add_new_link_meta($data); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Meta successfully created!", EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getSubViewUrl(Essential_Grid_Admin::VIEW_SUB_CUSTOM_META_AJAX))); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'remove_link_meta': if (!isset($data['handle'])) { Essential_Grid::ajaxResponseError(__('Meta not found', EG_TEXTDOMAIN), false); } $m = new Essential_Grid_Meta_Linking(); $result = $m->remove_link_meta_by_handle($data['handle']); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Meta successfully removed!", EG_TEXTDOMAIN), array('data' => $result)); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'edit_link_meta': if (!isset($data['handle'])) { Essential_Grid::ajaxResponseError(__('No handle given', EG_TEXTDOMAIN), false); } if (!isset($data['name'])) { Essential_Grid::ajaxResponseError(__('No name given', EG_TEXTDOMAIN), false); } if (!isset($data['original'])) { Essential_Grid::ajaxResponseError(__('No original given', EG_TEXTDOMAIN), false); } $m = new Essential_Grid_Meta_Linking(); $result = $m->edit_link_meta_by_handle($data); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Meta successfully changed!", EG_TEXTDOMAIN), array('data' => $result)); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'add_widget_area': $wa = new Essential_Grid_Widget_Areas(); $result = $wa->add_new_sidebar($data); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Widget Area successfully created!", EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getSubViewUrl(Essential_Grid_Admin::VIEW_SUB_WIDGET_AREA_AJAX))); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'edit_widget_area': if (!isset($data['handle'])) { Essential_Grid::ajaxResponseError(__('No handle given', EG_TEXTDOMAIN), false); } if (!isset($data['name'])) { Essential_Grid::ajaxResponseError(__('No name given', EG_TEXTDOMAIN), false); } $wa = new Essential_Grid_Widget_Areas(); $result = $wa->edit_widget_area_by_handle($data); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Widget Area successfully changed!", EG_TEXTDOMAIN), array('data' => $result)); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'remove_widget_area': if (!isset($data['handle'])) { Essential_Grid::ajaxResponseError(__('Widget Area not found', EG_TEXTDOMAIN), false); } $wa = new Essential_Grid_Widget_Areas(); $result = $wa->remove_widget_area_by_handle($data['handle']); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Widget Area successfully removed!", EG_TEXTDOMAIN), array('data' => $result)); } else { Essential_Grid::ajaxResponseError($result, false); } break; case 'get_preview_html_markup': //add wpml transient $lang_code = ''; if (Essential_Grid_Wpml::is_wpml_exists()) { $lang_code = Essential_Grid_Wpml::get_current_lang_code(); } if (isset($data['id'])) { delete_transient('ess_grid_trans_query_' . $data['id'] . $lang_code); //delete cache } $result = Essential_Grid_Base::output_demo_skin_html($data); if (isset($result['error'])) { Essential_Grid::ajaxResponseData($result); } else { Essential_Grid::ajaxResponseData(array("data" => array('html' => $result['html'], 'preview' => @$result['preview']))); } break; /* //TP: CHUNK case 'get_preview_html_markup_chunk': //only for custom grid $grid = new Essential_Grid(); $grid->init_by_data($data); $html = ''; if($grid->is_custom_grid()){ ob_start(); $grid->output_by_custom('custom', true); $html = ob_get_contents(); ob_clean(); ob_end_clean(); } $order_id = self::getPostVar("order_id", false); Essential_Grid::ajaxResponseData(array("data"=>array('preview' => $html, 'order_id' => $order_id))); break; */ /* //TP: CHUNK case 'get_preview_html_markup_chunk': //only for custom grid $grid = new Essential_Grid(); $grid->init_by_data($data); $html = ''; if($grid->is_custom_grid()){ ob_start(); $grid->output_by_custom('custom', true); $html = ob_get_contents(); ob_clean(); ob_end_clean(); } $order_id = self::getPostVar("order_id", false); Essential_Grid::ajaxResponseData(array("data"=>array('preview' => $html, 'order_id' => $order_id))); break; */ case 'save_search_settings': if (!empty($data)) { update_option('esg-search-settings', $data); } Essential_Grid::ajaxResponseSuccess(__("Search Settings succesfully saved!", EG_TEXTDOMAIN)); break; case 'update_general_settings': $result = self::savePluginPermission($data['permission']); $cur_query = get_option('tp_eg_query_type', 'wp_query'); update_option('tp_eg_output_protection', @$data['protection']); update_option('tp_eg_tooltips', @$data['tooltips']); update_option('tp_eg_wait_for_fonts', @$data['wait_for_fonts']); update_option('tp_eg_js_to_footer', @$data['js_to_footer']); update_option('tp_eg_use_cache', @$data['use_cache']); update_option('tp_eg_query_type', @$data['query_type']); update_option('tp_eg_enable_log', @$data['enable_log']); update_option('tp_eg_use_lightbox', @$data['use_lightbox']); if (@$data['use_lightbox'] === 'jackbox') { Essential_Grid_Jackbox::enable_jackbox(); } else { Essential_Grid_Jackbox::disable_jackbox(); } if ($cur_query !== $data['query_type']) { //delete cache $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) { 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); } } } } if ($result !== true) { $error = __("Global Settings did not change!", EG_TEXTDOMAIN); } else { Essential_Grid::ajaxResponseSuccess(__("Global Settings succesfully saved!", EG_TEXTDOMAIN), $result); } break; case 'update_create_grid': $result = self::update_create_grid($data); if ($result !== true) { $error = $result; } else { $lang = array(); if (Essential_Grid_Wpml::is_wpml_exists()) { $lang = icl_get_languages(); } if (isset($data['id']) && intval($data['id']) > 0) { if (!empty($lang)) { foreach ($lang as $code => $val) { delete_transient('ess_grid_trans_query_' . $data['id'] . $val['language_code']); //delete cache delete_transient('ess_grid_trans_full_grid_' . $data['id'] . $val['language_code']); //delete cache } } else { delete_transient('ess_grid_trans_query_' . $data['id']); //delete cache delete_transient('ess_grid_trans_full_grid_' . $data['id']); //delete cache } Essential_Grid::ajaxResponseSuccess(__("Grid successfully saved/changed!", EG_TEXTDOMAIN), $result); } else { Essential_Grid::ajaxResponseSuccess(__("Grid successfully saved/changed!", EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getViewUrl(Essential_Grid_Admin::VIEW_OVERVIEW))); } } break; case 'delete_grid': $result = self::delete_grid_by_id($data); if ($result !== true) { $error = $result; } else { Essential_Grid::ajaxResponseSuccess(__("Grid deleted", EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getViewUrl(Essential_Grid_Admin::VIEW_OVERVIEW))); } break; case 'duplicate_grid': $result = self::duplicate_grid_by_id($data); if ($result !== true) { $error = $result; } else { Essential_Grid::ajaxResponseSuccess(__("Grid duplicated", EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getViewUrl(Essential_Grid_Admin::VIEW_OVERVIEW))); } break; case 'update_create_item_skin': $result = Essential_Grid_Item_Skin::update_save_item_skin($data); if ($result !== true) { $error = $result; } else { if (isset($data['id']) && intval($data['id']) > 0) { Essential_Grid::ajaxResponseSuccess(__("Item Skin changed", EG_TEXTDOMAIN), array('data' => $result)); } else { Essential_Grid::ajaxResponseSuccess(__("Item Skin created/changed", EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getViewUrl("", "", 'essential-' . Essential_Grid_Admin::VIEW_SUB_ITEM_SKIN_OVERVIEW))); } } break; case 'update_custom_css': if (isset($data['global_css'])) { Essential_Grid_Global_Css::set_global_css_styles($data['global_css']); Essential_Grid::ajaxResponseSuccess(__("CSS saved!", EG_TEXTDOMAIN), ''); } else { $error = __("No CSS Received", EG_TEXTDOMAIN); } break; case 'delete_item_skin': $result = Essential_Grid_Item_Skin::delete_item_skin_by_id($data); if ($result !== true) { $error = $result; } else { Essential_Grid::ajaxResponseSuccess(__("Item Skin deleted", EG_TEXTDOMAIN), array('data' => $result)); } break; case 'duplicate_item_skin': $result = Essential_Grid_Item_Skin::duplicate_item_skin_by_id($data); if ($result !== true) { $error = $result; } else { Essential_Grid::ajaxResponseSuccess(__("Item Skin duplicated", EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getViewUrl("", "", 'essential-' . Essential_Grid_Admin::VIEW_SUB_ITEM_SKIN_OVERVIEW))); } break; case 'star_item_skin': $result = Essential_Grid_Item_Skin::star_item_skin_by_id($data); if ($result !== true) { $error = $result; } else { Essential_Grid::ajaxResponseSuccess(__("Favorite Changed", EG_TEXTDOMAIN), array('data' => $result)); } break; case 'update_create_item_element': $result = Essential_Grid_Item_Element::update_create_essential_item_element($data); if ($result !== true) { $error = $result; } else { Essential_Grid::ajaxResponseSuccess(__("Item Element created/changed", EG_TEXTDOMAIN), array('data' => $result)); } break; case 'check_item_element_existence': $result = Essential_Grid_Item_Element::check_existence_by_handle(@$data['name']); if ($result === false) { Essential_Grid::ajaxResponseData(array("data" => array('existence' => 'false'))); } elseif ($result === true) { Essential_Grid::ajaxResponseData(array("data" => array('existence' => 'true'))); } else { Essential_Grid::ajaxResponseData(array("data" => array('existence' => $result))); } break; case 'get_predefined_elements': $elements = Essential_Grid_Item_Element::getElementsForJavascript(); $html_elements = Essential_Grid_Item_Element::prepareDefaultElementsForEditor(); $html_elements .= Essential_Grid_Item_Element::prepareTextElementsForEditor(); Essential_Grid::ajaxResponseData(array("data" => array('elements' => $elements, 'html' => $html_elements))); break; case 'delete_predefined_elements': $result = Essential_Grid_Item_Element::delete_element_by_handle($data); if ($result !== true) { $error = $result; } else { Essential_Grid::ajaxResponseSuccess(__("Item Element successfully deleted", EG_TEXTDOMAIN), array('data' => $result)); } break; case 'update_create_navigation_skin_css': $nav = new Essential_Grid_Navigation(); $result = $nav->update_create_navigation_skin_css($data); if ($result !== true) { $error = $result; } else { $base = new Essential_Grid_Base(); $skin_css = Essential_Grid_Navigation::output_navigation_skins(); $skins = Essential_Grid_Navigation::get_essential_navigation_skins(); $select = ''; foreach ($skins as $skin) { $select .= '<option value="' . $skin['handle'] . '">' . $skin['name'] . '</option>' . "\n"; } if (isset($data['sid']) && intval($data['sid']) > 0) { Essential_Grid::ajaxResponseSuccess(__("Navigation Skin successfully changed!", EG_TEXTDOMAIN), array('css' => $skin_css, 'select' => $select, 'default_skins' => $skins)); } else { Essential_Grid::ajaxResponseSuccess(__("Navigation Skin successfully created", EG_TEXTDOMAIN), array('css' => $skin_css, 'select' => $select, 'default_skins' => $skins)); } } break; case 'delete_navigation_skin_css': $nav = new Essential_Grid_Navigation(); $result = $nav->delete_navigation_skin_css($data); if ($result !== true) { $error = $result; } else { $base = new Essential_Grid_Base(); $skin_css = Essential_Grid_Navigation::output_navigation_skins(); $skins = Essential_Grid_Navigation::get_essential_navigation_skins(); $select = ''; foreach ($skins as $skin) { $select .= '<option value="' . $skin['handle'] . '">' . $skin['name'] . '</option>' . "\n"; } Essential_Grid::ajaxResponseSuccess(__("Navigation Skin successfully deleted!", EG_TEXTDOMAIN), array('css' => $skin_css, 'select' => $select, 'default_skins' => $skins)); } break; case 'get_post_meta_html_for_editor': if (!isset($data['post_id']) || intval($data['post_id']) == 0) { Essential_Grid::ajaxResponseError(__('No Post ID/Wrong Post ID!', EG_TEXTDOMAIN), false); exit; } if (!isset($data['grid_id']) || intval($data['grid_id']) == 0) { Essential_Grid::ajaxResponseError(__('Please save the grid first to use this feature!', EG_TEXTDOMAIN), false); exit; } $post = get_post($data['post_id']); $disable_advanced = true; //nessecary, so that only normal things can be changed in preview mode if (!empty($post)) { $grid_id = $data['grid_id']; ob_start(); require 'views/elements/grid-meta-box.php'; $content = ob_get_contents(); ob_clean(); ob_end_clean(); Essential_Grid::ajaxResponseData(array("data" => array('html' => $content))); } else { Essential_Grid::ajaxResponseError(__('Post not found!', EG_TEXTDOMAIN), false); exit; } break; case 'update_post_meta_through_editor': if (!isset($data['metas']) || !isset($data['metas']['post_id']) || intval($data['metas']['post_id']) == 0) { Essential_Grid::ajaxResponseError(__('No Post ID/Wrong Post ID!', EG_TEXTDOMAIN), false); exit; } if (!isset($data['metas']) || !isset($data['metas']['grid_id']) || intval($data['metas']['grid_id']) == 0) { Essential_Grid::ajaxResponseError(__('Please save the grid first to use this feature!', EG_TEXTDOMAIN), false); exit; } //set the cobbles setting to the post $cobbles = json_decode(get_post_meta($data['metas']['post_id'], 'eg_cobbles', true), true); $cobbles[$data['metas']['grid_id']]['cobbles'] = $data['metas']['eg_cobbles_size']; $cobbles = json_encode($cobbles); update_post_meta($data['metas']['post_id'], 'eg_cobbles', $cobbles); //set the use_skin setting to the post $use_skin = json_decode(get_post_meta($data['metas']['post_id'], 'eg_use_skin', true), true); $use_skin[$data['metas']['grid_id']]['use-skin'] = $data['metas']['eg_use_skin']; $use_skin = json_encode($use_skin); update_post_meta($data['metas']['post_id'], 'eg_use_skin', $use_skin); $result = self::custom_meta_box_save($data['metas']['post_id'], $data['metas'], true); self::check_for_transient_deletion($data['metas']['post_id']); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__("Post Meta saved!", EG_TEXTDOMAIN), array()); } else { Essential_Grid::ajaxResponseError(__('Post not found!', EG_TEXTDOMAIN), false); exit; } break; case 'trigger_post_meta_visibility': if (!isset($data['post_id']) || intval($data['post_id']) == 0) { Essential_Grid::ajaxResponseError(__('No Post ID/Wrong Post ID!', EG_TEXTDOMAIN), false); exit; } if (!isset($data['grid_id']) || intval($data['grid_id']) == 0) { Essential_Grid::ajaxResponseError(__('Please save the grid first to use this feature!', EG_TEXTDOMAIN), false); exit; } $visibility = json_decode(get_post_meta($data['post_id'], 'eg_visibility', true), true); $found = false; if (!empty($visibility) && is_array($visibility)) { foreach ($visibility as $grid => $setting) { if ($grid == $data['grid_id']) { if ($setting == false) { $visibility[$grid] = true; } else { $visibility[$grid] = false; } $found = true; break; } } } if (!$found) { $visibility[$data['grid_id']] = false; } $visibility = json_encode($visibility); update_post_meta($data['post_id'], 'eg_visibility', $visibility); self::check_for_transient_deletion($data['post_id']); Essential_Grid::ajaxResponseSuccess(__("Visibility of Post for this Grid changed!", EG_TEXTDOMAIN), array()); break; case 'get_image_by_id': if (!isset($data['img_id']) || intval($data['img_id']) == 0) { $error = __('Wrong Image ID given', EG_TEXTDOMAIN); } else { $img = wp_get_attachment_image_src($data['img_id'], 'full'); if ($img !== false) { Essential_Grid::ajaxResponseSuccess('', array('url' => $img[0])); } else { $error = __('Image with given ID does not exist', EG_TEXTDOMAIN); } } break; case 'activate_purchase_code': $result = false; if (!empty($data['username']) && !empty($data['api_key']) && !empty($data['code'])) { $result = Essential_Grid_Admin::check_purchase_verification($data); } else { $error = __('The API key, the Purchase Code and the Username need to be set!', EG_TEXTDOMAIN); } if ($result === true) { Essential_Grid::ajaxResponseSuccess(__('Purchase Code Successfully Activated', EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getViewUrl("", "", 'essential-' . Essential_Grid_Admin::VIEW_START))); } else { if ($result !== false) { $error = $result; } else { $error = __('Purchase Code is invalid', EG_TEXTDOMAIN); } Essential_Grid::ajaxResponseError($error, false); exit; } break; case 'deactivate_purchase_code': $result = Essential_Grid_Admin::do_purchase_deactivation($data); if ($result === true) { Essential_Grid::ajaxResponseSuccess(__('Successfully removed validation', EG_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getViewUrl("", "", 'essential-' . Essential_Grid_Admin::VIEW_START))); } else { if ($result !== false) { $error = $result; } else { $error = __('Could not remove Validation!', EG_TEXTDOMAIN); } Essential_Grid::ajaxResponseError($error, false); exit; } break; case 'dismiss_notice': update_option('tp_eg_valid-notice', 'false'); Essential_Grid::ajaxResponseSuccess('.'); break; case 'import_default_post_data': try { require EG_PLUGIN_PATH . 'includes/assets/default-posts.php'; require EG_PLUGIN_PATH . 'includes/assets/default-grids-meta-fonts.php'; if (isset($json_tax)) { $import_tax = new PunchPost(); $import_tax->import_taxonomies($json_tax); } //insert meta, grids & punchfonts $im = new Essential_Grid_Import(); if (isset($tp_grid_meta_fonts)) { $tp_grid_meta_fonts = json_decode($tp_grid_meta_fonts, true); $grids = @$tp_grid_meta_fonts['grids']; if (!empty($grids) && is_array($grids)) { $grids_imported = $im->import_grids($grids); } $custom_metas = @$tp_grid_meta_fonts['custom-meta']; if (!empty($custom_metas) && is_array($custom_metas)) { $custom_metas_imported = $im->import_custom_meta($custom_metas); } $custom_fonts = @$tp_grid_meta_fonts['punch-fonts']; if (!empty($custom_fonts) && is_array($custom_fonts)) { $custom_fonts_imported = $im->import_punch_fonts($custom_fonts); } } if (isset($json_posts)) { $import = new PunchPort(); $import->set_tp_import_posts($json_posts); $import->import_custom_posts(); } Essential_Grid::ajaxResponseSuccess(__('Demo data successfully imported', EG_TEXTDOMAIN), array()); } catch (Exception $d) { $error = __('Something went wrong, please contact the developer', EG_TEXTDOMAIN); } break; case 'export_data': $export_grids = self::getPostVar('export-grids-id', false); $export_skins = self::getPostVar('export-skins-id', false); $export_elements = self::getPostVar('export-elements-id', false); $export_navigation_skins = self::getPostVar('export-navigation-skins-id', false); $export_global_styles = self::getPostVar('export-global-styles', false); $export_custom_meta = self::getPostVar('export-custom-meta-handle', false); $export_punch_fonts = self::getPostVar('export-punch-fonts-handle', false); header('Content-Type: text/json'); header('Content-Disposition: attachment;filename=ess_grid.json'); ob_start(); $export = array(); $ex = new Essential_Grid_Export(); //export Grids if (!empty($export_grids)) { $export['grids'] = $ex->export_grids($export_grids); } //export Skins if (!empty($export_skins)) { $export['skins'] = $ex->export_skins($export_skins); } //export Elements if (!empty($export_elements)) { $export['elements'] = $ex->export_elements($export_elements); } //export Navigation Skins if (!empty($export_navigation_skins)) { $export['navigation-skins'] = $ex->export_navigation_skins($export_navigation_skins); } //export Custom Meta if (!empty($export_custom_meta)) { $export['custom-meta'] = $ex->export_custom_meta($export_custom_meta); } //export Punch Fonts if (!empty($export_punch_fonts)) { $export['punch-fonts'] = $ex->export_punch_fonts($export_punch_fonts); } //export Global Styles if ($export_global_styles == 'on') { $export['global-css'] = $ex->export_global_styles($export_global_styles); } echo json_encode($export); $content = ob_get_contents(); ob_clean(); ob_end_clean(); echo $content; exit; break; case 'import_data': if (!isset($data['imports']) || empty($data['imports'])) { Essential_Grid::ajaxResponseError(__('No data for import selected', EG_TEXTDOMAIN), false); exit; } try { $im = new Essential_Grid_Import(); $temp_d = @$data['imports']; unset($temp_d['data-grids']); unset($temp_d['data-skins']); unset($temp_d['data-elements']); unset($temp_d['data-navigation-skins']); unset($temp_d['data-global-css']); $im->set_overwrite_data($temp_d); //set overwrite data global to class $skins = @$data['imports']['data-skins']; if (!empty($skins) && is_array($skins)) { foreach ($skins as $key => $skin) { $tskin = json_decode(stripslashes($skin), true); if (empty($tskin)) { $tskin = json_decode($skin, true); } $skins[$key] = $tskin; } if (!empty($skins)) { $skins_ids = @$data['imports']['import-skins-id']; $skins_imported = $im->import_skins($skins, $skins_ids); } } $navigation_skins = @$data['imports']['data-navigation-skins']; if (!empty($navigation_skins) && is_array($navigation_skins)) { foreach ($navigation_skins as $key => $navigation_skin) { $tnavigation_skin = json_decode(stripslashes($navigation_skin), true); if (empty($tnavigation_skin)) { $tnavigation_skin = json_decode($navigation_skin, true); } $navigation_skins[$key] = $tnavigation_skin; } if (!empty($navigation_skins)) { $navigation_skins_ids = @$data['imports']['import-navigation-skins-id']; $navigation_skins_imported = $im->import_navigation_skins(@$navigation_skins, $navigation_skins_ids); } } $grids = @$data['imports']['data-grids']; if (!empty($grids) && is_array($grids)) { foreach ($grids as $key => $grid) { $tgrid = json_decode(stripslashes($grid), true); if (empty($tgrid)) { $tgrid = json_decode($grid, true); } $grids[$key] = $tgrid; } if (!empty($grids)) { $grids_ids = @$data['imports']['import-grids-id']; $grids_imported = $im->import_grids($grids, $grids_ids); } } $elements = @$data['imports']['data-elements']; if (!empty($elements) && is_array($elements)) { foreach ($elements as $key => $element) { $telement = json_decode(stripslashes($element), true); if (empty($telement)) { $telement = json_decode($element, true); } $elements[$key] = $telement; } if (!empty($elements)) { $elements_ids = @$data['imports']['import-elements-id']; $elements_imported = $im->import_elements(@$elements, $elements_ids); } } $custom_metas = @$data['imports']['data-custom-meta']; if (!empty($custom_metas) && is_array($custom_metas)) { foreach ($custom_metas as $key => $custom_meta) { $tcustom_meta = json_decode(stripslashes($custom_meta), true); if (empty($tcustom_meta)) { $tcustom_meta = json_decode($custom_meta, true); } $custom_metas[$key] = $tcustom_meta; } if (!empty($custom_metas)) { $custom_metas_handle = @$data['imports']['import-custom-meta-handle']; $custom_metas_imported = $im->import_custom_meta($custom_metas, $custom_metas_handle); } } $custom_fonts = @$data['imports']['data-punch-fonts']; if (!empty($custom_fonts) && is_array($custom_fonts)) { foreach ($custom_fonts as $key => $custom_font) { $tcustom_font = json_decode(stripslashes($custom_font), true); if (empty($tcustom_font)) { $tcustom_font = json_decode($custom_font, true); } $custom_fonts[$key] = $tcustom_font; } if (!empty($custom_fonts)) { $custom_fonts_handle = @$data['imports']['import-punch-fonts-handle']; $custom_fonts_imported = $im->import_punch_fonts($custom_fonts, $custom_fonts_handle); } } if (@$data['imports']['import-global-styles'] == 'on') { $global_css = @$data['imports']['data-global-css']; $tglobal_css = stripslashes($global_css); if (empty($tglobal_css)) { $tglobal_css = $global_css; } $global_styles_imported = $im->import_global_styles($tglobal_css); } Essential_Grid::ajaxResponseSuccess(__('Successfully imported data', EG_TEXTDOMAIN), array('is_redirect' => true, 'redirect_url' => self::getViewUrl("", "", 'essential-' . Essential_Grid_Admin::VIEW_START))); } catch (Exception $d) { $error = __('Something went wrong, please contact the developer', EG_TEXTDOMAIN); } break; case 'delete_full_cache': $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) { 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); } } } Essential_Grid::ajaxResponseSuccess(__('Successfully deleted all cache', EG_TEXTDOMAIN), array()); break; case "get_image_url": if (isset($data['imageid']) && intval($data['imageid']) > 0) { $img_atts = wp_get_attachment_image_src($data['imageid']); if ($img_atts !== false) { $img_src = $img_atts[0]; Essential_Grid::ajaxResponseSuccess(__("Image URL found", EG_TEXTDOMAIN), array('url' => $img_src, 'imageid' => $data['imageid'])); } } $error = __('No correct image ID given', EG_TEXTDOMAIN); break; case "toggle_grid_favorite": if (isset($data['id']) && intval($data['id']) > 0) { $return = self::toggle_favorite_by_id($data['id']); if ($return === true) { Essential_Grid::ajaxResponseSuccess(__("Favorite Set", EG_TEXTDOMAIN)); } else { $error = $return; } } else { $error = __('No ID given', EG_TEXTDOMAIN); } break; case "subscribe_to_newsletter": if (isset($data['email']) && !empty($data['email'])) { $return = ThemePunch_Newsletter::subscribe($data['email']); if ($return !== false) { if (!isset($return['status']) || $return['status'] === 'error') { $error = isset($return['message']) && !empty($return['message']) ? $return['message'] : __('Invalid Email', EG_TEXTDOMAIN); } else { Essential_Grid::ajaxResponseSuccess(__("Success! Please check your Emails to finish the subscribtion", EG_TEXTDOMAIN), $return); } } else { $error = __('Invalid Email/Could not connect to the Newsletter server', EG_TEXTDOMAIN); } } else { $error = __('No Email given', EG_TEXTDOMAIN); } break; case "unsubscribe_to_newsletter": if (isset($data['email']) && !empty($data['email'])) { $return = ThemePunch_Newsletter::unsubscribe($data['email']); if ($return !== false) { if (!isset($return['status']) || $return['status'] === 'error') { $error = isset($return['message']) && !empty($return['message']) ? $return['message'] : __('Invalid Email', EG_TEXTDOMAIN); } else { Essential_Grid::ajaxResponseSuccess(__("Success! Please check your Emails to finish the process", EG_TEXTDOMAIN), $return); } } else { $error = __('Invalid Email/Could not connect to the Newsletter server', EG_TEXTDOMAIN); } } else { $error = __('No Email given', EG_TEXTDOMAIN); } break; default: $error = true; break; } } else { $error = true; } if ($error !== false) { $showError = __("Wrong Request!", EG_TEXTDOMAIN); if ($error !== true) { $showError = __("Ajax Error: ", EG_TEXTDOMAIN) . $error; } Essential_Grid::ajaxResponseError($showError, false); } exit; } catch (Exception $e) { exit; } }
</tr> </thead> <tbody> <?php foreach ($grids as $grid) { $total++; $cur_offset++; if ($cur_offset <= $offset) { continue; } //if we are lower then the offset, continue; if ($cur_offset > $limit + $offset) { continue; } // if we are higher then the limit + offset, continue $cur_grid = Essential_Grid::get_essential_grid_by_id($grid->id); $skin_id = @$cur_grid['params']['entry-skin']; ?> <tr> <td><a href="javascript:void(0);" class="eg-toggle-favorite" id="eg-star-id-<?php echo $grid->id; ?> "><i class="eg-icon-star<?php echo isset($cur_grid['settings']['favorite']) && $cur_grid['settings']['favorite'] == 'true' ? '' : '-empty'; ?> "></i></a></td> <td><?php echo $grid->id; ?> </td> <td><?php
exit; } //force the js file to be included wp_enqueue_script('essential-grid-item-editor-script', EG_PLUGIN_URL . 'admin/assets/js/grid-editor.js', array('jquery'), Essential_Grid::VERSION); ?> <h2 class="topheader"><?php _e('Overview', EG_TEXTDOMAIN); ?> </h2> <div id="eg-grid-even-item-skin-wrapper"> <?php $skins_c = new Essential_Grid_Item_Skin(); $navigation_c = new Essential_Grid_Navigation(); $grid_c = new Essential_Grid(); $grid['id'] = '1'; $grid['name'] = __('Overview', EG_TEXTDOMAIN); $grid['handle'] = 'overview'; $grid['postparams'] = array(); $grid['layers'] = array(); $grid['params'] = array('layout' => 'masonry', 'navigation-skin' => 'backend-flat', 'filter-arrows' => 'single', 'navigation-padding' => '0 0 0 0', 'force_full_width' => 'off', 'rows-unlimited' => 'off', 'rows' => 3, 'columns' => array(4, 3, 3, 2, 2, 2, 1), 'columns-width' => array(1400, 1170, 1024, 960, 778, 640, 480), 'spacings' => 15, 'grid-animation' => 'fade', 'grid-animation-speed' => 800, 'grid-animation-delay' => 5, 'x-ratio' => 4, 'y-ratio' => 3); $skins_html = ''; $skins_css = ''; $filters = array(); $skins = $skins_c->get_essential_item_skins(); $demo_img = array(); for ($i = 1; $i <= 4; $i++) { $demo_img[] = 'demoimage' . $i . '.jpg'; } if (!empty($skins) && is_array($skins)) {
/** * Add tinymce shortcode dialog * @since 1.2.0 */ public static function add_tiny_mce_shortcode_dialog() { $base = new Essential_Grid_Base(); $grid_c = new Essential_Grid(); $skins_c = new Essential_Grid_Item_Skin(); $grids = Essential_Grid::get_grids_short_vc(); ?> <div id="ess-grid-tiny-mce-dialog" tabindex="-1" action="" class="essential-dialog-wrap" title="<?php _e('Shortcode Generator', EG_TEXTDOMAIN); ?> " style="display: none; "> <script type="text/javascript"> var token = '<?php echo wp_create_nonce("Essential_Grid_actions"); ?> '; </script> <form id="ess-grid-tiny-mce-settings-form" action=""> <!-- STEP 1 --> <div id="ess-grid-tiny-dialog-step-1"> <div class="ess-top_half"> <p class="ess-quicktitle"><?php _e('Choose Predefined Grid:', EG_TEXTDOMAIN); ?> </p> <select name="ess-grid-existing-grid"> <option value="-1"><?php _e('--- Choose Grid ---', EG_TEXTDOMAIN); ?> </option> <?php if (!empty($grids)) { foreach ($grids as $title => $alias) { echo '<option value="' . $alias . '">' . $title . '</option>' . "\n"; } } ?> </select> <div style="margin-top:20px"> <a href="javascript:void(0);" class="button-primary ess-revgreen" id="eg-add-predefined-grid"><?php _e('Add Selected Grid', EG_TEXTDOMAIN); ?> </a> <a href="<?php echo Essential_Grid_Base::getViewUrl(Essential_Grid_Admin::VIEW_GRID_CREATE, 'create=true'); ?> " target="_blank" class="button-primary ess-revgreen" id="eg-create-predefined-grid"><?php _e('Create Full Grid', EG_TEXTDOMAIN); ?> </a> </div> </div> <div class="ess-bottom_half"> <p class="ess-quicktitle"><?php _e('Create a Quick Grid:', EG_TEXTDOMAIN); ?> </p> <a href="javascript:void(0);" class="" id="eg-create-custom-grid"> <div class="ess-customgridwrap"> <div class="dashicons dashicons-format-gallery ess-customgridicon"></div> <div class="ess-customonbutton"><?php _e('Add Custom', EG_TEXTDOMAIN); ?> </div> </div> </a> <a href="javascript:void(0);" class="" id="eg-edit-custom-grid"> <div class="ess-customgridwrap"> <div class="dashicons dashicons-format-gallery ess-customgridicon"></div> <div class="ess-customonbutton"><?php _e('Edit Custom', EG_TEXTDOMAIN); ?> </div> </div> </a> <a href="javascript:void(0);" class="" id="eg-create-popularpost-grid"> <div class="ess-customgridwrap"> <div class="dashicons dashicons-groups ess-customgridicon"></div> <div class="ess-customonbutton"><?php _e('Popular Post', EG_TEXTDOMAIN); ?> </div> </div> </a> <a href="javascript:void(0);" class="" id="eg-create-recentpost-grid"> <div class="ess-customgridwrap"> <div class="dashicons dashicons-calendar ess-customgridicon"></div> <div class="ess-customonbutton"><?php _e('Recent Post', EG_TEXTDOMAIN); ?> </div> </div> </a> <a href="javascript:void(0);" class="" id="eg-create-relatedpost-grid"> <div class="ess-customgridwrap"> <div class="dashicons dashicons-tickets ess-customgridicon"></div> <div class="ess-customonbutton"><?php _e('Related Post', EG_TEXTDOMAIN); ?> </div> </div> </a> </div> <div class="ess-stepnavigator"> <span class="ess-currentstep"><?php _e('STEP 1 - Choose Grid', EG_TEXTDOMAIN); ?> </span> </div> </div> <!-- STEP 2.5 --> <div id="ess-grid-tiny-dialog-step-2-5" style="display: none;"> <div id="esg-tiny-shortcode-analyze-wrap" class="ess-top_half" style="padding-top:0px;margin-top:0px;padding-bottom:30px;"> <div class="ess-quicktitle" style="margin-left:25px;"><?php _e('Edit Existing QuickGrid ShortCode', EG_TEXTDOMAIN); ?> </div> <p> <label><?php _e('Input Quickgrid Code', EG_TEXTDOMAIN); ?> </label> <input type="text" name="eg-shortcode-analyzer" value="" /> <a class="button-primary revblue" href="javascript:void(0);" id="eg-shortcode-do-analyze"><?php _e('Analyze Shortcode', EG_TEXTDOMAIN); ?> </a> </p> <p style="line-height:20px;font-size:11px;font-style:italic;color:#999;"><?php _e('You can paste your Existing Quick Grid Shortcode here for further editing. Simple copy the full Shortcode of Essential grid i.e. [ess_grid settings=....][/ess_grid] and paste it here.', EG_TEXTDOMAIN); ?> </div> <div style="width:100%;height:30px"></div> <div class="ess-stepnavigator"> <a href="javascript:void(0);" class="" id="eg-goto-step-1-5"> <div class="ess-stepbutton-left"> <div class="dashicons dashicons-arrow-left-alt2"></div> <span class="ess-currentstep"><?php _e('STEP 1 - Select Grid', EG_TEXTDOMAIN); ?> </span> </div> </a> </div> </div> <!-- STEP 2 --> <div id="ess-grid-tiny-dialog-step-2" style="display: none;"> <div id="esg-tiny-settings-wrap"> <div class="ess-top_half" style="padding:0px 0px 30px;"> <div class="ess-quicktitle" style="margin-left:25px;"><?php _e('Predefined Grid Settings', EG_TEXTDOMAIN); ?> </div> <p style=""> <label><?php _e('Choose Grid', EG_TEXTDOMAIN); ?> </label> <select name="ess-grid-tiny-existing-settings"> <option value="-1"><?php _e('--- Choose Grid to use Settings from Grid ---', EG_TEXTDOMAIN); ?> </option> <?php if (!empty($grids)) { foreach ($grids as $title => $alias) { echo '<option value="' . $alias . '">' . $title . '</option>' . "\n"; } } ?> </select> <p style="line-height:20px;font-size:11px;font-style:italic;color:#999;"><?php _e('Use the Grid Settings from one of the Existing Essential Grid. This helps to use all Complex settings of a Grid, not just the quick settings listed below.', EG_TEXTDOMAIN); ?> </p> </div> <div class="ess-bottom_half" style="padding:30px 0px 0px;"> <div class="ess-quicktitle" style="margin-left:25px;"><?php _e('Quick Grid Settings', EG_TEXTDOMAIN); ?> </div> <p class="esg-max-entries" style="display: none; background:#FFF;"> <label><?php _e('Maximum Entries', EG_TEXTDOMAIN); ?> </label> <input type="text" name="ess-grid-tiny-max-entries" value="20" /> </p> <div id="ess-grid-tiny-grid-settings-wrap"> <p> <label><?php _e('Grid Skin', EG_TEXTDOMAIN); ?> </label> <select name="ess-grid-tiny-entry-skin"> <?php $skins = Essential_Grid_Item_Skin::get_essential_item_skins('all', false); if (!empty($skins)) { foreach ($skins as $skin) { echo '<option value="' . $skin['id'] . '">' . $skin['name'] . '</option>' . "\n"; } } ?> </select> </p> <p> <label><?php _e('Layout', EG_TEXTDOMAIN); ?> </label> <select name="ess-grid-tiny-layout-sizing"> <option value="boxed"><?php _e('Boxed', EG_TEXTDOMAIN); ?> </option> <option value="fullwidth"><?php _e('Fullwidth', EG_TEXTDOMAIN); ?> </option> </select> </p> <p> <label><?php _e('Grid Layout', EG_TEXTDOMAIN); ?> </label> <select name="ess-grid-tiny-grid-layout"> <option value="even"><?php _e('Even', EG_TEXTDOMAIN); ?> </option> <option value="masonry"><?php _e('Masonry', EG_TEXTDOMAIN); ?> </option> <option value="cobbles"><?php _e('Cobbles', EG_TEXTDOMAIN); ?> </option> </select> </p> <p> <label><?php _e('Item Spacing', EG_TEXTDOMAIN); ?> </label> <input type="text" name="ess-grid-tiny-spacings" value="0" /> </p> <p> <label><?php _e('Pagination', EG_TEXTDOMAIN); ?> </label> <input type="radio" style="margin-left:0px !important;" name="ess-grid-tiny-rows-unlimited" value="on" /> <?php _e('Disable', EG_TEXTDOMAIN); ?> <input type="radio" name="ess-grid-tiny-rows-unlimited" checked="checked" value="off" /> <?php _e('Enable', EG_TEXTDOMAIN); ?> </p> <p> <label><?php _e('Columns', EG_TEXTDOMAIN); ?> </label> <input type="text" name="ess-grid-tiny-columns" value="5" /> </p> <p> <label><?php _e('Max. Visible Rows', EG_TEXTDOMAIN); ?> </label> <input type="text" name="ess-grid-tiny-rows" value="3" /> </p> <p> <label><?php _e('Start and Filter Animations', EG_TEXTDOMAIN); ?> </label> <?php $anims = Essential_Grid_Base::get_grid_animations(); ?> <select class="eg-tooltip-wrap tooltipstered" name="ess-grid-tiny-grid-animation" id="grid-animation-select"> <?php foreach ($anims as $value => $name) { echo '<option value="' . $value . '">' . $name . '</option>' . "\n"; } ?> </select> </p> <p> <label><?php _e('Choose Spinner', EG_TEXTDOMAIN); ?> </label> <select class="eg-tooltip-wrap tooltipstered" name="ess-grid-tiny-use-spinner" id="use_spinner"> <option value="-1"><?php _e('off', EG_TEXTDOMAIN); ?> </option> <option value="0" selected="selected">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </p> </div> </div> </div> <!--<a href="javascript:void(0);" class="button-primary ess-revgreen" id="eg-goto-step-3"><?php _e('Add Entries', EG_TEXTDOMAIN); ?> </a>--> <div style="width:100%;height:30px"></div> <div class="ess-stepnavigator"> <a href="javascript:void(0);" class="" id="eg-goto-step-1"> <div class="ess-stepbutton-left"> <div class="dashicons dashicons-arrow-left-alt2"></div> <span class="ess-currentstep"><?php _e('STEP 1 - Select Grid', EG_TEXTDOMAIN); ?> </span> </div> </a> <a href="javascript:void(0);" class="" id="eg-goto-step-3"> <div class="ess-stepbutton-right"> <span class="ess-currentstep"><?php _e('STEP 3 - Add Items', EG_TEXTDOMAIN); ?> </span> <div class="dashicons dashicons-arrow-right-alt2"></div> </div> </a> <a href="javascript:void(0);" class="" id="ess-grid-add-custom-shortcode-special" style="display: none;"> <div class="ess-stepbutton-right"> <span class="ess-currentstep"><?php _e('FINNISH - Generate Shortcode', EG_TEXTDOMAIN); ?> </span> <div class="dashicons dashicons-arrow-right-alt2"></div> </div> </a> </div> </div> </form> <form id="ess-grid-tiny-mce-layers-form" action=""> <!-- STEP 3 --> <div id="ess-grid-tiny-dialog-step-3" style="display: none;"> <div style="padding:30px"> <div class="ess-mediaselector"><a href="javascript:void(0);" class="eg-add-custom-element" data-type="image"><div class="dashicons dashicons-format-image"></div><?php _e('Image', EG_TEXTDOMAIN); ?> </a></div> <div class="ess-mediaselector"><a href="javascript:void(0);" class="eg-add-custom-element" data-type="html5"><div class="dashicons dashicons-editor-video"></div><?php _e('HTML5 Video', EG_TEXTDOMAIN); ?> </a></div> <div class="ess-mediaselector"><a href="javascript:void(0);" class="eg-add-custom-element" data-type="vimeo"><div class="dashicons dashicons-format-video"></div><?php _e('Vimeo', EG_TEXTDOMAIN); ?> </a></div> <div class="ess-mediaselector"><a href="javascript:void(0);" class="eg-add-custom-element" data-type="youtube"><div class="dashicons dashicons-format-video"></div><?php _e('YouTube', EG_TEXTDOMAIN); ?> </a></div> <div class="ess-mediaselector"><a href="javascript:void(0);" class="eg-add-custom-element" data-type="soundcloud"><div class="dashicons dashicons-format-audio"></div><?php _e('SoundCloud', EG_TEXTDOMAIN); ?> </a></div> <div class="ess-mediaselector collapseall"><a href="javascript:void(0);"><div class="dashicons dashicons-sort"></div><?php _e('Collapse', EG_TEXTDOMAIN); ?> </a></div> <div id="eg-custom-elements-wrap"> </div> </div> <div style="width:100%;height:30px"></div> <div class="ess-stepnavigator"> <a href="javascript:void(0);" class="" id="eg-goto-step-2"> <div class="ess-stepbutton-left"> <div class="dashicons dashicons-arrow-left-alt2"></div> <span class="ess-currentstep"><?php _e('STEP 2 - Grid Settings', EG_TEXTDOMAIN); ?> </span> </div> </a> <a href="javascript:void(0);" class="" id="ess-grid-add-custom-shortcode"> <div class="ess-stepbutton-right"> <span class="ess-currentstep"><?php _e('FINNISH - Generate Shortcode', EG_TEXTDOMAIN); ?> </span> <div class="dashicons dashicons-arrow-right-alt2"></div> </div> </a> </div> </div> </form> <div class="esg-tiny-template-wrap esg-tiny-element" style="display: none;"> <div class="ess-grid-tiny-collapse-wrapper"> <div style="width:100%;height:10px;"></div> <div class="ess-grid-tiny-custom-wrapper" > <!-- POSTER IMAGE --> <div id="ess-grid-tiny-custom-poster-wrap" class="ess-grid-tiny-option-wrap" style="display: none;"> <div class="ess-quicktitle"><?php _e('Choose Poster Image', EG_TEXTDOMAIN); ?> </div> <div class="esg-tiny-img-placeholder"><img src="" class="esg-tiny-preshow-img" style="display: none;" /></div> <a href="javascript:void(0);" class="esg-toolbutton ess-grid-select-image" data-setto="ess-grid-tiny-custom-poster[]"><div class="dashicons dashicons-plus"></div></a> <input type="hidden" name="ess-grid-tiny-custom-poster[]" data-type="image" value="" /> </div> <!-- SIMPLE IMAGE --> <div id="ess-grid-tiny-custom-image-wrap" class="ess-grid-tiny-option-wrap" style="display: none;"> <div class="ess-quicktitle"><?php _e('Choose Image', EG_TEXTDOMAIN); ?> </div> <div class="esg-tiny-img-placeholder"><img src="" class="esg-tiny-preshow-img" style="display: none;" /></div> <a href="javascript:void(0);" class="esg-toolbutton ess-grid-select-image" data-setto="ess-grid-tiny-custom-image[]"><div class="dashicons dashicons-plus"></div></a> <input type="hidden" name="ess-grid-tiny-custom-image[]" data-type="image" value="" /> </div> <!-- VIMEO ID SELECTOR --> <div id="ess-grid-tiny-custom-vimeo-wrap" class="ess-grid-tiny-option-wrap" style="display: none;"> <div class="ess-grid-tiny-elset-label"><?php _e('Vimeo ID', EG_TEXTDOMAIN); ?> </div><input type="text" name="ess-grid-tiny-custom-vimeo[]" value="" /> </div> <!-- YOUTUBE ID SELECTOR --> <div id="ess-grid-tiny-custom-youtube-wrap" class="ess-grid-tiny-option-wrap" style="display: none;"> <div class="ess-grid-tiny-elset-label"><?php _e('YouTube ID', EG_TEXTDOMAIN); ?> </div><input type="text" name="ess-grid-tiny-custom-youtube[]" value="" /> </div> <!-- SOUND CLOUD SELECTOR --> <div id="ess-grid-tiny-custom-soundcloud-wrap" class="ess-grid-tiny-option-wrap" style="display: none;"> <div class="ess-quicktitle"><?php _e('SoundCloud', EG_TEXTDOMAIN); ?> </div> <div class="ess-grid-tiny-elset-label"><?php _e('SoundCloud ID', EG_TEXTDOMAIN); ?> </div> <input type="text" name="ess-grid-tiny-custom-soundcloud[]" value="" /> </div> <!-- HTML5 SELECTORS --> <div id="ess-grid-tiny-custom-html5-wrap" class="ess-grid-tiny-option-wrap" style="display: none;"> <div class="ess-grid-tiny-elset-label"><?php _e('WEBM URL', EG_TEXTDOMAIN); ?> </div> <input type="text" name="ess-grid-tiny-custom-html5-webm[]" value="" /> <div class="ess-grid-tiny-elset-label"><?php _e('OGV URL', EG_TEXTDOMAIN); ?> </div> <input type="text" name="ess-grid-tiny-custom-html5-ogv[]" value="" /> <div class="ess-grid-tiny-elset-label"><?php _e('MP4 URL', EG_TEXTDOMAIN); ?> </div> <input type="text" name="ess-grid-tiny-custom-html5-mp4[]" value="" /> </div> <!-- VIDEO RATIO --> <div id="ess-grid-tiny-custom-ratio-wrap" class="ess-grid-tiny-option-wrap" style="display: none;"> <div class="ess-grid-tiny-elset-label"><?php _e('Video Ratio', EG_TEXTDOMAIN); ?> </div> <select name="ess-grid-tiny-custom-ratio[]"> <option value="0" selected="selected">4:3</option> <option value="1">16:9</option> </select> </div> <!-- COBBLES SETTINGS --> <div class="ess-grid-tiny-cobbles-size-wrap ess-grid-tiny-option-wrap" style="display: none;"> <div class="ess-grid-tiny-elset-label"><?php _e('Cobbles Size', EG_TEXTDOMAIN); ?> </div> <select name="ess-grid-tiny-cobbles-size[]"> <option value="1:1"><?php _e('width 1, height 1', EG_TEXTDOMAIN); ?> </option> <option value="1:2"><?php _e('width 1, height 2', EG_TEXTDOMAIN); ?> </option> <option value="1:3"><?php _e('width 1, height 3', EG_TEXTDOMAIN); ?> </option> <option value="2:1"><?php _e('width 2, height 1', EG_TEXTDOMAIN); ?> </option> <option value="2:2"><?php _e('width 2, height 2', EG_TEXTDOMAIN); ?> </option> <option value="2:3"><?php _e('width 2, height 3', EG_TEXTDOMAIN); ?> </option> <option value="3:1"><?php _e('width 3, height 1', EG_TEXTDOMAIN); ?> </option> <option value="3:2"><?php _e('width 3, height 2', EG_TEXTDOMAIN); ?> </option> <option value="3:3"><?php _e('width 3, height 3', EG_TEXTDOMAIN); ?> </option> </select> </div> <!-- CUSTOM SKIN SETTINGS --> <div class="ess-grid-tiny-use-skin-wrap ess-grid-tiny-option-wrap"> <div class="ess-grid-tiny-elset-label"><?php _e('Specific Skin', EG_TEXTDOMAIN); ?> </div> <?php $skins = Essential_Grid_Item_Skin::get_essential_item_skins('all', false); ?> <select name="ess-grid-tiny-use-skin[]"> <option value="-1"><?php _e('-- Default Skin --', EG_TEXTDOMAIN); ?> </option> <?php if (!empty($skins)) { foreach ($skins as $skin) { echo '<option value="' . $skin['id'] . '">' . $skin['name'] . '</option>' . "\n"; } } ?> </select> </div> </div> <div class="ess-grid-tiny-custom-wrapper" > <?php /*$meta = new Essential_Grid_Meta(); $custom_meta = $meta->get_all_meta(false); if(!empty($custom_meta)){ echo '<div class="ess-grid-tiny-elset-title">'; _e('Layers Content', EG_TEXTDOMAIN); echo '</div>'; foreach($custom_meta as $cmeta){ ?> <div class="ess-grid-tiny-<?php echo $cmeta['handle']; ?>-wrap ess-grid-tiny-elset-row" style="display: none;"><div class="eg-elset-label" class="eg-mb-label"><?php echo $cmeta['name']; ?>:</div> <?php switch($cmeta['type']){ case 'text': echo '<input type="text" name="ess-grid-tiny-'.$cmeta['handle'].'[]" value="" />'; break; case 'select': $el = $meta->prepare_select_by_string($cmeta['select']); echo '<select name="ess-grid-tiny-'.$cmeta['handle'].'[]">'; if(!empty($el) && is_array($el)){ echo '<option value="">'.__('---', EG_TEXTDOMAIN).'</option>'; foreach($el as $ele){ echo '<option value="'.$ele.'">'.$ele.'</option>'; } } echo '</select>'; break; case 'image': $var_src = ''; ?> <input type="hidden" value="" name="ess-grid-tiny-<?php echo $cmeta['handle']; ?>[]" id="ess-grid-tiny-<?php echo $cmeta['handle']; ?>" /> <a class="button-primary revblue eg-image-add" href="javascript:void(0);" data-setto="eg-<?php echo $cmeta['handle']; ?>"><?php _e('Choose Image', EG_TEXTDOMAIN); ?></a> <a class="button-primary revred eg-image-clear" href="javascript:void(0);" data-setto="eg-<?php echo $cmeta['handle']; ?>"><?php _e('Remove Image', EG_TEXTDOMAIN); ?></a> <div> <img id="ess-grid-tiny-<?php echo $cmeta['handle']; ?>-img" src="<?php echo $var_src; ?>" <?php echo ($var_src == '') ? 'style="max-width:200px; display: none;margin:20px 0px 0px 250px;"' : ''; ?>> </div> <?php break; } ?> </div> <?php } }else{ _e('No metas available yet. Add some through the Custom Meta menu of Essential Grid.', EG_TEXTDOMAIN); ?><div style="clear:both; height:20px"></div><?php }*/ $elements = Essential_Grid_Item_Element::getElementsForDropdown(); $p_lang = array('post' => __('Post', EG_TEXTDOMAIN), 'woocommerce' => __('WooCommerce', EG_TEXTDOMAIN)); foreach ($elements as $type => $element) { ?> <!--<div class="ess-grid-tiny-elset-title"> <?php echo $p_lang[$type]; ?> </div>--> <?php foreach ($element as $handle => $name) { echo '<div class="ess-grid-tiny-' . $handle . '-wrap ess-grid-tiny-elset-row" style="display: none;"><div class="ess-grid-tiny-elset-label" for="' . $handle . '">' . $name['name'] . ':</div><input name="ess-grid-tiny-' . $handle . '[]" value="" /></div>'; } } ?> </div> <div style="clear:both"></div> <div style="width:100%;height:30px;"></div> </div> <div class="ess-grid-tiny-custom-pictogram"><div class="dashicons dashicons-format-image"></div></div> <div class="esg-toolbutton esg-delete-item"> <a href="javascript:void(0);" class="esg-tiny-delete-entry"><div class="dashicons dashicons-trash"></div></a> </div> <div class="esg-toolbutton esg-collapsme-item"> <a href="javascript:void(0);" class="esg-tiny-collapsme-entry"><div class="dashicons dashicons-sort"></div></a> </div> <img class="esg-toolbarimg" src=""> </div> <script type="text/javascript"> <?php $skin_layers = array(); $all_skins = $skins_c->get_essential_item_skins(); if (!empty($all_skins)) { foreach ($all_skins as $cskin) { $custom_layer_elements = array(); if (isset($cskin['layers'])) { foreach ($cskin['layers'] as $layer) { if (@isset($layer['settings']['source'])) { switch ($layer['settings']['source']) { case 'post': $custom_layer_elements[@$layer['settings']['source-post']] = ''; break; case 'woocommerce': $custom_layer_elements[@$layer['settings']['source-woocommerce']] = ''; break; } } } } $skin_layers[$cskin['id']] = $custom_layer_elements; } } ?> var esg_tiny_skin_layers = jQuery.parseJSON(<?php echo $base->jsonEncodeForClientSide($skin_layers); ?> ); // KRIKI SCRIPT var esgCustomCollapser = function(bt,direction) { var cp = bt.closest('.esg-tiny-element'), cpitem = cp.find('.ess-grid-tiny-collapse-wrapper'), timg = cp.find('.esg-toolbarimg'), pimg = cp.find('.esg-tiny-preshow-img'); if ((direction=="auto" && cpitem.hasClass("collapsed")) || direction=="open") { cpitem.slideDown(200); cpitem.removeClass("collapsed"); bt.removeClass("collapsed"); timg.removeClass("collapsed"); } else { cpitem.slideUp(200); cpitem.addClass("collapsed"); bt.addClass("collapsed"); timg.addClass("collapsed"); jQuery.each(pimg,function(index,pimge) { if (jQuery(pimge).attr('src') !=undefined && jQuery(pimge).attr('src').length>0) timg.attr('src',jQuery(pimge).attr('src')); }) } } jQuery('body').on('click','.esg-toolbutton.esg-collapsme-item',function() { esgCustomCollapser(jQuery(this),"auto"); }); jQuery('.ess-mediaselector.collapseall').click(function() { var ca = jQuery(this); if (ca.hasClass("collapsed")) { jQuery('.esg-toolbutton.esg-collapsme-item').each(function() { esgCustomCollapser(jQuery(this),"open"); }) ca.removeClass("collapsed"); } else { jQuery('.esg-toolbutton.esg-collapsme-item').each(function() { esgCustomCollapser(jQuery(this),"close"); }) ca.addClass("collapsed"); } }) </script> </div> <?php }
<?php /** * Panel to the search options. * * @package Essential_Grid * @author ThemePunch <*****@*****.**> * @link http://www.themepunch.com/essential/ * @copyright 2014 ThemePunch * @since: 2.0 */ $settings = get_option('esg-search-settings', array('settings' => array(), 'global' => array(), 'shortcode' => array())); $settings = Essential_Grid_Base::stripslashes_deep($settings); $base = new Essential_Grid_Base(); $grids = Essential_Grid::get_grids_short(); $my_skins = array('light' => __('Light', EG_TEXTDOMAIN), 'dark' => __('Dark', EG_TEXTDOMAIN)); $my_skins = apply_filters('essgrid_modify_search_skins', $my_skins); ?> <h2 class="topheader"><?php _e('Search Settings', EG_TEXTDOMAIN); ?> </h2> <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);
/** * 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); }
/** * Output a full Skin with items by data * @return string html */ public function output_item_skin($demo = false, $choosen_skin = 0) { $base = new Essential_Grid_Base(); $grid = new Essential_Grid(); $m = new Essential_Grid_Meta(); $is_post = !empty($this->layer_values) ? false : true; $this->import_google_fonts(); $this->register_google_fonts(); $layer_type = $base->getVar($this->params, 'choose-layout', 'even'); $filters = ''; if (!empty($this->filter)) { foreach ($this->filter as $filter) { $filters .= ' filter-' . sanitize_title($filter['slug']); } } if ($demo !== false && $demo !== 'preview') { //add favorite filter if we are in a demo if (isset($this->settings['favorite']) && $this->settings['favorite'] == true) { $filters .= ' filter-favorite'; } if ($demo == 'skinchoose' && $choosen_skin == $this->id || $choosen_skin == '-1') { $filters .= ' filter-selectedskin'; } } $sortings = ''; if ($demo === false || $demo === 'preview') { if (!empty($this->sorting)) { foreach ($this->sorting as $handle => $value) { $sortings .= ' data-' . esc_attr($handle) . '="' . sanitize_title($value) . '"'; } } } $container_class = ' eg-' . esc_attr($this->handle) . '-container'; $li_class = ' eg-' . esc_attr($this->handle) . '-wrapper'; if ($is_post) { $li_class .= ' eg-post-id-' . @$this->post['ID']; } $container_background_color = $base->getVar($this->params, 'container-background-color', '#000'); $container_background_color_transparency = $base->getVar($this->params, 'element-container-background-color-opacity', '1'); //check for custom meta layout settings $meta_cover_bg_color = $this->get_meta_layout_change('cover-bg-color'); $meta_cover_bg_opacity = $this->get_meta_layout_change('cover-bg-opacity'); $meta_item_bg_color = $this->get_meta_layout_change('item-bg-color'); $meta_content_bg_color = $this->get_meta_layout_change('content-bg-color'); $meta_cover_style = ''; if ($meta_cover_bg_color === false && $meta_cover_bg_opacity !== false) { //we only change opacity, use default background-color $meta_cover_style = ' style="background-color: ' . Essential_Grid_Base::hex2rgba($container_background_color, $meta_cover_bg_opacity) . ';"'; } elseif ($meta_cover_bg_color !== false && $meta_cover_bg_opacity === false) { //we only change background-color, use default opacity $meta_cover_style = ' style="background-color: ' . Essential_Grid_Base::hex2rgba($meta_cover_bg_color, $container_background_color_transparency) . ';"'; } elseif ($meta_cover_bg_color !== false && $meta_cover_bg_opacity !== false) { //we change both settings $meta_cover_style = ' style="background-color: ' . Essential_Grid_Base::hex2rgba($meta_cover_bg_color, $meta_cover_bg_opacity) . ';"'; } $meta_content_style = ''; if ($meta_content_bg_color !== false) { $meta_content_style = ' style="background-color: ' . $meta_content_bg_color . ';"'; } $meta_item_style = ''; if ($meta_item_bg_color !== false) { $meta_item_style = ' style="background-color: ' . $meta_item_bg_color . ';"'; } $cover_type = $base->getVar($this->params, 'cover-type', 'full'); $cover_animation_top = ''; $cover_animation_delay_top = ''; $cover_animation_center = ''; $cover_animation_delay_center = ''; $cover_animation_bottom = ''; $cover_animation_delay_bottom = ''; if ($cover_type == 'full') { //cover is for overlay container $cover_animation_center = ' esg-' . $base->getVar($this->params, 'cover-animation-center', 'fade') . $base->getVar($this->params, 'cover-animation-center-type', ''); if ($cover_animation_center != ' esg-none' && $cover_animation_center != ' esg-noneout') { $cover_animation_delay_center = ' data-delay="' . round($base->getVar($this->params, 'cover-animation-delay-center', 0, 'i') / 100, 2) . '"'; } else { $cover_animation_center = ''; } } else { $cover_animation_top = ' esg-' . $base->getVar($this->params, 'cover-animation-top', 'fade') . $base->getVar($this->params, 'cover-animation-top-type', ''); if ($cover_animation_top != ' esg-none' && $cover_animation_top != ' esg-noneout') { $cover_animation_delay_top = ' data-delay="' . round($base->getVar($this->params, 'cover-animation-delay-top', 0, 'i') / 100, 2) . '"'; } else { $cover_animation_top = ''; } $cover_animation_center = ' esg-' . $base->getVar($this->params, 'cover-animation-center', 'fade') . $base->getVar($this->params, 'cover-animation-center-type', ''); if ($cover_animation_center != ' esg-none' && $cover_animation_center != ' esg-noneout') { $cover_animation_delay_center = ' data-delay="' . round($base->getVar($this->params, 'cover-animation-delay-center', 0, 'i') / 100, 2) . '"'; } else { $cover_animation_center = ''; } $cover_animation_bottom = ' esg-' . $base->getVar($this->params, 'cover-animation-bottom', 'fade') . $base->getVar($this->params, 'cover-animation-bottom-type', ''); if ($cover_animation_bottom != ' esg-none' && $cover_animation_bottom != ' esg-noneout') { $cover_animation_delay_bottom = ' data-delay="' . round($base->getVar($this->params, 'cover-animation-delay-bottom', 0, 'i') / 100, 2) . '"'; } else { $cover_animation_bottom = ''; } } //group is for cover container $cover_group_animation_delay = ''; $cover_group_animation = ' esg-' . $base->getVar($this->params, 'cover-group-animation', 'fade'); if ($cover_group_animation != ' esg-none') { $cover_group_animation_delay = ' data-delay="' . round($base->getVar($this->params, 'cover-group-animation-delay', 0, 'i') / 100, 2) . '"'; } else { $cover_group_animation = ''; } //media is for media container $media_animation_delay = ''; $media_animation = ' esg-' . $base->getVar($this->params, 'media-animation', 'fade'); if ($media_animation != ' esg-none') { $media_animation_delay = ' data-delay="' . round($base->getVar($this->params, 'media-animation-delay', 0, 'i') / 100, 2) . '"'; } else { $media_animation = ''; } if ($this->load_more_element == true) { $li_class .= ' eg-newli'; } //check if we are on cobble, if yes, get the data of entry for cobbles $cobbles_data = ''; if ($this->grid_type == 'cobbles') { if ($this->layer_values === false) { //we are on post $cobbles = json_decode(get_post_meta($this->post['ID'], 'eg_cobbles', true), true); if (isset($cobbles[$this->grid_id]['cobbles']) && strpos($cobbles[$this->grid_id]['cobbles'], ':') !== false) { $use_cobbles = $cobbles[$this->grid_id]['cobbles']; } else { $use_cobbles = '1:1'; } } else { //get the info from $this->layer_values $use_cobbles = $base->getVar($this->layer_values, 'cobbles-size', '1:1'); } $use_cobbles = explode(':', $use_cobbles); $cobbles_data = ' data-cobblesw="' . $use_cobbles[0] . '" data-cobblesh="' . $use_cobbles[1] . '"'; } echo '<!-- PORTFOLIO ITEM ' . $this->id . ' -->' . "\n"; echo '<li class="filterall' . $filters . $li_class; if ($demo == 'custom') { echo ' eg-newli'; } //neccesary for refresh of preview grid if new li will be added echo '"' . $sortings . $meta_item_style . $cobbles_data . '>' . "\n"; if ($demo == 'overview' || $demo == 'skinchoose') { //check if fav or not $cl = $demo == 'skinchoose' ? 'esg-screenselect-toolbar eg-tooltip-wrap' : ''; //show only in grid editor at skin chooser $cltitle = $demo == 'skinchoose' ? 'title="' . __('Select Skin', EG_TEXTDOMAIN) . '"' : ''; //Show Title only at Skin Chooser echo '<div ' . $cltitle . ' class="' . $cl . '" style="display:block !important;width:100%;height:30px;top:0px;left:0px;position:relative;z-index:10;background-color: #3498DB; padding: 0;">' . "\n"; echo ' <div class="btn-wrap-item-skin-overview-' . $this->id . '">' . "\n"; echo '<div class="eg-item-skin-overview-name">' . $this->name . "</div>\n"; if ($demo == 'overview') { $fav_class = !isset($this->settings['favorite']) || $this->settings['favorite'] == false ? 'eg-icon-star-empty' : 'eg-icon-star'; echo '<a href="javascript:void(0);" title="' . __('Mark as Favorit', EG_TEXTDOMAIN) . '" class="eg-ov-1 eg-overview-button eg-btn-star-item-skin revyellow eg-tooltip-wrap" id="eg-star-' . $this->id . '"><i class="' . $fav_class . '"></i></a>'; echo '<a href="' . Essential_Grid_Base::getViewUrl(Essential_Grid_Admin::VIEW_ITEM_SKIN_EDITOR, 'create=' . $this->id) . '" title="' . __('Edit Skin', EG_TEXTDOMAIN) . '" class="eg-tooltip-wrap eg-ov-2 eg-overview-button revgreen "><i class="eg-icon-cog"></i></a>'; echo '<a href="javascript:void(0);" title="' . __('Duplicate Skin', EG_TEXTDOMAIN) . '" class="eg-ov-3 eg-overview-button eg-btn-duplicate-item-skin revcarrot eg-tooltip-wrap " id="eg-duplicate-' . $this->id . '"><i class="eg-icon-picture"></i></a>'; echo '<a href="javascript:void(0);" title="' . __('Delete Skin', EG_TEXTDOMAIN) . '" class="eg-ov-4 eg-overview-button eg-btn-delete-item-skin revred eg-tooltip-wrap " id="eg-delete-' . $this->id . '"><i class="eg-icon-trash"></i></a>'; } elseif ($demo == 'skinchoose') { echo '<div title="' . __('Select Skin', EG_TEXTDOMAIN) . '" class="eg-tooltip-wrap eg-fakeinput "></div>'; echo '<input class="eg-tooltip-wrap " style="position: absolute; right: 0; top: 0;" type="radio" value="' . $this->id . '" title="' . __('Choose Skin', EG_TEXTDOMAIN) . '" name="entry-skin"'; if ($choosen_skin == '-1') { echo ' checked="checked"'; } else { checked($choosen_skin, $this->id); } //echo checked if it is current ID echo ' />'; } echo ' </div>' . "\n"; echo ' <div class="clear"></div>' . "\n\n"; echo ' </div>' . "\n\n"; } elseif ($demo == 'preview') { $is_visible = $grid->check_if_visible($this->post['ID'], $this->grid_id); $vis_icon = $is_visible ? 'eg-icon-eye' : 'eg-icon-eye-off'; $vis_icon_color = $is_visible ? 'revblue' : 'revred'; echo '<div class="esg-atoolbar" style="display:block !important;width:100%;height:30px;top:0px;left:0px;position:absolute;z-index:10; padding: 0;">' . "\n"; echo ' <div class="btn-wrap-item-skin-overview-' . $this->post['ID'] . '">' . "\n"; echo '<div class="eg-item-skin-overview-name">'; echo '<a href="javascript:void(0);" class="eg-ov-2 eg-overview-button eg-btn-activate-post-item ' . $vis_icon_color . ' eg-tooltip-wrap" title="' . __('Show/Hide from Grid', EG_TEXTDOMAIN) . '" id="eg-act-post-item-' . $this->post['ID'] . '"><i class="' . $vis_icon . '"></i></a>'; echo '<a href="' . get_edit_post_link($this->post['ID']) . '" class="eg-ov-3 eg-overview-button revyellow eg-tooltip-wrap" title="' . __('Edit Post', EG_TEXTDOMAIN) . '" target="_blank"><i class="eg-icon-pencil-1"></i></a>'; echo '<a href="javascript:void(0);" class="eg-ov-4 eg-overview-button eg-btn-edit-post-item revgreen eg-tooltip-wrap" title="' . __('Edit Post Meta', EG_TEXTDOMAIN) . '" id="eg-edit-post-item-' . $this->post['ID'] . '"><i class="eg-icon-cog"></i></a>'; echo '</div>' . "\n"; echo ' </div>' . "\n"; echo ' <div class="clear"></div>' . "\n\n"; echo ' </div>' . "\n\n"; } elseif ($demo == 'custom') { //add info of what items do exist in the layer that can be edited $custom_layer_elements = array(); $custom_layer_data = array(); if (!empty($this->layers)) { foreach ($this->layers as $layer) { if (isset($layer['settings']['source'])) { switch ($layer['settings']['source']) { case 'post': $custom_layer_elements[$layer['settings']['source-post']] = ''; break; case 'woocommerce': $custom_layer_elements[$layer['settings']['source-woocommerce']] = ''; break; } } } } if (!empty($this->layer_values)) { $custom_layer_data = $this->layer_values; } $custom_layer_elements = htmlentities(json_encode($custom_layer_elements)); $custom_layer_data = htmlentities(json_encode($custom_layer_data)); echo '<input type="hidden" name="layers[]" value="' . $custom_layer_data . '" />'; //has the values for this entry echo '<div class="esg-data-handler" data-exists="' . $custom_layer_elements . '" style="display: none;"></div>'; //has the information on what exists as layers in the skin #3498DB echo '<div class="esg-atoolbar" style="display:block !important;width:100%;height:30px;top:0px;left:0px;position:absolute;z-index:10;background-color: transparent; padding: 0;">' . "\n"; echo ' <div class="btn-wrap-item-skin-overview-0">' . "\n"; echo '<div class="eg-item-skin-overview-name">'; echo '<a href="javascript:void(0);" title="' . __('Move', EG_TEXTDOMAIN) . '" style="cursor: move;" class="eg-ov-10 eg-overview-button revdarkblue eg-tooltip-wrap "><i class="eg-icon-menu"></i></a>'; echo '<a href="javascript:void(0);" title="' . __('Move one before', EG_TEXTDOMAIN) . '" class="eg-ov-11 eg-overview-button eg-btn-move-before-custom-element revyellow eg-tooltip-wrap "><i class="eg-icon-angle-left"></i></a>'; echo '<a href="javascript:void(0);" title="' . __('Move one after', EG_TEXTDOMAIN) . '" class="eg-ov-12 eg-overview-button eg-btn-move-after-custom-element revyellow eg-tooltip-wrap "><i class="eg-icon-angle-right"></i></a>'; echo '<a href="javascript:void(0);" title="' . __('Move after #x', EG_TEXTDOMAIN) . '" class="eg-ov-13 eg-overview-button eg-btn-switch-custom-element revyellow eg-tooltip-wrap "><i class="eg-icon-angle-double-right"></i></a>'; echo '<a href="javascript:void(0);" title="' . __('Delete Element', EG_TEXTDOMAIN) . '" class="eg-ov-4 eg-overview-button eg-btn-delete-custom-element revred eg-tooltip-wrap "><i class="eg-icon-trash"></i></a>'; echo '<a href="javascript:void(0);" title="' . __('Duplicate Element', EG_TEXTDOMAIN) . '" class="eg-ov-3 eg-overview-button eg-btn-duplicate-custom-element revcarrot eg-tooltip-wrap "><i class="eg-icon-picture"></i></a>'; echo '<a href="javascript:void(0);" title="' . __('Edit Element', EG_TEXTDOMAIN) . '" class="eg-ov-2 eg-overview-button eg-btn-edit-custom-element revgreen eg-tooltip-wrap "><i class="eg-icon-cog"></i></a>'; echo '</div>' . "\n"; echo ' </div>' . "\n"; echo ' <div class="clear"></div>' . "\n\n"; echo ' </div>' . "\n\n"; } $c_layer = 0; $t_layer = 0; $b_layer = 0; $m_layer = 0; if (!empty($this->layers)) { foreach ($this->layers as $layer) { if (isset($layer['container'])) { if (!isset($layer['settings']['position']) || $layer['settings']['position'] !== 'absolute') { switch ($layer['container']) { case 'c': $c_layer++; break; case 'tl': $t_layer++; break; case 'br': $b_layer++; break; case 'm': $m_layer++; break; } } else { //absolute element marking } } } } $is_video = false; $is_iframe = false; $echo_media = ''; if ($demo == false || $demo == 'preview' || $demo == 'custom') { $video_poster_src = ''; //check for video poster image if (!empty($this->default_video_poster_order)) { foreach ($this->default_video_poster_order as $order) { if ($order == 'no-image') { //do not show image so set image empty $video_poster_src = ''; break; } if (isset($this->media_sources[$order]) && $this->media_sources[$order] !== '' && $this->media_sources[$order] !== false) { //found entry $video_poster_src = $this->media_sources[$order]; break; } } } if (!empty($this->default_media_source_order)) { //only show if something is checked foreach ($this->default_media_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; switch ($order) { case 'featured-image': case 'alternate-image': case 'content-image': if ($this->lazy_load) { $echo_media = '<img src="' . EG_PLUGIN_URL . 'public/assets/images/300x200transparent.png" data-lazysrc="' . $this->media_sources[$order] . '" alt="' . $this->media_sources[$order . '-alt'] . '">'; } else { $echo_media = '<img src="' . $this->media_sources[$order] . '" alt="' . $this->media_sources[$order . '-alt'] . '">'; } break; case 'youtube': case 'content-youtube': //if we are masonry, we need to crop the image $video_poster_src = $this->do_poster_cropping == true ? ess_aq_resize($video_poster_src, $this->video_sizes[$this->video_ratios['youtube']]['width'], $this->video_sizes[$this->video_ratios['youtube']]['height'], true, true, true) : $video_poster_src; $echo_media = '<div class="esg-media-video" data-youtube="' . $this->media_sources[$order] . '" width="' . $this->video_sizes[$this->video_ratios['youtube']]['width'] . '" height="' . $this->video_sizes[$this->video_ratios['youtube']]['height'] . '" data-poster="' . $video_poster_src . '"></div>'; $is_video = true; break; case 'vimeo': case 'content-vimeo': //if we are masonry, we need to crop the image $video_poster_src = $this->do_poster_cropping == true ? ess_aq_resize($video_poster_src, $this->video_sizes[$this->video_ratios['vimeo']]['width'], $this->video_sizes[$this->video_ratios['vimeo']]['height'], true, true, true) : $video_poster_src; $echo_media = '<div class="esg-media-video" data-vimeo="' . $this->media_sources[$order] . '" width="' . $this->video_sizes[$this->video_ratios['vimeo']]['width'] . '" height="' . $this->video_sizes[$this->video_ratios['vimeo']]['height'] . '" data-poster="' . $video_poster_src . '"></div>'; $is_video = true; break; case 'html5': case 'content-html5': if ((!isset($this->media_sources[$order]['mp4']) || $this->media_sources[$order]['mp4'] == '') && (!isset($this->media_sources[$order]['webm']) || $this->media_sources[$order]['webm'] == '') && (!isset($this->media_sources[$order]['ogv']) || $this->media_sources[$order]['ogv'] == '')) { //not a single video is set, go to the next instead of the break $do_continue = true; continue; } //if we are masonry, we need to crop the image $video_poster_src = $this->do_poster_cropping == true ? ess_aq_resize($video_poster_src, $this->video_sizes[$this->video_ratios['html5']]['width'], $this->video_sizes[$this->video_ratios['html5']]['height'], true, true, true) : $video_poster_src; $echo_media = '<div class="esg-media-video" data-mp4="' . @$this->media_sources[$order]['mp4'] . '" data-webm="' . @$this->media_sources[$order]['webm'] . '" data-ogv="' . @$this->media_sources[$order]['ogv'] . '" width="' . $this->video_sizes[$this->video_ratios['html5']]['width'] . '" height="' . $this->video_sizes[$this->video_ratios['html5']]['height'] . '" data-poster="' . $video_poster_src . '"></div>'; $is_video = true; break; case 'soundcloud': case 'content-soundcloud': //if we are masonry, we need to crop the image $video_poster_src = $this->do_poster_cropping == true ? ess_aq_resize($video_poster_src, $this->video_sizes[$this->video_ratios['soundcloud']]['width'], $this->video_sizes[$this->video_ratios['soundcloud']]['height'], true, true, true) : $video_poster_src; $echo_media = '<div class="esg-media-video" data-soundcloud="' . $this->media_sources[$order] . '" width="' . $this->video_sizes[$this->video_ratios['soundcloud']]['width'] . '" height="' . $this->video_sizes[$this->video_ratios['soundcloud']]['height'] . '" data-poster="' . $video_poster_src . '"></div>'; $is_video = true; break; case 'iframe': $echo_media = html_entity_decode($this->media_sources[$order]); $is_iframe = true; break; case 'content-iframe': $echo_media = html_entity_decode($this->media_sources[$order]); $is_iframe = true; break; } $echo_media = apply_filters('essgrid_set_media_source', $echo_media, $order, @$this->media_sources); $is_iframe = apply_filters('essgrid_set_media_source_is_iframe', $is_iframe, $order); $is_video = apply_filters('essgrid_set_media_source_is_video', $is_video, $order); $video_poster_src = apply_filters('essgrid_set_media_source_video_poster_src', $video_poster_src, $order, @$this->video_sizes, @$this->video_ratios); $do_continue = apply_filters('essgrid_set_media_source_do_continue', $do_continue, $order); if ($do_continue) { continue; } break; } } } if ($echo_media == '') { //set default image if one is set if ($this->default_image !== '') { $echo_media = '<img src="' . $this->default_image . '" />'; $this->item_media_type = 'default-image'; } } else { $this->item_media_type = $order; } } //check if we have a full link $link_set_to = $base->getVar($this->params, 'link-set-to', 'none'); $link_type_link = $base->getVar($this->params, 'link-link-type', 'none'); $link_target = $base->getVar($this->params, 'link-target', '_self'); if ($link_target !== 'disabled') { $link_target = ' target="' . $link_target . '"'; } else { $link_target = ''; } $link_wrapper = ''; if ($link_set_to !== 'none') { switch ($link_type_link) { case 'post': if ($demo === false) { if ($is_post) { $link_wrapper = '<a href="' . get_permalink($this->post['ID']) . '"' . $link_target . '>%REPLACE%</a>'; } else { $get_link = $this->get_custom_element_value('post-link', '', ''); //get the post link if ($get_link == '') { $link_wrapper = '<a href="javascript:void(0);"' . $link_target . '>%REPLACE%</a>'; } else { $link_wrapper = '<a href="' . $get_link . '"' . $link_target . '>%REPLACE%</a>'; } } } else { $link_wrapper = '<a href="javasccript:void(0);"' . $link_target . '>%REPLACE%</a>'; } break; case 'url': $lurl = $base->getVar($this->params, 'link-url-link', 'javascript:void(0);'); if (strpos($lurl, '://') === false && trim($lurl) !== '' && $lurl !== 'javascript:void(0);') { $lurl = is_ssl() ? 'https://' . $lurl : 'http://' . $lurl; } $link_wrapper = '<a href="' . $lurl . '"' . $link_target . '>%REPLACE%</a>'; break; case 'meta': if ($demo === false) { if ($is_post) { $meta_key = $base->getVar($this->params, 'link-meta-link', 'javascript:void(0);'); $meta_link = $m->get_meta_value_by_handle($this->post['ID'], $meta_key); if ($meta_link == '') { // if empty, link to nothing $link_wrapper = '<a href="javascript:void(0);"' . $link_target . '>%REPLACE%</a>'; } else { $link_wrapper = '<a href="' . $meta_link . '"' . $link_target . '>%REPLACE%</a>'; } } else { $get_link = $this->get_custom_element_value('post-link', '', ''); //get the post link if ($get_link == '') { $link_wrapper = '<a href="javascript:void(0);"' . $link_target . '>%REPLACE%</a>'; } else { $link_wrapper = '<a href="' . $get_link . '"' . $link_target . '>%REPLACE%</a>'; } } } else { $link_wrapper = '<a href="javascript:void(0);"' . $link_target . '>%REPLACE%</a>'; } break; case 'javascript': $js_link = $base->getVar($this->params, 'link-javascript-link', 'void(0);'); $link_wrapper = '<a href="javascript:' . $js_link . '"' . $link_target . '>%REPLACE%</a>'; 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_class = ''; $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'] == 'off') { $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'; 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', '', ''); } //the title from Post Title will be used } $link_wrapper = '<a class="' . $lb_class . '" href="' . $lb_source . '" lgtitle="' . $lb_title . '"' . $lb_rel . '>%REPLACE%</a>'; $this->load_lightbox = true; //set that jQuery is written 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; } } } if ($ajax_class !== '') { //set ajax loading to true so that the grid can decide to put ajax container in top/bottom $link_wrapper = '<a href="javascript:void(0);" ' . $ajax_attr . '>%REPLACE%</a>'; $this->ajax_loading = true; } break; } } if ($m_layer > 0) { $show_content = $base->getVar($this->params, 'show-content', 'bottom'); if ($show_content == 'top') { self::insert_masonry_layer($demo, $meta_content_style, $is_video); } } if ($is_iframe != false) { //disable animation if we fill in iFrame $media_animation = ''; } echo ' <!-- THE CONTAINER FOR THE MEDIA AND THE COVER EFFECTS -->' . "\n"; echo ' <div class="esg-media-cover-wrapper">' . "\n"; echo ' <!-- THE MEDIA OF THE ENTRY -->' . "\n"; if ($demo == 'overview' || $demo == 'skinchoose') { echo ' <div class="esg-entry-media' . $media_animation . '"' . $media_animation_delay . '><img src="' . EG_PLUGIN_URL . 'admin/assets/images/' . $this->cover_image . '"></div>' . "\n\n"; } else { $echo_media = '<div class="esg-entry-media' . $media_animation . '"' . $media_animation_delay . '>' . $echo_media . '</div>' . "\n\n"; //echo media from top here if ($link_set_to == 'media' && $link_type_link !== 'none') { //set link on whole media $echo_media = str_replace('%REPLACE%', $echo_media, $link_wrapper); } echo $echo_media; } //add absolute positioned elements here $link_inserted = false; if ($is_iframe == false) { //if we are iFrame, no wrapper and no elements in media should be written echo ' <!-- THE CONTENT OF THE ENTRY -->' . "\n"; if ($cover_type == 'full' && $c_layer > 0 || ($t_layer > 0 || $c_layer > 0 || $b_layer > 0)) { $cover_attr = ''; if ($link_set_to == 'cover' && $link_type_link !== 'none') { $cover_attr = ' data-clickable="on"'; } echo ' <div class="esg-entry-cover' . $cover_group_animation . '"' . $cover_group_animation_delay . $cover_attr . '>' . "\n\n"; echo ' <!-- THE COLORED OVERLAY -->' . "\n"; if ($link_set_to == 'cover' && $link_type_link !== 'none') { if (strpos($link_wrapper, 'class="') !== false) { echo str_replace(array('%REPLACE%', 'class="'), array('', 'class="eg-invisiblebutton '), $link_wrapper); } else { echo str_replace(array('%REPLACE%', '<a '), array('', '<a class="eg-invisiblebutton" '), $link_wrapper); } $link_inserted = true; } } if ($cover_type == 'full') { $echo_c = ' <div class="esg-overlay' . $cover_animation_center . $container_class . '"' . $cover_animation_delay_center . $meta_cover_style . '></div>' . "\n\n"; if ($link_set_to == 'cover' && $link_type_link !== 'none' && $link_inserted === false) { //set link on whole cover $echo_c = str_replace('%REPLACE%', $echo_c, $link_wrapper); } echo $echo_c; } else { if ($t_layer > 0) { $echo_t = ' <div class="esg-overlay esg-top' . $cover_animation_top . $container_class . '"' . $cover_animation_delay_top . $meta_cover_style . '></div>' . "\n\n"; if ($link_set_to == 'cover' && $link_type_link !== 'none' && $link_inserted === false) { //set link on whole cover $echo_t = str_replace('%REPLACE%', $echo_t, $link_wrapper); } echo $echo_t; } if ($c_layer > 0) { $echo_c = ' <div class="esg-overlay esg-center' . $cover_animation_center . $container_class . '"' . $cover_animation_delay_center . $meta_cover_style . '></div>' . "\n\n"; if ($link_set_to == 'cover' && $link_type_link !== 'none' && $link_inserted === false) { //set link on whole cover $echo_c = str_replace('%REPLACE%', $echo_c, $link_wrapper); } echo $echo_c; } if ($b_layer > 0) { $echo_b = ' <div class="esg-overlay esg-bottom' . $cover_animation_bottom . $container_class . '"' . $cover_animation_delay_bottom . $meta_cover_style . '></div>' . "\n\n"; if ($link_set_to == 'cover' && $link_type_link !== 'none' && $link_inserted === false) { //set link on whole cover $echo_b = str_replace('%REPLACE%', $echo_b, $link_wrapper); } echo $echo_b; } } /* <!-- ######################################################################### THE CLASSES FOR THE ALIGNS OF ANY ELEMENT IS: esg-top, esg-topleft, esg-topright, esg-left, esg-right, esg-center esg-bottom, esg-bottomleft, esg-bottomright IF YOU HAVE MORE THAN ONE ELEMENT IN THE SAME ALIGNED CONTAINER, THEY WILL BE ADDED UNDER EACH OTHER IN THE SAME ALIGNED CONTAINER ######################################################################### --> */ if (!empty($this->layers)) { foreach ($this->layers as $layer) { //add all but masonry elements if (!isset($layer['container']) || $layer['container'] == 'm') { continue; } $link_to = $base->getVar($layer['settings'], 'link-type', 'none'); $hide_on_video = $base->getVar($layer['settings'], 'hide-on-video', 'false'); if ($demo === false && $this->layer_values === false) { //show element only if it is on sale or if featured if (Essential_Grid_Woocommerce::is_woo_exists()) { $show_on_sale = $base->getVar($layer['settings'], 'show-on-sale', 'false'); if ($show_on_sale == 'true') { $sale = Essential_Grid_Woocommerce::check_if_on_sale($this->post['ID']); if (!$sale) { continue; } } $show_if_featured = $base->getVar($layer['settings'], 'show-if-featured', 'false'); if ($show_if_featured == 'true') { $featured = Essential_Grid_Woocommerce::check_if_is_featured($this->post['ID']); if (!$featured) { continue; } } } } if ($link_to != 'embedded_video' && $hide_on_video == 'true' && $is_video == true) { continue; } //this element is hidden if media is video if ($demo == 'overview' || $demo == 'skinchoose' || $demo == 'custom') { self::insert_layer($layer, $demo); } else { self::insert_layer($layer); } } } if ($this->load_lightbox === true) { if (!empty($this->lightbox_additions['items'])) { $lb_rel = $this->lb_rel !== false ? ' rel="' . $this->lb_rel . '"' : ''; echo '<div style="display: none">'; foreach ($this->lightbox_additions['items'] as $lb_key => $lb_img) { if ($this->lightbox_additions['base'] == 'on' && $lb_key == 0) { continue; } //if off, the first one is already written on the handle somewhere echo '<a href="' . $lb_img . '" class="esgbox"' . $lb_rel . '></a>'; } echo '</div>'; } } if ($cover_type == 'full' && $c_layer > 0 || ($t_layer > 0 || $c_layer > 0 || $b_layer > 0)) { echo ' </div><!-- END OF THE CONTENT IN THE ENTRY -->' . "\n"; } } if ($m_layer > 0) { if ($show_content == 'bottom') { self::insert_masonry_layer($demo, $meta_content_style, $is_video); } } echo ' </div><!-- END OF THE CONTAINER FOR THE MEDIA AND COVER/HOVER EFFECTS -->' . "\n\n"; echo '</li><!-- END OF PORTFOLIO ITEM -->' . "\n"; }
*/ if (!defined('ABSPATH')) { exit; } $grid = false; $base = new Essential_Grid_Base(); $nav_skin = new Essential_Grid_Navigation(); $wa = new Essential_Grid_Widget_Areas(); $meta = new Essential_Grid_Meta(); $isCreate = $base->getGetVar('create', 'true'); $title = __('Create New Ess. Grid', EG_TEXTDOMAIN); $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);
<?php /** * @package Essential_Grid * @author ThemePunch <*****@*****.**> * @link http://www.themepunch.com/essential/ * @copyright 2014 ThemePunch */ if (!defined('ABSPATH')) { exit; } $c_grids = new Essential_Grid(); $item_skin = new Essential_Grid_Item_Skin(); $item_ele = new Essential_Grid_Item_Element(); $nav_skin = new Essential_Grid_Navigation(); $metas = new Essential_Grid_Meta(); $fonts = new ThemePunch_Fonts(); $grids = $c_grids->get_essential_grids(); $skins = $item_skin->get_essential_item_skins(); $elements = $item_ele->get_essential_item_elements(); $navigation_skins = $nav_skin->get_essential_navigation_skins(); $custom_metas = $metas->get_all_meta(); $custom_fonts = $fonts->get_all_fonts(); $token = wp_create_nonce("Essential_Grid_actions"); $import_data = false; if (isset($_FILES['import_file'])) { if ($_FILES['import_file']['error'] > 0) { echo '<div class="error"><p>' . __('Invalid file or file size too big.', EG_TEXTDOMAIN) . '</p></div>'; } else { $file_name = $_FILES['import_file']['name']; $ext = explode(".", $file_name);
public function import_grids($import_grids, $import_ids = true, $check_append = true) { if ($import_grids !== false && !empty($import_grids)) { global $wpdb; $c_grid = new Essential_Grid(); $base = new Essential_Grid_Base(); $table_name = $wpdb->prefix . Essential_Grid::TABLE_GRID; $item_skin = new Essential_Grid_Item_Skin(); $grids = $c_grid->get_essential_grids(); foreach ($import_grids as $i_grid) { if (!empty($import_ids) && is_array($import_ids)) { $found = false; foreach ($import_ids as $id) { if ($i_grid['id'] == $id) { $found = true; break; } } if (!$found) { continue; } } else { if ($import_ids != true) { //only break if we do not want to import all break; } } //create/get category and tags if there are some selected $check = json_decode($i_grid['postparams'], true); if (isset($check['post_category']) && !empty($check['post_category'])) { $slug_cats = array(); $the_cats = explode(',', $check['post_category']); foreach ($the_cats as $cat) { $raw = explode('_', $cat); $catSlug = $raw[count($raw) - 1]; unset($raw[count($raw) - 1]); $cat = implode('_', $raw); $category = $base->get_create_category_by_slug($catSlug, $cat); if ($category !== false) { //only add if we have a ID $slug_cats[] = $cat . '_' . $category; } } $check['post_category'] = implode(',', $slug_cats); $i_grid['postparams'] = json_encode($check); } $check = json_decode($i_grid['params'], true); if (isset($check['entry-skin']) && !empty($check['entry-skin'])) { $skin = $item_skin->get_id_by_handle($check['entry-skin']); if (!empty($skin)) { $check['entry-skin'] = $skin['id']; } $i_grid['params'] = json_encode($check); } $exist = false; if (!empty($grids)) { foreach ($grids as $grid) { if ($grid->handle == $i_grid['handle']) { $i_grid['id'] = $grid->id; //this will force an update $exist = true; break; } } } if ($import_ids === true) { //do not insert if handle exists. This is for the import demo data process if ($exist) { continue; } } $append = true; if ($exist) { //skin exists - append or overwrite if ($check_append) { //check in data if append or overwrite $do = $base->getVar($this->overwrite_data, 'element-overwrite-' . $i_grid['id'], 'append'); $append = $do == 'append' ? true : false; } } if ($import_ids !== true) { if ($append) { //append if ($exist) { $i_grid['handle'] = $i_grid['handle'] . '-' . date('His'); $i_grid['name'] = $i_grid['name'] . '-' . date('His'); } $response = $wpdb->insert($table_name, array('name' => $i_grid['name'], 'handle' => $i_grid['handle'], 'postparams' => $i_grid['postparams'], 'params' => $i_grid['params'], 'layers' => $i_grid['layers'])); } else { //overwrite $response = $wpdb->update($table_name, array('name' => $i_grid['name'], 'handle' => $i_grid['handle'], 'postparams' => $i_grid['postparams'], 'params' => $i_grid['params'], 'layers' => $i_grid['layers']), array('id' => $i_grid['id'])); } } else { //create or overwrite if ($exist) { $response = $wpdb->update($table_name, array('name' => $i_grid['name'], 'handle' => $i_grid['handle'], 'postparams' => $i_grid['postparams'], 'params' => $i_grid['params'], 'layers' => $i_grid['layers']), array('id' => $i_grid['id'])); } else { $response = $wpdb->insert($table_name, array('name' => $i_grid['name'], 'handle' => $i_grid['handle'], 'postparams' => $i_grid['postparams'], 'params' => $i_grid['params'], 'layers' => $i_grid['layers'])); } } } } }
<?php if (!defined('ABSPATH')) { die('No direct access allowed'); } wp_enqueue_style('my_essentials', get_template_directory_uri() . '/mdf_templates/any/my_essentials/css/styles.css'); global $mdf_loop; MDTF_SORT_PANEL::mdtf_catalog_ordering(); if (class_exists('Essential_Grid')) { $_REQUEST['mdf_is_essential'] = true; global $essential; $ess_grid_handle = Essential_Grid::get_alias_by_id($essential); echo do_shortcode('[ess_grid alias="' . $ess_grid_handle . '"][/ess_grid]'); }
public function export_essential_grid() { require_once ABSPATH . 'wp-content/plugins/essential-grid/essential-grid.php'; $c_grid = new Essential_Grid(); $export_grids = array(); $grids = $c_grid->get_essential_grids(); foreach ($grids as $grid) { $export_grids[] = $grid->id; } $export_skins = array(); $item_skin = new Essential_Grid_Item_Skin(); $skins = $item_skin->get_essential_item_skins('all', false); foreach ($skins as $skin) { $export_grids[] = $skin['id']; } $export_elements = array(); $c_elements = new Essential_Grid_Item_Element(); $elements = $c_elements->get_essential_item_elements(); foreach ($elements as $element) { $export_elements[] = $element['id']; } $export_navigation_skins = array(); $c_nav_skins = new Essential_Grid_Navigation(); $nav_skins = $c_nav_skins->get_essential_navigation_skins(); foreach ($nav_skins as $nav_skin) { $export_navigation_skins[] = $nav_skin['id']; } $export_custom_meta = array(); $metas = new Essential_Grid_Meta(); $custom_metas = $metas->get_all_meta(); foreach ($custom_metas as $custom_meta) { $export_custom_meta[] = $custom_meta['handle']; } $export_punch_fonts = array(); $fonts = new ThemePunch_Fonts(); $custom_fonts = $fonts->get_all_fonts(); foreach ($custom_fonts as $custom_font) { $export_punch_fonts[] = $custom_font['handle']; } $export = array(); $ex = new Essential_Grid_Export(); //export Grids if (!empty($export_grids)) { $export['grids'] = $ex->export_grids($export_grids); } //export Skins if (!empty($export_skins)) { $export['skins'] = $ex->export_skins($export_skins); } //export Elements if (!empty($export_elements)) { $export['elements'] = $ex->export_elements($export_elements); } //export Navigation Skins if (!empty($export_navigation_skins)) { $export['navigation-skins'] = $ex->export_navigation_skins($export_navigation_skins); } //export Custom Meta if (!empty($export_custom_meta)) { $export['custom-meta'] = $ex->export_custom_meta($export_custom_meta); } //export Punch Fonts if (!empty($export_punch_fonts)) { $export['punch-fonts'] = $ex->export_punch_fonts($export_punch_fonts); } //export Global Styles $export['global-css'] = $ex->export_global_styles('on'); $this->save_as_txt_file('essential_grid.txt', json_encode($export)); }
/** * widget output */ public function widget($args, $instance) { $grid_id = $instance["ess_grid"]; $title = @$instance["ess_grid_title"]; if (empty($grid_id)) { return false; } $base = new Essential_Grid_Base(); $grid = new Essential_Grid(); $grids = $grid->get_grids_short_widgets(); if (!isset($grids[$grid_id])) { return false; } $grid_handle = $grids[$grid_id]; //widget output $beforeWidget = $args["before_widget"]; $afterWidget = $args["after_widget"]; $beforeTitle = $args["before_title"]; $afterTitle = $args["after_title"]; echo $beforeWidget; if (!empty($title)) { echo $beforeTitle . $title . $afterTitle; } if ($base->is_shortcode_with_handle_exist($grid_handle)) { $eg_nav = new Essential_Grid_Navigation(); $eg_nav->output_cart(); } echo $afterWidget; }
<?php /** * Fired when the plugin is uninstalled. * * @package Essential_Grid * @author ThemePunch <*****@*****.**> * @link http://www.themepunch.com/essential/ * @copyright 2014 ThemePunch */ // If uninstall not called from WordPress, then exit if (!defined('WP_UNINSTALL_PLUGIN')) { exit; } require_once plugin_dir_path(__FILE__) . '/public/essential-grid.class.php'; Essential_Grid::uninstall_plugin(true); /* global $wpdb; //Delete Database Tables $wpdb->query( "DROP TABLE ". $wpdb->prefix . Essential_Grid::TABLE_GRID); $wpdb->query( "DROP TABLE ". $wpdb->prefix . Essential_Grid::TABLE_ITEM_SKIN); $wpdb->query( "DROP TABLE ". $wpdb->prefix . Essential_Grid::TABLE_ITEM_ELEMENTS); $wpdb->query( "DROP TABLE ". $wpdb->prefix . Essential_Grid::TABLE_NAVIGATION_SKINS); //Delete Options delete_option('tp_eg_role'); delete_option('tp_eg_grids_version'); delete_option('tp_eg_custom_css'); delete_option('tp_eg_output_protection');
/** * return search result ID's * @since: 2.0 */ public static function output_search_result_ids($search, $grid_id = 0) { $grid_id = intval($grid_id); if ($search == '' || $grid_id === 0) { return __('Not found', EG_TEXTDOMAIN); } $grid = new Essential_Grid(); if ($grid->init_by_id($grid_id) === false) { return __('Not found', EG_TEXTDOMAIN); } $base = new Essential_Grid_Base(); $post_category = $grid->get_postparam_by_handle('post_category'); $post_types = $grid->get_postparam_by_handle('post_types'); $page_ids = explode(',', $grid->get_postparam_by_handle('selected_pages', '-1')); $start_sortby = $grid->get_param_by_handle('sorting-order-by-start', 'none'); $start_sortby_type = $grid->get_param_by_handle('sorting-order-type', 'ASC'); $max_entries = $grid->get_maximum_entries($grid); $cat_tax = Essential_Grid_Base::getCatAndTaxData($post_category); $additional_query = $grid->get_postparam_by_handle('additional-query', ''); if ($additional_query !== '') { $additional_query .= '&s=' . $search; } else { $additional_query .= 's=' . $search; } $additional_query = wp_parse_args($additional_query); ob_start(); $posts = Essential_Grid_Base::getPostsByCategory($grid_id, $cat_tax['cats'], $post_types, $cat_tax['tax'], $page_ids, $start_sortby, $start_sortby_type, $max_entries, $additional_query, false); ob_clean(); ob_end_clean(); if (empty($posts) || count($posts) === 0) { return __('Not found', EG_TEXTDOMAIN); } $ids = array(); foreach ($posts as $post) { $ids[] = $post['ID']; } return $ids; }
/** * 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; }