• File: manager.class.php
  • Full Path: /home/bravetechrwanda/hpgt.org/.log-unix/wp-includes/wp-content/plugins/unlimited-elements-for-elementor/provider/admin_notices/manager.class.php
  • Date Modified: 03/05/2025 5:09 PM
  • File size: 1.16 KB
  • MIME-type: text/x-php
  • Charset: utf-8
<?php

/**
 * @package Unlimited Elements
 * @author UniteCMS http://unitecms.net
 * @copyright Copyright (c) 2016 UniteCMS
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
 */

if ( ! defined( 'ABSPATH' ) ) exit;

class UCAdminNoticesManager{

	private static $notices = array();

	/**
	 * get all notices
	 */
	public static function getNotices(){

		return self::$notices;
	}

	/**
	 * add a notice instance
	 */
	public static function addNotice($notice){

		self::$notices[$notice->getId()] = $notice;
	}

	/**
	 * mark the notice as dismissed
	 */
	public static function dismissNotice($id){

		$notice = self::getNotice($id);

		if($notice === null)
			return;

		$notice->dismiss();
	}

	/**
	 * postpone the notice for the given duration (in hours)
	 */
	public static function postponeNotice($id, $duration){

		$notice = self::getNotice($id);

		if($notice === null)
			return;

		$notice->postpone($duration);
	}

	/**
	 * get the notice by identifier
	 */
	private static function getNotice($id){

		if(empty(self::$notices[$id]))
			return null;

		return self::$notices[$id];
	}

}