Overview

Packages

  • Auth
  • Core
  • Horde
    • Imsp
  • None
  • Notification

Classes

  • Horde
  • Horde_Config
  • Horde_Config_Form
  • Horde_Core_ActiveSync_Connector
  • Horde_Core_ActiveSync_Driver
  • Horde_Core_Ajax_Application
  • Horde_Core_Ajax_Imple
  • Horde_Core_Ajax_Imple_AutoCompleter
  • Horde_Core_Ajax_Imple_Geocoder_Geonames
  • Horde_Core_Ajax_Imple_SpellChecker
  • Horde_Core_Alarm_Handler_Notify
  • Horde_Core_Auth_Application
  • Horde_Core_Auth_Composite
  • Horde_Core_Auth_Ldap
  • Horde_Core_Auth_Msad
  • Horde_Core_Auth_Shibboleth
  • Horde_Core_Auth_Signup_Base
  • Horde_Core_Auth_Signup_Form
  • Horde_Core_Auth_Signup_Null
  • Horde_Core_Auth_Signup_Sql
  • Horde_Core_Auth_Signup_SqlObject
  • Horde_Core_Autoloader_Callback_Mime
  • Horde_Core_Autoloader_Callback_Nls
  • Horde_Core_Block
  • Horde_Core_Block_Collection
  • Horde_Core_Block_Layout
  • Horde_Core_Block_Layout_Manager
  • Horde_Core_Block_Layout_View
  • Horde_Core_Block_Upgrade
  • Horde_Core_Browser
  • Horde_Core_Bundle
  • Horde_Core_Cli
  • Horde_Core_Controller_NotFound
  • Horde_Core_Controller_RequestConfiguration
  • Horde_Core_Controller_RequestMapper
  • Horde_Core_Controller_SettingsFinder
  • Horde_Core_Db_Migration
  • Horde_Core_Factory_ActiveSyncBackend
  • Horde_Core_Factory_ActiveSyncServer
  • Horde_Core_Factory_ActiveSyncState
  • Horde_Core_Factory_Ajax
  • Horde_Core_Factory_Alarm
  • Horde_Core_Factory_Auth
  • Horde_Core_Factory_AuthSignup
  • Horde_Core_Factory_Base
  • Horde_Core_Factory_BlockCollection
  • Horde_Core_Factory_Browser
  • Horde_Core_Factory_Cache
  • Horde_Core_Factory_Crypt
  • Horde_Core_Factory_Data
  • Horde_Core_Factory_Db
  • Horde_Core_Factory_DbBase
  • Horde_Core_Factory_DbPear
  • Horde_Core_Factory_Dns
  • Horde_Core_Factory_Editor
  • Horde_Core_Factory_Facebook
  • Horde_Core_Factory_Group
  • Horde_Core_Factory_History
  • Horde_Core_Factory_HttpClient
  • Horde_Core_Factory_Identity
  • Horde_Core_Factory_Image
  • Horde_Core_Factory_Imple
  • Horde_Core_Factory_Imsp
  • Horde_Core_Factory_ImspAuth
  • Horde_Core_Factory_Injector
  • Horde_Core_Factory_KolabServer
  • Horde_Core_Factory_KolabSession
  • Horde_Core_Factory_KolabStorage
  • Horde_Core_Factory_Ldap
  • Horde_Core_Factory_Lock
  • Horde_Core_Factory_Logger
  • Horde_Core_Factory_LoginTasks
  • Horde_Core_Factory_Mail
  • Horde_Core_Factory_Mapper
  • Horde_Core_Factory_Matcher
  • Horde_Core_Factory_Memcache
  • Horde_Core_Factory_MimeViewer
  • Horde_Core_Factory_Notification
  • Horde_Core_Factory_Perms
  • Horde_Core_Factory_PermsCore
  • Horde_Core_Factory_Prefs
  • Horde_Core_Factory_Request
  • Horde_Core_Factory_Secret
  • Horde_Core_Factory_SessionHandler
  • Horde_Core_Factory_Share
  • Horde_Core_Factory_ShareBase
  • Horde_Core_Factory_Template
  • Horde_Core_Factory_TextFilter
  • Horde_Core_Factory_ThemesCache
  • Horde_Core_Factory_Token
  • Horde_Core_Factory_Tree
  • Horde_Core_Factory_Twitter
  • Horde_Core_Factory_UrlShortener
  • Horde_Core_Factory_Vfs
  • Horde_Core_Factory_View
  • Horde_Core_Factory_Weather
  • Horde_Core_Group_Ldap
  • Horde_Core_Log_Logger
  • Horde_Core_LoginTasks
  • Horde_Core_LoginTasks_Backend_Horde
  • Horde_Core_LoginTasks_SystemTask_Upgrade
  • Horde_Core_Mime_Viewer_Syntaxhighlighter
  • Horde_Core_Mime_Viewer_Vcard
  • Horde_Core_Notification_Event_Status
  • Horde_Core_Notification_Handler_Decorator_Hordelog
  • Horde_Core_Notification_Storage_Session
  • Horde_Core_Perms
  • Horde_Core_Perms_Ui
  • Horde_Core_Prefs_Cache_Session
  • Horde_Core_Prefs_Identity
  • Horde_Core_Prefs_Storage_Configuration
  • Horde_Core_Prefs_Storage_Hooks
  • Horde_Core_Prefs_Storage_Upgrade
  • Horde_Core_Prefs_Ui
  • Horde_Core_Prefs_Ui_Widgets
  • Horde_Core_Share_Driver
  • Horde_Core_Share_FactoryCallback
  • Horde_Core_Sidebar
  • Horde_Core_Text_Filter_Bbcode
  • Horde_Core_Text_Filter_Emails
  • Horde_Core_Text_Filter_Emoticons
  • Horde_Core_Text_Filter_Highlightquotes
  • Horde_Core_Translation
  • Horde_Core_Tree_Html
  • Horde_Core_Tree_Javascript
  • Horde_Core_Tree_Simplehtml
  • Horde_Core_Ui_FlagImage
  • Horde_Core_Ui_JsCalendar
  • Horde_Core_Ui_Language
  • Horde_Core_Ui_Layout
  • Horde_Core_Ui_ModalFormRenderer
  • Horde_Core_Ui_Pager
  • Horde_Core_Ui_Tabs
  • Horde_Core_Ui_TagCloud
  • Horde_Core_Ui_VarRenderer
  • Horde_Core_Ui_VarRenderer_Html
  • Horde_Core_Ui_VarRenderer_TablesetHtml
  • Horde_Core_Ui_Widget
  • Horde_ErrorHandler
  • Horde_Help
  • Horde_Menu
  • Horde_Registry
  • Horde_Registry_Api
  • Horde_Registry_Application
  • Horde_Registry_Caller
  • Horde_Registry_Nlsconfig
  • Horde_Script_Files
  • Horde_Session
  • Horde_Session_Null
  • Horde_Themes
  • Horde_Themes_Cache
  • Horde_Themes_Css
  • Horde_Themes_Element
  • Horde_Themes_Image
  • Horde_Themes_Sound

