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

Class Horde

The Horde:: class provides the functionality shared by all Horde applications.

Copyright 1999-2012 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.

Package: Core
Category: Horde
Author: Chuck Hagenbuch chuck@horde.org
Author: Jon Parise jon@horde.org
Located at Horde.php
Methods summary
public static
# logMessage( mixed $event, mixed $priority = null, array $options = array() )

Shortcut to logging method.

Shortcut to logging method.

See

Horde_Core_Log_Logger
public static
# debug( mixed $event = null, string $fname = null )

Debug method. Allows quick shortcut to produce debug output into a temporary file.

Debug method. Allows quick shortcut to produce debug output into a temporary file.

Parameters

$event
Item to log.
$fname
<p>Filename to log to. If empty, logs to 'horde_debug.txt' in the temporary directory.</p>
public static
# fatal( mixed $error, integer $file = null, integer $line = null, boolean $log = true )

Aborts with a fatal error, displaying debug information to the user.

Aborts with a fatal error, displaying debug information to the user.

Parameters

$error
<p>Either a string or an object with a getMessage() method (e.g. PEAR_Error, Exception).</p>
$file
The file in which the error occured.
$line
The line on which the error occured.
$log
Log this message via logMessage()?
public static
# errorHandler( integer $errno, string $errstr, string $errfile, integer $errline, array $errcontext )

PHP legacy error handling (non-Exceptions).

PHP legacy error handling (non-Exceptions).

Parameters

$errno
See set_error_handler().
$errstr
See set_error_handler().
$errfile
See set_error_handler().
$errline
See set_error_handler().
$errcontext
See set_error_handler().
public static
# addScriptFile( string $file, string $app = null, array $options = array() )

Adds the javascript code to the output (if output has already started) or to the list of script files to include via includeScriptFiles().

Adds the javascript code to the output (if output has already started) or to the list of script files to include via includeScriptFiles().

As long as one script file is added, 'prototype.js' will be automatically added, if the prototypejs property of Horde_Script_Files is true (it is true by default).

Parameters

$file
The full javascript file name.
$app
<p>The application name. Defaults to the current application.</p>
$options
Additional options: <pre><span class="php-quote">'external'</span> - (boolean) Treat <span class="php-var">$file</span> <span class="php-keyword1">as</span> an external URL. <span class="php-keyword1">DEFAULT</span>: <span class="php-var">$file</span> is located in the app<span class="php-quote">'s js/ directory. '</span>full<span class="php-quote">' - (boolean) Output a full URL DEFAULT: false</span></pre>

Throws

Horde_Exception
public static
# includeScriptFiles( )

Outputs the necessary script tags, honoring configuration choices as to script caching.

Outputs the necessary script tags, honoring configuration choices as to script caching.

Throws

Horde_Exception
public static string
# signQueryString( string $queryString, integer $now = null )

Add a signature + timestamp to a query string and return the signed query string.

Add a signature + timestamp to a query string and return the signed query string.

Parameters

$queryString
The query string to sign.
$now
<p>The timestamp at which to sign. Leave blank for generating signatures; specify when testing.</p>

Returns

string
The signed query string.
public static boolean
# verifySignedQueryString( string $data, integer $now = null )

Verify a signature and timestamp on a query string.

Verify a signature and timestamp on a query string.

Parameters

$data
The signed query string.
$now
The current time (can override for testing).

Returns

boolean
Whether or not the string was valid.
public static Horde_Url|boolean
# getServiceLink( string $type, string $app = null )

Returns the URL to various Horde services.

Returns the URL to various Horde services.

Parameters

$type
The service to display. <pre><span class="php-quote">'ajax'</span> <span class="php-quote">'cache'</span> <span class="php-quote">'download'</span> <span class="php-quote">'emailconfirm'</span> <span class="php-quote">'go'</span> <span class="php-quote">'help'</span> <span class="php-quote">'imple'</span> <span class="php-quote">'login'</span> <span class="php-quote">'logintasks'</span> <span class="php-quote">'logout'</span> <span class="php-quote">'pixel'</span> <span class="php-quote">'portal'</span> <span class="php-quote">'problem'</span> <span class="php-quote">'sidebar'</span> <span class="php-quote">'prefs'</span></pre>
$app
The name of the current Horde application.

Returns

