<?php
/**
* Get started notice
*/

add_action( 'wp_ajax_coffee_brewery_dismissed_notice_handler', 'coffee_brewery_ajax_notice_handler' );

function coffee_brewery_ajax_notice_handler() {
    check_ajax_referer( 'coffee_brewery_welcome_nonce', 'nonce' );

    if ( isset( $_POST['type'] ) ) {
        $coffee_brewery_type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
        update_option( 'dismissed-' . $coffee_brewery_type, true );
    }
    wp_send_json_success();
}

function coffee_brewery_deprecated_hook_admin_notice() {
    if ( get_option( 'dismissed-get_started', false ) ) {
        return;
    }
    $coffee_brewery_current_screen = get_current_screen();
    if (
        $coffee_brewery_current_screen &&
        $coffee_brewery_current_screen->id !== 'appearance_page_coffee-brewery-guide-page' &&
        $coffee_brewery_current_screen->id !== 'appearance_page_coffeebrewery-wizard'
    ) {
        $coffee_brewery_comments_theme = wp_get_theme();
        ?>
        <div class="coffee-brewery-notice-wrapper notice notice-success notice-get-started-class is-dismissible" data-notice="get_started">
            <div class="coffee-brewery-notice">
                <div class="coffee-brewery-notice-content">
                    <div class="coffee-brewery-notice-heading">
                        <h2>
                            <?php esc_html_e( 'Thanks For Installing ', 'coffee-brewery' ); ?>
                            <?php echo esc_html( $coffee_brewery_comments_theme ); ?>
                            <?php esc_html_e( ' Theme', 'coffee-brewery' ); ?>
                        </h2>
                        <p>
                        <?php
                        printf(
                            esc_html__( '%s is now installed and ready to use. We\'ve provided some links to get you started.', 'coffee-brewery' ),
                            esc_html( $coffee_brewery_comments_theme )
                        );
                        ?>
                        </p>
                    </div>
                    <div class="diplay-flex-btn">
                        <a class="button button-primary"
                           href="<?php echo esc_url( admin_url( 'themes.php?page=coffee-brewery-guide-page' ) ); ?>">
                           <?php esc_html_e( 'GET STARTED', 'coffee-brewery' ); ?>
                        </a>
                        <a class="button button-primary"
                           target="_blank"
                           href="<?php echo esc_url( COFFEE_BREWERY_BUY_NOW ); ?>">
                           <?php esc_html_e( 'GO TO PREMIUM', 'coffee-brewery' ); ?>
                        </a>
                        <a class="button button-primary import"
                           href="<?php echo esc_url( admin_url( 'themes.php?page=coffeebrewery-wizard' ) ); ?>">
                           <?php esc_html_e( 'ONE CLICK DEMO IMPORTER', 'coffee-brewery' ); ?>
                        </a>
                    </div>
                </div>
                <div class="coffee-brewery-notice-img">
                    <a href="<?php echo esc_url( COFFEE_BREWERY_THEME_BUNDLE ); ?>" target="_blank">
                        <img src="<?php echo esc_url( get_template_directory_uri() . '/assets/images/notification.png' ); ?>" alt="<?php esc_attr_e( 'logo', 'coffee-brewery' ); ?>">
                    </a>
                </div>
            </div>
        </div>
        <?php
    }
}
add_action( 'admin_notices', 'coffee_brewery_deprecated_hook_admin_notice' );

add_action( 'admin_menu', 'coffee_brewery_getting_started' );
function coffee_brewery_getting_started() {
    add_theme_page(
        esc_html__( 'Get Started', 'coffee-brewery' ),
        esc_html__( 'Get Started', 'coffee-brewery' ),
        'edit_theme_options',
        'coffee-brewery-guide-page',
        'coffee_brewery_test_guide'
    );
}

// After switching theme, reset dismissed notice option
add_action('after_switch_theme', 'coffee_brewery_after_switch_theme');
function coffee_brewery_after_switch_theme() {
    update_option('dismissed-get_started', FALSE);
}

