HEX
Server: nginx/1.27.1
System: Linux in-4 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: ilikadirect (1186)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v6964/2foodfactor/public_html/wp-content/plugins/job-board-light/admin/notifications.php
<?php
// Exit if accessed directly
if (!defined('ABSPATH')) {
	exit;
}

/**
 * @file
 *
 * Notifications API 
 */
if (!class_exists('wp_admin_notifications')) {
	class wp_admin_notifications   { 

	  /**
	   * Register a new notification
	   *
	   * @param $id
	   * @param $msg
	   * @param $type
	   * @param $pages
	   * @param $include
	   */
	  static function register_notification($id, $msg = '', $type = 'warning', $pages = array(), $include = true) {
	  	$notifications = get_option('wp_admin_notifications', array());

	  	$notification = array(
	  		'id' => $id,
	  		'msg' => $msg,
	  		'type' => $type,
	  		'pages' => $pages,
	  		'include' => $include,
	  		'active' => false,
	  		);

	  	$notifications[$id] =  $notification;
	  	update_option('wp_admin_notifications', $notifications);
	  }

	  /**
	   * Display a notification
	   * @param $id
	   */
	  static function display_notification($id) {
	  	$notifications = get_option('wp_admin_notifications', array());
	  	$notification =  $notifications[$id];
	  	echo '<div id="notification-'.$notification['id'].'" class="wp-admin-notification '.$notification['type'].'">' .esc_html( $notification['msg']). '</div>';
	  }

	  /**
	   * Display all enabled notifications
	   */
	  static function display_notifications() {

	  	$notifications = get_option('wp_admin_notifications', array());

	  	foreach($notifications as $notification) {
	  		if ($notification['active']) {
	  			self::display_notification($notification['id']);
	  		}
	  	}
	  }

	  /**
	   * Enable a notification
	   * @param $id
	   */
	  static function enable_notification($id) {
	  	$notifications = get_option('wp_admin_notifications', array());
	  	$notification =  $notifications[$id];

		 // Activate the notification
	  	$notification['active'] = true;

	  	$notifications[$id] =  $notification;
	  	update_option('wp_admin_notifications', $notifications);
	  }

	  /**
	   * Disable a notification
	   * @param $id
	   */
	  static function disable_notification($id) {
	  	$notifications = get_option('wp_admin_notifications', array());
	  	$notification =  $notifications[$id];

		 // Activate the notification
	  	$notification['active'] = false;

	  	$notifications[$id] =  $notification;
	  	update_option('wp_admin_notifications', $notifications);
	  }

	  /**
	   * Remove a notification
	   * @param $id
	   */
	  static function remove_notification($id) {
	  	$notifications = get_option('wp_admin_notifications', array());
	  	unset($notifications[$id]);
	  	update_option('wp_admin_notifications', $notifications);
	  }

	  /**
	   * Load the notification API
	   */
	  static function load() {
	  	add_action('admin_notices', 'wp_admin_notifications::display_notifications');
	  }
	}
}