PHP Class Horde, horde

Author: Chuck Hagenbuch ([email protected])
Author: Jon Parise ([email protected])
Afficher le fichier Open project: horde/horde Class Usage Examples

Protected Properties

Свойство Type Description
$_bufferLevel integer The current buffer level.
$_contentSent boolean Has content been sent at the base buffer level?
$_labels array The labels already used in this page.
$_noAccessKey boolean Are accesskeys supported on this system.
$_used array The access keys already used in this page.

Méthodes publiques

Méthode Description
__callStatic ( $name, $arguments ) Handle deprecated methods (located in Horde_Deprecated).
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.
contentSent ( ) : boolean Has any content been sent to the browser?
debug ( mixed $event = null, string $fname = null, boolean $backtrace = true ) Debug method. Allows quick shortcut to produce debug output into a temporary file.
endBuffer ( ) : string End buffering output.
escapeJson ( mixed $data, array $options = [] ) : string Do necessary escaping to output JSON.
externalUrl ( string $url, boolean $tag = false ) : string Returns an external link passed through the dereferrer to strip session IDs from the referrer.
getAccessKey ( string $label, boolean $nocheck = false, boolean $shutdown = false ) : string Returns an un-used access key from the label given.
getAccessKeyAndTitle ( string $label, boolean $nocheck = false, boolean $return_array = false ) : string Returns the appropriate "accesskey" and "title" attributes for an HTML tag and the given label.
getCacheUrl ( string $type, array $params = [] ) : Horde_Url Creates a URL for cached data.
getDriverConfig ( mixed $backend, string $type = 'sql' ) : array Returns the driver parameters for the specified backend.
getTempDir ( ) : string Determines the location of the system temporary directory. If a specific configuration cannot be found, it defaults to /tmp.
getTempFile ( string $prefix = 'Horde', boolean $delete = true, string $dir = '', boolean $secure = false, boolean $session_remove = false ) : string Creates a temporary filename for the lifetime of the script, and (optionally) registers it to be deleted at request shutdown.
highlightAccessKey ( string $label, string $accessKey ) : string Highlights an access key in a label.
isConnectionSecure ( ) : boolean Is the current HTTP connection considered secure?
label ( string $for, string $label, string $ak = null ) : string Returns a label element including an access key for usage in conjuction with a form field. User preferences regarding access keys are respected.
link ( Horde_Url | string $url = '', string $title = '', string $class = '', string $target = '', string $onclick = '', string $title2 = '', string $accesskey = '', array $attributes = [], boolean $escape = true ) : string Returns an anchor tag with the relevant parameters
linkTooltip ( string $url, string $status = '', string $class = '', string $target = '', string $onclick = '', string $title = '', string $accesskey = '', array $attributes = [] ) : string Uses DOM Tooltips to display the 'title' attribute for link() calls.
log ( $event, $priority = null, array $options = [] ) Shortcut to logging method.
logMessage ( $event, $priority = null, array $options = [] ) Shortcut to logging method.
permissionDeniedError ( string $app, string $perm, string $error = null ) Process a permission denied error, running a user-defined hook if necessary.
popupJs ( string | Horde_Url $url, array $options = [] ) : string Output the javascript needed to call the popup JS function.
redirect ( string $url ) Utility function to send redirect headers to browser, handling any browser quirks.
requireSecureConnection ( ) Throws an exception if not using a secure connection.
selfUrl ( boolean $script_params = false, boolean $nocache = true, boolean $full = false, boolean $force_ssl = false ) : Horde_Url Returns a session-id-ified version of $SCRIPT_NAME resp. $PHP_SELF.
selfUrlParams ( array $opts = [] ) : Horde_Url Create a self URL of the current page, building the parameter list from the current Horde_Variables object (or via another Variables object passed as an optional argument) rather than the original request data.
sidebar ( string $app = null ) : Horve_View_Sidebar Returns the sidebar for the current application.
signQueryString ( mixed $queryString, integer $now = null ) : mixed Add a signature + timestamp to a query string and return the signed query string.
startBuffer ( ) Start buffering output.
stripAccessKey ( string $label ) : string Strips an access key from a label.
url ( mixed $uri, boolean $full = false, mixed $opts = [] ) : Horde_Url Returns a session-id-ified version of $uri.
verifySignedQueryString ( string $data, integer $now = null ) : boolean Verify a signature and timestamp on a query string.
webServerID ( ) : string Returns the Web server being used.
widget ( array $params ) : string Returns an anchor sequence with the relevant parameters for a widget with accesskey and text.
wrapInlineScript ( array $script ) : string Print inline javascript to output buffer after wrapping with necessary javascript tags.