add_action( 'admin_enqueue_scripts', 'coffee_brewery_admin_enqueue_scripts' );
function coffee_brewery_admin_enqueue_scripts( $hook ) {
	wp_enqueue_style(
		'coffee-brewery-admin-style',
		get_template_directory_uri() . '/css/main.css',
		array(),
		wp_get_theme()->get( 'Version' )
	);
	wp_enqueue_script(
		'coffee-brewery-admin-script',
		get_template_directory_uri() . '/js/coffee-brewery-admin-script.js',
		array( 'jquery' ),
		wp_get_theme()->get( 'Version' ),
		true
	);
	wp_localize_script(
		'coffee-brewery-admin-script',
		'coffee_brewery_ajax_object',
		array(
			'ajax_url'      => admin_url( 'admin-ajax.php' ),
			'dismiss_nonce' => wp_create_nonce( 'coffee_brewery_welcome_nonce' ),
			'redirect_url'  => admin_url( 'themes.php?page=coffee-brewery-guide-page' ),
		)
	);
}

if ( ! defined( 'COFFEE_BREWERY_DOCS_FREE' ) ) {
define('COFFEE_BREWERY_DOCS_FREE',__('https://demo.misbahwp.com/docs/coffee-brewery-free-docs/','coffee-brewery'));
}
 if ( ! defined( 'COFFEE_BREWERY_DOCS_PRO' ) ) {
define('COFFEE_BREWERY_DOCS_PRO',__('https://demo.misbahwp.com/docs/coffee-brewery-pro-docs/','coffee-brewery'));
}
if ( ! defined( 'COFFEE_BREWERY_BUY_NOW' ) ) {
define('COFFEE_BREWERY_BUY_NOW',__('https://www.misbahwp.com/products/coffee-house-wordpress-theme','coffee-brewery'));
}
if ( ! defined( 'COFFEE_BREWERY_SUPPORT_FREE' ) ) {
define('COFFEE_BREWERY_SUPPORT_FREE',__('https://wordpress.org/support/theme/coffee-brewery','coffee-brewery'));
}
if ( ! defined( 'COFFEE_BREWERY_REVIEW_FREE' ) ) {
define('COFFEE_BREWERY_REVIEW_FREE',__('https://wordpress.org/support/theme/coffee-brewery/reviews/#new-post','coffee-brewery'));
}
if ( ! defined( 'COFFEE_BREWERY_DEMO_PRO' ) ) {
define('COFFEE_BREWERY_DEMO_PRO',__('https://demo.misbahwp.com/coffee-brewery/','coffee-brewery'));
}
if( ! defined( 'COFFEE_BREWERY_THEME_BUNDLE' ) ) {
define('COFFEE_BREWERY_THEME_BUNDLE',__('https://www.misbahwp.com/products/wordpress-bundle','coffee-brewery'));
}

