| Server IP : 130.225.57.55 / Your IP : 216.73.216.60 Web Server : Apache System : Linux wp-vhost07 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /srv/www/reco2st.eu/https/wp-content/themes/erc04961/ |
Upload File : |
<?php
/**
* The Includes Loader
*
* How to:
* 1. Create a file like: class-banner-controller.php
* 2. In the file write a class like: MInc_Banner_Controller
* 3. The class will be autoloaded when called (no need to require/include), eg:
* `new MInc_Banner_Controller();` or `MInc_Banner_Controller::get_title();`
*/
// Register the class autoloader for
// the mozaik library
spl_autoload_register( function ( $class ) {
$prefix = 'MInc_';
if ( substr( $class, 0, strlen( $prefix ) ) == $prefix ) {
$class = substr( $class, strlen( $prefix ) );
} else {
return;
}
$class = strtolower( $class );
$class = str_replace( '_', '-', $class );
$path = __DIR__ . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . "class-$class.php";
if ( file_exists( $path ) ) {
include $path;
}
} );
/* =========================================
ACTION HOOKS & FILTERS
========================================= */
/* * --- Actions ---* */
/**
* Setup the theme
*
* @since 1.0
*/
if ( !function_exists( 'moz_base_theme_setup' ) ) {
function moz_base_theme_setup() {
// Let wp know we want to use html5 for content
add_theme_support( 'html5', array(
'comment-list',
'comment-form',
'search-form',
'gallery',
'caption'
) );
// Let wp know we want to use post thumbnails
add_theme_support( 'post-thumbnails' );
// Stop WP from printing emoji service on the front
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
// Remove toolbar for all users in front end
show_admin_bar( false );
// WPML configuration
// disable plugin from printing styles and js
// we are going to handle all that ourselves.
if ( !is_admin() ) {
define( 'ICL_DONT_LOAD_NAVIGATION_CSS', true );
define( 'ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true );
define( 'ICL_DONT_LOAD_LANGUAGES_JS', true );
}
// Register Autoloaders Loader
$theme_dir = get_template_directory();
include "$theme_dir/library/library-loader.php";
// include "$theme_dir/includes/includes-loader.php";
include "$theme_dir/components/components-loader.php";
}
}
/**
* Register and/or Enqueue
* Styles for the theme
*
* @since 1.0
*/
if ( !function_exists( 'moz_base_theme_styles' ) ) {
function moz_base_theme_styles() {
$theme_dir = get_template_directory_uri();
wp_enqueue_style( 'main', "$theme_dir/assets/css/main.css", array(), null, 'all' );
}
}
/**
* Register and/or Enqueue
* Scripts for the theme
*
* @since 1.0
*/
if ( !function_exists( 'moz_base_theme_scripts' ) ) {
function moz_base_theme_scripts() {
$api_key = MOZ_THEME_GOOGLE_MAPS_API_KEY;
$theme_dir = get_template_directory_uri();
wp_enqueue_script( 'google-maps', "//maps.google.com/maps/api/js?key=$api_key&sensor=false", [], null, false );
wp_enqueue_script( 'main', "$theme_dir/assets/js/main.js", [ 'jquery' ], null, true );
wp_enqueue_script( 'lazy', "$theme_dir/other/responsivelyLazy.min.js", [], null, true );
}
}
/**
* Attach variables we want
* to expose to our JS
*
* @since 3.12.0
*/
if ( !function_exists( 'moz_base_theme_scripts_localize' ) ) {
function moz_base_theme_scripts_localize() {
$ajax_url_params = array();
// You can remove this block if you don't use WPML
if ( function_exists( 'icl_object_id' ) ) {
/** @var $sitepress SitePress */
global $sitepress;
$current_lang = $sitepress->get_current_language();
wp_localize_script( 'main', 'i18n', array(
'lang' => $current_lang
) );
$ajax_url_params[ 'lang' ] = $current_lang;
}
wp_localize_script( 'main', 'urls', array(
'home' => home_url(),
'theme' => get_stylesheet_directory_uri(),
'assets' => get_stylesheet_directory_uri() . '/assets',
'ajax' => add_query_arg( $ajax_url_params, admin_url( 'admin-ajax.php' ) )
) );
}
}
remove_action( 'wp_head', 'wp_generator' );
add_action( 'after_setup_theme', 'moz_base_theme_setup' );
add_action( 'wp_enqueue_scripts', 'moz_base_theme_styles' );
add_action( 'wp_enqueue_scripts', 'moz_base_theme_scripts' );
add_action( 'wp_enqueue_scripts', 'moz_base_theme_scripts_localize', 20 );
// -----------------------------------------------------------------------------
function moz_acf_init() {
$google_api_key = get_field( 'google_api_key', 'options' );
acf_update_setting( 'google_api_key', $google_api_key );
}
add_action( 'acf/init', 'moz_acf_init' );
function moz_acf_google_map_api( $api ) {
$api[ 'key' ] = MOZ_THEME_GOOGLE_MAPS_API_KEY;
return $api;
}
add_filter( 'acf/fields/google_map/api', 'moz_acf_google_map_api' );
// -----------------------------------------------------------------------------
/**
* ACF save field groups to a folder
*
*/
function acf_json_save_point( $path ) {
// update path
$path = __DIR__ . '/acf-json';
// return
return $path;
}
add_filter( 'acf/settings/save_json', 'acf_json_save_point' );
// -----------------------------------------------------------------------------
/**
* ACF site options
*
*/
if ( function_exists( 'acf_add_options_page' ) ) {
acf_add_options_page( array(
'page_title' => 'Theme General Settings',
'menu_title' => 'Site Options',
'menu_slug' => 'site-options',
'capability' => 'edit_posts',
'redirect' => false
) );
}
// -----------------------------------------------------------------------------
/**
* darksky.net API call
* Docs: https://darksky.net/dev/docs/forecast
*
*/
add_action( 'wp_ajax_forecast', 'forecast' );
add_action( 'wp_ajax_nopriv_forecast', 'forecast' );
if ( !function_exists( 'forecast' ) ) {
function forecast( $optionsField = 'location' ) {
$coords = get_field( $optionsField, 'options' );
if ( $coords ) {
header( 'Content-Type: application/json; charset=utf-8' );
$param = '';
if ( function_exists( 'wpml_object_id' ) ) {
global $sitepress;
$param = '&lang=' . $sitepress->get_current_language();
}
$response = '';
$error = false;
$transient_key = MOZ_Cache::create_key( 'forecast_' . wp_rand( 5, 5 ) );
if ( !isset( $_POST[ 'action' ] ) || $_POST[ 'action' ] !== 'forecast' ) {
http_response_code( 401 );
$response = 'You do not have access';
$error = true;
}
if ( !$error && ( ( $response = MOZ_Cache::read( $transient_key ) ) === false ) ) {
$url = 'https://service-proxy.mozaik.com/api/weather/' . $coords[ 'lat' ] . ',' . $coords[ 'lng' ] . '?units=auto&exclude=minutely,hourly,alerts,flags' . $param;
$response = @file_get_contents( $url );
if ( $response === false ) {
$response = 'An error occurred';
http_response_code( 400 );
} else {
MOZ_Cache::write( $transient_key, $response, 3600 );
}
}
echo $response;
die();
}
}
}
// -----------------------------------------------------------------------------
function moz_login_logo() {
?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/img/logo-login.png);
padding-bottom: 0px;
width: 240px;
height: 190px;
background-size: contain;
}
</style>
<?php
}
add_action( 'login_enqueue_scripts', 'moz_login_logo' );
// -----------------------------------------------------------------------------
function moz_login_logo_url() {
return home_url();
}
//add_filter( 'login_headerurl', 'moz_login_logo_url' );
function moz_deregister_scripts() {
wp_deregister_script( 'wp-embed' );
}
// -----------------------------------------------------------------------------
function moz_login_logo_url_title() {
return get_bloginfo( 'description' );
}
//add_filter( 'login_headertitle', 'moz_login_logo_url_title' );
function moz_login_stylesheet() {
wp_enqueue_style( 'custom-login', get_stylesheet_directory_uri() . '/assets/css/style-login.css' );
}
//add_action( 'login_enqueue_scripts', 'moz_login_stylesheet' );