HEX
Server: Apache
System: Linux hp3-wp-1011494.hostingp3.local 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64
User: csh2729955 (2121743)
PHP: 7.4.33
Disabled: shell_exec,exec,system,popen,set_time_limit
Upload Files
File: /home/storage/162/3480162/user/htdocs/wp-content/themes/newsreaders/classes/admin-notice.php
<?php
if ( !class_exists('Newsreaders_Dashboard_Notice') ):

    class Newsreaders_Dashboard_Notice
    {
        function __construct()
        {	
            global $pagenow;

        	if( $this->newsreaders_show_hide_notice() ){

	            if( is_multisite() ){

                  add_action( 'network_admin_notices',array( $this,'newsreaders_admin_notice' ) );

                } else {

                  add_action( 'admin_notices',array( $this,'newsreaders_admin_notice' ) );
                }
	        }
	        add_action( 'wp_ajax_newsreaders_notice_dismiss', array( $this, 'newsreaders_notice_dismiss' ) );
			add_action( 'switch_theme', array( $this, 'newsreaders_notice_clear_cache' ) );
            add_action('admin_init', array( $this, 'newsreaders_notice_remove' ),100);

        }
        
        function newsreaders_notice_remove(){
            if( isset( $_GET['page'] ) && $_GET['page'] == get_template().'-about' ){

                remove_all_actions('admin_notices');
                remove_all_actions('all_admin_notices');
            }
        }
        
        public static function newsreaders_show_hide_notice( $status = false ){

            if( $status ){

                if( (class_exists( 'Demo_Import_Kit_Class' ) ) || get_option('twp_newsreaders_admin_notice') ){

                    return false;

                }else{

                    return true;

                }

            }

            // Check If current Page 
            if ( isset( $_GET['page'] ) && $_GET['page'] == 'newsreaders-about'  ) {
                return false;
            }

        	// Hide if dismiss notice
        	if( get_option('twp_newsreaders_admin_notice') ){
				return false;
			}
            // Hide if all plugin active
            if (class_exists( 'Booster_Extension_Class' ) && class_exists( 'Demo_Import_Kit_Class' ) && class_exists( 'Themeinwp_Import_Companion' ) ) {
                return false;
            }
			// Hide On TGMPA pages
			if ( ! empty( $_GET['tgmpa-nonce'] ) ) {
				return false;
			}
			// Hide if user can't access
        	if ( current_user_can( 'manage_options' ) ) {
				return true;
			}
			
        }

        // Define Global Value
        public static function newsreaders_admin_notice(){ ?>

            <div class="updated notice is-dismissible twp-newsreaders-notice">

                <h3><?php esc_html_e('Quick Setup','newsreaders'); ?></h3>

                <p><strong><?php esc_html_e('Newsreaders is now installed and ready to use. Are you looking for a better experience to set up your site?','newsreaders'); ?></strong></p>

                <small><?php esc_html_e("We've prepared a unique onboarding process through our",'newsreaders'); ?> <a href="<?php echo esc_url( admin_url().'themes.php?page='.get_template().'-about') ?>"><?php esc_html_e('Getting started','newsreaders'); ?></a> <?php esc_html_e("page. It helps you get started and configure your upcoming website with ease. Let's make it shine!",'newsreaders'); ?></small>

                <p>
                    <a target="_blank" class="button button-primary button-primary-upgrade" href="<?php echo esc_url( 'https://www.themeinwp.com/theme/newsreaders-pro/' ); ?>">
                        <span class="dashicons dashicons-welcome-view-site"></span>
                        <span><?php esc_html_e('Upgrade to Pro','newsreaders'); ?></span>
                    </a>

                    <a class="button button-secondary twp-install-active" href="javascript:void(0)">
                        <span class="dashicons dashicons-admin-plugins"></span>
                        <span><?php esc_html_e('Install and activate recommended plugins','newsreaders'); ?></span>
                    </a>

                    <a target="_blank" class="button button-secondary" href="<?php echo esc_url( 'https://demo.themeinwp.com/newsreaders/' ); ?>">
                        <span class="dashicons dashicons-welcome-view-site"></span>
                        <span><?php esc_html_e('View Demo','newsreaders'); ?></span>
                    </a>

                    <span class="quick-loader-wrapper"><span class="quick-loader"></span></span>

                    <a target="_blank" class="button button-primary" href="<?php echo esc_url('https://wordpress.org/support/theme/newsreaders/reviews/?filter=5'); ?>">
                        <span class="dashicons dashicons-star-filled"></span>
                        <span class="dashicons dashicons-star-filled"></span>
                        <span class="dashicons dashicons-star-filled"></span>
                        <span class="dashicons dashicons-star-filled"></span>
                        <span class="dashicons dashicons-star-filled"></span>
                        <span><?php esc_html_e('Leave a review', 'newsreaders'); ?></span>
                    </a>

                    <a class="btn-dismiss twp-custom-setup" href="javascript:void(0)"><?php esc_html_e('Dismiss this notice.','newsreaders'); ?></a>

                </p>

            </div>

        <?php
        }

        public function newsreaders_notice_dismiss(){

        	if ( isset( $_POST[ '_wpnonce' ] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[ '_wpnonce' ] ) ), 'newsreaders_ajax_nonce' ) ) {

	        	update_option('twp_newsreaders_admin_notice','hide');

	        }

            die();

        }

        public function newsreaders_notice_clear_cache(){

        	update_option('twp_newsreaders_admin_notice','');

        }

    }
    new Newsreaders_Dashboard_Notice();
endif;