function coffee_brewery_test_guide() { 
	$coffee_brewery_theme = wp_get_theme();?>
	<div class="wrap" id="main-page">
		<div id="lefty">
			<div id="admin_links">
				<a href="<?php echo esc_url( COFFEE_BREWERY_DOCS_FREE ); ?>" target="_blank" class="blue-button-1"><?php esc_html_e( 'Documentation', 'coffee-brewery' ) ?></a>
				<a href="<?php echo esc_url( admin_url('customize.php') ); ?>" id="customizer" target="_blank"><?php esc_html_e( 'Customize', 'coffee-brewery' ); ?> </a>
				<a class="blue-button-1" href="<?php echo esc_url( COFFEE_BREWERY_SUPPORT_FREE ); ?>" target="_blank" class="btn3"><?php esc_html_e( 'Support', 'coffee-brewery' ) ?></a>
				<a class="blue-button-2" href="<?php echo esc_url( COFFEE_BREWERY_REVIEW_FREE ); ?>" target="_blank" class="btn4"><?php esc_html_e( 'Review', 'coffee-brewery' ) ?></a>
			</div>
			<div id="description">
				<h3><?php esc_html_e('Welcome! Thank you for choosing ','coffee-brewery'); ?><?php echo esc_html( $coffee_brewery_theme ); ?>  <span><?php esc_html_e('Version: ', 'coffee-brewery'); ?><?php echo esc_html($coffee_brewery_theme['Version']);?></span></h3>
				<div class="demo-import-box">
					<h4><?php echo esc_html__('Import homepage demo in just one click.','coffee-brewery'); ?></h4>
					<p><?php echo esc_html__('Get started with the wordpress theme installation','coffee-brewery'); ?></p>
					<a class="button button-primary import" href="themes.php?page=coffeebrewery-wizard"><?php echo esc_html__('ONE CLICK DEMO IMPORTER','coffee-brewery'); ?></a>
				</div>
				<img class="img_responsive" style="width: 100%;" src="<?php echo esc_url( $coffee_brewery_theme->get_screenshot() ); ?>" />
				<div id="description-insidee">
					<?php
						$coffee_brewery_theme = wp_get_theme();
						echo wp_kses_post( apply_filters( 'misbah_theme_description', esc_html( $coffee_brewery_theme->get( 'Description' ) ) ) );
					?>
				</div>
			</div>
		</div>

		<div id="righty">
			<div class="volleyball-postboxx">
				<h3 class="hndle"><?php esc_html_e( 'Upgrade to Premium', 'coffee-brewery' ); ?></h3>
				<div class="volleyball-insidee">
					<p><?php esc_html_e('Discover upgraded pro features with premium version click to upgrade.','coffee-brewery'); ?></p>
					<div id="admin_pro_links">
						<a class="blue-button-2" href="<?php echo esc_url( COFFEE_BREWERY_BUY_NOW ); ?>" target="_blank"><?php esc_html_e( 'Go Pro', 'coffee-brewery' ); ?></a>
						<a class="blue-button-1" href="<?php echo esc_url( COFFEE_BREWERY_DEMO_PRO ); ?>" target="_blank"><?php esc_html_e( 'Live Demo', 'coffee-brewery' ) ?></a>
						<a class="blue-button-2" href="<?php echo esc_url( COFFEE_BREWERY_DOCS_PRO ); ?>" target="_blank"><?php esc_html_e( 'Pro Docs', 'coffee-brewery' ) ?></a>
					</div>
				</div>

				<h3 class="hndle bundle"><?php esc_html_e( 'Get All Themes', 'coffee-brewery' ); ?></h3>
				<div class="insidee theme-bundle">
					<img width="100%" src="<?php echo esc_url( get_template_directory_uri() . '/assets/images/bundle-image.png' ); ?>" alt="<?php esc_attr_e('logo', 'coffee-brewery'); ?>">
					<p class="offer"><?php esc_html_e('Get 110+ Perfect WordPress Theme In A Single Package at just $89.','coffee-brewery'); ?></p>
					<p class="coupon"><?php esc_html_e('Get Our Theme Pack of 110+ WordPress Themes At 20% Off ','coffee-brewery'); ?><span class="coupon-code"><?php esc_html_e('"Bundleup15"','coffee-brewery'); ?></span></p>
				<div id="admin_pro_linkss">
					<a class="blue-button-1" href="<?php echo esc_url( COFFEE_BREWERY_THEME_BUNDLE ); ?>" target="_blank"><?php esc_html_e( 'Buy All Themes - $89', 'coffee-brewery' ) ?></a>
				</div>
				<div class="d-table">
			    <ul class="d-column">
			      <li class="feature"><?php esc_html_e('Features','coffee-brewery'); ?></li>
			      <li class="free"><?php esc_html_e('Pro','coffee-brewery'); ?></li>
			      <li class="plus"><?php esc_html_e('Free','coffee-brewery'); ?></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('24hrs Priority Support','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-yes"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('LearnPress Campatiblity','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-yes"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('Kirki Framework','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-yes"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('Advance Posttype','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-no"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('One Click Demo Import','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-yes"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('Section Reordering','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-no"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('Enable / Disable Option','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-yes"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('Multiple Sections','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-no"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('Advance Color Pallete','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-no"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('Advance Widgets','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-yes"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('Page Templates','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-no"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('Advance Typography','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-no"></span></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('Section Background Image / Color ','coffee-brewery'); ?></li>
			      <li class="right"><span class="dashicons dashicons-yes"></span></li>
			      <li class="wrong"><span class="dashicons dashicons-no"></span></li>
			    </ul>
	  		</div>
			</div>
		</div>
	</div>
<?php } ?>
