<?php

/**
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
} // Exit if accessed directly

if( !class_exists( 'venice_lite_admin_notice' ) ) {

	class venice_lite_admin_notice {
	
		/**
		 * Constructor
		 */
		 
		public function __construct( $fields = array() ) {

			if ( 
				!get_option( 'venice-lite-upsell-notice') &&
				version_compare( PHP_VERSION, VENICE_LITE_MIN_PHP_VERSION, '>=' )
			) {

				add_action( 'admin_notices', array(&$this, 'admin_notice') );
				add_action( 'admin_head', array( $this, 'dismiss' ) );
			
			}

		}

		/**
		 * Dismiss notice.
		 */
		
		public function dismiss() {

			if ( isset( $_GET['venice-lite-dismiss'] ) && check_admin_referer( 'venice-lite-dismiss-action' ) ) {
		
				update_option( 'venice-lite-upsell-notice', intval($_GET['venice-lite-dismiss']) );
				remove_action( 'admin_notices', array(&$this, 'admin_notice') );
				
			} 
		
		}

		/**
		 * Admin notice.
		 */
		 
		public function admin_notice() {
			
		?>
			
            <div class="notice notice-warning is-dismissible">
            
            	<p>
            
            		<strong>

						<?php esc_html_e( 'Unlock all premium features of Venice theme like...', 'venice-lite' );  ?>

                    </strong>
                
                </p>

				<p class="notice-coupon-message">

					<span class="dashicon dashicons dashicons-yes-alt" size="10"></span><?php esc_html_e( '600+ Google Fonts', 'venice-lite' ); ?><br/>
					<span class="dashicon dashicons dashicons-yes-alt" size="10"></span><?php esc_html_e( 'Custom colors', 'venice-lite' ); ?><br/>
					<span class="dashicon dashicons dashicons-yes-alt" size="10"></span><?php esc_html_e( 'Custom shortcodes', 'venice-lite' ); ?><br/>
					<span class="dashicon dashicons dashicons-yes-alt" size="10"></span><?php esc_html_e( 'Portfolio section', 'venice-lite' ); ?><br/>
					<span class="dashicon dashicons dashicons-yes-alt" size="10"></span><?php esc_html_e( 'Lifetime updates', 'venice-lite' ); ?><br/>
					<span class="dashicon dashicons dashicons-yes-alt" size="10"></span><?php esc_html_e( '30 days money back guarantee', 'venice-lite' ); ?><br/>
				
				</p>

            	<p>

					<a href="<?php echo esc_url(admin_url( 'themes.php?page=venice-lite-welcome-page&section=free_pro' )); ?>" class="button"><?php esc_html_e( 'Free vs Pro', 'venice-lite' ); ?></a>
					<a target="_blank" href="<?php echo esc_url( 'https://www.themeinprogress.com/venice-free-woocommerce-wordpress-blog-theme/?ref=2&campaign=venice-notice' ); ?>" class="button button-primary"><?php esc_html_e( 'Name your price', 'venice-lite' ); ?> - (<em><?php esc_html_e( 'Min price allowed: €1', 'venice-lite' ); ?></em>)</a>

            	</p>

            	<p>

            		<strong>

						<?php

							printf( 
								'<a href="%1$s" class="dismiss-notice">' . esc_html__( 'Dismiss this notice', 'venice-lite' ) . '</a>', 
								esc_url( wp_nonce_url( add_query_arg( 'venice-lite-dismiss', '1' ), 'venice-lite-dismiss-action'))
							);

                        ?>

                    </strong>

            	</p>

            </div>
		
		<?php
		
		}

	}

}

new venice_lite_admin_notice();

?>