<?php
/**
 * Bodyart Tattoo Studio functions and definitions
 *
 * @package bodyart_tattoo_studio
 * @since 1.0
 */

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

		load_theme_textdomain( 'bodyart-tattoo-studio', get_template_directory() . '/languages' );

		add_theme_support( 'custom-background', apply_filters( 'bodyart_tattoo_studio_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('BODYART_TATTOO_STUDIO_FREE_BUY_NOW',__('https://www.themepixels.net/products/bodyart-tattoo-studio/','bodyart-tattoo-studio'));
		define('BODYART_TATTOO_STUDIO_BUY_NOW',__('https://www.themepixels.net/products/tattoo-wordpress-theme','bodyart-tattoo-studio'));
		define('BODYART_TATTOO_STUDIO_LIVE_DEMO',__('themepixels.net/demo-site/bodyart-tattoo-studio-pro/','bodyart-tattoo-studio'));
		define('BODYART_TATTOO_STUDIO_FREE_DOC',__('https://www.themepixels.net/docs/bodyart-tattoo-studio-doc/','bodyart-tattoo-studio'));
		define('BODYART_TATTOO_STUDIO_BUNDLE',__('https://www.themepixels.net/products/wp-theme-bundle','bodyart-tattoo-studio'));
		define('BODYART_TATTOO_STUDIO_THEME_SUPPORT',__('https://wordpress.org/support/theme/bodyart-tattoo-studio','bodyart-tattoo-studio'));
		require_once get_theme_file_path( '/inc/customizer.php' );

	}
endif;

add_action( 'after_setup_theme', 'bodyart_tattoo_studio_support' );

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

		$bodyart_tattoo_studio_version_string = is_string( $bodyart_tattoo_studio_theme_version ) ? $bodyart_tattoo_studio_theme_version : false;
		wp_enqueue_style(
			'bodyart-tattoo-studio-style',
			get_template_directory_uri() . '/style.css',
			array(),
			$bodyart_tattoo_studio_version_string
		);

		wp_style_add_data('bodyart-tattoo-studio-style', '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') );

		wp_enqueue_script( 'bodyart-tattoo-studio-custom-scripts', get_template_directory_uri() . '/assets/js/custom-script.js', array('jquery'),'' ,true );

		wp_enqueue_script( 'owl.carousel-js', get_template_directory_uri(). '/assets/js/owl.carousel.js', array('jquery') ,'2.3.0',true);
        
        wp_enqueue_style( 'bodyart-tattoo-studio-fonts', get_template_directory_uri() . '/assets/css/fonts.css', array(), $bodyart_tattoo_studio_version_string );

		wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/inc/fontawesome/css/all.css', array(), '7.0.0' );
	}
endif;