Method Details

__callStatic() public static méthode

Handle deprecated methods (located in Horde_Deprecated).
public static __callStatic ( $name, $arguments )

assertDriverConfig() public static méthode

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.
public static assertDriverConfig ( array $params, string $driver, array $fields, string $name = null, string $file = 'conf.php', string $variable = '$conf' )
$params array The configuration array with all parameters.
$driver string The key name (in the configuration array) of the driver.
$fields array An array with mandatory parameter names for this driver.
$name string The clear text name of the driver. If not specified, the application name will be used.
$file string The configuration file that should contain these settings.
$variable string The name of the configuration variable.

contentSent() public static méthode

Has any content been sent to the browser?
public static contentSent ( ) : boolean
Résultat boolean True if content has been sent.

debug() public static méthode

Debug method. Allows quick shortcut to produce debug output into a temporary file.
public static debug ( mixed $event = null, string $fname = null, boolean $backtrace = true )
$event mixed Item to log.
$fname string Filename to log to. If empty, logs to 'horde_debug.txt' in the PHP temporary directory.
$backtrace boolean Include backtrace information?

endBuffer() public static méthode

End buffering output.
public static endBuffer ( ) : string
Résultat string The buffered output.

escapeJson() public static méthode

Do necessary escaping to output JSON.
public static escapeJson ( mixed $data, array $options = [] ) : string
$data mixed The data to JSON-ify.
$options array Additional options: - nodelimit: (boolean) Don't add security delimiters? DEFAULT: false - urlencode: (boolean) URL encode the json string DEFAULT: false
Résultat string The escaped string.

externalUrl() public static méthode

Returns an external link passed through the dereferrer to strip session IDs from the referrer.
public static externalUrl ( string $url, boolean $tag = false ) : string
$url string The external URL to link to.
$tag boolean If true, a complete tag is returned, only the url otherwise.
Résultat string The link to the dereferrer script.

getAccessKey() public static méthode

Returns an un-used access key from the label given.
public static getAccessKey ( string $label, boolean $nocheck = false, boolean $shutdown = false ) : string
$label string The label to choose an access key from.
$nocheck boolean Don't check if the access key already has been used?
$shutdown boolean Is this called as a shutdown function?
Résultat string A single lower case character access key, or an empty string if no key can be found.

getAccessKeyAndTitle() public static méthode

Returns the appropriate "accesskey" and "title" attributes for an HTML tag and the given label.
public static getAccessKeyAndTitle ( string $label, boolean $nocheck = false, boolean $return_array = false ) : string
$label string The title of an HTML element
$nocheck boolean Don't check if the access key already has been used?
$return_array boolean Return attributes as a hash?
Résultat string The title, and if appropriate, the accesskey attributes for the element.

getCacheUrl() public static méthode

Creates a URL for cached data.
public static getCacheUrl ( string $type, array $params = [] ) : Horde_Url
$type string The cache type ('app', 'css', 'js').
$params array Optional parameters: - app: REQUIRED for $type == 'app'. Identifies the application to call the 'cacheOutput' API call, which is passed in the value of the entire $params array (which may include parameters other than those listed here). The return from cacheOutput should be a 2-element array: 'data' (the cached data) and 'type' (the content-type of the data). - cid: REQUIRED for $type == 'css' || 'js'. The cacheid of the data (stored in Horde_Cache). - nocache: If true, sets the cache limiter to 'nocache' instead of the default 'public'.
Résultat Horde_Url The URL to the cache page.

getDriverConfig() public static méthode

Returns the driver parameters for the specified backend.
public static getDriverConfig ( mixed $backend, string $type = 'sql' ) : array
$backend mixed 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].
$type string The type of driver. If null, will not merge with base config.
Résultat array The connection parameters.

getTempDir() public static méthode

