| Server IP : 89.248.107.232 / Your IP : 216.73.217.70 Web Server : Apache System : Linux host2.kasilh.com 5.14.0-687.36.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 7 05:40:49 EDT 2026 x86_64 User : seg ( 10005) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/seg-sa.es/atjconsultores.com/wp-content/themes/StoreFront/ |
Upload File : |
<?php
/**
* GavernWP functions and definitions
*
* This file contains core framework operations. It is always
* loaded before the index.php file no the front-end
*
* @package WordPress
* @subpackage GavernWP
* @since GavernWP 1.0
**/
if(!function_exists('gavern_file')) {
/**
*
* Function used to get the file absolute path - useful when child theme is used
*
* @return file absolute path (in the original theme or in the child theme if file exists)
*
**/
function gavern_file($path) {
if(is_child_theme()) {
if($path == false) {
return get_stylesheet_directory();
} else {
if(is_file(get_stylesheet_directory() . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path))) {
return get_stylesheet_directory() . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path);
} else {
return get_template_directory() . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path);
}
}
} else {
if($path == false) {
return get_template_directory();
} else {
return get_template_directory() . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path);
}
}
}
}
if(!function_exists('gavern_file_uri')) {
/**
*
* Function used to get the file URI - useful when child theme is used
*
* @return file URI (in the original theme or in the child theme if file exists)
*
**/
function gavern_file_uri($path) {
if(is_child_theme()) {
if($path == false) {
return get_stylesheet_directory_uri();
} else {
if(is_file(get_stylesheet_directory() . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path))) {
return get_stylesheet_directory_uri() . '/' . $path;
} else {
return get_template_directory_uri() . '/' . $path;
}
}
} else {
if($path == false) {
return get_template_directory_uri();
} else {
return get_template_directory_uri() . '/' . $path;
}
}
}
}
//
if(!class_exists('GavernWP')) {
// include the framework base class
require(gavern_file('gavern/base.php'));
}
// load and parse template JSON file.
$config_language = 'en_US';
if(get_locale() != '' && is_dir(get_template_directory() . '/gavern/config/'. get_locale()) && is_dir(get_template_directory() . '/gavern/options/'. get_locale())) {
$config_language = get_locale();
}
$json_data = json_decode(file_get_contents(get_template_directory() . '/gavern/config/'.$config_language.'/template.json'));
$gk_tpl_name = strtolower(preg_replace("/[^A-Za-z0-9]/", "", $json_data->template->name));
// define constant to use with all __(), _e(), _n(), _x() and _xe() usage
define('GKTPLNAME', $gk_tpl_name);
// create the framework object
$gk_tpl = new GavernWP();
// Including file with helper functions
require_once(gavern_file('gavern/helpers/helpers.base.php'));
// Including file with template hooks
require_once(gavern_file('gavern/hooks.php'));
// Including file with template functions
require_once(gavern_file('gavern/functions.php'));
require_once(gavern_file('gavern/user.functions.php'));
// Including file with woocommerce functions
if (isset($woocommerce)) :
require_once(gavern_file('gavern/wc-functions.php'));
endif;
// Including file with template filters
require_once(gavern_file('gavern/filters.php'));
// Including file with template widgets
require_once(gavern_file('gavern/widgets.comments.php'));
// Including file with template admin features
require_once(gavern_file('gavern/helpers/helpers.features.php'));
// Including file with template shortcodes
require_once(gavern_file('gavern/helpers/helpers.shortcodes.php'));
// Including file with template layout functions
require_once(gavern_file('gavern/helpers/helpers.layout.php'));
// Including file with template layout functions - connected with template fragments
require_once(gavern_file('gavern/helpers/helpers.layout.fragments.php'));
// Including file with template branding functions
require_once(gavern_file('gavern/helpers/helpers.branding.php'));
// Including file with template customize functions
require_once(gavern_file('gavern/helpers/helpers.customizer.php'));
// initialize the framework
$gk_tpl->init();
// add theme setup function
add_action('after_setup_theme', 'gavern_theme_setup');
// Theme setup function
function gavern_theme_setup(){
// access to the global template object
global $gk_tpl;
// variable used for redirects
global $pagenow;
// check if the themes.php address with goto variable has been used
if ($pagenow == 'themes.php' && !empty($_GET['goto'])) {
/**
*
* IMPORTANT FACT: if you're using few different redirects on a lot of subpages
* we recommend to define it as themes.php?goto=X, because if you want to
* change the URL for X, then you can change it on one place below :)
*
**/
// check the goto value
switch ($_GET['goto']) {
// make proper redirect
case 'gavick-com':
wp_redirect("http://www.gavick.com");
break;
case 'wiki':
wp_redirect("http://www.gavick.com/documentation");
break;
// or use default redirect
default:
wp_safe_redirect('/wp-admin/');
break;
}
exit;
}
// if the normal page was requested do following operations:
// load and parse template JSON file.
$json_data = $gk_tpl->get_json('config','template');
// read the configuration
$template_config = $json_data->template;
// save the lowercase non-special characters template name
$template_name = strtolower(preg_replace("/[^A-Za-z0-9]/", "", $template_config->name));
// load the template text_domain
load_theme_textdomain( $template_name, get_stylesheet_directory() . '/languages' );
}
// scripts enqueue function
function gavern_enqueue_admin_js_and_css() {
// metaboxes scripts
wp_enqueue_script('gavern.metabox.js', gavern_file_uri('js/back-end/gavern.metabox.js'));
// widget rules JS
wp_register_script('widget-rules-js', gavern_file_uri('js/back-end/widget.rules.js'), array('jquery'));
wp_enqueue_script('widget-rules-js');
// widget rules CSS
wp_register_style('widget-rules-css', gavern_file_uri('css/back-end/widget.rules.css'));
wp_enqueue_style('widget-rules-css');
// metaboxes CSS
wp_register_style('gavern-metabox-css', gavern_file_uri('css/back-end/metabox.css'));
wp_enqueue_style('gavern-metabox-css');
// shortcodes database
if(
get_locale() != '' &&
is_dir(get_template_directory() . '/gavern/config/'. get_locale()) &&
is_dir(get_template_directory() . '/gavern/options/'. get_locale())
) {
$language = get_locale();
} else {
$language = 'en_US';
}
wp_enqueue_script('shortcodes.js', gavern_file_uri('gavern/config/'.$language.'/shortcodes.js'));
}
// this action enqueues scripts and styles:
// http://wpdevel.wordpress.com/2011/12/12/use-wp_enqueue_scripts-not-wp_print_styles-to-enqueue-scripts-and-styles-for-the-frontend/
add_action('admin_enqueue_scripts', 'gavern_enqueue_admin_js_and_css');
// remove the generator metatag due security reasons
remove_action('wp_head', 'wp_generator');
// EOF
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name'=>'Redes sociales Top',
'before_widget' => '<div class="widgetredes">',
'after_widget' => '</div>',
'before_title' => '<span class="widgettitle">',
'after_title' => '</span>'
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name'=>'Mainbody Bottom Portada',
'before_widget' => '<div class="widgetmbotportada">',
'after_widget' => '</div>',
'before_title' => '<span class="widgettitle">',
'after_title' => '</span>'
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name'=>'Slider portada',
'before_widget' => '<div class="widgetsliderportada">',
'after_widget' => '</div>',
'before_title' => '<span class="widgettitle">',
'after_title' => '</span>'
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name'=>'Logo pie',
'before_widget' => '<div class="widget-area gk-page widgetlogopie">',
'after_widget' => '</div>',
'before_title' => '<span class="widgettitle">',
'after_title' => '</span>'
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name'=>'Legales',
'before_widget' => '<div class="widgetlegales">',
'after_widget' => '</div>',
'before_title' => '<span class="widgettitle">',
'after_title' => '</span>'
));
remove_filter('the_content', 'wpautop'); //para quitar los <p> automaticos