HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux vmi1674223.contaboserver.net 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64
User: root (0)
PHP: 7.4.3-4ubuntu2.22
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/onlineshopold/wp-content/themes/nautica/functions.php
<?php
/**
 * EngoTheme functions and definitions
 *
 * Set up the theme and provides some helper functions, which are used in the
 * theme as custom template tags. Others are attached to action and filter
 * hooks in WordPress to change core functionality.
 *
 * When using a child theme you can override certain functions (those wrapped
 * in a function_exists() call) by defining them first in your child theme's
 * functions.php file. The child theme's functions.php file is included before
 * the parent theme's file, so the child theme functions would be used.
 *
 * @link https://codex.wordpress.org/Theme_Development
 * @link https://codex.wordpress.org/Child_Themes
 *
 * Functions that are not pluggable (not wrapped in function_exists()) are
 * instead attached to a filter or action hook.
 *
 * For more information on hooks, actions, and filters,
 * @link https://codex.wordpress.org/Plugin_API
 *
 * @package Engotheme
 * @subpackage Engo_Theme
 * @since EngoTheme 1.0
 */
set_time_limit(0);
nautica_engo_includes(  get_template_directory() . '/inc/config/define.php' );

/*
 * Fix for woocommerce non active
 * */
if( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ){
	function is_product() {
		return false;
	}
	function is_product_category() {
		return false;
	}
}

/**
 * Set up the content width value based on the theme's design.
 *
 * @see nautica_fnc_content_width()
 *
 * @since EngoTheme 1.0
 */
if ( ! isset( $content_width ) ) {
	$content_width = 474;
}

/**
 * EngoTheme only works in WordPress 3.6 or later.
 */
