Files
server/usr/share/psa-pear/pear/php/Horde/Notification.php
2026-01-07 20:52:11 +01:00

47 lines
1.4 KiB
PHP

<?php
/**
* The Horde_Notification:: class provides a subject-observer pattern for
* raising and showing messages of different types and to different
* listeners.
*
* Copyright 2001-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @author Jan Schneider <jan@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Notification
*/
class Horde_Notification
{
/**
* Horde_Notification instances.
*
* @var Horde_Notification
*/
protected static $_instances = array();
/**
* Returns a reference to the global notification handler, only
* creating it if it doesn't already exist.
*
* This method must be invoked as:
* $notification = Horde_Notification::singleton([$stack]);
*
* @param string $stack The name of the message stack to use.
*
* return Horde_Notification_Handler The Horde Notification handler.
*/
public static function singleton($stack = 'horde_notification_stacks')
{
if (!isset(self::$_instances[$stack])) {
self::$_instances[$stack] = new Horde_Notification_Handler(new Horde_Notification_Storage_Session($stack));
}
return self::$_instances[$stack];
}
}