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_Element:: class provides an object-oriented interface to
  4:  * a themes element.
  5:  *
  6:  * Copyright 2010-2012 Horde LLC (http://www.horde.org/)
  7:  *
  8:  * See the enclosed file COPYING for license information (LGPL). If you
  9:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 10:  *
 11:  * @author   Michael Slusarz <slusarz@horde.org>
 12:  * @category Horde
 13:  * @package  Core
 14:  *
 15:  * @property $fs  (string) Filesystem location.
 16:  * @property $fulluri  (Horde_Url) Full URI.
 17:  * @property $uri (string) Relative URI.
 18:  */
 19: class Horde_Themes_Element
 20: {
 21:     /**
 22:      * Current application name.
 23:      *
 24:      * @var string
 25:      */
 26:     public $app;
 27: 
 28:     /**
 29:      * URI/filesystem path values.
 30:      *
 31:      * @var array
 32:      */
 33:     protected $_data = array();
 34: 
 35:     /**
 36:      * The default directory name for this element type.
 37:      *
 38:      * @var string
 39:      */
 40:     protected $_dirname = '';
 41: 
 42:     /**
 43:      * Element name.
 44:      *
 45:      * @var string
 46:      */
 47:     protected $_name;
 48: 
 49:     /**
 50:      * Options.
 51:      *
 52:      * @var array
 53:      */
 54:     protected $_opts;
 55: 
 56:     /**
 57:      * Constructor.
 58:      *
 59:      * @param string $name    The element name. If null, will return the
 60:      *                        element directory.
 61:      * @param array $options  Additional options:
 62:      * <pre>
 63:      * 'app' - (string) Use this application instead of the current app.
 64:      * 'data' - (array) Contains 2 elements: 'fs' - filesystem path,
 65:                         'uri' - the element URI. If set, use as the data
 66:                         values instead of auto determining.
 67:      * 'nohorde' - (boolean) If true, do not fallback to horde for element.
 68:      * 'theme' - (string) Use this theme instead of the Horde default.
 69:      * 'uri' - (string) Use this as the URI value.
 70:      * </pre>
 71:      */
 72:     public function __construct($name = '', array $options = array())
 73:     {
 74:         $this->app = empty($options['app'])
 75:             ? $GLOBALS['registry']->getApp()
 76:             : $options['app'];
 77:         $this->_name = $name;
 78:         $this->_opts = $options;
 79: 
 80:         if ($GLOBALS['registry']->get('status', $this->app) == 'heading') {
 81:             $this->app = 'horde';
 82:         }
 83: 
 84:         if (isset($this->_opts['data'])) {
 85:             $this->_data = $this->_opts['data'];
 86:             unset($this->_opts['data']);
 87:         }
 88:     }
 89: 
 90:     /**
 91:      * String representation of this object.
 92:      *
 93:      * @return string  The relative URI.
 94:      */
 95:     public function __toString()
 96:     {
 97:         try {
 98:             return (string)$this->uri;
 99:         } catch (Exception $e) {
100:             Horde::logMessage($e, 'ERR');
101:             return '';
102:         }
103:     }
104: 
105:     /**
106:      */
107:     public function __get($name)
108:     {
109:         global $prefs, $registry;
110: 
111:         if (empty($this->_data)) {
112:             $theme = array_key_exists('theme', $this->_opts)
113:                 ? $this->_opts['theme']
114:                 : $prefs->getValue('theme');
115: 
116:             if (is_null($this->_name)) {
117:                 /* Return directory only. */
118:                 $this->_data = array(
119:                     'fs' => $registry->get('themesfs', $this->app) . '/' . $theme . '/' . $this->_dirname,
120:                     'uri' => $registry->get('themesuri', $this->app) . '/' . $theme . '/' . $this->_dirname
121:                 );
122:             } else {
123:                 $cache = $GLOBALS['injector']->getInstance('Horde_Core_Factory_ThemesCache')->create($this->app, $theme);
124:                 $mask = empty($this->_opts['nohorde'])
125:                     ? 0
126:                     : Horde_Themes_Cache::APP_DEFAULT | Horde_Themes_Cache::APP_THEME;
127: 
128:                 $this->_data = $cache->get($this->_dirname . '/' . $this->_name, $mask);
129:             }
130:         }
131: 
132:         switch ($name) {
133:         case 'fs':
134:         case 'uri':
135:             return $this->_data[$name];
136: 
137:         case 'fulluri':
138:             return Horde::url($this->_data['uri'], true);
139: 
140:         default:
141:             return null;
142:         }
143:     }
144: 
145:     /**
146:      * Convert a URI into a Horde_Themes_Element object.
147:      *
148:      * @param string $uri  The URI to convert.
149:      *
150:      * @return Horde_Themes_Element  A theme element object.
151:      */
152:     static public function fromUri($uri)
153:     {
154:         global $registry;
155: 
156:         return new self('', array(
157:             'data' => array(
158:                 'fs' => realpath($registry->get('fileroot', 'horde')) . preg_replace('/^' . preg_quote($registry->get('webroot', 'horde'), '/') . '/', '', $uri),
159:                 'uri' => $uri
160:             )
161:         ));
162:     }
163: 
164: }
165: 
API documentation generated by ApiGen