# master-addons/3.1.2/inc/classes/notifications/base/data.php

Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder &amp; Template Kits, version 3.1.2. 146 lines.

- Page: https://pluginprobe.com/plugins/master-addons/3.1.2/code/inc/classes/notifications/base/data.php
- Raw: https://pluginprobe.com/plugins/master-addons/3.1.2/raw/inc/classes/notifications/base/data.php
- Modified: 2026-03-08T11:32:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/master-addons/3.1.2/code/inc/classes/notifications/base/data.php#L10-L20`.

```php
<?php

namespace MasterAddons\Inc\Classes\Notifications\Base;

// No, Direct access Sir !!!
if (!defined('ABSPATH')) {
	exit;
}

/**
 * Data abstract class
 *
 * Jewel Theme <support@jeweltheme.com>
 */
abstract class Data
{

	use Date;

	public $notifications = array();

	/**
	 * Get Notifications
	 *
	 * @param [type] $instance_key .
	 *
	 * @author Jewel Theme <support@jeweltheme.com>
	 */
	public function get_notification($instance_key)
	{
		if (array_key_exists($instance_key, $this->notifications)) {
			return $this->notifications[$instance_key];
		}

		return null;
	}

	/**
	 * Get Notificaiton
	 *
	 * @param [type] $type .
	 *
	 * @author Jewel Theme <support@jeweltheme.com>
	 */
	public function get_notifications($type = null)
	{
		$notifications = $this->notifications;

		if ($type) {
			$notifications = wp_list_filter($notifications, array('type' => $type));
		}

		return $notifications;
	}

	/**
	 * Get Active notifications
	 *
	 * @param [type] $type .
	 *
	 * @author Jewel Theme <support@jeweltheme.com>
	 */
	public function get_active_notifications($type = null)
	{
		$notifications = wp_list_filter($this->get_notifications($type), array('is_active' => true));

		return wp_list_sort($notifications, 'next_exec_time');
	}

	/**
	 * Get executable notifications
	 *
	 * @param [type] $date .
	 * @param [type] $type .
	 *
	 * @author Jewel Theme <support@jeweltheme.com>
	 */
	public function get_exec_notifications($date = null, $type = null)
	{
		if (!$date) {
			$date = $this->current_time();
		}

		$notifications = $this->get_active_notifications($type);

		$_notifications = array();

		foreach ($notifications as $notification) {
			if (empty($notification->next_exec_time)) {
				continue;
			}

			if ($this->date_is_current_or_prev($notification->next_exec_time, $date)) {
				$_notifications[] = $notification;
			}
		}

		return $_notifications;
	}

	/**
	 * Get Upcoming Notificaitons
	 *
	 * @param [type] $date .
	 * @param [type] $type .
	 *
	 * @author Jewel Theme <support@jeweltheme.com>
	 */
	public function get_upcoming_notifications($date = null, $type = null)
	{
		if (!$date) {
			$date = $this->current_time();
		}

		$notifications = $this->get_active_notifications($type);

		$_notifications = array();

		foreach ($notifications as $notification) {
			if (empty($notification->next_exec_time)) {
				continue;
			}

			if ($this->date_is_next($notification->next_exec_time, $date)) {
				$_notifications[] = $notification;
			}
		}

		return $_notifications;
	}

	/**
	 * Register Instance
	 *
	 * @param [type] $instance .
	 *
	 * @author Jewel Theme <support@jeweltheme.com>
	 */
	public function register($instance)
	{
		if (!array_key_exists($instance->get_id(), $this->notifications)) {
			$this->notifications[$instance->get_id()] = $instance;
		}
	}
}

```
