Methods summary
public static
|
#
logMessage( mixed $event, mixed $priority = null, array $options = array() )
Shortcut to logging method.
Shortcut to logging method.
See
|
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
|
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 <br>, 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
<a> tag.</p>
Returns
|
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
|
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
|
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
|
|
public static
string
|
#
endBuffer( )
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.
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
|
|
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
|
#
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>
|