Determines the location of the system temporary directory. If a specific configuration cannot be found, it defaults to /tmp.
public static getTempDir ( ) : string
Résultat string A directory name that can be used for temp files. Returns false if one could not be found.

getTempFile() public static méthode

Creates a temporary filename for the lifetime of the script, and (optionally) registers it to be deleted at request shutdown.
public static getTempFile ( string $prefix = 'Horde', boolean $delete = true, string $dir = '', boolean $secure = false, boolean $session_remove = false ) : string
$prefix string Prefix to make the temporary name more recognizable.
$delete boolean Delete the file at the end of the request?
$dir string Directory to create the temporary file in.
$secure boolean If deleting file, should we securely delete the file?
$session_remove boolean Delete this file when session is destroyed?
Résultat string Returns the full path-name to the temporary file or false if a temporary file could not be created.

highlightAccessKey() public static méthode

Highlights an access key in a label.
public static highlightAccessKey ( string $label, string $accessKey ) : string
$label string The label to highlight the access key in.
$accessKey string The access key to highlight.
Résultat string The HTML version of the label with the access key highlighted.

isConnectionSecure() public static méthode

Is the current HTTP connection considered secure?
public static isConnectionSecure ( ) : boolean
Résultat boolean

label() public static méthode

Returns a label element including an access key for usage in conjuction with a form field. User preferences regarding access keys are respected.
public static label ( string $for, string $label, string $ak = null ) : string
$for string The form field's id attribute.
$label string The label text.
$ak string The access key to use. If null a new access key will be generated.
Résultat string The html code for the label element.

linkTooltip() public static méthode

Uses DOM Tooltips to display the 'title' attribute for link() calls.
public static linkTooltip ( string $url, string $status = '', string $class = '', string $target = '', string $onclick = '', string $title = '', string $accesskey = '', array $attributes = [] ) : string
$url string The full URL to be linked to
$status string The JavaScript mouse-over string
$class string The CSS class of the link
$target string The window target to point to.
$onclick string JavaScript action for the 'onclick' event.
$title string The link title (tooltip). Most not contain HTML data other than <br>, which will be converted to a linebreak.
$accesskey string The access key to use.
$attributes array Any other name/value pairs to add to the <a> tag.
Résultat string The full tag.

log() public static méthode

Shortcut to logging method.
See also: Horde_Core_Log_Logger
public static log ( $event, $priority = null, array $options = [] )
$options array

logMessage() public static méthode

Shortcut to logging method.
See also: log()
Deprecation: Use log() instead
public static logMessage ( $event, $priority = null, array $options = [] )
$options array

permissionDeniedError() public static méthode

Process a permission denied error, running a user-defined hook if necessary.
public static permissionDeniedError ( string $app, string $perm, string $error = null )
$app string Application name.
$perm string Permission name.
$error string An error message to output via the notification system.

popupJs() public static méthode

Output the javascript needed to call the popup JS function.
public static popupJs ( string | Horde_Url $url, array $options = [] ) : string
$url string | Horde_Url The page to load.
$options array Additional options: - height: (integer) The height of the popup window. DEFAULT: 650px - menu: (boolean) Show the browser menu in the popup window? DEFAULT: false - onload: (string) A JS function to call after the popup window is fully loaded. DEFAULT: None - params: (array) Additional parameters to pass to the URL. DEFAULT: None - urlencode: (boolean) URL encode the json string? DEFAULT: false - width: (integer) The width of the popup window. DEFAULT: 700 px
Résultat string The javascript needed to call the popup code.

redirect() public static méthode

Utility function to send redirect headers to browser, handling any browser quirks.
public static redirect ( string $url )
$url string The URL to redirect to.

requireSecureConnection() public static méthode

Throws an exception if not using a secure connection.
public static requireSecureConnection ( )

selfUrl() public static méthode

Returns a session-id-ified version of $SCRIPT_NAME resp. $PHP_SELF.
public static selfUrl ( boolean $script_params = false, boolean $nocache = true, boolean $full = false, boolean $force_ssl = false ) : Horde_Url
$script_params boolean Include script parameters like QUERY_STRING and PATH_INFO? (Deprecated: use Horde::selfUrlParams() instead.)
$nocache boolean Include a cache-buster parameter in the URL?
$full boolean Return a full URL?
$force_ssl boolean Ignore $conf['use_ssl'] and force creation of a SSL URL?
Résultat Horde_Url The requested URL.

