{
public function create(Horde_Injector $injector)
{
- $notify = Horde_Notification::singleton();
+ $notify = new Horde_Notification_Handler(
+ new Horde_Core_Notification_Storage_Session()
+ );
$notify->addType('default', '*', 'Horde_Core_Notification_Status');
$notify->addType('status', 'horde.*', 'Horde_Core_Notification_Status');
--- /dev/null
+<?php
+/**
+ * A class that stores notifications in the session, using Horde_Session.
+ *
+ * @author Michael Slusarz <slusarz@curecanti.org>
+ * @category Horde
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ * @package Core
+ */
+
+/**
+ * A class that stores notifications in the session, using Horde_Session.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @author Michael Slusarz <slusarz@curecanti.org>
+ * @category Horde
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ * @package Core
+ */
+class Horde_Core_Notification_Storage_Session
+implements Horde_Notification_Storage_Interface
+{
+ /**
+ */
+ public function get($key)
+ {
+ return $GLOBALS['session']['horde:notify/' . $key];
+ }
+
+ /**
+ */
+ public function set($key, $value)
+ {
+ $GLOBALS['session']['horde:notify/' . $key] = $value;
+ }
+
+ /**
+ */
+ public function exists($key)
+ {
+ return isset($GLOBALS['session']['horde:notify/' . $key]);
+ }
+
+ /**
+ */
+ public function clear($key)
+ {
+ unset($GLOBALS['session']['horde:notify/' . $key]);
+ }
+
+ /**
+ */
+ public function push($listener, Horde_Notification_Event $event)
+ {
+ global $session;
+
+ $events = $session['horde:notify/' . $listener . ';array'];
+ $events[] = $event;
+ $session['horde:notify/' . $listener . ';object'] = $events;
+ }
+
+}
* given page load. Thus, for arrays ans objects, it is beneficial to
* always convert to string representations so that the object/array
* does not need to be rebuilt every time the session is reloaded. */
- if (is_object($value)) {
+ if (is_object($value) || ($ob->type == 'object')) {
$value = serialize($value);
if ($this->_lzf) {
$value = lzf_compress($value);
}
$_SESSION[self::SERIALIZED][$ob->key] = 's';
- } elseif (is_array($value)) {
+ } elseif (is_array($value) || ($ob->type == 'array')) {
$value = json_encode($value);
if ($this->_lzf) {
$value = lzf_compress($value);
</dir> <!-- /lib/Horde/Core/Mime/Viewer -->
</dir> <!-- /lib/Horde/Core/Mime -->
<dir name="Notification">
+ <dir name="Storage">
+ <file name="Session.php" role="php" />
+ </dir> <!-- /lib/Horde/Core/Notification/Storage -->
<file name="Hordelog.php" role="php" />
<file name="Status.php" role="php" />
</dir> <!-- /lib/Horde/Core/Notification -->
<install as="Horde/Core/LoginTasks/Backend/Horde.php" name="lib/Horde/Core/LoginTasks/Backend/Horde.php" />
<install as="Horde/Core/Mime/Viewer/Syntaxhighlighter.php" name="lib/Horde/Core/Mime/Viewer/Syntaxhighlighter.php" />
<install as="Horde/Core/Mime/Viewer/Vcard.php" name="lib/Horde/Core/Mime/Viewer/Vcard.php" />
+ <install as="Horde/Core/Notification/Storage/Session.php" name="lib/Horde/Core/Notification/Storage/Session.php" />
<install as="Horde/Core/Notification/Hordelog.php" name="lib/Horde/Core/Notification/Hordelog.php" />
<install as="Horde/Core/Notification/Status.php" name="lib/Horde/Core/Notification/Status.php" />
<install as="Horde/Core/Perms/Ui.php" name="lib/Horde/Core/Perms/Ui.php" />