Horde_Url|boolean
The HTML to create the link.
public static object
# prepareResponse( mixed $data = null, boolean $notify = false )

Returns a response object with added notification information.

Returns a response object with added notification information.

Parameters

$data
The 'response' data.
$notify
If true, adds notification info to object.

Returns

object

The Horde JSON response. It has the following properties: - msgs: (array) [OPTIONAL] List of notification messages. - response: (mixed) The response data for the request.

public static
# sendHTTPResponse( mixed $data, string $ct )

Send response data to browser.

Send response data to browser.

Parameters

$data
The data to serialize and send to the browser.
$ct
<p>The content-type to send the data with. Either 'json', 'js-json', 'html', 'plain', and 'xml'.</p>
public static string
# escapeJson( mixed $data, array $options = array() )

Do necessary escaping to output JSON.

Do necessary escaping to output JSON.

Parameters

$data
The data to JSON-ify.
$options
Additional options: <pre><span class="php-quote">'nodelimit'</span> - (boolean) Don<span class="php-quote">'t add security delimiters? DEFAULT: false '</span><span class="php-keyword2">urlencode</span><span class="php-quote">' - (boolean) URL encode the json string DEFAULT: false</span></pre>

Returns

string
The escaped string.
public static boolean
# isConnectionSecure( )

Is the current HTTP connection considered secure?

Is the current HTTP connection considered secure?

Returns

boolean
public static
# requireSecureConnection( )

Throws an exception if not using a secure connection.

Throws an exception if not using a secure connection.

Throws

Horde_Exception
public static mixed
# loadConfiguration( string $config_file, string|array $var_names = null, string $app = null, boolean $show_output = false )

Loads global and vhost specific configuration files.

Loads global and vhost specific configuration files.

Parameters

$config_file
The name of the configuration file.
$var_names
<p>The name(s) of the variable(s) that is/are defined in the configuration file.</p>
$app
<p>The application. Defaults to the current application.</p>
$show_output
<p>If true, the contents of the requested config file are simply output instead of loaded into a variable.</p>

Returns

mixed

The value of $var_names, in a compact()'ed array if $var_names is an array.

Throws

Horde_Exception
public static array
# getDriverConfig( mixed $backend, string $type = 'sql' )

Returns the driver parameters for the specified backend.

Returns the driver parameters for the specified backend.

Parameters

$backend
<p>The backend system (e.g. 'prefs', 'categories', 'contacts') being used. The used configuration array will be $conf[$backend]. If an array gets passed, it will be $conf[$key1][$key2].</p>
$type
<p>The type of driver. If null, will not merge with base config.</p>

Returns

array
The connection parameters.
public static
# assertDriverConfig( array $params, string $driver, array $fields, string $name = null, string $file = 'conf.php', string $variable = '$conf' )

Checks if all necessary parameters for a driver configuration are set and throws a fatal error with a detailed explanation how to fix this, if something is missing.

Checks if all necessary parameters for a driver configuration are set and throws a fatal error with a detailed explanation how to fix this, if something is missing.

Parameters

$params
The configuration array with all parameters.
$driver
<p>The key name (in the configuration array) of the driver.</p>
$fields
<p>An array with mandatory parameter names for this driver.</p>
$name
<p>The clear text name of the driver. If not specified, the application name will be used.</p>
$file
<p>The configuration file that should contain these settings.</p>
$variable
The name of the configuration variable.

Throws

Horde_Exception
public static Horde_Url
# url( mixed $uri, boolean $full = false, mixed $opts = array() )

Returns a session-id-ified version of $uri. If a full URL is requested, all parameter separators get converted to "&", otherwise to "&".

Returns a session-id-ified version of $uri. If a full URL is requested, all parameter separators get converted to "&", otherwise to "&".

Parameters