add_action( 'wp_enqueue_scripts', 'bodyart_tattoo_studio_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/bodyart_tattoo_studio_themeinfo_page.php';

// NOTICE FUNCTION
function bodyart_tattoo_studio_activation_notice() {

    if ( get_option( 'bodyart_tattoo_studio_notice_dismissed' ) ) {
        return;
    }

    if ( isset( $_GET['page'] ) && $_GET['page'] === 'bodyart-tattoo-studio-themeinfo-page' ) {
        return;
    }
    bodyart_tattoo_studio_theme_notice_content( true, false, true );
}

function bodyart_tattoo_studio_theme_notice_content(
    $bodyart_tattoo_studio_show_theme_info = true,
    $bodyart_tattoo_studio_show_box_1 = false,
    $bodyart_tattoo_studio_show_dismiss = true
) {
?>
	<div class="updated notice notice-theme-info-class <?php echo $bodyart_tattoo_studio_show_dismiss ? 'is-dismissible' : ''; ?>" data-notice="theme_info">
        <div class="bodyart-tattoo-studio-theme-info-notice clearfix">
            <div class="bodyart-tattoo-studio-theme-notice-content">
				<div class="notice-content">
					<div class="inner-notice-contetn">
						<h4 class="best-value"><?php esc_html_e( 'Best Value', 'bodyart-tattoo-studio' ); ?></h4>
						<h2 class="bodyart-tattoo-studio-notice-h2">
							<?php
							printf(
								/* translators: 1: Theme name */
								esc_html__('Get 30+ Premium WordPress Themes in One Bundle', 'bodyart-tattoo-studio'), '<strong>' . esc_html(wp_get_theme()->get('Name')) . '</strong>'
							);
							?>
						</h2>

						<p class="bodyart-tattoo-studio-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 ', 'bodyart-tattoo-studio'), '<strong>' . esc_html(wp_get_theme()->get('Name')) . '</strong>'
							);
							?>
						</p>
					</div>
					<div class="inner-notice-buttons">
						<?php if ( $bodyart_tattoo_studio_show_theme_info ) : ?>
							<a class="bodyart-tattoo-studio-btn-theme-info button button-primary bundlee"
								href="<?php echo esc_url( admin_url( 'themes.php?page=bodyart-tattoo-studio-themeinfo-page' ) ); ?>">
								<?php esc_html_e( 'Theme Info', 'bodyart-tattoo-studio' ); ?>
							</a>
						<?php endif; ?>
						<a class="bodyart-tattoo-studio-btn-theme-info button button-primary live-demoo" target="_blank" href="<?php echo esc_url(BODYART_TATTOO_STUDIO_BUY_NOW); ?>" id="bodyart-tattoo-studio-bundle-button"> <?php esc_html_e('Buy Now', 'bodyart-tattoo-studio') ?></a>
						<a class="bodyart-tattoo-studio-btn-theme-info button button-primary bundlee" target="_blank" href="<?php echo esc_url(BODYART_TATTOO_STUDIO_LIVE_DEMO); ?>" id="bodyart-tattoo-studio-collection-button"> <?php esc_html_e('Live Demo', 'bodyart-tattoo-studio') ?></a>
						<a class="bodyart-tattoo-studio-btn-theme-info button button-primary bundlee" target="_blank" href="<?php echo esc_url(BODYART_TATTOO_STUDIO_BUNDLE); ?>" 
						id="bodyart-tattoo-studio-collection-button"> <?php esc_html_e('Get Bundle', 'bodyart-tattoo-studio') ?></a>
					</div>
				</div>
				<div class="middle-box">
					<?php if ( $bodyart_tattoo_studio_show_box_1 ) : ?>
						<div class="box-1">
							<div class="box-info">
								<span class="dashicons dashicons-yes-alt"></span>
								<div>
									<p><?php esc_html_e( '30+ Premium', 'bodyart-tattoo-studio' ); ?></p>
									<p><?php esc_html_e( 'WordPress Themes', 'bodyart-tattoo-studio' ); ?></p>
								</div>
							</div>
							<div class="box-info">
								<span class="dashicons dashicons-yes-alt"></span>
								<div>
									<p><?php esc_html_e( 'Single Theme', 'bodyart-tattoo-studio' ); ?></p>
									<p><?php esc_html_e( 'Starting at $40', 'bodyart-tattoo-studio' ); ?></p>
								</div>
							</div>
							<div class="box-info">
								<span class="dashicons dashicons-yes-alt"></span>
								<div>
									<p><?php esc_html_e( 'One Time Payment -', 'bodyart-tattoo-studio' ); ?></p>
									<p><?php esc_html_e( 'no hidden charges', 'bodyart-tattoo-studio' ); ?></p>
								</div>
							</div>
						</div>
					<?php endif; ?>
					<div class="box-2">
						<p class="box-2-para"><?php esc_html_e( 'Total Value', 'bodyart-tattoo-studio' ); ?></p>
						<h4><?php esc_html_e( '$2499', 'bodyart-tattoo-studio' ); ?></h4>
						<p><?php esc_html_e( 'Bundle Price', 'bodyart-tattoo-studio' ); ?></p>
						<span><sup><?php esc_html_e( '$', 'bodyart-tattoo-studio' ); ?></sup><h2><?php esc_html_e( '59', 'bodyart-tattoo-studio' ); ?></h2></span>
						<p class="box-para"><?php esc_html_e( 'One Time Payement', 'bodyart-tattoo-studio' ); ?></p>
						<p class="box-btn"><?php esc_html_e( 'You Save $2430', 'bodyart-tattoo-studio' ); ?></p>
					</div>
				</div>
				<div class="notice-image">
					<a href="<?php echo esc_url( BODYART_TATTOO_STUDIO_BUNDLE ); ?>" target="_blank" rel="noopener noreferrer">
						<img src="<?php echo esc_url( get_stylesheet_directory_uri() . '/assets/images/bundle-img.png' ); ?>" alt="<?php esc_attr_e( 'Theme Screenshot', 'bodyart-tattoo-studio' ); ?>">
					</a>
				</div>
            </div>
        </div>
    </div>
<?php
}

add_action('admin_notices', 'bodyart_tattoo_studio_activation_notice');

add_action('wp_ajax_bodyart_tattoo_studio_dismiss_notice', 'bodyart_tattoo_studio_dismiss_notice');

function bodyart_tattoo_studio_notice_status() {
    delete_option('bodyart_tattoo_studio_notice_dismissed');
}
add_action('after_switch_theme', 'bodyart_tattoo_studio_notice_status');

function bodyart_tattoo_studio_dismiss_notice() {
    update_option('bodyart_tattoo_studio_notice_dismissed', true);
    wp_send_json_success();
}

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