From: Michael M Slusarz Date: Tue, 19 Jan 2010 23:26:09 +0000 (-0700) Subject: Move notification init to Horde_Registry_Application X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6af38a8d259fd27a381fdb2a320269ec2be13dc7;p=horde.git Move notification init to Horde_Registry_Application --- diff --git a/framework/Core/lib/Horde/Registry/Application.php b/framework/Core/lib/Horde/Registry/Application.php index 360caf6c5..28bc502f2 100644 --- a/framework/Core/lib/Horde/Registry/Application.php +++ b/framework/Core/lib/Horde/Registry/Application.php @@ -61,6 +61,9 @@ class Horde_Registry_Application * Initialization. Does any necessary init needed to setup the full * environment for the application. * + * Global variables defined: + * $notification - Notification object. + * * Global constants defined: * [APPNAME]_TEMPLATES - (string) Location of template files. */ @@ -74,6 +77,9 @@ class Horde_Registry_Application define($appname . '_TEMPLATES', $GLOBALS['registry']->get('templates')); } + $GLOBALS['notification'] = Horde_Notification::singleton(); + $this->_initNotification($GLOBALS['notification']); + $this->_init(); } } @@ -86,4 +92,15 @@ class Horde_Registry_Application { } + /** + * Initialization for Notification system. + * + * @param Horde_Notification_Handler_Base $notify The notification + * object. + */ + protected function _initNotification($notify) + { + $notify->attach('status'); + } + } diff --git a/gollem/lib/Application.php b/gollem/lib/Application.php index f33b24994..be71518ad 100644 --- a/gollem/lib/Application.php +++ b/gollem/lib/Application.php @@ -49,14 +49,9 @@ class Gollem_Application extends Horde_Registry_Application * $gollem_backends - A link to the current list of available backends * $gollem_be - A link to the current backend parameters in the session * $gollem_vfs - A link to the current VFS object for the active backend - * $notification - Notification object */ protected function _init() { - // Notification system. - $GLOBALS['notification'] = Horde_Notification::singleton(); - $GLOBALS['notification']->attach('status'); - // Set the global $gollem_be variable to the current backend's // parameters. $GLOBALS['gollem_be'] = empty($_SESSION['gollem']['backend_key']) diff --git a/horde/lib/Application.php b/horde/lib/Application.php index 7bb5a7d6f..b56ebd30b 100644 --- a/horde/lib/Application.php +++ b/horde/lib/Application.php @@ -25,18 +25,6 @@ class Horde_Application extends Horde_Registry_Application public $version = '4.0-git'; /** - * Application initialization. - * - * Global variables defined: - * $notification - Notification object - */ - protected function _init() - { - $GLOBALS['notification'] = Horde_Notification::singleton(); - $GLOBALS['notification']->attach('status'); - } - - /** * Returns a list of available permissions. * * @return array TODO diff --git a/hylax/lib/Application.php b/hylax/lib/Application.php index 8ac5ff986..679f5dbb6 100644 --- a/hylax/lib/Application.php +++ b/hylax/lib/Application.php @@ -38,11 +38,6 @@ class Hylax_Application extends Horde_Registry_Application protected function _init() { - /* Notification system. */ - $notification = Horde_Notification::singleton(); - $notification->attach('status'); - $GLOBALS['notification'] = &$notification; - /* Hylax Driver */ $this->gateway = Hylax_Driver::singleton($conf['fax']['driver'], $conf['fax']['params']); diff --git a/imp/lib/Application.php b/imp/lib/Application.php index 96b9e638b..0a2ee78de 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -85,9 +85,7 @@ class IMP_Application extends Horde_Registry_Application * Global variables defined: * $imp_imap - An IMP_Imap object * $imp_mbox - Current mailbox information - * $imp_notify - A Horde_Notification_Listener object * $imp_search - An IMP_Search object - * $notification - Notification object * * When calling Horde_Registry::appInit(), the following parameters are * also supported: @@ -115,21 +113,32 @@ class IMP_Application extends Horde_Registry_Application Horde_Mime_Headers::$defaultCharset = $def_charset; } - $GLOBALS['notification'] = Horde_Notification::singleton(); + // Initialize global $imp_mbox array. This call also initializes the + // IMP_Search object. + IMP::setCurrentMailboxInfo(); + } + + /** + * Initialization for Notification system. + * + * Global variables defined: + * $imp_notify - A Horde_Notification_Listener object + * + * @param Horde_Notification_Handler_Base $notify The notification + * object. + */ + protected function _initNotification($notify) + { $viewmode = IMP::getViewMode(); if ($viewmode == 'mimp') { - $GLOBALS['imp_notify'] = $GLOBALS['notification']->attach('status', null, 'IMP_Notification_Listener_StatusMobile'); + $GLOBALS['imp_notify'] = $notify->attach('status', null, 'IMP_Notification_Listener_StatusMobile'); } else { - $GLOBALS['imp_notify'] = $GLOBALS['notification']->attach('status', array('viewmode' => $viewmode), 'IMP_Notification_Listener_Status'); + $GLOBALS['imp_notify'] = $notify->attach('status', array('viewmode' => $viewmode), 'IMP_Notification_Listener_Status'); if ($viewmode == 'imp') { - $GLOBALS['notification']->attach('audio'); + $notify->attach('audio'); } } - - // Initialize global $imp_mbox array. This call also initializes the - // IMP_Search object. - IMP::setCurrentMailboxInfo(); } /* Horde permissions. */ diff --git a/kronolith/lib/Application.php b/kronolith/lib/Application.php index c5ce69b57..b6772ce45 100644 --- a/kronolith/lib/Application.php +++ b/kronolith/lib/Application.php @@ -43,9 +43,7 @@ class Kronolith_Application extends Horde_Registry_Application * Initialization function. * * Global variables defined: - * $kronolith_notify - A Horde_Notification_Listener object * $kronolith_shares - TODO - * $notification - Notification object * * When calling Horde_Registry::appInit(), the following parameters are * also supported: @@ -67,10 +65,6 @@ class Kronolith_Application extends Horde_Registry_Application throw new Horde_Exception('The Content_Tagger class could not be found. Make sure the registry entry for the Content system is present.'); } - /* Notification system. */ - $GLOBALS['notification'] = Horde_Notification::singleton(); - $GLOBALS['kronolith_notify'] = $GLOBALS['notification']->attach('status', null, 'Kronolith_Notification_Listener_Status'); - /* Set the timezone variable, if available. */ Horde_Nls::setTimeZone(); @@ -81,6 +75,20 @@ class Kronolith_Application extends Horde_Registry_Application } /** + * Initialization for Notification system. + * + * Global variables defined: + * $kronolith_notify - A Horde_Notification_Listener object. + * + * @param Horde_Notification_Handler_Base $notify The notification + * object. + */ + protected function _initNotification($notify) + { + $GLOBALS['kronolith_notify'] = $notify->attach('status', null, 'Kronolith_Notification_Listener_Status'); + } + + /** * Returns a list of available permissions. * * @return array An array describing all available permissions. diff --git a/skeleton/lib/Application.php b/skeleton/lib/Application.php index 81a33ccb7..63220686e 100644 --- a/skeleton/lib/Application.php +++ b/skeleton/lib/Application.php @@ -40,19 +40,6 @@ class Skeleton_Application extends Horde_Registry_Application public $version = 'H4 (0.1-git)'; /** - * Initialization function. - * - * Global variables defined: - * $notification - Notification object - */ - protected function _init() - { - // Notification system. - $notification = Horde_Notification::singleton(); - $notification->attach('status'); - } - - /** * Generate the menu to use on the prefs page. * * @return Horde_Menu A Horde_Menu object. diff --git a/turba/lib/Application.php b/turba/lib/Application.php index 22dba104d..696529952 100644 --- a/turba/lib/Application.php +++ b/turba/lib/Application.php @@ -50,7 +50,6 @@ class Turba_Application extends Horde_Registry_Application * $cfgSources - TODO * $copymove_source_options - TODO * $copymoveSources - TODO - * $notification - Notification object * $turba_shares - TODO * * When calling Horde_Registry::appInit(), the following parameters are @@ -65,9 +64,6 @@ class Turba_Application extends Horde_Registry_Application Horde_Auth::setAuth($this->initParams['user'], array()); } - $GLOBALS['notification'] = Horde_Notification::singleton(); - $GLOBALS['notification']->attach('status'); - // Turba source and attribute configuration. include TURBA_BASE . '/config/attributes.php'; include TURBA_BASE . '/config/sources.php';