selfUrlParams() public static méthode

Create a self URL of the current page, building the parameter list from the current Horde_Variables object (or via another Variables object passed as an optional argument) rather than the original request data.
Since: 2.3.0
public static selfUrlParams ( array $opts = [] ) : Horde_Url
$opts array Additional options: - force_ssl: (boolean) Force creation of an SSL URL? DEFAULT: false - full: (boolean) Return a full URL? DEFAULT: false - nocache: (boolean) Include a cache-buster parameter in the URL? DEFAULT: true - vars: (Horde_Variables) Use this Horde_Variables object instead of the Horde global object. DEFAULT: Use the Horde global object.
Résultat Horde_Url The self URL.

sidebar() public static méthode

Returns the sidebar for the current application.
public static sidebar ( string $app = null ) : Horve_View_Sidebar
$app string The application to generate the menu for. Defaults to the current app.
Résultat Horve_View_Sidebar The sidebar.

signQueryString() public static méthode

Add a signature + timestamp to a query string and return the signed query string.
public static signQueryString ( mixed $queryString, integer $now = null ) : mixed
$queryString mixed The query string (or Horde_Url object) to sign.
$now integer The timestamp at which to sign. Leave blank for generating signatures; specify when testing.
Résultat mixed The signed query string (or Horde_Url object).

startBuffer() public static méthode

Start buffering output.
public static startBuffer ( )

stripAccessKey() public static méthode

For multibyte charset strings the access key gets removed completely, otherwise only the underscore gets removed.
public static stripAccessKey ( string $label ) : string
$label string The label containing an access key.
Résultat string The label with the access key being stripped.

url() public static méthode

If a full URL is requested, all parameter separators get converted to "&", otherwise to "&".
public static url ( mixed $uri, boolean $full = false, mixed $opts = [] ) : Horde_Url
$uri mixed The URI to be modified (either a string or any object with a __toString() function).
$full boolean Generate a full (http://server/path/) URL.
$opts mixed Additional options. If a string/integer, it is taken to be the 'append_session' option. If an array, one of the following: - app: (string) Use this app for the webroot. DEFAULT: current application - append_session: (integer) 0 = only if needed [DEFAULT], 1 = always, -1 = never. - force_ssl: (boolean) Ignore $conf['use_ssl'] and force creation of a SSL URL? DEFAULT: false
Résultat Horde_Url The URL with the session id appended (if needed).

verifySignedQueryString() public static méthode

Verify a signature and timestamp on a query string.
public static verifySignedQueryString ( string $data, integer $now = null ) : boolean
$data string The signed query string.
$now integer The current time (can override for testing).
Résultat boolean Whether or not the string was valid.

webServerID() public static méthode

PHP string list built from the PHP 'configure' script.
See also: php_sapi_name()
public static webServerID ( ) : string
Résultat string A web server identification string.

widget() public static méthode

Returns an anchor sequence with the relevant parameters for a widget with accesskey and text.
public static widget ( array $params ) : string
$params array A hash with widget options (other options will be passed as attributes to the link tag): - url: (string) The full URL to be linked to. - title: (string) The link title/description. - nocheck: (boolean, optional) Don't check if the accesskey already already has been used. Defaults to false (= check).
Résultat string The full Title sequence.

wrapInlineScript() public static méthode

Print inline javascript to output buffer after wrapping with necessary javascript tags.
public static wrapInlineScript ( array $script ) : string
$script array The script to output.
Résultat string The script with the necessary HTML javascript tags appended.

Property Details

$_bufferLevel protected_oe static_oe property

The current buffer level.
protected static int $_bufferLevel
Résultat integer

$_contentSent protected_oe static_oe property

Has content been sent at the base buffer level?
protected static bool $_contentSent
Résultat boolean

$_labels protected_oe static_oe property

The labels already used in this page.
protected static array $_labels
Résultat array

$_noAccessKey protected_oe static_oe property

Are accesskeys supported on this system.
protected static bool $_noAccessKey
Résultat boolean

$_used protected_oe static_oe property

The access keys already used in this page.
protected static array $_used
Résultat array