<?php

define('Estana_VER', '1.0.0');

class Estana_Core
{
    /**
     * Class prefix for autoload
     *
     * @var string
     */
    protected static $prefix = 'Estana_';

    /**
     * Variable hold the page options
     *
     * @var array
     */
    //protected  $page_options = array();

    public static $plugins;

    public function __construct()
    {
        require_once get_template_directory() . '/netbase-core/vendor/tgmpa/class-tgm-plugin-activation.php';

        if(class_exists('WeDevs_Dokan')) {

            require get_template_directory() . '/dokan/dokan.php';
        }

        spl_autoload_register(array($this, 'autoload'));

        new Estana_Customize();

        Estana_Helper::include_template_tags();

        if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
            Estana_Extensions_WooCommerce::init();
        }
        //add_action('wp', array($this, 'get_options'));
        //add_action('customize_register', array('Estana_Customize', 'register'));

        add_action('after_setup_theme', array($this, 'theme_setup'));
        add_action('widgets_init', array($this, 'default_sidebars'));

        //add_action('admin_enqueue_scripts', array($this, 'admin_scripts_enqueue'));
       // add_action('customize_controls_enqueue_scripts', array('Estana_Customize', 'customize_control_js'));
       // add_action('customize_preview_init', array('Estana_Customize', 'customize_preview_js'));
        //add_action('customize_controls_print_styles', array('Estana_Customize', 'customize_style'));

        //TODO make inline style below woocommerce.css.
        add_action('wp_enqueue_scripts', array($this, 'core_scripts_enqueue'), 9998);
        add_action('wp_enqueue_scripts', array($this, 'print_embed_style'), 9999);
        add_action('wp_enqueue_scripts', array($this, 'google_fonts_url'));

        add_filter('body_class', array('Estana_Helper', 'nbcore_body_classes'));
        add_action('wp_head', array('Estana_Helper', 'nbcore_pingback_header'));

        add_filter('show_recent_comments_widget_style', '__return_false');

        add_filter('upload_mimes', array($this, 'upload_mimes'));

        add_action( 'tgmpa_register', array($this, 'register_required_plugins') );

		//add_action( 'admin_init', array($this, 'add_editor_styles') );

        $content_width = 1170;