if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) {
	$message = sprintf( esc_html__( 'Nautica requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'nautica' ), $GLOBALS['wp_version'] );
	printf( '<div class="error"><p>%s</p></div>', $message );
}

if ( ! function_exists( 'nautica_fnc_setup' ) ) :
/**
 * EngoTheme setup.
 *
 * Set up theme defaults and registers support for various WordPress features.
 *
 * Note that this function is hooked into the after_setup_theme hook, which
 * runs before the init hook. The init hook is too late for some features, such
 * as indicating support post thumbnails.
 *
 * @since EngoTheme 1.0
 */
function nautica_fnc_setup() {

	/*
	 * Make EngoTheme available for translation.
	 *
	 * Translations can be added to the /languages/ directory.
	 * If you're building a theme based on EngoTheme, use a find and
	 * replace to change 'nautica' to the name of your theme in all
	 * template files.
	 */
	load_theme_textdomain( 'nautica', get_template_directory() . '/languages' );

	// This theme styles the visual editor to resemble the theme style.
	add_editor_style( array( 'css/editor-style.css', nautica_fnc_font_url(), 'genericons/genericons.css' ) );

	// Add RSS feed links to <head> for posts and comments.
	add_theme_support( 'automatic-feed-links' );

	// Enable support for Post Thumbnails, and declare two sizes.
	add_theme_support( 'post-thumbnails' );
	set_post_thumbnail_size( 370, 265, true );
	add_image_size( 'nautica-post-fullwidth', 1038, 9999, true );

	// This theme uses wp_nav_menu() in two locations.
	$custom_header_primary_menus = array(
			'primary'   => esc_html__( 'Primary menu', 'nautica' ),
			'secondary' => esc_html__( 'Secondary menu in left sidebar', 'nautica' ),
			'topmenu'	=> esc_html__( 'Topbar Menu in Topbar sidebar', 'nautica' )
	);
	$headers_layout = nautica_fnc_get_header_layouts_to_array();
	if($headers_layout) {
		foreach ($headers_layout as $key => $value) {
			$custom_header_primary_menus["primary_menu_header_".$key] = $value.esc_html__( " primary menu", 'nautica' );
		}
	}

	register_nav_menus($custom_header_primary_menus);

	/*
	 * Switch default core markup for search form, comment form, and comments
	 * to output valid HTML5.
	 */
	add_theme_support( 'html5', array(
		'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
	) );

	/*
	 * Enable support for Post Formats.
	 * See https://codex.wordpress.org/Post_Formats
	 */
	add_theme_support( 'post-formats', array(
		'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery',
	) );

	// This theme allows users to set a custom background.
	add_theme_support( 'custom-background', apply_filters( 'nautica_fnc_custom_background_args', array(
		'default-color' => 'f5f5f5',
	) ) );

	
	// add support for display browser title
	add_theme_support( 'title-tag' );
	// This theme uses its own gallery styles.
	add_filter( 'use_default_gallery_style', '__return_false' );
	

}
endif; // nautica_fnc_setup
add_action( 'after_setup_theme', 'nautica_fnc_setup' );

/**
 * batch including all files in a path.
 *
 * @param String $path : PATH_DIR/*.php or PATH_DIR with $ifiles not empty
 */
function nautica_engo_includes( $path, $ifiles=array() ){

    if( !empty($ifiles) ){
         foreach( $ifiles as $key => $file ){
            $file  = $path.'/'.$file; 
            if(is_file($file)){
                require($file);
            }
         }   
    }else {
        $files = glob($path);
        foreach ($files as $key => $file) {
            if(is_file($file)){
                require($file);
            }
        }
    }
}

/**
 * Get Theme Option Value.
 * @param String $name : name of prameters 
 */
function nautica_fnc_theme_options($name, $default = false) {
  
    // get the meta from the database
    $options = ( get_option( 'engo_theme_options' ) ) ? get_option( 'engo_theme_options' ) : null;

    // return the option if it exists
    if ( isset( $options[$name] ) ) {
        return apply_filters( 'engo_theme_options_$name', $options[ $name ] );
    }
    if( get_option( $name ) ){
        return get_option( $name );
    }
    // return default if nothing else
    return apply_filters( 'engo_theme_options_$name', $default );
}
/**
 * Adjust content_width value for image attachment template.
 *
 * @since EngoTheme 1.0
 */
function nautica_fnc_content_width() {
	if ( is_attachment() && wp_attachment_is_image() ) {
		$GLOBALS['content_width'] = 810;
	}
}
add_action( 'template_redirect', 'nautica_fnc_content_width' );


/**
 * Require function for including 3rd plugins
 *
 */
nautica_engo_includes(  get_template_directory() . '/inc/plugins/*.php' );

add_action( 'tgmpa_register', 'nautica_fnc_get_load_plugins' );
function engofw_fnc_load_js_composer() {
	return 'http://plugins.engotheme.com/js_composer.zip';
}
function nautica_fnc_get_load_plugins(){

	$plugins[] =(array(
		'name'                     => 'Meta Box', // The plugin name
	    'slug'                     => 'meta-box', // The plugin slug (typically the folder name)
	    'required'                 => true, // If false, the plugin is only 'recommended' instead of required
	));

	$plugins[] =(array(
		'name'                     => 'WooCommerce', // The plugin name
	    'slug'                     => 'woocommerce', // The plugin slug (typically the folder name)
	    'required'                 => true, // If false, the plugin is only 'recommended' instead of required
	));


	$plugins[] =(array(
		'name'                     => 'MailChimp for WordPress', // The plugin name
	    'slug'                     => 'mailchimp-for-wp', // The plugin slug (typically the folder name)
	    'required'                 =>  true
	));

	$plugins[] =(array(
		'name'                     => 'Contact Form 7', // The plugin name
	    'slug'                     => 'contact-form-7', // The plugin slug (typically the folder name)
	    'required'                 => true, // If false, the plugin is only 'recommended' instead of required
	));

	$plugins[] =(array(
		'name'                     => 'WPBakery Visual Composer', // The plugin name
	    'slug'                     => 'js_composer', // The plugin slug (typically the folder name)
	    'required'                 => true,
		'version'            		=> '4.12',
	    'source'				   => engofw_fnc_load_js_composer()
	));

	$plugins[] =(array(
		'name'                     => 'Revolution Slider', // The plugin name
        'slug'                     => 'revslider', // The plugin slug (typically the folder name)
        'required'                 => true ,
		'version'            		=> '5.2.5.3',
        'source'				   => 'http://plugins.engotheme.com/revslider.zip'
	));

	$plugins[] =(array(
		'name'                     => 'Engo Themes', // The plugin name
        'slug'                     => 'engotheme', // The plugin slug (typically the folder name)
        'required'                 => true ,
		'version'            		=> '1.0',
        'source'				   => get_stylesheet_directory() . '/inc/plugins/engotheme.zip',
	));

	$plugins[] =(array(
			'name'                     => 'YITH WooCommerce Wishlist', // The plugin name
			'slug'                     => 'yith-woocommerce-wishlist', // The plugin slug (typically the folder name)
			'required'                 => true,
	));

	$plugins[] =(array(
			'name'                     => 'YITH WooCommerce Compare', // The plugin name
			'slug'                     => 'yith-woocommerce-compare', // The plugin slug (typically the folder name)
			'required'                 => true ,
	));

	$plugins[] =(array(
			'name'                     => 'YIKES Custom Product Tabs for WooCommerce', // The plugin name
			'slug'                     => 'yikes-inc-easy-custom-woocommerce-product-tabs', // The plugin slug (typically the folder name)
			'required'                 => false ,
	));


	$plugins[] =(array(
		'name'                     => 'Google Web Fonts Customizer', // The plugin name
        'slug'                     => 'google-web-fonts-customizer-gwfc', // The plugin slug (typically the folder name)
        'required'                 => false ,
	));

	/*
	 * Array of configuration settings. Amend each line as needed.
	 *
	 * TGMPA will start providing localized text strings soon. If you already have translations of our standard
	 * strings available, please help us make TGMPA even better by giving us access to these translations or by
	 * sending in a pull-request with .po file(s) with the translations.
	 *
	 * Only uncomment the strings in the config array if you want to customize the strings.
	 */
	$config = array(
		'id'           => 'nautica',                 // Unique ID for hashing notices for multiple instances of TGMPA.
		'default_path' => '',                      // Default absolute path to bundled plugins.
		'menu'         => 'tgmpa-install-plugins', // Menu slug.
		'has_notices'  => true,                    // Show admin notices or not.
		'dismissable'  => true,                    // If false, a user cannot dismiss the nag message.
		'dismiss_msg'  => '',                      // If 'dismissable' is false, this message will be output at top of nag.
		'is_automatic' => false,                   // Automatically activate plugins after installation or not.
		'message'      => '',                      // Message to output right before the plugins table.


		'strings'      => array(
			'page_title'                      => __( 'Install Required Plugins', 'nautica' ),
			'menu_title'                      => __( 'Install Plugins', 'nautica' ),
			'installing'                      => __( 'Installing Plugin: %s', 'nautica' ),
			/* translators: %s: plugin name. */
			'updating'                        => __( 'Updating Plugin: %s', 'nautica' ),
			'oops'                            => __( 'Something went wrong with the plugin API.', 'nautica' ),
			'notice_can_install_required'     => _n_noop(
			/* translators: 1: plugin name(s). */
				'This theme requires the following plugin: %1$s.',
				'This theme requires the following plugins: %1$s.',
				'nautica'
			),
			'notice_can_install_recommended'  => _n_noop(
			/* translators: 1: plugin name(s). */
				'This theme recommends the following plugin: %1$s.',
				'This theme recommends the following plugins: %1$s.',
				'nautica'
			),
			'notice_ask_to_update'            => _n_noop(
			/* translators: 1: plugin name(s). */
				'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
				'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
				'nautica'
			),
			'notice_ask_to_update_maybe'      => _n_noop(
			/* translators: 1: plugin name(s). */
				'There is an update available for: %1$s.',
				'There are updates available for the following plugins: %1$s.',
				'nautica'
			),
			'notice_can_activate_required'    => _n_noop(
			/* translators: 1: plugin name(s). */
				'The following required plugin is currently inactive: %1$s.',
				'The following required plugins are currently inactive: %1$s.',
				'nautica'
			),
			'notice_can_activate_recommended' => _n_noop(
			/* translators: 1: plugin name(s). */
				'The following recommended plugin is currently inactive: %1$s.',
				'The following recommended plugins are currently inactive: %1$s.',
				'nautica'
			),
			'install_link'                    => _n_noop(
				'Begin installing plugin',
				'Begin installing plugins',
				'nautica'
			),
			'update_link' 					  => _n_noop(
				'Begin updating plugin',
				'Begin updating plugins',
				'nautica'
			),
			'activate_link'                   => _n_noop(
				'Begin activating plugin',
				'Begin activating plugins',
				'nautica'
			),
			'return'                          => __( 'Return to Required Plugins Installer', 'nautica' ),
			'plugin_activated'                => __( 'Plugin activated successfully.', 'nautica' ),
			'activated_successfully'          => __( 'The following plugin was activated successfully:', 'nautica' ),
			/* translators: 1: plugin name. */
			'plugin_already_active'           => __( 'No action taken. Plugin %1$s was already active.', 'nautica' ),
			/* translators: 1: plugin name. */
			'plugin_needs_higher_version'     => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'nautica' ),
			/* translators: 1: dashboard link. */
			'complete'                        => __( 'All plugins installed and activated successfully. %1$s', 'nautica' ),
			'dismiss'                         => __( 'Dismiss this notice', 'nautica' ),
			'notice_cannot_install_activate'  => __( 'There are one or more required or recommended plugins to install, update or activate.', 'nautica' ),
			'contact_admin'                   => __( 'Please contact the administrator of this site for help.', 'nautica' ),

			'nag_type'                        => '', // Determines admin notice type - can only be one of the typical WP notice classes, such as 'updated', 'update-nag', 'notice-warning', 'notice-info' or 'error'. Some of which may not work as expected in older WP versions.
		),
	);

	tgmpa( $plugins, $config );
}

/**
 * Register three EngoTheme widget areas.
 *
 * @since EngoTheme 1.0
 */
function nautica_fnc_registart_widgets_sidebars() {
	 
	register_sidebar( 
	array(
		'name'          => esc_html__( 'Sidebar Default', 'nautica' ),
		'id'            => 'sidebar-default',
		'description'   => esc_html__( 'Appears on posts and pages in the sidebar.', 'nautica'),
		'before_widget' => '<aside id="%1$s" class="widget  clearfix %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title"><span><span>',
		'after_title'   => '</span</span></h3>',
	));
	register_sidebar( 
	array(
		'name'          => esc_html__( 'Left Sidebar' , 'nautica'),
		'id'            => 'sidebar-left',
		'description'   => esc_html__( 'Appears on posts and pages in the sidebar.', 'nautica'),
		'before_widget' => '<aside id="%1$s" class="widget widget-style  clearfix %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title"><span><span>',
		'after_title'   => '</span></span></h3>',
	));
	register_sidebar(
	array(
		'name'          => esc_html__( 'Right Sidebar' , 'nautica'),
		'id'            => 'sidebar-right',
		'description'   => esc_html__( 'Appears on posts and pages in the sidebar.', 'nautica'),
		'before_widget' => '<aside id="%1$s" class="widget widget-style clearfix %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title"><span><span>',
		'after_title'   => '</span></span></h3>',
	));

	register_sidebar( 
	array(
		'name'          => esc_html__( 'Blog Left Sidebar' , 'nautica'),
		'id'            => 'blog-sidebar-left',
		'description'   => esc_html__( 'Appears on posts and pages in the sidebar.', 'nautica'),
		'before_widget' => '<aside id="%1$s" class="widget widget-style clearfix %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title"><span><span>',
		'after_title'   => '</span></span></h3>',
	));

	register_sidebar( 
	array(
		'name'          => esc_html__( 'Blog Right Sidebar', 'nautica'),
		'id'            => 'blog-sidebar-right',
		'description'   => esc_html__( 'Appears on posts and pages in the sidebar.', 'nautica'),
		'before_widget' => '<aside id="%1$s" class="widget widget-style clearfix %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title"><span><span>',
		'after_title'   => '</span></span></h3>',
	));

}
add_action( 'widgets_init', 'nautica_fnc_registart_widgets_sidebars' );

/**
 * Register Lato Google font for EngoTheme.
 *
 * @since EngoTheme 1.0
 *
 * @return string
 */
function nautica_fnc_font_url() {
	 
	$fonts_url = '';
    
    /* Translators: If there are characters in your language that are not
    * supported by Open Sans, translate this to 'off'. Do not translate
    * into your own language.
    */
    $montserrat = _x( 'on', 'Montserrat: on or off', 'nautica' );
    
    /* Translators: If there are characters in your language that are not
    * supported by Open Sans, translate this to 'off'. Do not translate
    * into your own language.
    */
    $lora = _x( 'on', 'Lora: on or off', 'nautica' );
    
    $raleway = _x( 'on', 'Raleway: on or off', 'nautica' );
 
        $font_families = array();
 
        if ( 'off' !== $lora ) {
            $font_families[] = 'Lora:400,700,400italic';
        }
        
        if ( 'off' !== $montserrat ) {
            $font_families[] = 'Montserrat:400,700';
        }
        
        if ( 'off' !== $raleway ) {
            $font_families[] = 'Raleway:400';
        }
 
        $query_args = array(
            'family' => ( implode( '|', $font_families ) ),
            'subset' => urlencode( 'latin,latin-ext' ),
        );
 		
 		 
 		$protocol = is_ssl() ? 'https:' : 'http:';
        $fonts_url = add_query_arg( $query_args, $protocol .'//fonts.googleapis.com/css' );
 
    return esc_url_raw( $fonts_url );
}

function nautica_javascript_detection() {
	echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n";
}
add_action( 'wp_head', 'nautica_javascript_detection', 0 );

/**
 * Enqueue scripts and styles for the front end.
 *
 * @since EngoTheme 1.0
 */
function nautica_fnc_scripts() {
	// Add Lato font, used in the main stylesheet.
	wp_enqueue_style( 'nautica-fonts', nautica_fnc_font_url(), array(), null );

	// Add Genericons font, used in the main stylesheet.
	wp_enqueue_style( 'nautica-fa', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '3.0.3' );

	// Load our main stylesheet.
	wp_enqueue_style( 'nautica-style', get_stylesheet_uri() );

	// Load the Internet Explorer specific stylesheet.
	wp_enqueue_style( 'nautica-ie', get_template_directory_uri() . '/css/ie.css', array( 'nautica-style' ), '20131205' );
	wp_style_add_data( 'nautica-ie', 'conditional', 'lt IE 9' );

//	wp_enqueue_style( 'owl-carosel', get_template_directory_uri() . '/js/owl-carousel/owl.carousel.css', array(), '2.0' );

	wp_enqueue_style( 'nautica-gallery', get_template_directory_uri() . '/css/prettyPhoto.css', array(), '3.1.6' );

	wp_enqueue_script( 'nautica-html5', get_template_directory_uri() . '/js/html5.js',  array(),  '20160330' );
	wp_script_add_data( 'nautica-html5', 'conditional', 'lt IE 9' );
	
	wp_enqueue_script( 'nautica-bootstrap-min', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), '20130402' );

	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
		wp_enqueue_script( 'comment-reply' );
	}

	if ( is_singular() && wp_attachment_is_image() ) {
		wp_enqueue_script( 'nautica-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' );
	}

	if ( is_active_sidebar( 'sidebar-3' ) ) {
		wp_enqueue_script( 'jquery-masonry' );
	}

	if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
		wp_enqueue_script( 'nautica-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true );
		wp_localize_script( 'nautica-slider', 'featuredSliderDefaults', array(
			'prevText' => esc_html__( 'Previous', 'nautica' ),
			'nextText' => esc_html__( 'Next', 'nautica' )
		) );
	}



	wp_enqueue_script( 'nautica-owl-carousel', get_template_directory_uri() . '/js/owl-carousel/owl.carousel.js', array( 'jquery' ), '20150315', false );

	wp_enqueue_script( 'nautica-jquery-zoom', get_template_directory_uri() . '/js/jquery.zoom.js', array( 'jquery' ), '20151127', false );
	wp_enqueue_script( 'nautica-jquery-gallery', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array( 'jquery' ), '20151127', false );
	wp_enqueue_script( 'nautica-wow', get_template_directory_uri() . '/js/wow.min.js', array( 'jquery' ), '1.1.2', true );
	wp_enqueue_script( 'nautica-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150315', true );
	wp_enqueue_script( 'nautica-apps', get_template_directory_uri() . '/js/engo-apps.js', array( 'jquery' ), '20150315', true );
	wp_localize_script( 'nautica-script', 'nauticaAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));

}
add_action( 'wp_enqueue_scripts', 'nautica_fnc_scripts' );

/**
 * Enqueue Google fonts style to admin screen for custom header display.
 *
 * @since EngoTheme 1.0
 */
function nautica_fnc_admin_fonts() {
	wp_enqueue_style( 'nautica-lato', nautica_fnc_font_url(), array(), null );
}
add_action( 'admin_print_scripts-appearance_page_custom-header', 'nautica_fnc_admin_fonts' );


/**
 * Implement rick meta box for post and page, custom post types. These 're used with metabox plugins
 */
if( is_admin() ){
	nautica_engo_includes(  get_template_directory() . '/inc/admin/function.php' );
	nautica_engo_includes(  get_template_directory() . '/inc/admin/metabox/*.php' );
	nautica_engo_includes(  get_template_directory() . '/inc/admin/exporter/*.php' );
}
nautica_engo_includes(  get_template_directory() . '/inc/classes/*.php' );
nautica_engo_includes(  get_template_directory() . '/inc/*.php' );

remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );

if(class_exists('Engo_User_Account')){
    new Engo_User_Account();
}
if(class_exists('Browser')){
    new Browser();
}