HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/insiders/wp-load/wp-content/plugins/affiliatex/includes/notice/AdminNoticeManager.php
<?php
/**
 * Admin notice manager for AffiliateX
 *
 * @package AffiliateX\Notice
 */

namespace AffiliateX\Notice;

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

/**
 * Class AdminNoticeManager
 *
 * @package AffiliateX\Notice
 */
class AdminNoticeManager {
    /**
     * Constructor
     */
    public function __construct() {
        $this->init();
    }

    /**
     * Initialize hooks
     *
     * @return void
     */
    public function init() {
        add_action( 'admin_enqueue_scripts', array( $this, 'hide_non_affiliatex_notices' ) );
    }

    /**
     * Hide non-AffiliateX notices in plugin admin pages
     *
     * @param string $hook The current admin page hook.
     * @return void
     */
    public function hide_non_affiliatex_notices( $hook ) {
        $screen = get_current_screen();
        
        // Return early if not on AffiliateX admin page
        if ( ! $screen || false === strpos( $screen->base, 'affiliatex' ) ) {
            return;
        }

        $custom_css = '
        .wrap > .notice,
        .wrap > div.updated,
        .wrap > div.error,
        .wrap > div.warning,
        #wpbody-content > .notice,
        #wpbody-content > div.updated,
        #wpbody-content > div.error,
        #wpbody-content > div.warning {
            display: none !important;
        }
    ';

        wp_add_inline_style( 'affiliatex-admin-css', $custom_css );
    }
}