<?php
/**
 * Yoga Workout functions and definitions
 *
 * @package yoga_workout
 * @since 1.0
 */

if ( ! function_exists( 'yoga_workout_support' ) ) :
	function yoga_workout_support() {

		load_theme_textdomain( 'yoga-workout', get_template_directory() . '/languages' );

		add_theme_support( 'custom-background', apply_filters( 'yoga_workout_custom_background', array(
            'default-color' => 'ffffff',
            'default-image' => '',
        )));

		// Add support for block styles.
		add_theme_support( 'wp-block-styles' );

		add_theme_support('woocommerce');

		// Enqueue editor styles.
		add_editor_style(get_stylesheet_directory_uri() . '/assets/css/editor-style.css');

		define('YOGA_WORKOUT_FREE_BUY_NOW',__('https://www.themepixels.net/products/yoga-workout/','yoga-workout'));
		define('YOGA_WORKOUT_BUY_NOW',__('https://www.themepixels.net/products/yoga-workout-wordpress-theme/','yoga-workout'));
		define('YOGA_WORKOUT_LIVE_DEMO',__('https://themepixels.net/demo-site/yoga-workout/','yoga-workout'));
		define('YOGA_WORKOUT_FREE_DOC',__('https://www.themepixels.net/docs/yoga-workout-free/','yoga-workout'));
		define('YOGA_WORKOUT_BUNDLE',__('https://www.themepixels.net/products/wp-theme-bundle','yoga-workout'));
		define('YOGA_WORKOUT_THEME_SUPPORT',__('https://wordpress.org/support/theme/yoga-workout','yoga-workout'));
		define('YOGA_WORKOUT_COLLECTIONS',__('https://www.themepixels.net/premium-wordpress-themes','yoga-workout'));
    	require_once get_theme_file_path( '/inc/customizer.php' );
	}
endif;

add_action( 'after_setup_theme', 'yoga_workout_support' );

if ( ! function_exists( 'yoga_workout_styles' ) ) :
	function yoga_workout_styles() {
		// Register theme stylesheet.
		$yoga_workout_theme_version = wp_get_theme()->get( 'Version' );

		$yoga_workout_version_string = is_string( $yoga_workout_theme_version ) ? $yoga_workout_theme_version : false;
		wp_enqueue_style(
			'yoga-workout-style',
			get_template_directory_uri() . '/style.css',
			array(),
			$yoga_workout_version_string
		);

		wp_style_add_data('yoga-workout', 'rtl', 'replace');

		wp_enqueue_style( 'dashicons' );

		wp_enqueue_style( 'animate-css', esc_url(get_template_directory_uri()).'/assets/css/animate.css' );

		wp_enqueue_style( 'owl.carousel-css', esc_url(get_template_directory_uri()).'/assets/css/owl.carousel.css' );

		wp_enqueue_script( 'jquery-wow', esc_url(get_template_directory_uri()) . '/assets/js/wow.js', array('jquery') );
        
        // Theme fonts ( Epilogue )
        wp_enqueue_style( 'yoga-workout-fonts', get_template_directory_uri() . '/assets/css/fonts.css', array(), $yoga_workout_version_string );
	    wp_enqueue_script( 'owl.carousel-js', get_template_directory_uri(). '/assets/js/owl.carousel.js', array('jquery') ,'',true);
	    
	    wp_enqueue_script( 'yoga-workout-custom-scripts', get_template_directory_uri() . '/assets/js/custom-script.js', array('jquery'),'' ,true );

		 //font-awesome
		 wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/inc/fontawesome/css/all.css'
		 	, array(), '6.7.0' );
	}
endif;

add_action( 'wp_enqueue_scripts', 'yoga_workout_styles' );


// Add block patterns
require get_template_directory() . '/inc/block-patterns.php';

// Add block styles
require get_template_directory() . '/inc/block-styles.php';

// Block Filters
require get_template_directory() . '/inc/block-filters.php';

// Svg icons
require get_template_directory() . '/inc/icon-function.php';

/**
* GET START.
*/
require get_template_directory() . '/themeinfo/yoga_workout_themeinfo_page.php';