        if(empty(get_transient('current_load_css'))) {
            set_transient('current_load_css', NBT_LOAD_CUSTOMIZE_FROM_HEAD, NBT_TIMEOUT_TRANSIENT_CUSTOMIZE);
        }
    }

    public static function autoload($class_name)
    {
        // Verify class prefix.
        if (0 !== strpos($class_name, self::$prefix)) {
            return false;
        }

        // Generate file path from class name.
        $base = get_template_directory() . '/netbase-core/';
        $path = strtolower(str_replace('_', '/', substr($class_name, strlen(self::$prefix))));

        // Check if class file exists.
        $standard = $path . '.php';
        $alternative = $path . '/' . current(array_slice(explode('/', str_replace('\\', '/', $path)), -1)) . '.php';

        while (true) {
            // Check if file exists in standard path.
            if (@is_file($base . $standard)) {
                $exists = $standard;

                break;
            }

            // Check if file exists in alternative path.
            if (@is_file($base . $alternative)) {
                $exists = $alternative;

                break;
            }

            // If there is no more alternative file, quit the loop.
            if (false === strrpos($standard, '/') || 0 === strrpos($standard, '/')) {
                break;
            }

            // Generate more alternative files.
            $standard = preg_replace('#/([^/]+)$#', '-\\1', $standard);
            $alternative = implode('/', array_slice(explode('/', str_replace('\\', '/', $standard)), 0, -1)) . '/' . substr(current(array_slice(explode('/', str_replace('\\', '/', $standard)), -1)), 0, -4) . '/' . current(array_slice(explode('/', str_replace('\\', '/', $standard)), -1));
        }

        // Include class declaration file if exists.
        if (isset($exists)) {
            return include_once $base . $exists;
        }

        return false;
    }

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

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

        /*
         * Let WordPress manage the document title.
         * By adding theme support, we declare that this theme does not use a
         * hard-coded <title> tag in the document head, and expect WordPress to
         * provide it for us.
         */
        add_theme_support('title-tag');

        /*
         * Enable support for Post Thumbnails on posts and pages.
         *
         * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
         */
        add_theme_support('post-thumbnails');

        // A theme must have at least one navbar, right?
        register_nav_menus(array(
            'primary' => esc_html__('Primary', 'estana'),
        ));
		
		add_theme_support('post-formats', array(
            'standard',
            'image',
            'video',
            'gallery',
            'audio',
            'aside',
            'chat',
            'link',
            'quote',
            'status'
        ));

        /*
         * 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://developer.wordpress.org/themes/functionality/post-formats/
         */

        // Add theme support for selective refresh for widgets.
        add_theme_support('customize-selective-refresh-widgets');

        add_image_size('estana-masonry', 450, 450, true);
		
		add_theme_support( 'woocommerce' );
        add_theme_support( 'wc-product-gallery-zoom' );
        add_theme_support( 'wc-product-gallery-lightbox' );
        add_theme_support( 'wc-product-gallery-slider' );
		
		add_theme_support( 'custom-header', apply_filters( 'estana_custom_header_args', array(
			'width'                  => 1140,
			'height'                 => 280,
			'flex-height'            => true,
		) ) );
		add_theme_support( 'custom-background', apply_filters( 'estana_custom_background_args', array(
			'default-color' => estana_get_options('nbcore_background_color'),
		) ) );
		
		foreach (estana_default_options() as $k => $v){
			if (FALSE === get_theme_mod($k)){
				set_theme_mod($k,$v);
			}
		}
    }

    /**
     * Theme default sidebar.
     *
     * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
     */
    public static function default_sidebars()
    {
        register_sidebar(array(
            'name' => esc_html__('Default Sidebar', 'estana'),
            'id' => 'default-sidebar',
            'description' => esc_html__('Add widgets here.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        if (class_exists('WooCommerce')) {
			register_sidebar(array(
				'name' => esc_html__('Shop Sidebar', 'estana'),
				'id' => 'shop-sidebar',
				'description' => esc_html__('Add widgets for category page.', 'estana'),
				'before_widget' => '<div id="%1$s" class="widget %2$s">',
				'after_widget' => '</div>',
				'before_title' => '<h3 class="widget-title">',
				'after_title' => '</h3>',
			));

			register_sidebar(array(
				'name' => esc_html__('Product Sidebar', 'estana'),
				'id' => 'product-sidebar',
				'description' => esc_html__('Add widgets for product details page', 'estana'),
				'before_widget' => '<div id="%1$s" class="widget %2$s">',
				'after_widget' => '</div>',
				'before_title' => '<h3 class="widget-title">',
				'after_title' => '</h3>',
			));
		}

        register_sidebar(array(
            'name' => esc_html__('Header Top #1', 'estana'),
            'id' => 'header-top-1',
            'description' => esc_html__('For best display, please assign only one widget in this section.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        register_sidebar(array(
            'name' => esc_html__('Header Top #2', 'estana'),
            'id' => 'header-top-2',
            'description' => esc_html__('For best display, please assign only one widget in this section.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        register_sidebar(array(
            'name' => esc_html__('Footer Top #1', 'estana'),
            'id' => 'footer-top-1',
            'description' => esc_html__('For best display, please assign only one widget in this section.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        register_sidebar(array(
            'name' => esc_html__('Footer Top #2', 'estana'),
            'id' => 'footer-top-2',
            'description' => esc_html__('For best display, please assign only one widget in this section.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        register_sidebar(array(
            'name' => esc_html__('Footer Top #3', 'estana'),
            'id' => 'footer-top-3',
            'description' => esc_html__('For best display, please assign only one widget in this section.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        register_sidebar(array(
            'name' => esc_html__('Footer Top #4', 'estana'),
            'id' => 'footer-top-4',
            'description' => esc_html__('For best display, please assign only one widget in this section.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        register_sidebar(array(
            'name' => esc_html__('Footer Bottom #1', 'estana'),
            'id' => 'footer-bot-1',
            'description' => esc_html__('For best display, please assign only one widget in this section.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        register_sidebar(array(
            'name' => esc_html__('Footer Bottom #2', 'estana'),
            'id' => 'footer-bot-2',
            'description' => esc_html__('For best display, please assign only one widget in this section.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        register_sidebar(array(
            'name' => esc_html__('Footer Bottom #3', 'estana'),
            'id' => 'footer-bot-3',
            'description' => esc_html__('For best display, please assign only one widget in this section.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        register_sidebar(array(
            'name' => esc_html__('Footer Bottom #4', 'estana'),
            'id' => 'footer-bot-4',
            'description' => esc_html__('For best display, please assign only one widget in this section.', 'estana'),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));
		
		if (class_exists('WeDevs_Dokan')) {
			register_sidebar( array(
				'name' => __( 'Dokan Store Sidebar', 'estana' ),
				'id' => 'sidebar-store',
				'before_widget' => '<div id="%1$s" class="widget %2$s">',
				'after_widget' => '</div>',
				'before_title' => '<h3 class="widget-title">',
				'after_title' => '</h3>',
			));
		}
    }

    // Todo change to minified version and load conditional. Example: isotope is now always load
    public static function core_scripts_enqueue()
    {
        //TODO Remember this
        wp_dequeue_script('wc-cart');
        wp_enqueue_style('estana_fontello', get_template_directory_uri() . '/assets/vendor/fontello/fontello.css', array(), Estana_VER);
		wp_enqueue_style( 'dashicons' );

        wp_enqueue_style('estana_front_style', get_stylesheet_uri());
		wp_enqueue_style('estana_front_font', get_template_directory_uri() . '/assets/font/font.css', array(), Estana_VER);

        wp_enqueue_script('isotope', get_template_directory_uri() . '/assets/vendor/isotope/isotope.pkdg.min.js', array('jquery'), '3.0.3', true);

        wp_enqueue_style('magnific-popup', get_template_directory_uri() . '/assets/vendor/magnific-popup/magnific-popup.css', array(), '2.0.5');
        wp_enqueue_script('magnific-popup', get_template_directory_uri() . '/assets/vendor/magnific-popup/jquery.magnific-popup.min.js', array('jquery'), '2.0.5', true);
        
		if (!class_exists("WPBakeryShortCode")) {
			wp_register_style( 'prettyphoto', get_template_directory_uri() . '/assets/vendor/prettyphoto/css/prettyPhoto.min.css', array(), Estana_VER );
			wp_register_script( 'prettyphoto', get_template_directory_uri() . '/assets/vendor/prettyphoto/js/jquery.prettyPhoto.min.js', array( 'jquery' ), Estana_VER, true );
		}

        wp_enqueue_style('swiper', get_template_directory_uri() . '/assets/vendor/swiper/swiper.min.css', array(), '3.4.2');
		wp_enqueue_script('swiper', get_template_directory_uri() . '/assets/vendor/swiper/swiper.jquery.min.js', array('jquery'), '3.4.2', true);

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

        if (function_exists('is_product') && is_product() && 'accordion-tabs' == estana_get_options('nbcore_info_style')) {
            wp_enqueue_script('jquery-ui-accordion');
        }

        if (estana_get_options('nbcore_header_fixed')) {
            wp_enqueue_script('theme_waypoints', get_template_directory_uri() . '/assets/vendor/waypoints/jquery.waypoints.min.js', array('jquery'), '4.0.1', true);
        }

        if (estana_get_options('nbcore_blog_sticky_sidebar') || estana_get_options('shop_sticky_sidebar') || estana_get_options('product_sticky_sidebar')) {
            wp_enqueue_script('sticky-kit', get_template_directory_uri() . '/assets/vendor/sticky-kit/jquery.sticky-kit.min.js', array('jquery'), '1.1.2', true);
        }

        wp_enqueue_script('estana_front_script', get_template_directory_uri() . '/assets/netbase/js/main.js', array('jquery'), Estana_VER, true);

        wp_enqueue_script('estana_cart_script', get_template_directory_uri() . '/assets/netbase/js/cart.js', array('jquery'), Estana_VER, true);

        $localize_array = array(
            'ajaxurl'           => admin_url( 'admin-ajax.php', 'relative' ),
            'upsells_columns' => estana_get_options('nbcore_pd_upsells_columns'),
            'related_columns' => estana_get_options('nbcore_pd_related_columns'),
            'cross_sells_columns' => estana_get_options('nbcore_cross_sells_per_row'),
            'thumb_pos' => estana_get_options('nbcore_pd_thumb_pos'),
            'menu_resp' => estana_get_options('nbcore_menu_resp'),
        );
		
		if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
            $version = version_compare( preg_replace( '/-beta-([0-9]+)/', '', WC()->version ), '2.3.0', '<' );   
            $localize_array['is2_2'] = $version;
        }
		
        wp_localize_script('estana_front_script', 'estana', $localize_array);

        wp_dequeue_script('yith-wcqv-frontend');
        wp_dequeue_style('yith-quick-view');
    }
	
	/**
	 *  Editor Style
	 */
	public static function add_editor_styles() {
		add_editor_style( 'css/editor-style.css' );
	}

    public static function admin_scripts_enqueue()
    {
        wp_enqueue_style('estana_fontello', get_template_directory_uri() . '/assets/vendor/fontello/fontello.css', array(), Estana_VER);
		wp_enqueue_script('estana_admin_inline_script', get_template_directory_uri() . '/assets/netbase/js/admin/admin-inline.min.js', array('jquery'), Estana_VER, true);
    }

    /*public static function get_options()
    {
        static $prepared;

        if (!isset($prepared)) {
            // Get all customizer options
            $theme_mods = Estana_Customize::get_options();

            if ($theme_mods && is_array($theme_mods)) {
                self::$page_options = array_merge(self::$page_options, $theme_mods);
            }

            if (function_exists('get_fields')) {
                $page_id = get_the_ID();

                if ($page_id) {
                    // Todo replace acf ?
                    $post_meta = get_fields();
                    if ($post_meta) {
                        foreach ($post_meta as $k => $v) {
                            self::$page_options[$k] = maybe_unserialize($v);
                        }
                    }
                }

                if (isset(self::$page_options)) {
                    // Merge with theme options with higher priority.
                    self::$page_options = array_merge(
                        $theme_mods,
                        self::$page_options
                    );
                }
            }

            $prepared = true;
        }

        if (!doing_action('wp')) {
            // Prepare options to return.
            if (isset($page_id) && isset(self::$page_options[$page_id])) {
                $options = self::$page_options[$page_id];
            }

            return self::$page_options;
        }

    }*/

    //TODO optimize this(grouping and bring to css if can)
    //TODO early esc_
    public static function get_embed_style()
    {


        $bg_color = estana_get_options('nbcore_background_color');
        $inner_bg = estana_get_options('nbcore_inner_background');

        $top_padding = estana_get_options('nbcore_top_section_padding');
        $top_bg = estana_get_options('nbcore_header_top_bg');
        $top_color = estana_get_options('nbcore_header_top_color');
        $top_hover_color = estana_get_options('nbcore_header_top_hover_color');
        $middle_padding = estana_get_options('nbcore_middle_section_padding');
        $middle_bg = estana_get_options('nbcore_header_middle_bg');
        $middle_color = estana_get_options('nbcore_header_middle_color');
        $middle_hover_color = estana_get_options('nbcore_header_middle_hover_color');
        $bot_padding = estana_get_options('nbcore_bot_section_padding');
        $bot_bg = estana_get_options('nbcore_header_bot_bg');
        $bot_color = estana_get_options('nbcore_header_bot_color');
        $bot_hover_color = estana_get_options('nbcore_header_bot_hover_color');
        $menu_bg = estana_get_options('nbcore_header_mainmn_bg');
        $menu_color = estana_get_options('nbcore_header_mainmn_color');
        $menu_bor = estana_get_options('nbcore_header_mainmn_bor');
        $menu_bg2 = estana_get_options('nbcore_header_mainmnhover_bg');
        $menu_color2 = estana_get_options('nbcore_header_mainmnhover_color');
        $menu_bor2 = estana_get_options('nbcore_header_mainmnhover_bor');

        $logo_area_width = estana_get_options('nbcore_logo_width');
        $blog_width = estana_get_options('nbcore_blog_width');
        $primary_color = estana_get_options('nbcore_primary_color');
        $secondary_color = estana_get_options('nbcore_secondary_color');
        $tertiary_color = estana_get_options('nbcore_tertiary_color');
        $divider_color = estana_get_options('nbcore_divider_color');

        $heading_font_array = explode(",", estana_get_options('heading_font_family'));
        $heading_family = end($heading_font_array);
        $heading_font_style = explode(",", estana_get_options('heading_font_style'));
        $heading_weight = end($heading_font_style);
        $heading_color = estana_get_options('nbcore_heading_color');

        $heading_base_size = estana_get_options('heading_base_size');

        $body_family_array = explode(",", estana_get_options('body_font_family'));
        $body_family = end($body_family_array);
        $body_style_array = explode(",", estana_get_options('body_font_style'));
        $body_weight = end($body_style_array);
        $body_color = estana_get_options('nbcore_body_color');
        $meta_color = estana_get_options('nbcore_meta_color');
        $body_size = estana_get_options('body_font_size');

        $link_color = estana_get_options('nbcore_link_color');
        $link_hover_color = estana_get_options('nbcore_link_hover_color');

        $blog_sidebar = estana_get_options('nbcore_blog_sidebar');
        $page_title_padding = estana_get_options('nbcore_page_title_padding');
        $page_title_color = estana_get_options('nbcore_page_title_color');
        $page_title_img = estana_get_options('nbcore_page_title_image');
        $page_title_img_size = estana_get_options('nbcore_page_title_image_size');
        $page_title_img_pos = estana_get_options('nbcore_page_title_image_pos');
        $page_title_img_repeat = estana_get_options('nbcore_page_title_image_repeat');
		if ($page_title_img != '') {
			$page_title_img = wp_get_attachment_image_src( $page_title_img, 'full', false );
			$page_title_img = $page_title_img[0];
		}

        if ( class_exists( 'WooCommerce' ) ) {
			$wc_content_width = estana_get_options('nbcore_shop_content_width');
			$shop_sidebar = estana_get_options('nbcore_shop_sidebar');
			$loop_columns_xl = estana_get_options('nbcore_loop_columns_xl');
			$loop_columns_lg = estana_get_options('nbcore_loop_columns_lg');
			$loop_columns_md = estana_get_options('nbcore_loop_columns_md');
			$loop_columns_sm = estana_get_options('nbcore_loop_columns_sm');
			$pd_details_sidebar = estana_get_options('nbcore_pd_details_sidebar');
			$pd_details_width = estana_get_options('nbcore_pd_details_width');
			$pd_images_width = estana_get_options('nbcore_pd_images_width');
		}

        if ( class_exists( 'WeDevs_Dokan' ) ) {
			$vendor_width = estana_get_options('nbcore_vendor_details_width');
			$vendor_sidebar = estana_get_options('nbcore_vendor_details_sidebar');
		}

        $pb_bg = estana_get_options('nbcore_pb_background');
        $pb_bg_hover = estana_get_options('nbcore_pb_background_hover');
        $pb_text = estana_get_options('nbcore_pb_text');
        $pb_text_hover = estana_get_options('nbcore_pb_text_hover');
        $pb_border = estana_get_options('nbcore_pb_border');
        $pb_border_hover = estana_get_options('nbcore_pb_border_hover');
        $sb_bg = estana_get_options('nbcore_sb_background');
        $sb_bg_hover = estana_get_options('nbcore_sb_background_hover');
        $sb_text = estana_get_options('nbcore_sb_text');
        $sb_text_hover = estana_get_options('nbcore_sb_text_hover');
        $sb_border = estana_get_options('nbcore_sb_border');
        $sb_border_hover = estana_get_options('nbcore_sb_border_hover');
        $tb_bg = estana_get_options('nbcore_tb_background');
        $tb_bg_hover = estana_get_options('nbcore_tb_background_hover');
        $tb_text = estana_get_options('nbcore_tb_text');
        $tb_text_hover = estana_get_options('nbcore_tb_text_hover');
        $tb_border = estana_get_options('nbcore_tb_border');
        $tb_border_hover = estana_get_options('nbcore_tb_border_hover');
        $button_padding = estana_get_options('nbcore_button_padding');
        $button_border_radius = estana_get_options('nbcore_button_border_radius');
        $button_border_width = estana_get_options('nbcore_button_border_width');

        $footer_top_heading = estana_get_options('nbcore_footer_top_heading');
        $footer_top_color = estana_get_options('nbcore_footer_top_color');
        $footer_top_hover_color = estana_get_options('nbcore_footer_top_hover_color');
        $footer_top_bg = estana_get_options('nbcore_footer_top_bg');
        $footer_top_bor = estana_get_options('nbcore_footer_top_bor');
        $footer_bot_heading = estana_get_options('nbcore_footer_bot_heading');
        $footer_bot_color = estana_get_options('nbcore_footer_bot_color');
        $footer_bot_hover_color = estana_get_options('nbcore_footer_bot_hover_color');
        $footer_bot_bg = estana_get_options('nbcore_footer_bot_bg');
        $footer_bot_bor = estana_get_options('nbcore_footer_bot_bor');
        $footer_abs_bg = estana_get_options('nbcore_footer_abs_bg');
        $footer_abs_bor = estana_get_options('nbcore_footer_abs_bor');
        $footer_abs_color = estana_get_options('nbcore_footer_abs_color');
        $footer_abs_hover_color = estana_get_options('nbcore_footer_abs_hover_color');
        $footer_bg_img = estana_get_options('nbcore_footer_bg_img');
        $footer_bg_size = estana_get_options('nbcore_footer_bg_size');
        $footer_bg_pos = estana_get_options('nbcore_footer_bg_pos');
        $footer_bg_repeat = estana_get_options('nbcore_footer_bg_repeat');
		if ($footer_bg_img != '') {
			$footer_bg_img = wp_get_attachment_image_src( $footer_bg_img, 'full', false );
			$footer_bg_img = $footer_bg_img[0];
		}

        $blog_title_size = estana_get_options('nbcore_blog_single_title_size');
        $page_title_size = estana_get_options('nbcore_page_title_size');

        $footer_abs_padding = estana_get_options('nbcore_footer_abs_padding');

        $page_content_width = estana_get_options('page_content_width');
        $page_sidebar = estana_get_options('page_sidebar');
        $page_bg = wp_get_attachment_image_src(get_post_meta(get_the_ID(), 'page_bg_image', true), 'full');
        $page_bg_color = get_post_meta(get_the_ID(), 'page_bg_color', true);
		
        $vendor_map_height = estana_get_options('nbcore_vendor_map_height');
        $dashboard_sidebar = estana_get_options('nbcore_dashboard_sidebar');
        $dashboard_width = estana_get_options('nbcore_dashboard_width');

        $css = "";

        if($body_family_array[0] === 'custom') {
            $body_custom_font_url = array_slice($body_family_array, 1, -1);
            $css .= "
            @font-face {
                font-family: '" . end($body_family_array) . "';            
            ";

            foreach($body_custom_font_url as $url) {
                $css .= "
                src: url('" . $url . "');
                ";
            }

            $css .= "
            }
            ";
        }
        if($heading_font_array[0] === 'custom') {
            $heading_custom_font_url = array_slice($heading_font_array, 1, -1);
            $css .= '
            @font-face {
                font-family: "' . end($heading_font_array) . '";            
            ';

            foreach($heading_custom_font_url as $url) {
                $css .= '
                src: url("' . $url . '");
                ';
            }

            $css .= '
            }
            ';
        }
        $css .= '
            body {
                background-color: ' . esc_attr($bg_color) . ';
            }
            .nb-page-title-wrap,
            .single-blog .entry-author,
            .products .list-type-wrap,
            .shop-main.accordion-tabs .accordion-title-wrap,
            .woocommerce .woocommerce-message,
            .woocommerce .woocommerce-info,
            .woocommerce .woocommerce-error,
            .woocommerce-page .woocommerce-message,
            .woocommerce-page .woocommerce-info,
            .woocommerce-page .woocommerce-error,
            .cart-layout-2 .cart-totals-wrap,
            .blog.style-2 .post .entry-content,
            .comments-area,
            .blog .post .entry-cat a,
            .error404 main .text-wrap{
                background-color: ' . esc_attr($inner_bg) . ';
            }
            .products.list-type .product .list-type-wrap .product-image:before {
                border-right-color: ' . esc_attr($inner_bg) . ';
            }
            .main-logo {
                width: ' . esc_attr($logo_area_width) . 'px;
            }
            a,
            .footer-top-section a:hover,
            .footer-top-section .widget ul li a:hover,
            .footer-bot-section a:hover,
            .footer-bot-section .widget ul li a:hover{
                color: ' . esc_attr($link_color) . ';
            }
            a:hover, a:focus, a:active,
			h1 > a:hover, h2 > a:hover, h3 > a:hover, h4 > a:hover, h5 > a:hover, h6 > a:hover,
			.widget ul li a:hover, .woocommerce-breadcrumb a:hover, .nb-social-icons > a:hover, .wc-tabs > li:not(.active) a:hover, 
			.shop-main.accordion-tabs .accordion-title-wrap:not(.ui-state-active) a:hover, .nb-account-dropdown a:hover,
			.entry-meta .byline a:hover, .comments-link a:hover,
			.nb-page-title-wrap a:hover,
            .widget ul li a:hover,
			.woocommerce-MyAccount-navigation-link a:hover,
			.woocommerce-MyAccount-navigation-link.is-active a,
			.shop_table .cart_item td a:hover{
                color: ' . esc_attr($link_hover_color) . ';
            }
            body {
                font-family: ' . esc_attr($body_family) . '; 
                font-weight: ' . esc_attr($body_weight) . ';
                font-size: ' . esc_attr($body_size) . 'px;
        ';
        if (in_array("italic", $body_style_array)) {
            $css .= '
                font-style: italic;
            ';
        }
        if (in_array("underline", $body_style_array)) {
            $css .= '
                text-decoration: underline;
            ';
        }
        if (in_array("uppercase", $body_style_array)) {
            $css .= '
                text-transform: uppercase;
            ';
        }
        $css .= '
            }
            .button, .nb-primary-button, .post-password-form input[type="submit"],
			.nbt-product .product-action .button:hover,
			.nb-back-to-top-wrap:hover a.light, .nb-back-to-top-wrap:hover a.dark,
			.mini-cart-wrap .buttons .button,input[type="submit"].dokan-btn-default,
            .wc-tabs-wrapper .form-submit input,
			input[type="submit"].dokan-btn-theme, a.dokan-btn-theme, .dokan-btn-theme,
			.wpcf7-form input[type="submit"],
			#simplemodal-login-container-education form .submit input{
                color: ' . esc_attr($pb_text) . ' !important;
                background-color: ' . esc_attr($pb_bg) . ';
                border-color: ' . esc_attr($pb_border) . ';
            }
            .button:hover, .nb-primary-button:hover, .post-password-form input[type="submit"]:hover,
			.button:focus, .nb-primary-button:focus, .post-password-form input[type="submit"]:focus,
			.mini-cart-wrap .buttons .button:hover, .mini-cart-wrap .buttons .button:focus,
            .wc-tabs-wrapper .form-submit input:hover,input[type="submit"].dokan-btn-default:hover,
			input[type="submit"].dokan-btn-theme:hover, a.dokan-btn-theme:hover, .dokan-btn-theme:hover,
			input[type="submit"].dokan-btn-theme:focus, a.dokan-btn-theme:focus, .dokan-btn-theme:focus,
			input[type="submit"].dokan-btn-theme:active, a.dokan-btn-theme:active, .dokan-btn-theme:active,
			input[type="submit"].dokan-btn-theme.active, a.dokan-btn-theme.active, .dokan-btn-theme.active,
			.open .dropdown-toggleinput[type="submit"].dokan-btn-theme, .open .dropdown-togglea.dokan-btn-theme, .open .dropdown-toggle.dokan-btn-theme,
			.wpcf7-form input[type="submit"]:hover,
			#simplemodal-login-container-education form .submit input:hover {
                color: ' . esc_attr($pb_text_hover) . ';
                background-color: ' . esc_attr($pb_bg_hover) . ';
                border-color: ' . esc_attr($pb_border_hover) . ';
            }
            .nb-secondary-button,.readmore,.vc_btn3.vc_btn3-style-custom,
			.wpb-js-composer .vc_tta.vc_tta-style-nbstyle1 .vc_tta-tabs-container .vc_tta-tabs-list .vc_tta-tab > a,
			.wpb-js-composer .vc_tta.vc_tta-style-nbstyle1 .vc_tta-panels-container .vc_tta-panel-title > a,
            .single-product-wrap .yith-wcwl-add-to-wishlist,
			.filters-button-group .filter-btn{
                color: ' . esc_attr($sb_text) . ';
                background-color: ' . esc_attr($sb_bg) . ';
                border-color: ' . esc_attr($sb_border) . ';
            }
            .nb-secondary-button:hover, .nb-secondary-button:focus,.readmore:hover,.vc_btn3.vc_btn3-style-custom:hover,
			.wpb-js-composer .vc_tta.vc_tta-style-nbstyle1 .vc_tta-tabs-container .vc_tta-tabs-list .vc_tta-tab:hover > a,
			.wpb-js-composer .vc_tta.vc_tta-style-nbstyle1 .vc_tta-tabs-container .vc_tta-tabs-list .vc_tta-tab.vc_active > a,
			.wpb-js-composer .vc_tta.vc_tta-style-nbstyle1 .vc_tta-panels-container .vc_active .vc_tta-panel-title > a,
            .single-product-wrap .yith-wcwl-add-to-wishlist:hover,
			.filters-button-group .filter-btn.is-checked, .filters-button-group .filter-btn:hover{
                color: ' . esc_attr($sb_text_hover) . ';
                background-color: ' . esc_attr($sb_bg_hover) . ';
                border-color: ' . esc_attr($sb_border_hover) . ';
            }
			.nb_gallery .nb_galleryimg-i .nb_img_caption .nb_img_title{
				color: ' . esc_attr($tb_text) . ';
                background-color: ' . esc_attr($tb_bg) . ';
                border-color: ' . esc_attr($tb_border) . ';
			}
			.nb_gallery .nb_galleryimg-i:hover .nb_img_caption .nb_img_title{
				color: ' . esc_attr($tb_text_hover) . ';
                background-color: ' . esc_attr($tb_bg_hover) . ';
                border-color: ' . esc_attr($tb_border_hover) . ';
			}
            .list-type .add_to_cart_button, .nb-primary-button, .nb-secondary-button,.readmore,
			.single_add_to_cart_button, .post-password-form input[type="submit"],
			.error404 main .home-link a,
			input[type="submit"].dokan-btn, a.dokan-btn, .dokan-btn,
			.nb_gallery .nb_galleryimg-i .nb_img_caption .nb_img_title{
                padding-left: ' . esc_attr($button_padding) . 'px;
                padding-right: ' . esc_attr($button_padding) . 'px;
                border-width: ' . esc_attr($button_border_width) . 'px;
            ';
        if ($button_border_radius) {
            $css .= '
                border-radius: ' . esc_attr($button_border_radius) . 'px;
            ';
        } else {
            $css .= '
                border-radius: 0px;
            ';
        }
        $css .= '
            }
            body,
            .widget ul li a,
            .woocommerce-breadcrumb a,
			.woocommerce-MyAccount-navigation-link a,
            .nb-social-icons > a,
            .shop-main.accordion-tabs .accordion-title-wrap:not(.ui-state-active) a,
            .nb-account-dropdown a,
            .header-account-wrap .not-logged-in,
            .mid-inline .nb-account-dropdown a, 
            .mid-inline .mini-cart-section span, 
            .mid-inline .mini-cart-section a, 
            .mid-inline .mini-cart-section strong{
                color: ' . esc_attr($body_color) . ';
            }
			.entry-meta,
            .entry-meta .byline a,
            .comments-link a{
                color: ' . esc_attr($meta_color) . ';
            }
            h1 {
                font-size: ' . esc_attr(intval($heading_base_size * 2.074)) . 'px;
            }
            h2 {
                font-size: ' . esc_attr(intval($heading_base_size * 1.728)) . 'px;
            }
            h3 {
                font-size: ' . esc_attr(intval($heading_base_size * 1.44)) . 'px;
            }
            h4 {
                font-size: ' . esc_attr(intval($heading_base_size * 1.2)) . 'px;
            }
            h5 {
                font-size: ' . esc_attr(intval($heading_base_size * 1)) . 'px;
            }
            h6 {
                font-size: ' . esc_attr(intval($heading_base_size * 0.833)) . 'px;
            }
            h1, h2, h3, h4, h5, h6,
            .entry-title > a,
            .woocommerce-Reviews .comment-reply-title {
                font-family: ' . esc_attr($heading_family) . '; 
                font-weight: ' . esc_attr($heading_weight) . ';
                color: ' . esc_attr($heading_color) . ';
        ';
        if (in_array("italic", $heading_font_style)) {
            $css .= '
                font-style: italic;
            ';
        }
        if (in_array("underline", $heading_font_style)) {
            $css .= '
                text-decoration: underline;
            ';
        }
        if (in_array("uppercase", $heading_font_style)) {
            $css .= '
                text-transform: uppercase;
            ';
        }
        //TODO after make inline below woocommerce.css remove these !important
        //TODO postMessage font-size .header-top-bar a
        $css .= '
            }
            h1 > a, h2 > a, h3 > a, h4 > a, h5 > a, h6 > a{
				color: ' . esc_attr($heading_color) . ';
				';
			if (in_array("underline", $heading_font_style)) {
				$css .= '
					text-decoration: underline;
				';
			}
        $css .= '
			}
            .site-header .top-section-wrap {
                padding: ' . esc_attr($top_padding) . 'px 0;
                background-color: ' . esc_attr($top_bg) . ';
            }
            .top-section-wrap,.top-section-wrap a {
                color: ' . esc_attr($top_color) . ';
            }
            .top-section-wrap a:hover,
			.top-section-wrap .nb-navbar .menu-item:hover > a, .top-section-wrap .nb-navbar .menu-item.current-menu-parent > a, .top-section-wrap .nb-navbar .menu-item.current-menu-item > a, .top-section-wrap .nb-navbar .menu-item.current-menu-ancestor > a,
			.top-section-wrap .nb-header-sub-menu .menu-item:hover > a, .top-section-wrap .nb-header-sub-menu .menu-item.current-menu-parent > a, .top-section-wrap .nb-header-sub-menu .menu-item.current-menu-item > a,.top-section-wrap .nb-header-sub-menu .menu-item.current-menu-ancestor > a,
			.top-section-wrap .mini-cart-wrap .mini_cart_item .remove:hover {
                color: ' . esc_attr($top_hover_color) . ' !important;
            }
            .top-section-wrap .nb-header-sub-menu .sub-menu {
                background-color: ' . esc_attr($top_bg) . ';
            }
            .site-header .middle-section-wrap {
                padding: ' . esc_attr($middle_padding) . 'px 0;
                background-color: ' . esc_attr($middle_bg) . ';
            }
			.site-header.left-inline .middle-section-wrap .middle-section .nb-navbar, .header-cart-wrap {
				margin-top: -' . esc_attr($middle_padding) . 'px;
				margin-bottom: -' . esc_attr($middle_padding) . 'px;
			}
			.site-header.left-inline .middle-section-wrap .middle-section .nb-navbar > li > a, .header-cart-wrap {
				padding-top: ' . esc_attr($middle_padding) . 'px;
				padding-bottom: ' . esc_attr($middle_padding) . 'px;
			}
            .middle-section-wrap,.middle-section-wrap a {
                color: ' . esc_attr($middle_color) . ';
            }
            .middle-section-wrap a:hover,
			.middle-section-wrap .nb-navbar .menu-item:hover > a, .middle-section-wrap .nb-navbar .menu-item.current-menu-parent > a, .middle-section-wrap .nb-navbar .menu-item.current-menu-item > a, .middle-section-wrap .nb-navbar .menu-item.current-menu-ancestor > a,
			.middle-section-wrap .nb-header-sub-menu .menu-item:hover > a, .middle-section-wrap .nb-header-sub-menu .menu-item.current-menu-parent > a, .middle-section-wrap .nb-header-sub-menu .menu-item.current-menu-item > a, .middle-section-wrap .nb-header-sub-menu .menu-item.current-menu-ancestor > a,
			.icon-header-wrap .nb-cart-section i,
			.middle-section-wrap .mini-cart-wrap .mini_cart_item .remove:hover{
                color: ' . esc_attr($middle_hover_color) . ';
            }
            .site-header:not(.mid-stack) .bot-section-wrap {
                padding: ' . esc_attr($bot_padding) . 'px 0;                
            }
            .site-header.mid-stack .nb-navbar > .menu-item > a {
                padding: ' . esc_attr($bot_padding) . 'px 20px;                
            }
            .site-header .bot-section-wrap {
                background-color: ' . esc_attr($bot_bg) . ';           
            }
            .bot-section-wrap, .bot-section-wrap a{
                color: ' . esc_attr($bot_color) . ';
            }
            .bot-section-wrap a:hover,
			.bot-section-wrap .nb-navbar .menu-item:hover > a, .bot-section-wrap .nb-navbar .menu-item.current-menu-parent > a, .bot-section-wrap .nb-navbar .menu-item.current-menu-item > a, .bot-section-wrap .nb-navbar .menu-item.current-menu-ancestor > a,
			.bot-section-wrap .nb-header-sub-menu .menu-item:hover > a, .bot-section-wrap .nb-header-sub-menu .menu-item.current-menu-parent > a, .bot-section-wrap .nb-header-sub-menu .menu-item.current-menu-item > a, .bot-section-wrap .nb-header-sub-menu .menu-item.current-menu-ancestor > a,
			.bot-section-wrap .mini-cart-wrap .mini_cart_item .remove:hover{
                color: ' . esc_attr($bot_hover_color) . ';
            }
            .nb-navbar .menu-item-has-children > a span:after,
            .icon-header-section .nb-cart-section,
            .nb-navbar .menu-item a,
            .nb-navbar .sub-menu > .menu-item:not(:last-child),
            .nb-header-sub-menu .sub-menu > .menu-item:not(:last-child),
            .widget .widget-title,
            .blog .classic .post .entry-footer,
            .single-post .single-blog .entry-footer,
            .nb-social-icons > a,
            .single-blog .entry-author-wrap,
			.single-product-wrap .product-image .thumb-gallery .swiper-slide,
            .shop-main:not(.wide) .single-product-wrap .product_meta,
            .shop-main.accordion-tabs .accordion-item .accordion-title-wrap,
            .shop-main.horizontal-tabs .wc-tabs-wrapper .wc-tabs,
            .shop_table thead th,
            .shop_table th,
            .shop_table td,
            .mini-cart-wrap .total,
            .icon-header-wrap .nb-account-dropdown ul li:not(:last-of-type) a,
            .widget tbody th, .widget tbody td,
            .widget ul > li:not(:last-of-type),
			.widget ul .children,
			.widget .sub-menu,
            .blog .post .entry-image .entry-cat,
            .comment-list .comment,
			.commentlist .comment-text,
			.blog .classic .post .entry-footer, .content-search > article .entry-footer,
			.dokan-single-seller .store-wrapper{
                border-color: ' . esc_attr($divider_color) . ';
            }
            @media (max-width: 767px) {
                .shop_table.cart {
                    border: 1px solid ' . esc_attr($divider_color) . ';
                }
                .shop_table.cart td {
                    border-bottom: 1px solid ' . esc_attr($divider_color) . ';
                }
            }
			article.sticky,
			.product_list_widget > li > a:hover > img,.product_list_widget > li > a > img:hover,
            .product .product-image .onsale,
            .wc-tabs > li.active,
            .product .onsale.sale-style-2 .percent,
            .wc-tabs-wrapper .woocommerce-Reviews #review_form_wrapper .comment-respond,
            .site-header.mid-stack .main-navigation .nb-navbar > .menu-item:hover,
            .shop-main.accordion-tabs .accordion-item .accordion-title-wrap.ui-accordion-header-active,
			.variations ul.swatch li:hover span, .variations ul.swatch li.selected span,
            .widget .tagcloud a,
            .footer-top-section .widget .tagcloud a,
            .footer-bot-section .widget .tagcloud a,
            .cart-notice-wrap .cart-notice,
			.single-product-wrap .product-image .thumb-gallery .swiper-slide.swiper-slide-active,
			.single-product-wrap .product-image .thumb-gallery .swiper-slide:hover,
			.widget .woocommerce-product-search .search-field:focus,
			#yith-wcwl-popup-message,
            .paging-navigation.pagination-style-1 .current,
            .woocommerce-pagination.pagination-style-1 .page-numbers.current,
            .paging-navigation.pagination-style-1 .page-numbers:hover,
            .woocommerce-pagination.pagination-style-1 .page-numbers:hover,
			.page-links.pagination-style-1 > span,
			.page-links.pagination-style-1 > a:hover,
			.wpb-js-composer .vc_tta.vc_tta-style-nbstyle1.vc_tta-shape-none .vc_tta-tabs-container .vc_tta-tabs-list .vc_tta-tab:hover > a,
			.wpb-js-composer .vc_tta.vc_tta-style-nbstyle1.vc_tta-shape-none .vc_tta-tabs-container .vc_tta-tabs-list .vc_tta-tab.vc_active > a,
			.nb-input-group .search-field:focus,
			.widget .nb-input-group .search-field:focus,
			.contact-form .uavc-list .uavc-list-content .uavc-list-icon,
			#simplemodal-login-form .simplemodal-login-fields p >input:focus,
			#simplemodal-login-form .simplemodal__footer .footer__right a,
			.nbt-primary-border,
			.ult_countdown .ult_countdown-section .ult_time-mid,
			.dokan-dashboard.dokan-custom-style .dokan-dash-sidebar ul.dokan-dashboard-menu li:hover,
            .dokan-dashboard.dokan-custom-style .dokan-dash-sidebar ul.dokan-dashboard-menu li.active,
            .dokan-dashboard.dokan-custom-style .dokan-dash-sidebar ul.dokan-dashboard-menu li.dokan-common-links a:hover,
            .blog .post:not(.sticky) .entry-image,
            .blog .post:not(.sticky) .entry-content,
            .dokan-dashboard.dokan-custom-style .dokan-dashboard-content .dokan-report-wrap .dokan-reports-sidebar ul.chart-legend li:first-child{
				border-color: ' . esc_attr($primary_color) . ';
			}
            .widget .widget-title:before,
            .paging-navigation.pagination-style-1 .current,
            .woocommerce-pagination.pagination-style-1 .page-numbers.current,
            .paging-navigation.pagination-style-1 .page-numbers:hover,
            .woocommerce-pagination.pagination-style-1 .page-numbers:hover,
			.page-links.pagination-style-1 > span,
			.page-links.pagination-style-1 > a:hover,
            .paging-navigation.pagination-style-2 .current,
            .product .onsale.sale-style-1,
            .woocommerce-pagination.pagination-style-2 span.current,
			.page-links.pagination-style-2 > span,
			.page-links.pagination-style-2 > a:hover,
            .shop-main.right-dots .flickity-page-dots .dot,
            .nb-input-group .search-button button,
            .widget .tagcloud a:hover,
            .nb-back-to-top-wrap a:hover,
			.swiper-pagination-bullet.swiper-pagination-bullet-active,
			.woocommerce .widget_price_filter .ui-slider .ui-slider-handle,
			.error404 main .home-link,
			#secondary .tagcloud a:hover,
			.nbt-primary-bg,
			.tp-bullets.custom .tp-bullet.selected,
			.tp-bullets.custom .tp-bullet:hover,
			.crating_list_action .icon_list_item:hover .icon_list_icon:before,
			[data-slide="owl-carousel"] .owl-dots .owl-dot.active span, [data-slide="owl-carousel"] .owl-dots .owl-dot:hover span,
			.dokan-dashboard.dokan-custom-style .dokan-progress.m-dokan-progress .dokan-progress-bar{
                background-color: ' . esc_attr($primary_color) . ';
            }
			article.sticky:before,
            .product .star-rating:before,
            .product .star-rating span,
			.nbt-product .product-content .product-title > a:hover,
            .single-product-wrap .price ins,
            .single-product-wrap .price > span.amount,
			.nbt-product .product-content .price .amount,
			.product_list_widget .product-title > a:hover,
			.product_list_widget span.amount,
            .wc-tabs > li.active a,
            .wc-tabs > li.active a:hover,
            .wc-tabs > li.active a:focus,
            .wc-tabs .ui-accordion-header-active a,
            .wc-tabs .ui-accordion-header-active a:focus,
            .wc-tabs .ui-accordion-header-active a:hover,
            .shop-main.accordion-tabs .ui-accordion-header-active:after,
            .shop_table .cart_item td .amount,
            .cart_totals .order-total .amount,
            .shop_table.woocommerce-checkout-review-order-table .order-total .amount,
            .woocommerce-order .woocommerce-thankyou-order-received,
            .woocommerce-order .woocommerce-table--order-details .amount,
			.variations ul.swatch li:hover span, .variations ul.swatch li.selected span,
			.post a.more-link,
			.shop-main .woocommerce-Reviews #review_form_wrapper .stars:hover a:before,
			.shop-main .woocommerce-Reviews #review_form_wrapper .stars.selected a:before,
			.shop-main .woocommerce-Reviews #review_form_wrapper .stars.selected a.active:before,
			.woocommerce-wishlist.woocommerce #content table.wishlist_table.cart a.remove:hover,
			.shop_table.cart td.product-name a:hover,
			.wpb-js-composer .vc_tta.vc_tta-style-nbstyle1.vc_tta-shape-none .vc_tta-tabs-container .vc_tta-tabs-list .vc_tta-tab:hover > a,
			.wpb-js-composer .vc_tta.vc_tta-style-nbstyle1.vc_tta-shape-none .vc_tta-tabs-container .vc_tta-tabs-list .vc_tta-tab.vc_active > a,
			.error404 main .pnf-heading,
			.contact-form .uavc-list .uavc-list-content a:hover,
			.contact-form .uavc-list .uavc-list-content .uavc-list-icon,
			.nb-input-group .search-button button:hover,
			.widget .nb-input-group .search-button button:hover,
			#simplemodal-login-form .simplemodal__footer .footer__right a,
			.nbt-primary-color,
			.aio-icon-component:before,
			.img-shop .wpb_column .wpb_text_column a:hover,
			.dokan-single-store .store-page-wrap .dokan-store-tabs ul.dokan-list-inline li:nth-child(1) a,
			.dokan-single-store .store-review-wrap .dokan-store-tabs ul.dokan-list-inline li:nth-child(2) a,
			.dokan-single-store .dokan-store-tabs ul li a:hover,
			.nb_wp_post.nb_wp-blog2 .nb-post-date .vc_post_date-month,.nb_wp_post .nb_wp_post-i .nb-post-block .nb-post-meta a:hover,
			.nb_testimonials .nb_testimonial-item .nb_testimonial-box2:before,
			.dokan-dashboard.dokan-custom-style .dokan-dash-sidebar ul.dokan-dashboard-menu li a i,
            .dokan-dashboard.dokan-custom-style .dokan-dash-sidebar ul.dokan-dashboard-menu li:hover,
            .dokan-dashboard.dokan-custom-style .dokan-dash-sidebar ul.dokan-dashboard-menu li:hover a,
            .dokan-dashboard.dokan-custom-style .dokan-dash-sidebar ul.dokan-dashboard-menu li.active,
            .dokan-dashboard.dokan-custom-style .dokan-dash-sidebar ul.dokan-dashboard-menu li.active a,
            .dokan-dashboard.dokan-custom-style .dokan-dash-sidebar ul.dokan-dashboard-menu li.dokan-common-links a:hover,
            .dokan-dashboard.dokan-custom-style .dokan-dashboard-content .dokan-report-wrap ul.dokan_tabs li:hover a,
            .dokan-dashboard.dokan-custom-style .dokan-dashboard-content .dokan-report-wrap ul.dokan_tabs li.active a,
            .type-post:not(.sticky).format-standard .entry-block:before,
            .dokan-dashboard.dokan-custom-style .dokan-dashboard-content .dokan-report-wrap .dokan-reports-sidebar ul.chart-legend li:first-child,
            .dokan-product-listing .dokan-product-listing-area table.product-listing-table td.post-date .status{
                color: ' . esc_attr($primary_color) . ';
            }
			.nbt-brands .aio-icon:hover{
				color: ' . esc_attr($primary_color) . ' !important;
			}
			.post a.more-link:hover,
			.error404 main h1{
                color: ' . esc_attr($secondary_color) . ';
            }
			.nbt-why .nbt-img-why .aio-icon-component:hover .aio-icon-img,
			.nbt-why .img-why > figure .vc_single_image-wrapper:before,
			.nbt-why .img-why > figure .vc_single_image-wrapper:after{
				border-color: ' . esc_attr($tertiary_color) . ';
			}
            .nb-page-title-wrap {
                padding-top: ' . esc_attr($page_title_padding) . 'px;
                padding-bottom: ' . esc_attr($page_title_padding) . 'px;'
				. ($page_title_img != '' ? ('background-image: url(' . esc_url($page_title_img) . ');
				background-size: ' . $page_title_img_size . ';
				background-position: ' . $page_title_img_pos . ';
				background-repeat: ' . $page_title_img_repeat . ';') : '')
            . '}
            .nb-page-title-wrap a, .nb-page-title-wrap h2, .nb-page-title-wrap nav {
                color: ' . esc_attr($page_title_color) . ';
            }            
            .nb-page-title-wrap h2 {
                font-size: ' . esc_attr($page_title_size) . 'px;
            }
            .woocommerce-page.wc-no-sidebar #primary {
                width: 100%;
            }                                   
        ';
		if ($footer_bg_img != ''){
			$css .= '
            .site-footer {
				background-image: url(' . esc_url($footer_bg_img) . ');
				background-size: ' . $footer_bg_size . ';
				background-position: ' . $footer_bg_pos . ';
				background-repeat: ' . $footer_bg_repeat . ';'
            . '}';
		}
        $css .= '
            .footer-top-section {
                background-color: ' . esc_attr($footer_top_bg) . ';
                border-color: ' . esc_attr($footer_top_bor) . ';
            }
            .footer-top-section *, .footer-top-section .input-group .form-control, .footer-top-section .input-group .btn {
                border-color: ' . esc_attr($footer_top_bor) . ';
            }
            .footer-top-section h1,
            .footer-top-section h2,
            .footer-top-section h3,
            .footer-top-section h4,
            .footer-top-section h5,
            .footer-top-section h6,
            .footer-top-section .widget-title a{
                color: ' . esc_attr($footer_top_heading) . ';
            }
            .footer-top-section,
            .footer-top-section a,
            .footer-top-section .widget ul li a{
                color: ' . esc_attr($footer_top_color) . ';
            }
			.footer-top-section input{
				color: ' . esc_attr($footer_top_color) . ' !important;
			}
			.footer-top-section input::-webkit-input-placeholder {
				color: ' . esc_attr($footer_top_color) . ' !important;
				opacity: 0.65;
			}
			.footer-top-section input:-moz-placeholder {
				color: ' . esc_attr($footer_top_color) . ' !important;
				opacity: 0.65;
			}
			.footer-top-section input::-moz-placeholder {
				color: ' . esc_attr($footer_top_color) . ' !important;
				opacity: 0.65;
			}
			.footer-top-section input:-ms-input-placeholder {
				color: ' . esc_attr($footer_top_color) . ' !important;
				opacity: 0.65;
			}
            .footer-top-section a:hover,
            .footer-top-section .widget ul li a:hover,
			.footer-top-section .form-newsletter .input-group .btn:hover{
                color: ' . esc_attr($footer_top_hover_color) . ';
            }
            .footer-top-section .widget .tagcloud a{
                border-color: ' . esc_attr($footer_top_color) . ';
            }
            .footer-bot-section{
                background-color: ' . esc_attr($footer_bot_bg) . ';
                border-color: ' . esc_attr($footer_bot_bor) . ';
            }
            .footer-bot-section * {
                border-color: ' . esc_attr($footer_bot_bor) . ';
            }
            .footer-bot-section h1,
            .footer-bot-section h2,
            .footer-bot-section h3,
            .footer-bot-section h4,
            .footer-bot-section h5,
            .footer-bot-section h6,
            .footer-bot-section .widget-title a{
                color: ' . esc_attr($footer_bot_heading) . ';
            }
            .footer-bot-section,
            .footer-bot-section a,
            .footer-bot-section .widget ul li a{
                color: ' . esc_attr($footer_bot_color) . ';
            }
            .footer-bot-section a:hover,
            .footer-bot-section .widget ul li a:hover,
			.footer-bot-section .form-newsletter .input-group .btn:hover{
                color: ' . esc_attr($footer_bot_hover_color) . ';
            }
            .footer-bot-section .widget .tagcloud a{
                border-color: ' . esc_attr($footer_bot_color) . ';
            }
            .footer-abs-section{
                color: ' . esc_attr($footer_abs_color) . ';
                background-color: ' . esc_attr($footer_abs_bg) . ';
                border-color: ' . esc_attr($footer_abs_bor) . ';
                padding-top: ' . esc_attr($footer_abs_padding) . 'px;
                padding-bottom: ' . esc_attr($footer_abs_padding) . 'px;
            }
            .footer-abs-section * {
                border-color: ' . esc_attr($footer_abs_bor) . ';
            }
            .footer-abs-section p {
                color: ' . esc_attr($footer_abs_color) . ';
            }
            .footer-abs-section a, .footer-abs-section a:hover,
			.footer-abs-section .form-newsletter .input-group .btn:hover {
                color: ' . esc_attr($footer_abs_hover_color) . ';
            }
            .single-blog .nb-page-title .entry-title,
            .single-blog .entry-title{
                font-size: ' . esc_attr($blog_title_size) . 'px;
            }
			.dokan-store-sidebar #dokan-store-location{
				height: ' . $vendor_map_height . 'px;
			}
            ';
        if ($page_bg_color) {
            $css .= '
                .page #site-wrapper {
                    background-color: ' . esc_attr($page_bg_color) . ';
                }
                ';
        }
        if ($page_bg[0]) {
            $css .= '
                .page #site-wrapper {
                    background: url(' . esc_url($page_bg[0]) . ') repeat center center / cover; 
                }
            ';
        }
		
		$css .= '@media (min-width: 992px) {
			';

        if ('no-sidebar' !== $blog_sidebar && is_active_sidebar('default-sidebar')) {
            $css .= '            
                .site-content .blog #primary,
                .site-content .single-blog #primary {
                    -webkit-box-flex: 0;
                    -ms-flex: 0 0 ' . esc_attr($blog_width) . '%;
                    flex: 0 0 ' . esc_attr($blog_width) . '%;
                    max-width: ' . esc_attr($blog_width) . '%;
                } 
                .site-content .blog #secondary,
                .site-content .single-blog #secondary {
                    -webkit-box-flex: 0;
                    -ms-flex: 0 0 ' . esc_attr(100 - absint($blog_width)) . '%;
                    flex: 0 0 ' . esc_attr(100 - absint($blog_width)) . '%;
                    max-width: ' . esc_attr(100 - absint($blog_width)) . '%;
                }                                  
            ';
			if ('left-sidebar' == $blog_sidebar) {
				$css .= '
					.single-blog #primary, .blog #primary {
						order: 2;
					}
				';
			}
        }
		
        if ( class_exists( 'WooCommerce' ) ) {
			$css .= '
				.shop-main:not(.wide) .single-product-wrap .product-image {
					-webkit-box-flex: 0;
					-ms-flex: 0 0 ' . esc_attr($pd_images_width) . '%;
					flex: 0 0 ' . esc_attr($pd_images_width) . '%;                   
					max-width: ' . esc_attr($pd_images_width) . '%;
				}
				.shop-main:not(.wide) .single-product-wrap .entry-summary {
					-webkit-box-flex: 1;
					-webkit-flex: 1;
					-ms-flex: 1;
					flex: 1;
				}
			';
			if ('left-sidebar' == $shop_sidebar) {
				$css .= '
					.archive.woocommerce .shop-main {
						order: 2;
					}
				';
			}
			if ('left-sidebar' == $pd_details_sidebar) {
				$css .= '
					.single-product .shop-main {
						order: 2;
					}
				';
			}
			if ('no-sidebar' !== $pd_details_sidebar && is_active_sidebar('product-sidebar')) {
				$css .= '
					.single-product.wc-pd-has-sidebar .shop-main {
						-webkit-box-flex: 1;
						-webkit-flex: 1;
						-ms-flex: 1;
						flex: 1;
					}
					.single-product #secondary {
						-webkit-box-flex: 0;
						-ms-flex:' . esc_attr(100 - absint($pd_details_width)) . '%);
						flex: 0 0 ' . esc_attr(100 - absint($pd_details_width)) . '%);
						max-width: ' . esc_attr(100 - absint($pd_details_width)) . '%);
					}
				';
			}
			// TODO check this for tag ... ?
			if ('no-sidebar' !== $shop_sidebar && is_active_sidebar('shop-sidebar')) {
				$css .= '
					.archive.woocommerce.wc-has-sidebar .shop-main{
						-webkit-box-flex: 1;
						-webkit-flex: 1;
						-ms-flex: 1;
						flex: 1;
					}
					.archive.woocommerce.wc-has-sidebar #secondary{
						-webkit-box-flex: 0;
						-ms-flex: 0 0 ' . esc_attr(100 - absint($wc_content_width)) . '%;
						flex: 0 0 ' . esc_attr(100 - absint($wc_content_width)) . '%;
						max-width: ' . esc_attr(100 - absint($wc_content_width)) . '%;
					}
				';
			} else {
				$css .= '
					.archive.woocommerce.wc-no-sidebar .shop-main {
						-webkit-box-flex: 0;
						-ms-flex: 0 0 100%;
						flex: 0 0 100%;
						max-width: 100%;
					}
				';
			}
		}
		if ( class_exists( 'WeDevs_Dokan' ) ) {
			$vendor_width = estana_get_options('nbcore_vendor_details_width');
			$vendor_sidebar = estana_get_options('nbcore_vendor_details_sidebar');
			if ('no-sidebar' !== $vendor_sidebar) {
				$css .= '
					.dokan-store.dk-has-sidebar .shop-main{
						-webkit-box-flex: 1;
						-webkit-flex: 1;
						-ms-flex: 1;
						flex: 1;
					}
					.dokan-store.dk-has-sidebar #secondary{
						-webkit-box-flex: 0;
						-ms-flex: 0 0 ' . esc_attr(100 - absint($vendor_width)) . '%;
						flex: 0 0 ' . esc_attr(100 - absint($vendor_width)) . '%;
						max-width: ' . esc_attr(100 - absint($vendor_width)) . '%;
					}
				';
				if ('left-sidebar' == $vendor_sidebar) {
					$css .= '
						.dokan-store.dk-has-sidebar .shop-main {
							order: 2;
						}
					';
				}
			} else {
				$css .= '
					.dokan-store.dk-no-sidebar .shop-main {
						-webkit-box-flex: 0;
						-ms-flex: 0 0 100%;
						flex: 0 0 100%;
						max-width: 100%;
					}
				';
			}
		}
        if ('full-width' !== $page_sidebar && is_active_sidebar('default-sidebar')) {
            $css .= '            
                .page #primary {
                    -webkit-box-flex: 1;
					-webkit-flex: 1;
					-ms-flex: 1;
					flex: 1;
                }
                .page #secondary {
                    -webkit-box-flex: 0;
                    -ms-flex: 0 0 ' . esc_attr(100 - absint($page_content_width)) . '%;
                    flex: 0 0 ' . esc_attr(100 - absint($page_content_width)) . '%;  
                    max-width: ' . esc_attr(100 - absint($page_content_width)) . '%;
                }
            ';
        }

        $css .= "
            .site-main .dokan-dashboard-wrap .dokan-dash-sidebar {
                -webkit-box-flex: 0;
                -ms-flex: 0 0 calc(100% - " . esc_attr($dashboard_width) . "%);
                flex: 0 0 calc(100% - " . esc_attr($dashboard_width) . "%);
                max-width: calc(100% - " . esc_attr($dashboard_width) . "%);
            }
            .site-main .dokan-dashboard-wrap .dokan-dashboard-content {
                -webkit-box-flex: 0;
                -ms-flex: 0 0 " . esc_attr($dashboard_width) . "%;
                flex: 0 0 " . esc_attr($dashboard_width) . "%;
                max-width: " . esc_attr($dashboard_width) . "%;
            }
        ";

        if('right-sidebar' === $dashboard_sidebar) {
            $css .= "
                .site-main .dokan-dashboard-wrap .dokan-dashboard-content {
                    order: 1;
                    padding-left: 0;
                    padding-right: 25px;
                }
                .site-main .dokan-dashboard-wrap .dokan-dash-sidebar {
                    order: 2
                }
            ";
        }


        $css .= '
            }
        ';

        return $css;
    }

    public function print_embed_style()
    {
        if (class_exists( 'NetbaseCustomizeClass', false ) ) {
            if(!empty(get_transient('change_customize_css'))) {
                if(get_transient('change_customize_css')==1) {
                    set_transient('change_customize_css', 0, NBT_TIMEOUT_TRANSIENT_CUSTOMIZE);
                    $style = $this->get_embed_style();
                    $style = preg_replace('#/\*.*?\*/#s', '', $style);
                    $style = preg_replace('/\s*([{}|:;,])\s+/', '$1', $style);
                    $style = preg_replace('/\s\s+(.*)/', '$1', $style);
                    if(get_option('customize_save_css')==false) {
                        add_option( 'customize_save_css', $style, '', 'yes' );
                    } else {
                        update_option( 'customize_save_css', $style );
                    }
                    $cp = new NetbaseCustomizeClass();
                    $cp->save_css_customize();
                }
            }
        }
        $my_transient = get_transient('current_load_css');
        if(empty($my_transient) || !$this->is_plugin_active_byme('nb-fw/nb-fw.php')) {
            $this->print_style_head();
        } else {
            if($my_transient==NBT_LOAD_CUSTOMIZE_FROM_HEAD) {
                $this->print_style_head();
            } else {
                if($my_transient==NBT_LOAD_CUSTOMIZE_FROM_CSS_FILE && file_exists(NBT_REAL_PATH_TEMPLATE . NBT_CSS_CUSTOMIZE_PATH . NBT_CSS_CUSTOMIZE_NAME)) {
                    wp_enqueue_style('customize', get_template_directory_uri() . NBT_CSS_CUSTOMIZE_PATH . NBT_CSS_CUSTOMIZE_NAME, array(), Estana_VER);
                } else {
                    set_transient('current_load_css', NBT_LOAD_CUSTOMIZE_FROM_HEAD, NBT_TIMEOUT_TRANSIENT_CUSTOMIZE);
                    $this->print_style_head();
                }
            }
        }
    }

    public function print_style_head() {
        $style = $this->get_embed_style();

        $style = preg_replace('#/\*.*?\*/#s', '', $style);
        $style = preg_replace('/\s*([{}|:;,])\s+/', '$1', $style);
        $style = preg_replace('/\s\s+(.*)/', '$1', $style);

        wp_add_inline_style('estana_front_style', $style);
    }
    function is_plugin_active_byme( $plugin ) {
        return in_array( $plugin, (array) get_option( 'active_plugins', array() ) );
    }

    public static function filter_fonts($font)
    {
        $font_args = explode(",", estana_get_options($font));
        if($font_args[0] === 'google') {
            self::handle_google_font($font_args[1]);
        } elseif($font_args[0] === 'custom') {
            self::handle_custom_font($font_args[1]);
        } elseif($font_args[0] === 'standard') {
            self::handle_standard_font($font_args[1]);
        }
    }

    public static function handle_google_font($font_name)
    {
        $font_subset = 'latin,latin-ext';
        $font_families = array();
        $google_fonts = Estana_Helper::google_fonts();
        $font_parse = array();


        $font_weight = $google_fonts[$font_name];
        $font_families[$font_name] = isset($font_families[$font_name]) ? array_unique(array_merge($font_families[$font_name], $font_weight)) : $font_weight;

        foreach ($font_families as $font => $font_weight) {
            $font_parse[] = $font . ':' . implode(',', $font_weight);
        }

        if (estana_get_options('subset_cyrillic')) {
            $font_subset .= ',cyrillic,cyrillic-ext';
        }
        if (estana_get_options('subset_greek')) {
            $font_subset .= ',greek,greek-ext';
        }
        if (estana_get_options('subset_vietnamese')) {
            $font_subset .= ',vietnamese';
        }

        $query_args = array(
            'family' => urldecode(implode('|', $font_parse)),
            'subset' => urldecode($font_subset),
        );

        $font_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css');

        $enqueue = esc_url_raw($font_url);

        wp_enqueue_style('estana-google-fonts', $enqueue);
    }

    public static function google_fonts_url()
    {
        $gg_font_arr = array();
        $gg_font_parse = array();
        $google_fonts = Estana_Helper::google_fonts();
        $gg_subset = 'latin,latin-ext';

        $body_font = explode(',', estana_get_options('body_font_family'));
        $heading_font = explode(',', estana_get_options('heading_font_family'));

        if($body_font[0] === 'google') {
            $body_name = $body_font[1];
            $body_weight = $google_fonts[$body_name];
            $gg_font_arr[$body_name] = isset($gg_font_arr[$body_name]) ? array_unique(array_merge($gg_font_arr[$body_name], $body_weight)) : $body_weight;
        }

        if($heading_font[0] === 'google') {
            $heading_name = $heading_font[1];
            $heading_weight = $google_fonts[$heading_name];
            $gg_font_arr[$heading_name] = isset($gg_font_arr[$heading_name]) ? array_unique(array_merge($gg_font_arr[$heading_name], $heading_weight)) : $heading_weight;
        }

        if(!empty($gg_font_arr)) {
            foreach ($gg_font_arr as $gg_font_name => $gg_font_weight) {
                $gg_font_parse[] = $gg_font_name . ':' . implode(',', $gg_font_weight);
            }

            if (estana_get_options('subset_cyrillic')) {
                $gg_subset .= ',cyrillic,cyrillic-ext';
            }
            if (estana_get_options('subset_greek')) {
                $gg_subset .= ',greek,greek-ext';
            }
            if (estana_get_options('subset_vietnamese')) {
                $gg_subset .= ',vietnamese';
            }

            $query_args = array(
                'family' => urldecode(implode('|', $gg_font_parse)),
                'subset' => urldecode($gg_subset),
            );

            $font_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css');

            $enqueue = esc_url_raw($font_url);

            wp_enqueue_style('estana-google-fonts', $enqueue);
        }
    }

    public static function upload_mimes($t)
    {
        // Add supported font extensions and MIME types.
        $t['eot'] = 'application/vnd.ms-fontobject';
        $t['otf'] = 'application/x-font-opentype';
        $t['ttf'] = 'application/x-font-ttf';
        $t['woff'] = 'application/font-woff';
        $t['woff2'] = 'application/font-woff2';

        return $t;
    }

    public static function register_required_plugins()
    {
        if(!isset(self::$plugins)) {
            self::$plugins = array(
                array(
                    'name' => 'Advanced Custom Fields',
                    'slug' => 'advanced-custom-fields',
                    'thumb' => get_template_directory_uri() . '/assets/images/plugins/acf.jpg',
                    'required' => true,
                    'version' => '4.4.12',
                ),
                array(
                    'name' => 'WooCommerce',
                    'slug' => 'woocommerce',
                    'thumb' => get_template_directory_uri() . '/assets/images/plugins/woocommerce.png',
                    'required' => true,
                    'version' => '3.4.3',
                ),
                array(
                    'name' => 'YITH WooCommerce Wishlist',
                    'slug' => 'yith-woocommerce-wishlist',
                    'required' => false,
                    'version' => '2.2.2',
                ),
                array(
                    'name' => 'YITH WooCommerce Quick View',
                    'slug' => 'yith-woocommerce-quick-view',
                    'required' => false,
                    'version' => '1.3.1',
                ),
                array(
                    'name' => 'Contact Form 7',
                    'slug' => 'contact-form-7',
                    'required' => false,
                    'version' => '5.0.2',
                ),
                array(
                    'name' => 'One Click Demo Import',
                    'slug' => 'one-click-demo-import',
                    'required' => true,
                    'version' => '2.4.0',
                ),
                array(
                    'name' => 'MailChimp for WordPress',
                    'slug' => 'mailchimp-for-wp',
                    'required' => false,
                    'version' => '4.2.3',
                ),
                array(
                    'name' => 'Widget CSS Classes',
                    'slug' => 'widget-css-classes',
                    'required' => false,
                    'version' => '1.5.2.1',
                ),
                array(
                    'name' => 'Slider Revolution',
                    'slug' => 'revslider',
                    'required' => false,
                    'version' => '5.4.6.4',
                    'source' => get_template_directory() . '/plugins/revslider.zip',
                ),
                array(
                    'name' => 'WPBakery Visual Composer',
                    'slug' => 'js_composer',
                    'required' => true,
                    'version' => '5.5.1',
                    'source' => get_template_directory() . '/plugins/js_composer.zip',
                ),
                array(
                    'name' => 'Ultimate Addons for Visual Composer',
                    'slug' => 'Ultimate_VC_Addons',
                    'required' => true,
                    'version' => '3.16.21',
                    'source' => get_template_directory() . '/plugins/Ultimate_VC_Addons.zip',
                ),
                array(
                    'name' => 'Netbase Framework',
                    'slug' => 'nb-fw',
                    'required' => true,
                    'version' => '1.0.0',
                    'source' => get_template_directory() . '/plugins/nb-fw.zip',
                ),
                array(
                    'name' => 'Handmade Element',
                    'slug' => 'handmade-elements',
                    'required' => true,
                    'version' => '1.0.0',
                    'source' => get_template_directory() . '/plugins/handmade-elements.zip',
                ),
                array(
                    'name' => 'NetbaseTeam SimpleModal Login',
                    'slug' => 'nbt-simplemodal-login',
                    'required' => false,
                    'version' => '1.1',
                    'source' => get_template_directory() . '/plugins/nbt-simplemodal-login.zip',
                ),
                array(
                    'name' => 'Dokan',
                    'slug' => 'dokan-lite',
                    'required' => true,
                    'version' => '2.8.2',
                ),
                array(
                    'name' => 'Dokan Pro',
                    'slug' => 'dokan-pro',
                    'required' => false,
                    'version' => '2.6.6',
                    'source' => get_template_directory() . '/plugins/dokan-pro-v2.6.6.zip',
                ),
            );
        }

        $config = array(
            'id'           => 'estana',                 // 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.
        );

        tgmpa( self::$plugins, $config );
    }
    public static function update_plugin_src(){
        if(defined('NB_PLUGINS_PATH')){
            $plugins_data = array(
                array(
                    'file'          => NB_PLUGINS_PATH. 'nb-fw\nb-fw.php',
                    'plugin_name'   => 'nb-fw',
                    'repository'    => '6546134',
                ),
                array(
                    'file'          => NB_PLUGINS_PATH. 'handmade-elements\handmade-elements.php',
                    'plugin_name'   => 'antique-elements',
                    'repository'    => '7031375',
                ),

            );

            $netbase_updater = new Netbase_Plugins_Updater($plugins_data);
            $netbase_updater->set_token('Xq_b8ohdiX97xx3eFDS-');
            $netbase_updater->initialize();
        }
    }

    public static function ocdi_import_files() {
        return array(
            array(
                'import_file_name'           => 'Demo 1',
                'local_import_file'            => get_template_directory() . 'ocdi/demo1/content.xml',
                'local_import_widget_file'     => get_template_directory()  . 'ocdi/demo1/widgets.wie',
                'local_import_customizer_file' => get_template_directory()  . 'ocdi/demo1/customizer.dat',
                'import_preview_image_url'     => get_template_directory_uri() . '/import-file/ocdi/demo1/screenshot.png',
            ),
            array(
                'import_file_name'           => 'Demo 2',
                'local_import_file'            => get_template_directory() . 'ocdi/demo2/content.xml',
                'local_import_widget_file'     => get_template_directory() . 'ocdi/demo2/widgets.wie',
                'local_import_customizer_file' => get_template_directory() . 'ocdi/demo2/customizer.dat',
                'import_preview_image_url'     => get_template_directory_uri() . '/import-file/ocdi/demo2/screenshot.png',
            ),
            array(
                'import_file_name'           => 'Demo 3',
                'local_import_file'            => get_template_directory() . '/import-file/ocdi/demo3/content.xml',
                'local_import_widget_file'     => get_template_directory() . '/import-file/ocdi/demo3/widgets.wie',
                'local_import_customizer_file' => get_template_directory() . '/import-file/ocdi/demo3/customizer.dat',
                'import_preview_image_url'     => get_template_directory_uri() . '/import-file/ocdi/demo3/screenshot.png',
            ),
        );


    }

    public static function after_import( $selected_import ) {

        if ( 'Demo 1' === $selected_import['import_file_name'] ) {
            $page = get_page_by_title( 'Home');
            if ( isset( $page->ID ) ) {
                update_option( 'page_on_front', $page->ID );
                update_option( 'show_on_front', 'page' );
            }
            $primary_menu = get_term_by('name', 'Main Menu', 'nav_menu');
            set_theme_mod( 'nav_menu_locations', array(
                    'primary' => $primary_menu->term_id,
                )
            );

            if ( class_exists( 'RevSlider' ) ) {
                $slider_array = array(
                    get_template_directory() .'/import-file/ocdi/demo1/handmade1.zip'
                );

                $slider = new RevSlider();

                foreach($slider_array as $filepath){
                    $slider->importSliderFromPost(true,true,$filepath);
                }

                echo 'Slider processed';
            }
        } elseif ( 'Demo 2' === $selected_import['import_file_name'] ) {
            $page = get_page_by_title( 'Home 2');
            if ( isset( $page->ID ) ) {
                update_option( 'page_on_front', $page->ID );
                update_option( 'show_on_front', 'page' );
            }
            $primary_menu = get_term_by('name', 'Main Menu', 'nav_menu');
            set_theme_mod( 'nav_menu_locations', array(
                    'primary' => $primary_menu->term_id,
                )
            );

            if ( class_exists( 'RevSlider' ) ) {
                $slider_array = array(
                    get_template_directory() .'/import-file/ocdi/demo2/handmade2.zip'
                );

                $slider = new RevSlider();

                foreach($slider_array as $filepath){
                    $slider->importSliderFromPost(true,true,$filepath);
                }

                echo 'Slider processed';
            }
        } elseif ( 'Demo 3' === $selected_import['import_file_name'] ) {
            $page = get_page_by_title( 'Home 3');
            if ( isset( $page->ID ) ) {
                update_option( 'page_on_front', $page->ID );
                update_option( 'show_on_front', 'page' );
            }
            $primary_menu = get_term_by('name', 'Main Menu', 'nav_menu');
            set_theme_mod( 'nav_menu_locations', array(
                    'primary' => $primary_menu->term_id,
                )
            );

            if ( class_exists( 'RevSlider' ) ) {
                $slider_array = array(
                    get_template_directory() .'/import-file/ocdi/demo3/handmade3.zip'
                );

                $slider = new RevSlider();

                foreach($slider_array as $filepath){
                    $slider->importSliderFromPost(true,true,$filepath);
                }

                echo 'Slider processed';
            }
        }
    }

}

new Estana_Core();