$uri
<p>The URI to be modified (either a string or any object with a __toString() function).</p>
$full
Generate a full (http://server/path/) URL.
$opts
<p>Additional options. If a string/integer, it is taken to be the 'append_session' option. If an array, one of the following:</p> <pre><span class="php-quote">'app'</span> - (string) <span class="php-keyword1">Use</span> this app <span class="php-keyword1">for</span> the webroot. <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword2">current</span> application <span class="php-quote">'append_session'</span> - (integer) <span class="php-num">0</span> = only <span class="php-keyword1">if</span> needed [<span class="php-keyword1">DEFAULT</span>], <span class="php-num">1</span> = always, -<span class="php-num">1</span> = never. <span class="php-quote">'force_ssl'</span> - (boolean) Ignore <span class="php-var">$conf</span>[<span class="php-quote">'use_ssl'</span>] <span class="php-keyword1">and</span> force creation of a SSL URL? <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span> <span class="php-quote">'noajax'</span> - (boolean) Don<span class="php-quote">'t add AJAX UI parameter? DEFAULT: false</span></pre>

Returns

Horde_Url
The URL with the session id appended (if needed).
public static string
# externalUrl( string $url, boolean $tag = false )

Returns an external link passed through the dereferrer to strip session IDs from the referrer.

Returns an external link passed through the dereferrer to strip session IDs from the referrer.

Parameters

$url
The external URL to link to.
$tag
<p>If true, a complete <a> tag is returned, only the url otherwise.</p>

Returns

string
The link to the dereferrer script.
public static Horde_Url
# downloadUrl( string $filename, array $params = array(), string $url = null )

Returns a URL to be used for downloading, that takes into account any special browser quirks (i.e. IE's broken filename handling).

Returns a URL to be used for downloading, that takes into account any special browser quirks (i.e. IE's broken filename handling).

Parameters

$filename
The filename of the download data.
$params
Any additional parameters needed.
$url
<p>The URL to alter. If none passed in, will use the file 'view.php' located in the current app's base directory.</p>

Returns

Horde_Url
The download URL.
public static string
# link( Horde_Url|string $url = '', string $title = '', string $class = '', string $target = '', string $onclick = '', string $title2 = '', string $accesskey = '', array $attributes = array(), boolean $escape = true )

Returns an anchor tag with the relevant parameters

Returns an anchor tag with the relevant parameters

Parameters

$url
The full URL to be linked to.
$title
The link title/description.
$class
The CSS class of the link.
$target
The window target to point to.
$onclick
JavaScript action for the 'onclick' event.
$title2
<p>The link title (tooltip) (deprecated - just use $title).</p>
$accesskey
The access key to use.
$attributes
<p>Any other name/value pairs to add to the <a> tag.</p>
$escape
<p>Whether to escape special characters in the title attribute.</p>

Returns

string
The full tag.
public static string
# linkTooltip( string $url, string $status = '', string $class = '', string $target = '', string $onclick = '', string $title = '', string $accesskey = '', array $attributes = array() )

Uses DOM Tooltips to display the 'title' attribute for link() calls.

Uses DOM Tooltips to display the 'title' attribute for link() calls.

Parameters

$url
The full URL to be linked to
$status
The JavaScript mouse-over string
$class
The CSS class of the link
$target
The window target to point to.
$onclick
JavaScript action for the 'onclick' event.
$title
<p>The link title (tooltip). Most not contain HTML data other than &lt;br&gt;, which will be converted to a linebreak.</p>
$accesskey
The access key to use.
$attributes
<p>Any other name/value pairs to add to the &lt;a&gt; tag.</p>

Returns

string
The full tag.
public static string
# widget( string $url, string $title = '', string $class = 'widget', string $target = '', string $onclick = '', string $title2 = '', boolean $nocheck = false )

Returns an anchor sequence with the relevant parameters for a widget with accesskey and text.

Returns an anchor sequence with the relevant parameters for a widget with accesskey and text.

Parameters

$url
The full URL to be linked to.
$title
The link title/description.
$class
The CSS class of the link
$target
The window target to point to.
$onclick
JavaScript action for the 'onclick' event.
$title2
<p>The link title (tooltip) (deprecated - just use $title).</p>
$nocheck
<p>Don't check if the access key already has been used. Defaults to false (= check).</p>

Returns

string
The full Title sequence.
public static Horde_Url
# selfUrl( boolean $script_params = false, boolean $nocache = true, boolean $full = false, boolean $force_ssl = false )

Returns a session-id-ified version of $SCRIPT_NAME resp. $PHP_SELF.

Returns a session-id-ified version of $SCRIPT_NAME resp. $PHP_SELF.

Parameters

$script_params
<p>Include script parameters like QUERY_STRING and PATH_INFO?</p>
$nocache
<p>Include a cache-buster parameter in the URL?</p>
$full
Return a full URL?
$force_ssl
<p>Ignore $conf['use_ssl'] and force creation of a SSL URL?</p>

Returns

Horde_Url
The requested URL.
public static string
# img( mixed $src, string $alt = '', mixed $attr = '' )

Constructs a correctly-pathed tag to an image.

Constructs a correctly-pathed tag to an image.

Parameters

$src
<p>The image file (either a string or a Horde_Themes_Image object).</p>
$alt
Text describing the image.
$attr
<p>Any additional attributes for the image tag. Can be a pre-built string or an array of key/value pairs that will be assembled and html-encoded.</p>

Returns

string
The full image tag.
public static
# fullSrcImg( mixed $src, mixed $options = array() )

Same as img(), but returns a full source url for the image. Useful for when the image may be part of embedded Horde content on an external site.

Same as img(), but returns a full source url for the image. Useful for when the image may be part of embedded Horde content on an external site.

See

Horde::img()
public static string
# base64ImgData( mixed $in, integer $limit = null )

Generate RFC 2397-compliant image data strings.

Generate RFC 2397-compliant image data strings.

Parameters

$in
<p>URI or Horde_Themes_Image object containing image data.</p>
$limit
<p>Sets a hard size limit for image data; if exceeded, will not string encode.</p>

Returns

string

The string to use in the image 'src' attribute; either the image data if the browser supports, or the URI if not.

public static
# includeFavicon( )

Generate the favicon tag for the current application.

Generate the favicon tag for the current application.

public static
# includeStylesheetFiles( array $opts = array(), array $full = false )

Generate the stylesheet tags for the current application.

Generate the stylesheet tags for the current application.

Parameters

$opts
<p>Options to pass to Horde_Themes_Css::getStylesheetUrls().</p>
$full
Return a full URL?
public static string
# getTempDir( )

Determines the location of the system temporary directory. If a specific configuration cannot be found, it defaults to /tmp.

Determines the location of the system temporary directory. If a specific configuration cannot be found, it defaults to /tmp.

Returns

string

A directory name that can be used for temp files. Returns false if one could not be found.

public static string
# getTempFile( string $prefix = 'Horde', boolean $delete = true, string $dir = '', boolean $secure = false, boolean $session_remove = false )

Creates a temporary filename for the lifetime of the script, and (optionally) registers it to be deleted at request shutdown.

Creates a temporary filename for the lifetime of the script, and (optionally) registers it to be deleted at request shutdown.

Parameters

$prefix
<p>Prefix to make the temporary name more recognizable.</p>
$delete
<p>Delete the file at the end of the request?</p>
$dir
<p>Directory to create the temporary file in.</p>
$secure
<p>If deleting file, should we securely delete the file?</p>
$session_remove
<p>Delete this file when session is destroyed (since 1.7.0)?</p>

Returns

string

Returns the full path-name to the temporary file or false if a temporary file could not be created.

public static
# compressOutput( )

Starts output compression, if requested.

Starts output compression, if requested.

public static boolean
# allowOutputCompression( )

Determines if output compression can be used.

Determines if output compression can be used.

Returns

boolean
True if output compression can be used, false if not.
public static string
# webServerID( )

Returns the Web server being used. PHP string list built from the PHP 'configure' script.

Returns the Web server being used. PHP string list built from the PHP 'configure' script.

Returns

string
A web server identification string.

See

php_sapi_name()
public static string
# getAccessKey( string $label, boolean $nocheck = false, mixed $shutdown = false )

Returns an un-used access key from the label given.

Returns an un-used access key from the label given.

Parameters

$label
The label to choose an access key from.
$nocheck
<p>Don't check if the access key already has been used?</p>
$shutdown

Returns

string

A single lower case character access key or empty string if none can be found

public static string
# stripAccessKey( string $label )

Strips an access key from a label. For multibyte charset strings the access key gets removed completely, otherwise only the underscore gets removed.

Strips an access key from a label. For multibyte charset strings the access key gets removed completely, otherwise only the underscore gets removed.

Parameters

$label
The label containing an access key.

Returns

string
The label with the access key being stripped.
public static string
# highlightAccessKey( string $label, string $accessKey )

Highlights an access key in a label.

Highlights an access key in a label.

Parameters

$label
The label to highlight the access key in.
$accessKey
The access key to highlight.

Returns

string

The HTML version of the label with the access key highlighted.

public static string
# getAccessKeyAndTitle( string $label, boolean $nocheck = false )

Returns the appropriate "accesskey" and "title" attributes for an HTML tag and the given label.

Returns the appropriate "accesskey" and "title" attributes for an HTML tag and the given label.

Parameters

$label
The title of an HTML element
$nocheck
<p>Don't check if the access key already has been used?</p>

Returns

string

The title, and if appropriate, the accesskey attributes for the element.

public static string
# label( string $for, string $label, string $ak = null )

Returns a label element including an access key for usage in conjuction with a form field. User preferences regarding access keys are respected.

Returns a label element including an access key for usage in conjuction with a form field. User preferences regarding access keys are respected.

Parameters

$for
The form field's id attribute.
$label
The label text.
$ak
<p>The access key to use. If null a new access key will be generated.</p>

Returns

string
The html code for the label element.
public static mixed
# callHook( string $hook, array $args = array(), string $app = 'horde' )

Call a Horde hook, handling all of the necessary lookups and parsing of the hook code.

Call a Horde hook, handling all of the necessary lookups and parsing of the hook code.

WARNING: Throwing exceptions is expensive, so use callHook() with care and cache the results if you going to use the results more than once.

Parameters

$hook
The function to call.
$args
<p>An array of any arguments to pass to the hook function.</p>
$app
The hook application.

Returns

mixed
The results of the hook.

Throws

Horde_Exception
Thrown on error from hook code.
Horde_Exception_HookNotSet
Thrown if hook is not active.
public static boolean
# hookExists( string $hook, string $app = 'horde' )

Returns whether a hook exists.

Returns whether a hook exists.

Use this if you have to call a hook many times and expect the hook to not exist.

Parameters

$hook
The function to call.
$app
The hook application.

Returns

boolean
True if the hook exists.
public static
# redirect( string $url )

Utility function to send redirect headers to browser, handling any browser quirks.

Utility function to send redirect headers to browser, handling any browser quirks.

Parameters

$url
The URL to redirect to.
public static
# addInlineScript( mixed $script, string $onload = null, boolean $top = false )

Add inline javascript to the output buffer.

Add inline javascript to the output buffer.

Parameters

$script
<p>The script text to add (can be stored in an array also).</p>
$onload
<p>Load the script after the page has loaded? Either 'dom' (on dom:loaded), 'load'.</p>
$top
Add script to top of stack?
public static array
# addInlineJsVars( array $data, array $opts = array() )

Add inline javascript variable definitions to the output buffer.

Add inline javascript variable definitions to the output buffer.

Parameters

$data
<p>Keys are the variable names, values are the data to JSON encode. If the key begins with a '-', the data will be added to the output as-is.</p>
$opts
Options: <pre>onload - (string) Wrap the definition in an onload handler? Either <span class="php-quote">'dom'</span> (on dom:loaded), <span class="php-quote">'load'</span>. <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span> ret_vars - (boolean) <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, will <span class="php-keyword1">return</span> the <span class="php-keyword1">list</span> of variable definitions instead of outputting to page. <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span> top - (boolean) Add definitions to top of stack? <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span></pre>

Returns

array
Returns the variable list of 'ret_vars' option is true.
public static
# outputInlineScript( boolean $raw = false )

Print pending inline javascript to the output buffer.

Print pending inline javascript to the output buffer.

Parameters

$raw
<p>Return the raw script (not wrapped in CDATA tags or observe wrappers)?</p>
public static string
# wrapInlineScript( array $script )

Print inline javascript to output buffer after wrapping with necessary javascript tags.

Print inline javascript to output buffer after wrapping with necessary javascript tags.

Parameters

$script
The script to output.

Returns

string

The script with the necessary HTML javascript tags appended.

public static Horde_Url
# getCacheUrl( string $type, array $params = array() )

Creates a URL for cached data.

Creates a URL for cached data.

Parameters

$type
The cache type ('app', 'css', 'js').
$params
Optional parameters: <pre>RESERVED PARAMETERS: <span class="php-quote">'app'</span> - REQUIRED <span class="php-keyword1">for</span> <span class="php-var">$type</span> == <span class="php-quote">'app'</span>. Identifies the application to call the <span class="php-quote">'cacheOutput'</span> API call, which is passed in the value of the entire <span class="php-var">$params</span> <span class="php-keyword1">array</span> (which may <span class="php-keyword1">include</span> parameters other than those listed here). The <span class="php-keyword1">return</span> from cacheOutput should be a <span class="php-num">2</span>-element <span class="php-keyword1">array</span>: <span class="php-quote">'data'</span> (the cached data) <span class="php-keyword1">and</span> <span class="php-quote">'type'</span> (the content-type of the data). <span class="php-quote">'cid'</span> - REQUIRED <span class="php-keyword1">for</span> <span class="php-var">$type</span> == <span class="php-quote">'css'</span> || <span class="php-quote">'js'</span>. The cacheid of the data (stored in Horde_Cache). <span class="php-quote">'nocache'</span> - <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, sets the cache limiter to <span class="php-quote">'nocache'</span> instead of the <span class="php-keyword1">default</span> <span class="php-quote">'public'</span>.</pre>

Returns

Horde_Url
The URL to the cache page.
public static string
# popupJs( string|Horde_Url $url, array $options = array() )

Output the javascript needed to call the popup JS function.

Output the javascript needed to call the popup JS function.

Parameters

$url
The page to load.
$options
Additional options: <pre><span class="php-quote">'height'</span> - (integer) The height of the popup window. <span class="php-keyword1">DEFAULT</span>: <span class="php-num">650</span>px <span class="php-quote">'menu'</span> - (boolean) Show the browser menu in the popup window? <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span> <span class="php-quote">'onload'</span> - (string) A JS <span class="php-keyword1">function</span> to call after the popup window is fully loaded. <span class="php-keyword1">DEFAULT</span>: None <span class="php-quote">'params'</span> - (<span class="php-keyword1">array</span>) Additional parameters to pass to the URL. <span class="php-keyword1">DEFAULT</span>: None <span class="php-quote">'urlencode'</span> - (boolean) URL encode the json string? <span class="php-keyword1">DEFAULT</span>: No <span class="php-quote">'width'</span> - (integer) The width of the popup window. <span class="php-keyword1">DEFAULT</span>: <span class="php-num">700</span> px</pre>

Returns

string
The javascript needed to call the popup code.
public static
# startBuffer( )

Start buffering output.

Start buffering output.

public static string
# endBuffer( )

End buffering output.

End buffering output.

Returns

string
The buffered output.
public static boolean
# contentSent( )

Has any content been sent to the browser?

Has any content been sent to the browser?

Returns

boolean
True if content has been sent.
public static
# addMetaTag( string $type, string $content )

Adds a META http-equiv tag to the page output.

Adds a META http-equiv tag to the page output.

Parameters

$type
The http-equiv type value.
$content
The content of the META tag.
public static
# metaRefresh( integer $time, string $url )

Adds a META refresh tag.

Adds a META refresh tag.

Parameters

$time
Refresh time.
$url
Refresh URL
public static
# noDnsPrefetch( )

Adds a META tag to disable DNS prefetching. See Horde Bug #8836.

Adds a META tag to disable DNS prefetching. See Horde Bug #8836.

public static
# outputMetaTags( )

Output META tags to page.

Output META tags to page.

public static boolean
# ajaxAvailable( )

Is an AJAX view supported/available on the current browser?

Is an AJAX view supported/available on the current browser?

Returns

boolean
True if the AJAX view can be displayed.
public static string|Horde_Menu
# menu( array $opts = array() )

Generates the menu output.

Generates the menu output.

Parameters

$opts
Additional options: <pre><span class="php-quote">'app'</span> - (string) The application to generate the menu <span class="php-keyword1">for</span>. <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword2">current</span> application <span class="php-quote">'mask'</span> - (integer) The Horde_Menu mask to <span class="php-keyword1">use</span>. <span class="php-keyword1">DEFAULT</span>: Horde_Menu::MASK_ALL <span class="php-quote">'menu_ob'</span> - (boolean) <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, returns the menu object <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span> (renders menu)</pre>

Returns

string|Horde_Menu

The menu output, or the menu object if 'menu_ob' is true.

public static
# permissionDeniedError( string $app, string $perm, string $error = null )

Process a permission denied error, running a user-defined hook if necessary.

Process a permission denied error, running a user-defined hook if necessary.

Parameters

$app
Application name.
$perm
Permission name.
$error
<p>An error message to output via the notification system.</p>
API documentation generated by ApiGen