<?php

/**
* Get started notice
*/

add_action( 'wp_ajax_web_hosting_lite_dismissed_notice_handler', 'web_hosting_lite_ajax_notice_handler' );

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

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

add_action( 'admin_menu', 'web_hosting_lite_getting_started' );
function web_hosting_lite_getting_started() {
    add_theme_page(
        esc_html__( 'Get Started', 'web-hosting-lite' ),
        esc_html__( 'Get Started', 'web-hosting-lite' ),
        'edit_theme_options',
        'web-hosting-lite-guide-page',
        'web_hosting_lite_test_guide'
    );
}

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

function web_hosting_lite_admin_enqueue_scripts() {
	wp_enqueue_style( 'web-hosting-lite-admin-style', esc_url( get_template_directory_uri() ).'/css/main.css' );
	wp_enqueue_script( 'web-hosting-lite-admin-script', get_template_directory_uri() . '/js/web-hosting-lite-admin-script.js', array( 'jquery' ), '', true );
    wp_localize_script( 'web-hosting-lite-admin-script', 'web_hosting_lite_ajax_object',
        array( 'ajax_url' => admin_url( 'admin-ajax.php' ) )
    );
}
add_action( 'admin_enqueue_scripts', 'web_hosting_lite_admin_enqueue_scripts' );

if ( ! defined( 'WEB_HOSTING_LITE_DOCS_FREE' ) ) {
define('WEB_HOSTING_LITE_DOCS_FREE',__('https://demo.misbahwp.com/docs/web-hosting-free-docs/','web-hosting-lite'));
}
if ( ! defined( 'WEB_HOSTING_LITE_DOCS_PRO' ) ) {
define('WEB_HOSTING_LITE_DOCS_PRO',__('https://demo.misbahwp.com/docs/web-hosting-pro-docs','web-hosting-lite'));
}
if ( ! defined( 'WEB_HOSTING_LITE_BUY_NOW' ) ) {
define('WEB_HOSTING_LITE_BUY_NOW',__('https://www.misbahwp.com/products/hosting-company-wordpress-theme','web-hosting-lite'));
}
if ( ! defined( 'WEB_HOSTING_LITE_SUPPORT_FREE' ) ) {
define('WEB_HOSTING_LITE_SUPPORT_FREE',__('https://wordpress.org/support/theme/web-hosting-lite','web-hosting-lite'));
}
if ( ! defined( 'WEB_HOSTING_LITE_REVIEW_FREE' ) ) {
define('WEB_HOSTING_LITE_REVIEW_FREE',__('https://wordpress.org/support/theme/web-hosting-lite/reviews/#new-post','web-hosting-lite'));
}
if ( ! defined( 'WEB_HOSTING_LITE_DEMO_PRO' ) ) {
define('WEB_HOSTING_LITE_DEMO_PRO',__('https://demo.misbahwp.com/web-hosting/','web-hosting-lite'));
}
if( ! defined( 'WEB_HOSTING_LITE_THEME_BUNDLE' ) ) {
define('WEB_HOSTING_LITE_THEME_BUNDLE',__('https://www.misbahwp.com/products/wordpress-bundle','web-hosting-lite'));
}

function web_hosting_lite_test_guide() { ?>
	<?php $web_hosting_lite_theme = wp_get_theme(); ?>

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

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

				<h3 class="hndle bundle"><?php esc_html_e( 'Get All Themes', 'web-hosting-lite' ); ?></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', 'web-hosting-lite'); ?>">
					<p class="offer"><?php esc_html_e('Get 110+ Perfect WordPress Theme In A Single Package at just $89."','web-hosting-lite'); ?></p>
					<p class="coupon"><?php esc_html_e('Get Our Theme Pack of 110+ WordPress Themes At 20% Off','web-hosting-lite'); ?><span class="coupon-code"><?php esc_html_e('"Bundleup15"','web-hosting-lite'); ?></span></p>
				<div id="admin_pro_linkss">
					<a class="blue-button-1" href="<?php echo esc_url( WEB_HOSTING_LITE_THEME_BUNDLE ); ?>" target="_blank"><?php esc_html_e( 'Buy All Themes - $89', 'web-hosting-lite' ) ?></a>
				</div>
				<div class="d-table">
			    <ul class="d-column">
			      <li class="feature"><?php esc_html_e('Features','web-hosting-lite'); ?></li>
			      <li class="free"><?php esc_html_e('Pro','web-hosting-lite'); ?></li>
			      <li class="plus"><?php esc_html_e('Free','web-hosting-lite'); ?></li>
			    </ul>
			    <ul class="d-row">
			      <li class="points"><?php esc_html_e('24hrs Priority Support','web-hosting-lite'); ?></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','web-hosting-lite'); ?></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','web-hosting-lite'); ?></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','web-hosting-lite'); ?></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','web-hosting-lite'); ?></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','web-hosting-lite'); ?></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','web-hosting-lite'); ?></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','web-hosting-lite'); ?></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','web-hosting-lite'); ?></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','web-hosting-lite'); ?></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','web-hosting-lite'); ?></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 ','web-hosting-lite'); ?></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 } ?>
