<?php 
/*******************************************************************************
 *  Get Started Notice
 *******************************************************************************/

add_action( 'wp_ajax_coupon_flash_deals_dismissed_notice_handler', 'coupon_flash_deals_ajax_notice_handler' );

/** * AJAX handler to record dismissible notice status. */
function coupon_flash_deals_ajax_notice_handler() {
    if ( isset( $_POST['type'] ) ) {
        $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
        update_option( 'dismissed-' . $type, TRUE );
    }
}

function coupon_flash_deals_admin_notice_deprecated_hook() {
        $current_screen = get_current_screen();
        if ($current_screen->id !== 'toplevel_page_coupon-flash-deals-guide-page') {
        if ( ! get_option('dismissed-get_started', FALSE ) ) { ?>
            <div class="updated notice notice-get-started-class is-dismissible" data-notice="get_started">
                <div class="coupon-flash-deals-getting-started-notice clearfix">
                    <div class="coupon-flash-deals-theme-notice-content">
                        <h2 class="coupon-flash-deals-notice-h2">
                            <?php
                            echo esc_html__( 'Let\'s Create Your website With', 'coupon-flash-deals' ) . ' <strong>' . esc_html( wp_get_theme()->get('Name') ) . '</strong>';
                            ?>
                        </h2>
                        <span class="st-notification-wrapper">
                            <span class="st-notification-column-wrapper">
                                <span class="st-notification-column">
                                    <h2><?php echo esc_html('Features Rich Theme','coupon-flash-deals'); ?></h2>
                                    <ul class="st-notification-column-list">
                                        <li><?php echo esc_html('Live Customize','coupon-flash-deals'); ?></li>
                                        <li><?php echo esc_html('Detailed theme Options','coupon-flash-deals'); ?></li>
                                        <li><?php echo esc_html('Cleanly Coded','coupon-flash-deals'); ?></li>
                                        <li><?php echo esc_html('Search Engine Friendly','coupon-flash-deals'); ?></li>
                                    </ul>
                                </span>
                                <span class="st-notification-column">
                                    <h2><?php echo esc_html('Customize Your Site','coupon-flash-deals'); ?></h2>
                                    <ul>
                                        <li><a href="<?php echo esc_url( admin_url( 'customize.php' ) ) ?>" target="_blank" class="button button-primary"><?php echo esc_html('Customize','coupon-flash-deals'); ?></a></li>
                                        <li><a href="<?php echo esc_url( admin_url( 'widgets.php' ) ) ?>" class="button button-primary"><?php echo esc_html('Add Widgets','coupon-flash-deals'); ?></a></li>
                                        <li><a href="<?php echo esc_url( COUPON_FLASH_DEALS_SUPPORT_FREE ); ?>" target="_blank" class="button button-primary"><?php echo esc_html('Get Support','coupon-flash-deals'); ?></a> </li>
                                        <li><a href="<?php echo esc_url( admin_url( 'themes.php?page=coupon-flash-deals-guide-page' ) ); ?>" class="button-primary button get-start"><?php echo esc_html('Getting Started','coupon-flash-deals'); ?></a></li>
                                    </ul>
                                </span>
                                <span class="st-notification-column">
                                    <h2><?php echo esc_html('Get More Options','coupon-flash-deals'); ?></h2>
                                    <ul>
                                        <li><a href="<?php echo esc_url( COUPON_FLASH_DEALS_DEMO_PRO ); ?>" target="_blank" class="button button-primary"><?php echo esc_html('View Live Demo','coupon-flash-deals'); ?></a></li>
                                        <li><a href="<?php echo esc_url( COUPON_FLASH_DEALS_BUY_NOW ); ?>" target="_blank" class="button button-primary premium"><?php echo esc_html('Purchase Now','coupon-flash-deals'); ?></a></li>
                                        <li><a href="<?php echo esc_url( COUPON_FLASH_DEALS_DOCS_FREE ); ?>" target="_blank" class="button button-primary"><?php echo esc_html('Free Documentation','coupon-flash-deals'); ?></a> </li>
                                        <li><a href="<?php echo esc_url( admin_url( 'themes.php?page=couponflashdeals-wizard' ) ); ?>" class="button button-primary demo-import"><?php echo esc_html('Demo Importer','coupon-flash-deals'); ?></a> </li>
                                    </ul>
                                </span>
                            </span>
                            <span class="notice-img">
                                <img src="<?php echo esc_url( get_template_directory_uri() . '/images/notice.png' ); ?>">                                
                            </span>
                        </span>
                        <style>
                        </style>
                    </div>
                </div>
            </div>
        <?php }
    }
}

add_action( 'admin_notices', 'coupon_flash_deals_admin_notice_deprecated_hook' );

function coupon_flash_deals_switch_theme_function () {
    delete_option('dismissed-get_started', FALSE );
}

add_action('after_switch_theme', 'coupon_flash_deals_switch_theme_function');