/**
  * 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;
     }
 }
示例#2
0
    /**
     * Insert Global Settings Dialog
     * @since    1.0.0
     */
    public static function globalSettingsDialog()
    {
        $curPermission = Essential_Grid_Admin::getPluginPermissionValue();
        $output_protection = get_option('tp_eg_output_protection', 'none');
        $tooltips = get_option('tp_eg_tooltips', 'true');
        $wait_for_fonts = get_option('tp_eg_wait_for_fonts', 'true');
        $js_to_footer = get_option('tp_eg_js_to_footer', 'false');
        $use_cache = get_option('tp_eg_use_cache', 'false');
        $query_type = get_option('tp_eg_query_type', 'wp_query');
        $enable_log = get_option('tp_eg_enable_log', 'false');
        $use_lightbox = get_option('tp_eg_use_lightbox', 'false');
        if (Essential_Grid_Jackbox::jb_exists()) {
            $jb_active = true;
        } else {
            //disable jackbox and reset to default if it was set until now
            if ($use_lightbox == 'jackbox') {
                update_option('tp_eg_use_lightbox', 'false');
            }
            $jb_active = false;
        }
        if (Essential_Grid_Social_Gallery::sg_exists()) {
            $sg_active = true;
        } else {
            //disable jackbox and reset to default if it was set until now
            if ($use_lightbox == 'sg') {
                update_option('tp_eg_use_lightbox', 'false');
            }
            $sg_active = false;
        }
        ?>
		<div id="global-settings-dialog-wrap" class="essential-dialog-wrap" title="<?php 
        _e('Global Settings', EG_TEXTDOMAIN);
        ?>
"  style="display: none;">
			<p>
				<label><?php 
        echo _e('View Plugin Permissions', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="plugin_permissions">
					<option <?php 
        echo $curPermission == Essential_Grid_Admin::ROLE_ADMIN ? 'selected="selected" ' : '';
        ?>
value="admin"><?php 
        _e('Admin', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $curPermission == Essential_Grid_Admin::ROLE_EDITOR ? 'selected="selected" ' : '';
        ?>
value="editor"><?php 
        _e('Editor, Admin', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $curPermission == Essential_Grid_Admin::ROLE_AUTHOR ? 'selected="selected" ' : '';
        ?>
value="author"><?php 
        _e('Author, Editor, Admin', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
			</p>
			<p>
				<label><?php 
        echo _e('Advanced Tooltips', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="plugin_tooltips">
					<option <?php 
        echo $tooltips == 'true' ? 'selected="selected" ' : '';
        ?>
value="true"><?php 
        _e('On', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $tooltips == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Off', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('Show or Hide the Tooltips on Hover over the Settings in Essential Grid Backend. ', EG_TEXTDOMAIN);
        ?>
</i>
			</p>
			<p>
				<label><?php 
        echo _e('Wait for Fonts', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="wait_for_fonts">
					<option <?php 
        echo $wait_for_fonts == 'true' ? 'selected="selected" ' : '';
        ?>
value="true"><?php 
        _e('On', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $wait_for_fonts == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Off', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('In case Options is enabled, the Grid will always wait till the Google Fonts has been loaded, before the grid starts.', EG_TEXTDOMAIN);
        ?>
</i>
			</p>
			<p>
				<label><?php 
        echo _e('Output Filter Protection', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="output_protection">
					<option <?php 
        echo $output_protection == 'none' ? 'selected="selected" ' : '';
        ?>
value="none"><?php 
        _e('None', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $output_protection == 'compress' ? 'selected="selected" ' : '';
        ?>
value="compress"><?php 
        _e('By Compressing Output', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $output_protection == 'echo' ? 'selected="selected" ' : '';
        ?>
value="echo"><?php 
        _e('By Echo Output', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('The HTML Markup is printed in compressed form, or it is written due Echo instead of Reutrn. In some case Echo will move the full Grid to the top/bottom of the page ! ', EG_TEXTDOMAIN);
        ?>
</i>				
			</p>
			<p>
				<label><?php 
        echo _e('JS To Footer', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="js_to_footer">
					<option <?php 
        echo $js_to_footer == 'true' ? 'selected="selected" ' : '';
        ?>
value="true"><?php 
        _e('On', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $js_to_footer == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Off', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('Defines where the jQuery files should be loaded in the DOM.', EG_TEXTDOMAIN);
        ?>
</i>				
			</p>
			<p>
				<label><?php 
        echo _e('Select LightBox Type', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="use_lightbox">
					<option <?php 
        echo $use_lightbox == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Default LightBox', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $use_lightbox == 'jackbox' ? 'selected="selected" ' : '';
        ?>
value="jackbox" <?php 
        echo $jb_active === true ? '' : ' disabled="disabled"';
        ?>
><?php 
        _e('JackBox', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $use_lightbox == 'sg' ? 'selected="selected" ' : '';
        ?>
value="sg" <?php 
        echo $sg_active === true ? '' : ' disabled="disabled"';
        ?>
><?php 
        _e('Social Gallery', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $use_lightbox == 'disabled' ? 'selected="selected" ' : '';
        ?>
value="disabled"><?php 
        _e('Disable LightBox', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('Select the default LightBox to be used.<br>- The JackBox WordPress plugin is available <a href="http://codecanyon.net/item/jackbox-responsive-lightbox-wordpress-plugin/3357551" target="_blank">here</a>,<br>- The Social Gallery plugin can be found <a href="http://codecanyon.net/item/social-gallery-wordpress-photo-viewer-plugin/2665332" target="_blank">here</a>', EG_TEXTDOMAIN);
        ?>
</i>				
			</p>
			<p>
				<label><?php 
        echo _e('Use Own Caching System', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="use_cache">
					<option <?php 
        echo $use_cache == 'true' ? 'selected="selected" ' : '';
        ?>
value="true"><?php 
        _e('On', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $use_cache == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Off', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<a href="#" id="ess-grid-delete-cache" class="button-primary revblue"><?php 
        echo _e('delete cache', EG_TEXTDOMAIN);
        ?>
</a>
				<i style=""><?php 
        echo _e('Essential Grid has two Caching Engines !  The Primary cache will precache Post Queries to provide a quicker result of queries.  The "Own" Caching system will additional allow to cache the Grid HTML Markup also, to provide an extreme quick Result of output. This cache should be deleted after any changes ! Only for advanced users.', EG_TEXTDOMAIN);
        ?>
</i>								 
			</p>
			<p>
				<label><?php 
        echo _e('Set Query Type Used', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="query_type">
					<option <?php 
        echo $query_type == 'wp_query' ? 'selected="selected" ' : '';
        ?>
value="wp_query"><?php 
        _e('WP_Query()', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $query_type == 'get_posts' ? 'selected="selected" ' : '';
        ?>
value="get_posts"><?php 
        _e('get_posts()', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('If this is changed, caching of Essential Grid may be required to be deleted!', EG_TEXTDOMAIN);
        ?>
</i>
			</p>
			<p>
				<label><?php 
        echo _e('Enable Debug Log', EG_TEXTDOMAIN);
        ?>
:</label>
				<select name="enable_log">
					<option <?php 
        echo $enable_log == 'true' ? 'selected="selected" ' : '';
        ?>
value="true"><?php 
        _e('On', EG_TEXTDOMAIN);
        ?>
</option>
					<option <?php 
        echo $enable_log == 'false' ? 'selected="selected" ' : '';
        ?>
value="false"><?php 
        _e('Off', EG_TEXTDOMAIN);
        ?>
</option>
				</select>
				<i style=""><?php 
        echo _e('This enables console logs for debugging purposes.', EG_TEXTDOMAIN);
        ?>
</i>								 
			</p>
		</div>
		<?php 
    }
 /**
  * insert layer
  */
 public function insert_layer($layer, $demo = false, $masonry = false)
 {
     $base = new Essential_Grid_Base();
     $m = new Essential_Grid_Meta();
     $is_post = !empty($this->layer_values) ? false : true;
     if ($demo === false) {
         $post = $this->post;
         $layer_values = $this->layer_values;
     } else {
         $post['ID'] = '0';
         //set default if we are in demo mode
     }
     //check advanced rules
     $show = $this->check_advanced_rules($layer, $post);
     if ($show === false) {
         return false;
     }
     $position = $base->getVar($layer, 'container', 'tl');
     $class = 'top';
     switch ($position) {
         case 'tl':
             $class = 'top';
             break;
         case 'br':
             $class = 'bottom';
             break;
         case 'c':
             $class = 'center';
             break;
         case 'm':
             $class = 'content';
             break;
     }
     if (!isset($layer['settings'])) {
         return false;
     }
     $this->register_layer_css($layer, $demo);
     $unique_class = 'eg-' . esc_attr($this->handle) . '-element-' . $layer['id'];
     $special_item = $base->getVar($layer['settings'], 'special', 'false');
     $special_item_type = $base->getVar($layer['settings'], 'special-type', 'line-break');
     /*if($special_item != 'true'){
     			$this->add_element_css($layer['settings'], $unique_class); //add css to queue
     		}*/
     //check if absolute positioned, remove class depending on it
     $absolute = $this->is_absolute_position($unique_class);
     if ($absolute) {
         $class = 'absolute';
     }
     $hideunderHTML = '';
     $hideunderClass = '';
     $hideunder = $base->getVar($layer['settings'], 'hideunder', 0, 'i');
     $hideunderheight = $base->getVar($layer['settings'], 'hideunderheight', 0, 'i');
     $hideundertype = $base->getVar($layer['settings'], 'hidetype', 'visibility');
     if ($hideunder > 0) {
         $hideunderHTML .= ' data-hideunder="' . $hideunder . '"';
         $hideunderClass = 'eg-handlehideunder ';
     }
     if ($hideunderheight > 0) {
         $hideunderHTML .= ' data-hideunderheight="' . $hideunderheight . '"';
         $hideunderClass = 'eg-handlehideunder ';
     }
     if ($hideunderHTML !== '') {
         $hideunderHTML .= ' data-hidetype="' . $hideundertype . '"';
     }
     $delay = '';
     $transition_split = '';
     if ($masonry) {
         $transition = '';
         //$transition_split = '';
     } else {
         $transition = ' esg-' . $base->getVar($layer['settings'], 'transition', 'fade') . $base->getVar($layer['settings'], 'transition-type', '');
         //$transition_split = ' data-split="'.$base->getVar($layer['settings'], 'split', 'line').'"';
         $meta_tran = $this->get_meta_element_change($layer['id'], 'transition');
         //check if we have meta transition set
         if ($meta_tran !== false) {
             $transition = ' esg-' . $meta_tran;
         }
         if ($transition == ' esg-none' || $transition == ' esg-noneout' || $base->getVar($layer['settings'], 'transition-type', '') == 'always') {
             //no transition
             $transition = '';
             //$transition_split = '';
         } else {
             $delay = ' data-delay="' . round($base->getVar($layer['settings'], 'delay', 0) / 100, 2) . '"';
             $meta_tran_delay = $this->get_meta_element_change($layer['id'], 'transition-delay');
             //check if we have meta transition-delay set
             if ($meta_tran_delay !== false) {
                 $delay = ' data-delay="' . round($meta_tran_delay / 100, 2) . '"';
             }
         }
     }
     $text = '';
     $do_limit = true;
     $do_display = true;
     $do_full = false;
     $do_ignore_styles = false;
     $is_woo_cats = false;
     $is_woo_button = false;
     $is_html_source = false;
     $is_filter_cat = false;
     $demo_element_type = ' data-custom-type="%s"';
     if (isset($layer['settings']['source'])) {
         $separator = $base->getVar($layer['settings'], 'source-separate', ',');
         $meta = $base->getVar($layer['settings'], 'source-meta', '');
         $func = $base->getVar($layer['settings'], 'source-function', 'link');
         switch ($layer['settings']['source']) {
             case 'post':
                 if ($demo === false) {
                     if ($is_post) {
                         $text = $this->get_post_value($layer['settings']['source-post'], $separator, $func, $meta);
                     } else {
                         $text = $this->get_custom_element_value($layer['settings']['source-post'], $separator, $meta);
                     }
                     if ($func == 'filter') {
                         $is_filter_cat = true;
                     }
                 } elseif ($demo === 'custom') {
                     $text = $this->get_custom_element_value($layer['settings']['source-post'], $separator, $meta);
                 } else {
                     $post_text = Essential_Grid_Item_Element::getPostElementsArray();
                     if (array_key_exists(@$layer['settings']['source-post'], $post_text)) {
                         $text = $post_text[@$layer['settings']['source-post']]['name'];
                     }
                     if ($layer['settings']['source-post'] == 'date') {
                         $da = get_option('date_format');
                         if ($da !== false) {
                             $text = date(get_option('date_format'));
                         } else {
                             $text = date('Y.m.d');
                         }
                     }
                 }
                 $demo_element_type = str_replace('%s', $layer['settings']['source-post'], $demo_element_type);
                 if ($layer['settings']['source-post'] == 'cat_list' || $layer['settings']['source-post'] == 'tag_list') {
                     //no limiting if category or tag list
                     $do_limit = false;
                     $do_display = false;
                     $do_full = true;
                 }
                 break;
             case 'event':
                 if ($demo === false) {
                 } else {
                     $event = Essential_Grid_Item_Element::getEventElementsArray();
                     if (array_key_exists(@$layer['settings']['source-event'], $event)) {
                         $text = $event[@$layer['settings']['source-event']]['name'];
                     }
                 }
                 $demo_element_type = str_replace('%s', $layer['settings']['source-event'], $demo_element_type);
                 break;
             case 'woocommerce':
                 //check if woocommerce is installed
                 if ($demo === false) {
                     if (Essential_Grid_Woocommerce::is_woo_exists()) {
                         if ($is_post) {
                             $text = $this->get_woocommerce_value($layer['settings']['source-woocommerce'], $separator);
                         } else {
                             $text = $this->get_custom_element_value($layer['settings']['source-woocommerce'], $separator, '');
                         }
                         if ($layer['settings']['source-woocommerce'] == 'wc_categories') {
                             $do_limit = false;
                             $do_display = false;
                             $do_full = true;
                             $is_woo_cats = true;
                         } elseif ($layer['settings']['source-woocommerce'] == 'wc_add_to_cart_button') {
                             $do_limit = false;
                             $is_woo_button = true;
                         }
                     }
                 } elseif ($demo === 'custom') {
                     if (Essential_Grid_Woocommerce::is_woo_exists()) {
                         $text = $this->get_custom_element_value($layer['settings']['source-woocommerce'], $separator, '');
                         if ($layer['settings']['source-woocommerce'] == 'wc_categories') {
                             $do_limit = false;
                             $do_display = false;
                             $do_full = true;
                             $is_woo_cats = true;
                         } elseif ($layer['settings']['source-woocommerce'] == 'wc_add_to_cart_button') {
                             $do_limit = false;
                             $is_woo_button = true;
                         }
                     }
                 } else {
                     if (Essential_Grid_Woocommerce::is_woo_exists()) {
                         $tmp_wc = Essential_Grid_Woocommerce::get_meta_array();
                         foreach ($tmp_wc as $handle => $name) {
                             $woocommerce[$handle]['name'] = $name;
                         }
                         if (array_key_exists(@$layer['settings']['source-woocommerce'], $woocommerce)) {
                             $text = $woocommerce[@$layer['settings']['source-woocommerce']]['name'];
                         }
                     }
                 }
                 $demo_element_type = str_replace('%s', $layer['settings']['source-woocommerce'], $demo_element_type);
                 break;
             case 'icon':
                 $text = '<i class="' . @$layer['settings']['source-icon'] . '"></i>';
                 $demo_element_type = '';
                 break;
             case 'text':
                 $text = @$layer['settings']['source-text'];
                 if ($demo === false) {
                     //check for metas by %meta%
                     if ($is_post) {
                         $text = $m->replace_all_meta_in_text($this->post['ID'], $text);
                     } else {
                         $text = $m->replace_all_custom_element_meta_in_text($this->layer_values, $text);
                     }
                 }
                 if (@$layer['settings']['source-text-style-disable']) {
                     $do_ignore_styles = true;
                 }
                 $do_display = false;
                 $demo_element_type = '';
                 $is_html_source = true;
                 break;
             default:
                 $demo_element_type = '';
         }
         if ($do_limit) {
             $limit_by = $base->getVar($layer['settings'], 'limit-type', 'none');
             if ($limit_by !== 'none') {
                 switch ($layer['settings']['source']) {
                     case 'post':
                     case 'event':
                     case 'woocommerce':
                         $text = $base->get_text_intro($text, $base->getVar($layer['settings'], 'limit-num', 10, 'i'), $limit_by);
                         break;
                 }
             }
         }
     }
     $link_to = $base->getVar($layer['settings'], 'link-type', 'none');
     $link_target = $base->getVar($layer['settings'], 'link-target', '_self');
     if ($link_target !== 'disabled') {
         $link_target = ' target="' . $link_target . '"';
     } else {
         $link_target = '';
     }
     $video_play = '';
     $ajax_class = '';
     $ajax_attr = '';
     $lb_class = '';
     switch ($link_to) {
         case 'post':
             if ($demo === false) {
                 if ($is_post) {
                     $text = '<a href="' . get_permalink($post['ID']) . '"' . $link_target . '>' . $text . '</a>';
                 } else {
                     $get_link = $this->get_custom_element_value('post-link', $separator, '');
                     //get the post link
                     if ($get_link == '') {
                         $text = '<a href="javascript:void(0);"' . $link_target . '>' . $text . '</a>';
                     } else {
                         $text = '<a href="' . $get_link . '"' . $link_target . '>' . $text . '</a>';
                     }
                 }
             } else {
                 $text = '<a href="javasccript:void(0);"' . $link_target . '>' . $text . '</a>';
             }
             break;
         case 'url':
             $lurl = $base->getVar($layer['settings'], 'link-type-url', 'javascript:void(0);');
             if (strpos($lurl, '://') === false && trim($lurl) !== '' && $lurl !== 'javascript:void(0);') {
                 $lurl = is_ssl() ? 'https://' . $lurl : 'http://' . $lurl;
             }
             $text = '<a href="' . $lurl . '"' . $link_target . '>' . $text . '</a>';
             break;
         case 'meta':
             if ($demo === false) {
                 if ($is_post) {
                     $meta_key = $base->getVar($layer['settings'], 'link-type-meta', 'javascript:void(0);');
                     $meta_link = $m->get_meta_value_by_handle($post['ID'], $meta_key);
                     if ($meta_link == '') {
                         // if empty, link to nothing
                         $text = '<a href="javascript:void(0);"' . $link_target . '>' . $text . '</a>';
                     } else {
                         $text = '<a href="' . $meta_link . '"' . $link_target . '>' . $text . '</a>';
                     }
                 } else {
                     $meta_key = $base->getVar($layer['settings'], 'link-type-meta', '');
                     $get_link = $this->get_custom_element_value('post-link', $separator, $meta_key);
                     //get the post link
                     if ($get_link == '') {
                         $text = '<a href="javascript:void(0);"' . $link_target . '>' . $text . '</a>';
                     } else {
                         $text = '<a href="' . $get_link . '"' . $link_target . '>' . $text . '</a>';
                     }
                 }
             } else {
                 $text = '<a href="javascript:void(0);"' . $link_target . '>' . $text . '</a>';
             }
             break;
         case 'javascript':
             $text = '<a href="javascript:' . $base->getVar($layer['settings'], 'link-type-javascript', 'void(0);') . '"' . $link_target . '>' . $text . '</a>';
             //javascript-link
             break;
         case 'lightbox':
             if (!Essential_Grid_Jackbox::is_active() && !Essential_Grid_Social_Gallery::is_active()) {
                 //enqueue only if default LightBox is selected
                 wp_enqueue_script('themepunchboxext');
                 wp_enqueue_style('themepunchboxextcss');
             }
             $lb_source = '#';
             $lb_addition = '';
             $lb_rel = $this->lb_rel !== false ? ' rel="' . $this->lb_rel . '"' : '';
             if (!empty($this->default_lightbox_source_order)) {
                 //only show if something is checked
                 foreach ($this->default_lightbox_source_order as $order) {
                     //go through the order and set media as wished
                     if (isset($this->media_sources[$order]) && $this->media_sources[$order] !== '' && $this->media_sources[$order] !== false) {
                         //found entry
                         $do_continue = false;
                         if (!empty($this->lightbox_additions['items']) && $this->lightbox_additions['base'] == 'on') {
                             $lb_source = $this->lightbox_additions['items'][0];
                             $lb_class = ' esgbox';
                         } else {
                             switch ($order) {
                                 case 'featured-image':
                                 case 'alternate-image':
                                 case 'content-image':
                                     if ($order == 'content-image') {
                                         $lb_source = $this->media_sources[$order];
                                     } else {
                                         $lb_source = $this->media_sources[$order . '-full'];
                                     }
                                     $lb_class = ' esgbox';
                                     break;
                                 case 'youtube':
                                     $http = is_ssl() ? 'https' : 'http';
                                     $lb_source = $http . '://www.youtube.com/watch?v=' . $this->media_sources[$order];
                                     $lb_class = ' esgbox';
                                     break;
                                 case 'vimeo':
                                     $http = is_ssl() ? 'https' : 'http';
                                     $lb_source = $http . '://vimeo.com/' . $this->media_sources[$order];
                                     $lb_class = ' esgbox';
                                     break;
                                 case 'iframe':
                                     //$lb_source = html_entity_decode($this->media_sources[$order]);
                                     //$lb_class = ' esgbox';
                                     $do_continue = true;
                                     break;
                                 case 'html5':
                                     if (trim($this->media_sources[$order]['mp4']) === '' && trim($this->media_sources[$order]['ogv']) === '' && trim($this->media_sources[$order]['webm'] === '')) {
                                         $do_continue = true;
                                     } else {
                                         $lb_mp4 = $this->media_sources[$order]['mp4'];
                                         $lb_ogv = $this->media_sources[$order]['ogv'];
                                         $lb_webm = $this->media_sources[$order]['webm'];
                                         $lb_source = "#";
                                         $lb_class = ' esgbox esgboxhtml5';
                                         $lb_addition = ' data-mp4="' . $lb_mp4 . '" data-ogv="' . $lb_ogv . '" data-webm="' . $lb_webm . '"';
                                     }
                                     break;
                                 default:
                                     $do_continue = true;
                                     break;
                             }
                         }
                         if ($do_continue) {
                             continue;
                         }
                         break;
                     }
                 }
             }
             if ($demo !== false) {
                 $lb_title = __('demo mode', EG_TEXTDOMAIN);
             } else {
                 if ($is_post) {
                     $lb_title = $base->getVar($this->post, 'post_title', '');
                 } else {
                     $lb_title = $this->get_custom_element_value('title', $separator, '');
                 }
                 //the title from Post Title will be used
             }
             $text = '<a href="' . $lb_source . '"' . $lb_addition . ' lgtitle="' . $lb_title . '"' . $lb_rel . '>' . $text . '</a>';
             $this->load_lightbox = true;
             //set that jQuery is written
             break;
         case 'embedded_video':
             $video_play = ' esg-click-to-play-video';
             break;
         case 'ajax':
             $ajax_class = '';
             if (!empty($this->default_ajax_source_order)) {
                 //only show if something is checked
                 $ajax_class = ' eg-ajaxclicklistener';
                 foreach ($this->default_ajax_source_order as $order) {
                     //go through the order and set media as wished
                     $do_continue = false;
                     if (isset($this->media_sources[$order]) && $this->media_sources[$order] !== '' && $this->media_sources[$order] !== false || $order == 'post-content') {
                         //found entry
                         switch ($order) {
                             case 'youtube':
                                 $vid_ratio = $this->video_ratios['youtube'] == '0' ? '4:3' : '16:9';
                                 $ajax_attr = ' data-ajaxtype="youtubeid"';
                                 // postid, html5vid youtubeid vimeoid soundcloud revslider
                                 $ajax_attr .= ' data-ajaxsource="' . $this->media_sources[$order] . '"';
                                 //depending on type
                                 $ajax_attr .= ' data-ajaxvideoaspect="' . $vid_ratio . '"';
                                 //depending on type
                                 break;
                             case 'vimeo':
                                 $vid_ratio = $this->video_ratios['vimeo'] == '0' ? '4:3' : '16:9';
                                 $ajax_attr = ' data-ajaxtype="vimeoid"';
                                 // postid, html5vid youtubeid vimeoid soundcloud revslider
                                 $ajax_attr .= ' data-ajaxsource="' . $this->media_sources[$order] . '"';
                                 //depending on type
                                 $ajax_attr .= ' data-ajaxvideoaspect="' . $vid_ratio . '"';
                                 //depending on type
                                 break;
                             case 'html5':
                                 if ($this->media_sources[$order]['mp4'] == '' && $this->media_sources[$order]['webm'] == '' && $this->media_sources[$order]['ogv'] == '') {
                                     $do_continue = true;
                                 } else {
                                     //mp4/webm/ogv
                                     $vid_ratio = $this->video_ratios['html5'] == '0' ? '4:3' : '16:9';
                                     $ajax_attr = ' data-ajaxtype="html5vid"';
                                     // postid, html5vid youtubeid vimeoid soundcloud revslider
                                     $ajax_attr .= ' data-ajaxsource="';
                                     $ajax_attr .= @$this->media_sources[$order]['mp4'] . '|';
                                     $ajax_attr .= @$this->media_sources[$order]['webm'] . '|';
                                     $ajax_attr .= @$this->media_sources[$order]['ogv'];
                                     $ajax_attr .= '"';
                                     $ajax_attr .= ' data-ajaxvideoaspect="' . $vid_ratio . '"';
                                     //depending on type
                                 }
                                 break;
                             case 'soundcloud':
                                 $ajax_attr = ' data-ajaxtype="soundcloudid"';
                                 // postid, html5vid youtubeid vimeoid soundcloud revslider
                                 $ajax_attr .= ' data-ajaxsource="' . $this->media_sources[$order] . '"';
                                 //depending on type
                                 break;
                             case 'post-content':
                                 if ($is_post) {
                                     $ajax_attr = ' data-ajaxtype="postid"';
                                     // postid, html5vid youtubeid vimeoid soundcloud revslider
                                     $ajax_attr .= ' data-ajaxsource="' . @$this->post['ID'] . '"';
                                     //depending on type
                                 } else {
                                     $do_continue = true;
                                     //$ajax_class = '';
                                 }
                                 break;
                             case 'featured-image':
                             case 'alternate-image':
                             case 'content-image':
                                 $img_url = '';
                                 if ($order == 'content-image') {
                                     $img_url = $this->media_sources[$order];
                                 } else {
                                     $img_url = $this->media_sources[$order . '-full'];
                                 }
                                 $ajax_attr = ' data-ajaxtype="imageurl"';
                                 // postid, html5vid youtubeid vimeoid soundcloud revslider
                                 $ajax_attr .= ' data-ajaxsource="' . $img_url . '"';
                                 //depending on type
                                 break;
                             default:
                                 $ajax_class = '';
                                 $do_continue = true;
                                 break;
                         }
                         if ($do_continue) {
                             continue;
                         }
                         break;
                     } else {
                         //some custom entry maybe
                         $postobj = $is_post ? $this->post : false;
                         $ajax_attr = apply_filters('essgrid_handle_ajax_content', $order, $this->media_sources, $postobj, $this->grid_id);
                         if (empty($ajax_attr)) {
                             //$ajax_class = '';
                             $do_continue = true;
                         }
                         if ($do_continue) {
                             continue;
                         }
                         break;
                     }
                 }
             }
             //$ajax_attr .= ' data-ajaxcallback=""'; //functionname
             //$ajax_attr .= ' data-ajaxcsstoload=""'; //css source
             //$ajax_attr .= ' data-ajaxjstoload=""'; //js source
             if ($ajax_class !== '') {
                 //set ajax loading to true so that the grid can decide to put ajax container in top/bottom
                 $this->ajax_loading = true;
             }
             break;
     }
     if ($link_to !== 'none') {
         $do_display = true;
     }
     //set back to true if a link is set on layer
     $text = trim($text);
     //check for special styling coming from post option and set css to the queue
     $this->set_meta_element_changes($layer['id'], $unique_class);
     $post_class = !isset($post['ID']) ? '' : ' eg-post-' . $post['ID'];
     if ($base->text_has_certain_tag($text, 'a') && !$do_ignore_styles) {
         //check if a tag exists, if yes, class will be set to a tags and not the wrapping div, also the div will receive the position and other stylings // && @$layer['settings']['source'] !== 'text'
         if ($is_woo_cats && strpos($text, 'class="') !== false || $is_woo_button || $is_filter_cat && strpos($text, 'class="') !== false) {
             //add to the classes instead of creating own class attribute if it is woocommerce cats AND a class can be found
             $text = str_replace('class="', 'class="' . $unique_class . $post_class . $lb_class . ' ', $text);
         } elseif ($is_html_source && strpos($text, 'class="') !== false) {
             $text = str_replace('<a', '<a class="' . $unique_class . $post_class . $lb_class . '"', $text);
         } else {
             $text = str_replace('<a', '<a class="' . $unique_class . $post_class . $lb_class . '"', $text);
         }
         //moved to more global css generation process @version: 2.0
         //$this->add_css_wrap[$unique_class]['a']['display'] = $do_display; //do_display defines if we should write display: block;
         //$this->add_css_wrap[$unique_class]['a']['full'] = $do_full; //do full styles (for categories and tags separator)
         $unique_class .= '-a';
     }
     if ($do_ignore_styles) {
         $unique_class = 'eg-' . esc_attr($this->handle) . '-nostyle-element-' . $layer['id'];
     }
     //replace all the normal shortcodes
     $text = do_shortcode($text);
     if ($special_item == 'true' && $special_item_type == 'line-break') {
         //line break element
         echo '              <div class="esg-' . $class . ' ' . $unique_class . ' esg-none esg-clear" style="height: 5px; visibility: hidden;"></div>' . "\n";
     } elseif (trim($text) !== '') {
         //}elseif(!empty($text)){
         $use_tag = $base->getVar($layer['settings'], 'tag-type', 'div');
         echo '				<' . $use_tag . ' class="esg-' . $class . $post_class . $video_play . $ajax_class . ' ' . $hideunderClass . $unique_class . $transition . '"' . $ajax_attr . $transition_split . $delay . $hideunderHTML;
         echo $demo == 'custom' ? $demo_element_type : '';
         echo '>';
         echo $text;
         echo '</' . $use_tag . '>' . "\n";
     }
 }
示例#4
0
 public function output_grid_javascript($load_lightbox = false, $is_demo = false)
 {
     $base = new Essential_Grid_Base();
     $hide_markup_before_load = $base->getVar($this->grid_params, 'hide-markup-before-load', 'off');
     $layout = $base->getVar($this->grid_params, 'layout', 'even');
     $force_full_width = $base->getVar($this->grid_params, 'force_full_width', 'off');
     $content_push = $base->getVar($this->grid_params, 'content-push', 'off');
     $rows_unlimited = $base->getVar($this->grid_params, 'rows-unlimited', 'on');
     $load_more_type = $base->getVar($this->grid_params, 'load-more', 'on');
     $rows = $base->getVar($this->grid_params, 'rows', 4, 'i');
     $columns = $base->getVar($this->grid_params, 'columns', '');
     $columns = $base->set_basic_colums($columns);
     $columns_advanced = $base->getVar($this->grid_params, 'columns-advanced', 'off');
     if ($columns_advanced == 'on') {
         $columns_width = $base->getVar($this->grid_params, 'columns-width', '');
     } else {
         $columns_width = array();
         //get defaults
     }
     $columns_width = $base->set_basic_colums_width($columns_width);
     $space = $base->getVar($this->grid_params, 'spacings', 0, 'i');
     $page_animation = $base->getVar($this->grid_params, 'grid-animation', 'scale');
     $anim_speed = $base->getVar($this->grid_params, 'grid-animation-speed', 800, 'i');
     $delay_basic = $base->getVar($this->grid_params, 'grid-animation-delay', 1, 'i');
     $delay_hover = $base->getVar($this->grid_params, 'hover-animation-delay', 1, 'i');
     $filter_type = $base->getVar($this->grid_params, 'filter-arrows', 'single');
     $filter_logic = $base->getVar($this->grid_params, 'filter-logic', 'or');
     $filter_show_on = $base->getVar($this->grid_params, 'filter-show-on', 'hover');
     $lightbox_mode = $base->getVar($this->grid_params, 'lightbox-mode', 'single');
     $lightbox_mode = $lightbox_mode == 'content' || $lightbox_mode == 'content-gallery' || $lightbox_mode == 'woocommerce-gallery' ? 'contentgroup' : $lightbox_mode;
     $layout_sizing = $base->getVar($this->grid_params, 'layout-sizing', 'boxed');
     $layout_offset_container = $base->getVar($this->grid_params, 'fullscreen-offset-container', '');
     $aspect_ratio_x = $base->getVar($this->grid_params, 'x-ratio', 4, 'i');
     $aspect_ratio_y = $base->getVar($this->grid_params, 'y-ratio', 3, 'i');
     $lazy_load = $base->getVar($this->grid_params, 'lazy-loading', 'off');
     $lazy_load_color = $base->getVar($this->grid_params, 'lazy-load-color', '#FFFFFF');
     $spinner = $base->getVar($this->grid_params, 'use-spinner', '0');
     $spinner_color = $base->getVar($this->grid_params, 'spinner-color', '#FFFFFF');
     //LIGHTBOX VARIABLES
     $usetwitter = $base->getVar($this->grid_params, 'lightbox-twitter', 'off');
     $usefacebook = $base->getVar($this->grid_params, 'lightbox-facebook', 'off');
     $lightbox_title_type = $base->getVar($this->grid_params, 'lightbox-type', "null");
     $lightbox_position = $base->getVar($this->grid_params, 'lightbox-position', 'bottom');
     $lightbox_effect_open_close = $base->getVar($this->grid_params, 'lightbox-effect-open-close', 'fade');
     $lightbox_effect_next_prev = $base->getVar($this->grid_params, 'lightbox-effect-next-prev', 'fade');
     $lightbox_effect_open_close_speed = $base->getVar($this->grid_params, 'lightbox-effect-open-close-speed', 'normal');
     $lightbox_effect_next_prev_speed = $base->getVar($this->grid_params, 'lightbox-effect-next-prev-speed', 'normal');
     $lightbox_arrows = $base->getVar($this->grid_params, 'lightbox-arrows', 'on');
     $lightbox_thumbs = $base->getVar($this->grid_params, 'lightbox-thumbs', 'off');
     $lightbox_thumbs_w = $base->getVar($this->grid_params, 'lbox-thumb-w', '50');
     $lightbox_thumbs_h = $base->getVar($this->grid_params, 'lbox-thumb-h', '50');
     $linebreak = '\'<br />\'';
     $twitteraddon = '\'<a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="\'+this.href+\'">' . __('Tweet', EG_TEXTDOMAIN) . '</a>\'';
     $facebookaddon = '\'<iframe src="//www.facebook.com/plugins/like.php?href=\'+this.href+\'&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:23px;" allowTransparency="true"></iframe>\'';
     $lbox_padding = $base->getVar($this->grid_params, 'lbox-padding', array('0', '0', '0', '0'));
     $lbox_inpadding = $base->getVar($this->grid_params, 'lbox-inpadding', array('0', '0', '0', '0'));
     $rtl = $base->getVar($this->grid_params, 'rtl', 'off');
     $wait_for_fonts = get_option('tp_eg_wait_for_fonts', 'true');
     $pagination_numbers = $base->getVar($this->grid_params, 'pagination-numbers', 'smart');
     $pagination_scroll = $base->getVar($this->grid_params, 'pagination-scroll', 'off');
     $pagination_scroll_offset = $base->getVar($this->grid_params, 'pagination-scroll-offset', '0', 'i');
     $ajax_callback = $base->getVar($this->grid_params, 'ajax-callback', '');
     $ajax_css_url = $base->getVar($this->grid_params, 'ajax-css-url', '');
     $ajax_js_url = $base->getVar($this->grid_params, 'ajax-js-url', '');
     $ajax_scroll_onload = $base->getVar($this->grid_params, 'ajax-scroll-onload', 'on');
     $ajax_callback_argument = $base->getVar($this->grid_params, 'ajax-callback-arg', 'on');
     $ajax_content_id = $base->getVar($this->grid_params, 'ajax-container-id', '');
     $ajax_scrollto_offset = $base->getVar($this->grid_params, 'ajax-scrollto-offset', '0');
     $ajax_close_button = $base->getVar($this->grid_params, 'ajax-close-button', 'off');
     $ajax_button_nav = $base->getVar($this->grid_params, 'ajax-nav-button', 'off');
     $ajax_content_sliding = $base->getVar($this->grid_params, 'ajax-content-sliding', 'on');
     $ajax_button_type = $base->getVar($this->grid_params, 'ajax-button-type', 'button');
     if ($ajax_button_type == 'type2') {
         $ajax_button_text = $base->getVar($this->grid_params, 'ajax-button-text', __('Close', EG_TEXTDOMAIN));
     }
     $ajax_button_skin = $base->getVar($this->grid_params, 'ajax-button-skin', 'light');
     $ajax_button_inner = $base->getVar($this->grid_params, 'ajax-button-inner', 'false');
     $ajax_button_h_pos = $base->getVar($this->grid_params, 'ajax-button-h-pos', 'r');
     $ajax_button_v_pos = $base->getVar($this->grid_params, 'ajax-button-v-pos', 't');
     $cobbles_pattern = $base->getVar($this->grid_params, 'cobbles-pattern', array());
     $use_cobbles_pattern = $base->getVar($this->grid_params, 'use-cobbles-pattern', 'off');
     $cookie_time = intval($base->getVar($this->grid_params, 'cookie-save-time', '30'));
     $cookie_search = $base->getVar($this->grid_params, 'cookie-save-search', 'off');
     $cookie_filter = $base->getVar($this->grid_params, 'cookie-save-filter', 'off');
     $cookie_pagination = $base->getVar($this->grid_params, 'cookie-save-pagination', 'off');
     $js_to_footer = get_option('tp_eg_js_to_footer', 'false') == 'true' ? true : false;
     //add inline style into the footer
     if ($js_to_footer && $is_demo == false) {
         ob_start();
     }
     echo '<script type="text/javascript">' . "\n";
     if ($hide_markup_before_load == 'off') {
         echo 'function eggbfc(winw,resultoption) {' . "\n";
         echo '	var lasttop = winw,' . "\n";
         echo '	lastbottom = 0,' . "\n";
         echo '	smallest =9999,' . "\n";
         echo '	largest = 0,' . "\n";
         echo '	samount = 0,' . "\n";
         echo '	lamoung = 0,' . "\n";
         echo '	lastamount = 0,' . "\n";
         echo '	resultid = 0,' . "\n";
         echo '	resultidb = 0,' . "\n";
         echo '	responsiveEntries = [' . "\n";
         echo '						{ width:' . $columns_width['0'] . ',amount:' . $columns['0'] . '},' . "\n";
         echo '						{ width:' . $columns_width['1'] . ',amount:' . $columns['1'] . '},' . "\n";
         echo '						{ width:' . $columns_width['2'] . ',amount:' . $columns['2'] . '},' . "\n";
         echo '						{ width:' . $columns_width['3'] . ',amount:' . $columns['3'] . '},' . "\n";
         echo '						{ width:' . $columns_width['4'] . ',amount:' . $columns['4'] . '},' . "\n";
         echo '						{ width:' . $columns_width['5'] . ',amount:' . $columns['5'] . '},' . "\n";
         echo '						{ width:' . $columns_width['6'] . ',amount:' . $columns['6'] . '}' . "\n";
         echo '						];' . "\n";
         echo '	if (responsiveEntries!=undefined && responsiveEntries.length>0)' . "\n";
         echo '		jQuery.each(responsiveEntries, function(index,obj) {' . "\n";
         echo '			var curw = obj.width != undefined ? obj.width : 0,' . "\n";
         echo '				cura = obj.amount != undefined ? obj.amount : 0;' . "\n";
         echo '			if (smallest>curw) {' . "\n";
         echo '				smallest = curw;' . "\n";
         echo '				samount = cura;' . "\n";
         echo '				resultidb = index;' . "\n";
         echo '			}' . "\n";
         echo '			if (largest<curw) {' . "\n";
         echo '				largest = curw;' . "\n";
         echo '				lamount = cura;' . "\n";
         echo '			}' . "\n";
         echo '			if (curw>lastbottom && curw<=lasttop) {' . "\n";
         echo '				lastbottom = curw;' . "\n";
         echo '				lastamount = cura;' . "\n";
         echo '				resultid = index;' . "\n";
         echo '			}' . "\n";
         echo '		})' . "\n";
         echo '		if (smallest>winw) {' . "\n";
         echo '			lastamount = samount;' . "\n";
         echo '			resultid = resultidb;' . "\n";
         echo '		}' . "\n";
         echo '		var obj = new Object;' . "\n";
         echo '		obj.index = resultid;' . "\n";
         echo '		obj.column = lastamount;' . "\n";
         echo '		if (resultoption=="id")' . "\n";
         echo '			return obj;' . "\n";
         echo '		else' . "\n";
         echo '			return lastamount;' . "\n";
         echo '	}' . "\n";
         echo 'if ("' . $layout . '"=="even") {' . "\n";
         echo '	var coh=0,' . "\n";
         echo '		container = jQuery("#esg-grid-' . $this->grid_div_name . '-' . $this->grid_serial . '");' . "\n";
         if ($layout_sizing == 'fullscreen') {
             echo 'coh = jQuery(window).height();' . "\n";
             if ($layout_offset_container !== '') {
                 echo 'try{' . "\n";
                 echo '	var offcontainers = "' . $layout_offset_container . '".split(",");' . "\n";
                 echo '	jQuery.each(offcontainers,function(index,searchedcont) {' . "\n";
                 echo '		coh = coh - jQuery(searchedcont).outerHeight(true);' . "\n";
                 echo '	})' . "\n";
                 echo '} catch(e) {}' . "\n";
             }
         } else {
             echo '	var	cwidth = container.width(),' . "\n";
             echo '		ar = "' . $aspect_ratio_x . ':' . $aspect_ratio_y . '",' . "\n";
             echo '		gbfc = eggbfc(jQuery(window).width(),"id"),' . "\n";
             if ($rows_unlimited == 'on') {
                 echo '	row = 2;' . "\n";
             } else {
                 echo '	row = ' . $rows . ';' . "\n";
             }
             echo 'ar = ar.split(":");' . "\n";
             echo 'aratio=parseInt(ar[0],0) / parseInt(ar[1],0);' . "\n";
             echo 'coh = cwidth / aratio;' . "\n";
             echo 'coh = coh/gbfc.column*row;' . "\n";
         }
         echo '	var ul = container.find("ul").first();' . "\n";
         echo '	ul.css({display:"block",height:coh+"px"});' . "\n";
         echo '}' . "\n";
     }
     echo 'var essapi_' . $this->grid_api_name . ';' . "\n";
     echo 'jQuery(document).ready(function() {' . "\n";
     echo '	essapi_' . $this->grid_api_name . ' = jQuery("#esg-grid-' . $this->grid_div_name . '-' . $this->grid_serial . '").tpessential({' . "\n";
     echo '        gridID:' . $this->grid_id . ',' . "\n";
     echo '        layout:"' . $layout . '",' . "\n";
     if ($rtl == 'on') {
         echo '        rtl:"on",' . "\n";
     }
     echo '        forceFullWidth:"' . $force_full_width . '",' . "\n";
     echo '        lazyLoad:"' . $lazy_load . '",' . "\n";
     if ($lazy_load == 'on') {
         echo '        lazyLoadColor:"' . $lazy_load_color . '",' . "\n";
     }
     if ($rows_unlimited == 'on') {
         $load_more = $base->getVar($this->grid_params, 'load-more', 'button');
         $load_more_amount = $base->getVar($this->grid_params, 'load-more-amount', 3, 'i');
         $load_more_show_number = $base->getVar($this->grid_params, 'load-more-show-number', 'on');
         if ($load_more !== 'none') {
             $load_more_text = $base->getVar($this->grid_params, 'load-more-text', __('Load More', EG_TEXTDOMAIN));
             echo '        gridID:"' . $this->grid_id . '",' . "\n";
             echo '        loadMoreType:"' . $load_more . '",' . "\n";
             echo '        loadMoreAmount:' . $load_more_amount . ',' . "\n";
             echo '        loadMoreTxt:"' . $load_more_text . '",' . "\n";
             echo '        loadMoreNr:"' . $load_more_show_number . '",' . "\n";
             echo '        loadMoreEndTxt:"' . __('No More Items for the Selected Filter', EG_TEXTDOMAIN) . '",' . "\n";
             echo '        loadMoreItems:';
             $this->output_load_more_list();
             echo ',' . "\n";
         }
         echo '        row:9999,' . "\n";
     } else {
         echo '        row:' . $rows . ',' . "\n";
     }
     $token = wp_create_nonce('Essential_Grid_Front');
     echo '        loadMoreAjaxToken:"' . $token . '",' . "\n";
     echo '        loadMoreAjaxUrl:"' . admin_url('admin-ajax.php') . '",' . "\n";
     echo '        loadMoreAjaxAction:"Essential_Grid_Front_request_ajax",' . "\n";
     echo '        ajaxContentTarget:"' . $ajax_content_id . '",' . "\n";
     echo '        ajaxScrollToOffset:"' . $ajax_scrollto_offset . '",' . "\n";
     echo '        ajaxCloseButton:"' . $ajax_close_button . '",' . "\n";
     echo '        ajaxContentSliding:"' . $ajax_content_sliding . '",' . "\n";
     if ($ajax_callback !== '') {
         echo '        ajaxCallback:"' . stripslashes($ajax_callback) . '",' . "\n";
     }
     if ($ajax_css_url !== '') {
         echo '        ajaxCssUrl:"' . $ajax_css_url . '",' . "\n";
     }
     if ($ajax_js_url !== '') {
         echo '        ajaxJsUrl:"' . $ajax_js_url . '",' . "\n";
     }
     if ($ajax_scroll_onload !== 'off') {
         echo '        ajaxScrollToOnLoad:"on",' . "\n";
     }
     if ($ajax_callback_argument == 'on') {
         echo '        ajaxCallbackArgument:"on",' . "\n";
     }
     echo '        ajaxNavButton:"' . $ajax_button_nav . '",' . "\n";
     echo '        ajaxCloseType:"' . $ajax_button_type . '",' . "\n";
     if ($ajax_button_type == 'type2') {
         echo '        ajaxCloseTxt:"' . $ajax_button_text . '",' . "\n";
     }
     echo '        ajaxCloseInner:"' . $ajax_button_inner . '",' . "\n";
     echo '        ajaxCloseStyle:"' . $ajax_button_skin . '",' . "\n";
     $ajax_button_h_pos = $base->getVar($this->grid_params, 'ajax-button-h-pos', 'r');
     $ajax_button_v_pos = $base->getVar($this->grid_params, 'ajax-button-v-pos', 't');
     if ($ajax_button_h_pos == 'c') {
         echo '        ajaxClosePosition:"' . $ajax_button_v_pos . '",' . "\n";
     } else {
         echo '        ajaxClosePosition:"' . $ajax_button_v_pos . $ajax_button_h_pos . '",' . "\n";
     }
     echo '        space:' . $space . ',' . "\n";
     echo '        pageAnimation:"' . $page_animation . '",' . "\n";
     if ($pagination_numbers == 'full') {
         echo '        smartPagination:"off",' . "\n";
     }
     echo '        paginationScrollToTop:"' . $pagination_scroll . '",' . "\n";
     if ($pagination_scroll == 'on') {
         echo '        paginationScrollToOffset:' . $pagination_scroll_offset . ',' . "\n";
     }
     echo '        spinner:"spinner' . $spinner . '",' . "\n";
     if ($spinner != '0' && $spinner != '5') {
         echo '        spinnerColor:"' . $spinner_color . '",' . "\n";
     }
     if ($layout_sizing == 'fullwidth') {
         echo '        forceFullWidth:"on",' . "\n";
     } elseif ($layout_sizing == 'fullscreen') {
         echo '        forceFullScreen:"on",' . "\n";
         if ($layout_offset_container !== '') {
             echo '        fullScreenOffsetContainer:"' . $layout_offset_container . '",' . "\n";
         }
     }
     if ($layout == 'even') {
         echo '        evenGridMasonrySkinPusher:"' . $content_push . '",' . "\n";
     }
     echo '        lightBoxMode:"' . $lightbox_mode . '",' . "\n";
     if (!empty($cobbles_pattern) && $layout == 'cobbles' && $use_cobbles_pattern == 'on') {
         echo '        cobblesPattern:"' . implode(',', $cobbles_pattern) . '",' . "\n";
     }
     echo '        animSpeed:' . $anim_speed . ',' . "\n";
     echo '        delayBasic:' . $delay_basic . ',' . "\n";
     echo '        mainhoverdelay:' . $delay_hover . ',' . "\n";
     echo '        filterType:"' . $filter_type . '",' . "\n";
     if ($filter_type == 'multi') {
         echo '        filterLogic:"' . $filter_logic . '",' . "\n";
     }
     echo '        showDropFilter:"' . $filter_show_on . '",' . "\n";
     echo '        filterGroupClass:"esg-fgc-' . $this->grid_id . '",' . "\n";
     if ($wait_for_fonts === 'true') {
         $tf_fonts = new ThemePunch_Fonts();
         $fonts = $tf_fonts->get_all_fonts();
         if (!empty($fonts)) {
             $first = true;
             $font_string = '[';
             foreach ($fonts as $font) {
                 if ($first === false) {
                     $font_string .= ',';
                 }
                 $font_string .= "'" . esc_attr($font['url']) . "'";
                 $first = false;
             }
             $font_string .= ']';
             echo '        googleFonts:' . $font_string . ',' . "\n";
         }
     }
     if ($cookie_search === 'on' || $cookie_filter === 'on' || $cookie_pagination === 'on') {
         echo '        cookies: {' . "\n";
         if ($cookie_search == 'on') {
             echo '                search:"' . $cookie_search . '",' . "\n";
         }
         if ($cookie_filter == 'on') {
             echo '                filter:"' . $cookie_filter . '",' . "\n";
         }
         if ($cookie_pagination == 'on') {
             echo '                pagination:"' . $cookie_pagination . '",' . "\n";
         }
         echo '                timetosave:"' . $cookie_time . '"' . "\n";
         echo '        },' . "\n";
     }
     if ($layout != 'masonry') {
         echo '        aspectratio:"' . $aspect_ratio_x . ':' . $aspect_ratio_y . '",' . "\n";
     }
     echo '        responsiveEntries: [' . "\n";
     echo '						{ width:' . $columns_width['0'] . ',amount:' . $columns['0'] . '},' . "\n";
     echo '						{ width:' . $columns_width['1'] . ',amount:' . $columns['1'] . '},' . "\n";
     echo '						{ width:' . $columns_width['2'] . ',amount:' . $columns['2'] . '},' . "\n";
     echo '						{ width:' . $columns_width['3'] . ',amount:' . $columns['3'] . '},' . "\n";
     echo '						{ width:' . $columns_width['4'] . ',amount:' . $columns['4'] . '},' . "\n";
     echo '						{ width:' . $columns_width['5'] . ',amount:' . $columns['5'] . '},' . "\n";
     echo '						{ width:' . $columns_width['6'] . ',amount:' . $columns['6'] . '}' . "\n";
     echo '						]';
     if ($columns_advanced == 'on') {
         $this->output_ratio_list();
     }
     echo "\n";
     echo '	});' . "\n\n";
     //check if lightbox is active
     $opt = get_option('tp_eg_use_lightbox', 'false');
     if ($load_lightbox && !Essential_Grid_Jackbox::is_active() && !Essential_Grid_Social_Gallery::is_active() && $opt !== 'disabled') {
         echo '	try{' . "\n";
         echo '	jQuery("#esg-grid-' . $this->grid_div_name . '-' . $this->grid_serial . ' .esgbox").esgbox({' . "\n";
         echo '		padding : [' . $lbox_padding[0] . ',' . $lbox_padding[1] . ',' . $lbox_padding[2] . ',' . $lbox_padding[3] . '],' . "\n";
         echo '      afterLoad:function() { ' . "\n";
         echo ' 		if (this.element.hasClass("esgboxhtml5")) {' . "\n";
         echo '		   var mp = this.element.data("mp4"),' . "\n";
         echo '		      ogv = this.element.data("ogv"),' . "\n";
         echo '		      webm = this.element.data("webm");' . "\n";
         echo '         this.content =\'<div style="width:100%;height:100%;"><video autoplay="true" loop="" class="rowbgimage" poster="" width="100%" height="auto"><source src="\'+mp+\'" type="video/mp4"><source src="\'+webm+\'" type="video/webm"><source src="\'+ogv+\'" type="video/ogg"></video></div>\';	' . "\n";
         echo '		   var riint = setInterval(function() {jQuery(window).trigger("resize");},100); setTimeout(function() {clearInterval(riint);},2500);' . "\n";
         echo '		   };' . "\n";
         echo '		 },' . "\n";
         /*	echo '		ajax: { type:"post",url:'.admin_url('admin-ajax.php').',dataType:"json",data:{
         		 action: "Essential_Grid_Front_request_ajax",
         	     client_action: "load_more_content",
         	     token: '.$token.',
         	     postid:postid}, success:function(data) { jQuery.esgbox(data.data)} },'."\n";*/
         echo '		beforeShow : function () { ' . "\n";
         echo '			this.title = jQuery(this.element).attr(\'lgtitle\');' . "\n";
         echo '			if (this.title) {' . "\n";
         if ($lightbox_title_type == "null") {
             echo '				this.title="";' . "\n";
         }
         if ($usetwitter == "on" || $usefacebook == "on") {
             echo '				this.title += ' . $linebreak . ';' . "\n";
         }
         if ($usetwitter == "on") {
             echo '				this.title += ' . $twitteraddon . ';' . "\n";
         }
         if ($usefacebook == "on") {
             echo '				this.title += ' . $facebookaddon . ';' . "\n";
         }
         echo '   		this.title =  \'<div style="padding:' . $lbox_inpadding[0] . 'px ' . $lbox_inpadding[1] . 'px ' . $lbox_inpadding[2] . 'px ' . $lbox_inpadding[3] . 'px">\'+this.title+\'</div>\';' . "\n";
         echo '			}' . "\n";
         echo '		},' . "\n";
         echo '		afterShow : function() {' . "\n";
         if ($usetwitter == "on") {
             echo '			twttr.widgets.load();' . "\n";
         }
         echo '		},' . "\n";
         echo '		openEffect : \'' . $lightbox_effect_open_close . '\',' . "\n";
         echo '		closeEffect : \'' . $lightbox_effect_open_close . '\',' . "\n";
         echo '		nextEffect : \'' . $lightbox_effect_next_prev . '\',' . "\n";
         echo '		prevEffect : \'' . $lightbox_effect_next_prev . '\',' . "\n";
         echo '		openSpeed : \'' . $lightbox_effect_open_close_speed . '\',' . "\n";
         echo '		closeSpeed : \'' . $lightbox_effect_open_close_speed . '\',' . "\n";
         echo '		nextSpeed : \'' . $lightbox_effect_next_prev_speed . '\',' . "\n";
         echo '		prevSpeed : \'' . $lightbox_effect_next_prev_speed . '\',' . "\n";
         if ($lightbox_arrows == "off") {
             echo '		arrows : false,' . "\n";
         }
         echo '		helpers : {' . "\n";
         echo '			media : {},' . "\n";
         if ($lightbox_thumbs == "on") {
             echo '			thumbs: {' . "\n";
             echo '				width : ' . $lightbox_thumbs_w . ',' . "\n";
             echo '				height : ' . $lightbox_thumbs_h . "\n";
             echo '			},' . "\n";
         }
         echo '		    title : {' . "\n";
         if ($lightbox_title_type != "null") {
             echo '				type:"' . $lightbox_title_type . '",' . "\n";
         } else {
             echo '				type:""' . "\n";
         }
         if ($lightbox_title_type != "null") {
             echo '				position:"' . $lightbox_position . '",' . "\n";
         }
         echo '			}' . "\n";
         echo '		}' . "\n";
         echo '});' . "\n" . "\n";
         echo ' } catch (e) {}' . "\n" . "\n";
     }
     //output custom javascript if any is set
     $custom_javascript = stripslashes($base->getVar($this->grid_params, 'custom-javascript', ''));
     if ($custom_javascript !== '') {
         echo $custom_javascript;
     }
     echo '});' . "\n";
     echo '</script>' . "\n";
     if ($js_to_footer && $is_demo == false) {
         $js_content = ob_get_contents();
         ob_clean();
         ob_end_clean();
         $this->grid_inline_js = $js_content;
         add_action('wp_footer', array($this, 'add_inline_js'));
     }
 }
示例#5
0
							<p>
							<?php 
_e('First Ordered Poster Source will be loaded as default. If source not exist, next available Poster source in order will be taken', EG_TEXTDOMAIN);
?>
							</p>
						</div>
						<div style="clear:both"></div>
					</div>
				</div>
			</div>

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