PNG %k25u25%fgd5n!
/home/mkuwqnjx/palaknaturals.com/wp-content/plugins/echo-rewards/includes/Ecre_Admin.php
<?php
/**
 * File: Ecre_Admin.php
 *
 * The Ecre_Admin class manages the administration features of the Wooecho Rewards plugin.
 *
 * @package ECRE
 * @since   1.0.0
 */

namespace ECRE;

if ( ! class_exists( 'Ecre_Admin' ) ) {
	/**
	 * The Ecre_Admin class manages the administration features of the Wooecho Rewards plugin.
	 *
	 * @since 1.0.0
	 */
	class Ecre_Admin {
		/**
		 * Indicates whether the user has a professional (pro) account.
		 *
		 * @var bool
		 */
		public $is_pro;

		/**
		 * Ecre_Admin constructor.
		 *
		 * Initializes the Ecre_Admin class and sets up admin-specific functionalities
		 * based on plugin settings, user plan (pro or free), and WooCommerce status.
		 *
		 * @param array $erce_settings           The current plugin settings array.
		 * @param bool  $is_pro                  Indicates whether the user has a professional (pro) account.
		 * @param bool  $is_woocommerce_activate Indicates whether WooCommerce is activated.
		 *
		 * @since 1.0.0
		 */
		public function __construct( $erce_settings, $is_pro, $is_woocommerce_activate ) {
			$this->is_pro = $is_pro;
			new Admin\Ecre_Menu( $is_pro, $is_woocommerce_activate );

			if ( $is_woocommerce_activate ) {
				new Admin\Ecre_Coupon_Columns();
				new Admin\Ecre_Orders_Column();
				new Admin\Ecre_Orders_Filter();
				// new Admin\Ecre_Order_Tracking();
				// new Admin\Ecre_Order_Tracking();
				// Register the Ecre_Email class for handling referral email notifications.
				add_action( 'woocommerce_email_classes', array( $this, 'ecre_add_referral_email' ), 90, 1 );
			} else {
				add_action( 'admin_init', array( $this, 'remove_all_notices_on_plugin_page' ), 999 );
			}
		}

		/**
		 * Add the Ecre_Email class to the list of WooCommerce email classes.
		 *
		 * @param array $email_classes The array of email classes.
		 *
		 * @return array The updated array of email classes.
		 *
		 * @since 1.0.0
		 */
		public function ecre_add_referral_email( $email_classes ) {
			$email_classes['Ecre_Email'] = new Admin\Ecre_Email( $this->is_pro );
			return $email_classes;
		}

		/**
		 * Version to use inside a class. Add this as a method in your plugin class.
		 */
		public function remove_all_notices_on_plugin_page() {
			// Check if we're on the Echo Rewards page.
			if ( filter_input( INPUT_GET, 'page' ) === 'echo-rewards' ) {
				// Remove all admin notices.
				remove_all_actions( 'admin_notices' );
				remove_all_actions( 'all_admin_notices' );

				// Also remove any network admin notices if in a multisite environment.
				remove_all_actions( 'network_admin_notices' );

				// Remove any user admin notices.
				remove_all_actions( 'user_admin_notices' );

				// Add an empty admin_notices action to prevent notices that might be added later.
				add_action( 'admin_notices', '__return_false' );
				add_action( 'all_admin_notices', '__return_false' );
			}
		}
	}
}