<?php
/**
 * Class Enqueue Scripts
 * 
 * @package IS-Medify
 * 
 * @since 1.0.0
 *  
*/
class IS_Medify_Enqueue_Scripts {

	public function __construct() {
		// load class.
		$this->is_medify_scripts_setup_hooks();
	}

	public function is_medify_scripts_setup_hooks() {
		/**
		 * Actions.
		*/
		add_action( 'wp_enqueue_scripts', [ $this, 'is_medify_register_styles' ] );
		add_action( 'wp_enqueue_scripts', [ $this, 'is_medify_register_scripts' ] );
	}

	public function is_medify_register_styles() {
		// Enqueue Styles.
		wp_enqueue_style( 'is-medify-bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css' );	
		wp_enqueue_style( 'is-medify-font-awesome', get_template_directory_uri() . '/assets/fontawesome6.5.1/css/all.min.css' );
		wp_enqueue_style( 'is-medify-animate',  get_template_directory_uri() . '/assets/css/animate.css' );
		wp_enqueue_style( 'is-medify-custom', get_template_directory_uri() . '/assets/css/custom.css' );
		wp_enqueue_style( 'is-medify-media-query',  get_template_directory_uri() . '/assets/css/media-query.css' );
		wp_enqueue_style( 'is-medify-style', get_stylesheet_uri(), array(), _S_VERSION );
		
		
		/* Web Fonts Typography Settings code start */		

        wp_enqueue_style('fabstar-google-fonts',esc_url(is_medify2()));
		
		$font_var          = '300,400,600,700,900,300italic,400italic,600italic,700italic,900italic';
        $http              = ( ! empty( $_SERVER['HTTPS'] ) ) ? "https" : "http";
        $main_heading_font = str_replace( ' ' , '+', get_theme_mod( 'main_heading_font', 'Open Sans' ) );
        $menu_font         = str_replace( ' ' , '+', get_theme_mod( 'menu_font', 'Open Sans' ) );
        $theme_title       = str_replace( ' ' , '+', get_theme_mod( 'theme_title', 'Open Sans' ) );
        $desc_font_all     = str_replace( ' ' , '+', get_theme_mod( 'desc_font_all', 'Open Sans' ) );

        wp_enqueue_style('main_heading_font', $http . '://fonts.googleapis.com/css?family=' . $main_heading_font . ':' . $font_var);	
        wp_enqueue_style('menu_font', $http . '://fonts.googleapis.com/css?family=' . $menu_font . ':' . $font_var);	
        wp_enqueue_style('theme_title', $http . '://fonts.googleapis.com/css?family=' . $theme_title . ':' . $font_var);
        wp_enqueue_style('desc_font_all', $http . '://fonts.googleapis.com/css?family=' . $desc_font_all . ':' . $font_var);
	}

	public function is_medify_register_scripts() {
		// Enqueue Scripts.
		wp_enqueue_script( 'is-medify-bootstrap', get_template_directory_uri().'/assets/js/bootstrap.js', array('jquery' ), true, true );
		wp_enqueue_script( 'is-medify-theme-scripts', get_template_directory_uri().'/assets/js/theme-scripts.js', array('jquery' ), true, true );

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