// NOTICE FUNCTION
function yoga_workout_activation_notice() {
    if (get_option('yoga_workout_notice_dismissed')) {
        return;
    }

    if (isset($_GET['page']) && $_GET['page'] === 'yoga-workout-themeinfo-page') {
        return;
    }
    ?>
    <div class="updated notice notice-theme-info-class is-dismissible" data-notice="theme_info">
        <div class="yoga-workout-theme-info-notice clearfix">
            <div class="yoga-workout-theme-notice-content">
				<div class="notice-content">
					<div class="inner-notice-contetn">
						<h4 class="best-value"><?php esc_html_e( 'Best Value', 'yoga-workout' ); ?></h4>
						<h2 class="yoga-workout-notice-h2">
							<?php
							printf(
								/* translators: 1: Theme name */
								esc_html__('Get 30+ Premium WordPress Themes in One Bundle', 'yoga-workout'), '<strong>' . esc_html(wp_get_theme()->get('Name')) . '</strong>'
							);
							?>
						</h2>

						<p class="yoga-workout-notice-p">
							<?php
							printf(
								/* translators: 1: Theme name */
								esc_html__('Premium WordPress Themes for Business, Ecommerce, Blogs, Portfolio and more. Our themes are light & easy to customize ', 'yoga-workout'), '<strong>' . esc_html(wp_get_theme()->get('Name')) . '</strong>'
							);
							?>
						</p>
					</div>
					<div class="inner-notice-buttons">
						<a class="yoga-workout-btn-theme-info button button-primary bundlee" target="_blank" href="<?php echo esc_url(YOGA_WORKOUT_COLLECTIONS); ?>" id="yoga-workout-collection-button"> <?php esc_html_e('View All Themes', 'yoga-workout') ?></a>
						<a class="yoga-workout-btn-theme-info button button-primary live-demoo" target="_blank" href="<?php echo esc_url(YOGA_WORKOUT_BUNDLE); ?>" id="yoga-workout-bundle-button"> <?php esc_html_e('Buy Bundle', 'yoga-workout') ?></a>
					</div>
				</div>
				<div class="middle-box">
					<div class="box-1">
						<div class="box-info">
							<span class="dashicons dashicons-yes-alt"></span>
							<div>
								<p><?php esc_html_e( '30+ Premium', 'yoga-workout' ); ?></p>
								<p><?php esc_html_e( 'WordPress Themes', 'yoga-workout' ); ?></p>
							</div>
						</div>
						<div class="box-info">
							<span class="dashicons dashicons-yes-alt"></span>
							<div>
								<p><?php esc_html_e( 'Single Theme', 'yoga-workout' ); ?></p>
								<p><?php esc_html_e( 'Starting at $40', 'yoga-workout' ); ?></p>
							</div>
						</div>
						<div class="box-info">
							<span class="dashicons dashicons-yes-alt"></span>
							<div>
								<p><?php esc_html_e( 'One Time Payment -', 'yoga-workout' ); ?></p>
								<p><?php esc_html_e( 'no hidden charges', 'yoga-workout' ); ?></p>
							</div>
						</div>
					</div>
					<div class="box-2">
						<p class="box-2-para"><?php esc_html_e( 'Total Value', 'yoga-workout' ); ?></p>
						<h4><?php esc_html_e( '$2499', 'yoga-workout' ); ?></h4>
						<p><?php esc_html_e( 'Bundle Price', 'yoga-workout' ); ?></p>
						<span><sup><?php esc_html_e( '$', 'yoga-workout' ); ?></sup><h2><?php esc_html_e( '59', 'yoga-workout' ); ?></h2></span>
						<p class="box-para"><?php esc_html_e( 'One Time Payement', 'yoga-workout' ); ?></p>
						<p class="box-btn"><?php esc_html_e( 'You Save $2430', 'yoga-workout' ); ?></p>
					</div>
				</div>
				<div class="notice-image">
					<img src="<?php echo esc_url( get_stylesheet_directory_uri() . '/assets/images/bundle-img.png' ); ?>" alt="<?php esc_attr_e( 'Theme Screenshot', 'yoga-workout' ); ?>">
				</div>
            </div>
        </div>
    </div>
    <?php
}

add_action('admin_notices', 'yoga_workout_activation_notice');

add_action('wp_ajax_yoga_workout_dismiss_notice', 'yoga_workout_dismiss_notice');

function yoga_workout_notice_status() {
    delete_option('yoga_workout_notice_dismissed');
}
add_action('after_switch_theme', 'yoga_workout_notice_status');

function yoga_workout_dismiss_notice() {
    update_option('yoga_workout_notice_dismissed', true);
    wp_send_json_success();
}

function yoga_workout_admin_enqueue_scripts(){
	wp_enqueue_style('yoga-workout-admin-style', esc_url( get_template_directory_uri() ) . '/assets/css/yoga-workout-notice.css');
	wp_enqueue_script('yoga-workout-dismiss-notice-script', get_stylesheet_directory_uri() . '/assets/js/yoga-workout-notice.js', array('jquery'), null, true);
}
add_action( 'admin_enqueue_scripts', 'yoga_workout_admin_enqueue_scripts' );