Exceptions

  • Horde_Exception_HookNotSet
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * The Horde_Themes:: class provides an interface to handling Horde themes.
  4:  *
  5:  * Copyright 2010-2012 Horde LLC (http://www.horde.org/)
  6:  *
  7:  * See the enclosed file COPYING for license information (LGPL). If you
  8:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
  9:  *
 10:  * @author   Michael Slusarz <slusarz@horde.org>
 11:  * @category Horde
 12:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 13:  * @package  Core
 14:  */
 15: class Horde_Themes
 16: {
 17:     /**
 18:      * Return the path to an image, using the default image if the image does
 19:      * not exist in the current theme.
 20:      *
 21:      * @param string $name    The image name. If null, will return the image
 22:      *                        directory.
 23:      * @param mixed $options  Additional options. If a string, is taken to be
 24:      *                        the 'app' parameter. If an array, the following
 25:      *                        options are available:
 26:      * <pre>
 27:      * 'app' - (string) Use this application instead of the current app.
 28:      * 'nohorde' - (boolean) If true, do not fallback to horde for image.
 29:      * 'theme' - (string) Use this theme instead of the Horde default.
 30:      * </pre>
 31:      *
 32:      * @return Horde_Themes_Image  An object which contains the URI
 33:      *                             and filesystem location of the image.
 34:      */
 35:     static public function img($name = null, $options = array())
 36:     {
 37:         if (is_string($options)) {
 38:             $options = array('app' => $options);
 39:         }
 40: 
 41:         return new Horde_Themes_Image($name, $options);
 42:     }
 43: 
 44:     /**
 45:      * Return the path to a sound, using the default sound if the sound does
 46:      * not exist in the current theme.
 47:      *
 48:      * @param string $name    The sound name. If null, will return the sound
 49:      *                        directory.
 50:      * @param mixed $options  Additional options. If a string, is taken to be
 51:      *                        the 'app' parameter. If an array, the following
 52:      *                        options are available:
 53:      * <pre>
 54:      * 'app' - (string) Use this application instead of the current app.
 55:      * 'nohorde' - (boolean) If true, do not fallback to horde for sound.
 56:      * 'theme' - (string) Use this theme instead of the Horde default.
 57:      * </pre>
 58:      *
 59:      * @return Horde_Themes_Sound  An object which contains the URI
 60:      *                             and filesystem location of the sound.
 61:      */
 62:     static public function sound($name = null, $options = array())
 63:     {
 64:         if (is_string($options)) {
 65:             $options = array('app' => $options);
 66:         }
 67: 
 68:         return new Horde_Themes_Sound($name, $options);
 69:     }
 70: 
 71:     /**
 72:      * Returns a list of available themes.
 73:      *
 74:      * @return array  Keys are theme names, values are theme descriptions.
 75:      * @throws UnexpectedValueException
 76:      */
 77:     static public function themeList()
 78:     {
 79:         $out = array();
 80: 
 81:         // Throws UnexpectedValueException
 82:         $di = new DirectoryIterator($GLOBALS['registry']->get('themesfs', 'horde'));
 83: 
 84:         foreach ($di as $val) {
 85:             $theme_name = null;
 86: 
 87:             if ($val->isDir() &&
 88:                 !$di->isDot() &&
 89:                 (@include $val->getPathname() . '/info.php')) {
 90:                 $out[strval($val)] = $theme_name;
 91:             }
 92:         }
 93: 
 94:         asort($out);
 95: 
 96:         return $out;
 97:     }
 98: 
 99:     /**
100:      * Returns a list of available sounds.
101:      *
102:      * @param string $app  The app to search in.
103:      * @param string $theme  The app to search in.
104:      *
105:      * @return array  An array of Horde_Themes_Sound objects. Keys are the
106:      *                base filenames.
107:      */
108:     static public function soundList($app = null, $theme = null)
109:     {
110:         if (is_null($app)) {
111:             $app = $GLOBALS['registry']->getApp();
112:         }
113: 
114:         if (is_null($theme)) {
115:             $theme = $GLOBALS['prefs']->getValue('theme');
116:         }
117: 
118:         $cache = $GLOBALS['injector']->getInstance('Horde_Core_Factory_ThemesCache')->create($app, $theme);
119: 
120:         $sounds = array();
121:         foreach ($cache->build() as $val) {
122:             if ((strpos($val, 'sounds/') === 0) &&
123:                 (substr(strrchr($val, '.'), 1) == 'wav')) {
124:                 $sounds[basename($val)] = self::sound(substr($val, 7));
125:             }
126:         }
127: 
128:         ksort($sounds);
129:         return $sounds;
130:     }
131: 
132:     /**
133:      * Return the location of the feed XSL file.
134:      *
135:      * As of now, this file MUST live in horde/themes/default/feed-rss.xsl.
136:      *
137:      * @return string  Path to the feed file.
138:      */
139:     static public function getFeedXsl()
140:     {
141:          return $GLOBALS['registry']->get('themesuri', 'horde') . '/default/feed-rss.xsl';
142:     }
143: 
144: }
145: 
API documentation generated by ApiGen