<?php

/**
* Get started notice
*/

add_action( 'wp_ajax_ecommece_marketplace_dismissed_notice_handler', 'ecommece_marketplace_ajax_notice_handler' );

function ecommece_marketplace_ajax_notice_handler() {
    if ( isset( $_POST['type'] ) ) {
        $ecommece_marketplace_type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
        update_option( 'dismissed-' . $ecommece_marketplace_type, TRUE );
    }
}

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

add_action( 'admin_menu', 'ecommece_marketplace_getting_started' );
function ecommece_marketplace_getting_started() {
    add_theme_page(
        esc_html__( 'Get Started', 'ecommece-marketplace' ),
        esc_html__( 'Get Started', 'ecommece-marketplace' ),
        'edit_theme_options',
        'ecommece-marketplace-guide-page',
        'ecommece_marketplace_test_guide'
    );
}

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

function ecommece_marketplace_admin_enqueue_scripts() {
	wp_enqueue_style( 'ecommece-marketplace-admin-style', esc_url( get_template_directory_uri() ).'/css/main.css' );
	wp_enqueue_script( 'ecommece-marketplace-admin-script', get_template_directory_uri() . '/js/ecommece-marketplace-admin-script.js', array( 'jquery' ), '', true );
    wp_localize_script( 'ecommece-marketplace-admin-script', 'ecommece_marketplace_ajax_object',
        array( 'ajax_url' => admin_url( 'admin-ajax.php' ) )
    );
}
add_action( 'admin_enqueue_scripts', 'ecommece_marketplace_admin_enqueue_scripts' );

if ( ! defined( 'ECOMMERCE_MARKETPLACE_DOCS_FREE' ) ) {
define('ECOMMERCE_MARKETPLACE_DOCS_FREE',__('https://demo.misbahwp.com/docs/ecommece-marketplace-free-docs/','ecommece-marketplace'));
}
 if ( ! defined( 'ECOMMERCE_MARKETPLACE_DOCS_PRO' ) ) {
define('ECOMMERCE_MARKETPLACE_DOCS_PRO',__('https://demo.misbahwp.com/docs/ecommece-marketplace-pro-docs','ecommece-marketplace'));
}
if ( ! defined( 'ECOMMERCE_MARKETPLACE_BUY_NOW' ) ) {
define('ECOMMERCE_MARKETPLACE_BUY_NOW',__('https://www.misbahwp.com/products/ecommece-marketplace-wordpress-theme','ecommece-marketplace'));
}
if ( ! defined( 'ECOMMERCE_MARKETPLACE_SUPPORT_FREE' ) ) {
define('ECOMMERCE_MARKETPLACE_SUPPORT_FREE',__('https://wordpress.org/support/theme/ecommece-marketplace','ecommece-marketplace'));
}
if ( ! defined( 'ECOMMERCE_MARKETPLACE_REVIEW_FREE' ) ) {
define('ECOMMERCE_MARKETPLACE_REVIEW_FREE',__('https://wordpress.org/support/theme/ecommece-marketplace/reviews/#new-post','ecommece-marketplace'));
}
if ( ! defined( 'ECOMMERCE_MARKETPLACE_DEMO_PRO' ) ) {
define('ECOMMERCE_MARKETPLACE_DEMO_PRO',__('https://demo.misbahwp.com/ecommece-marketplace/','ecommece-marketplace'));
}
if( ! defined( 'ECOMMERCE_MARKETPLACE_THEME_BUNDLE' ) ) {
define('ECOMMERCE_MARKETPLACE_THEME_BUNDLE',__('https://www.misbahwp.com/products/wordpress-bundle','ecommece-marketplace'));
}

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

		<div id="righty">
			<div class="postboxx donate">
				<h3 class="hndle"><?php esc_html_e( 'Upgrade to Premium', 'ecommece-marketplace' ); ?></h3>
				<div class="insidee">
					<p><?php esc_html_e('Discover upgraded pro features with premium version click to upgrade.','ecommece-marketplace'); ?></p>
					<div id="admin_pro_links">
						<a class="blue-button-2" href="<?php echo esc_url( ECOMMERCE_MARKETPLACE_BUY_NOW ); ?>" target="_blank"><?php esc_html_e( 'Go Pro', 'ecommece-marketplace' ); ?></a>
						<a class="blue-button-1" href="<?php echo esc_url( ECOMMERCE_MARKETPLACE_DEMO_PRO ); ?>" target="_blank"><?php esc_html_e( 'Live Demo', 'ecommece-marketplace' ) ?></a>
						<a class="blue-button-2" href="<?php echo esc_url( ECOMMERCE_MARKETPLACE_DOCS_PRO ); ?>" target="_blank"><?php esc_html_e( 'Pro Docs', 'ecommece-marketplace' ) ?></a>
					</div>
				</div>
				<h3 class="hndle bundle"><?php esc_html_e( 'Get All Themes', 'ecommece-marketplace' ); ?></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', 'ecommece-marketplace'); ?>">
					<p class="offer"><?php esc_html_e('Get 110+ Perfect WordPress Theme In A Single Package at just $89."','ecommece-marketplace'); ?></p>
					<p class="coupon"><?php esc_html_e('Get Our Theme Pack of 110+ WordPress Themes At 20% Off','ecommece-marketplace'); ?><span class="coupon-code"><?php esc_html_e('"Bundleup15"','ecommece-marketplace'); ?></span></p>
				<div id="admin_pro_linkss">
					<a class="blue-button-1" href="<?php echo esc_url( ECOMMERCE_MARKETPLACE_THEME_BUNDLE ); ?>" target="_blank"><?php esc_html_e( 'Buy All Themes - $89', 'ecommece-marketplace' ) ?></a>
				</div>
				<div class="d-table">
			    <ul class="d-column">
			      <li class="feature"><?php esc_html_e('Features','ecommece-marketplace'); ?></li>
			      <li class="free"><?php esc_html_e('Pro','ecommece-marketplace'); ?></li>
			      <li class="plus"><?php esc_html_e('Free','ecommece-marketplace'); ?></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('24hrs Priority Support','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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','ecommece-marketplace'); ?></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 ','ecommece-marketplace'); ?></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 } ?>
