Documentation

Horde_Config
in package

The Horde_Config:: package provides a framework for managing the configuration of Horde applications, writing conf.php files from conf.xml source files, generating user interfaces, etc.

Copyright 2002-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Tags
author

Chuck Hagenbuch chuck@horde.org

category

Horde

Table of Contents

Properties

$_app  : string
The name of the configured application.
$_configBegin  : string
The line marking the begin of the generated configuration.
$_configEnd  : string
The line marking the end of the generated configuration.
$_configHash  : string
The SHA-1 hash of the conf.xml file which will be copied into the conf.php file.
$_currentConfig  : array<string|int, mixed>
The current $conf array of the configured application.
$_oldConfig  : string
The content of the old configuration file.
$_phpConfig  : string
The content of the generated configuration file.
$_postConfig  : string
The manual configuration after the generated configuration.
$_preConfig  : string
The manual configuration in front of the generated configuration.
$_versionTag  : string
The version tag of the conf.xml file which will be copied into the conf.php file.
$_versionUrl  : string
Horde URL to check version information.
$_xmlConfigTree  : array<string|int, mixed>
The XML tree of the configuration file traversed to an associative array.

Methods

__construct()  : mixed
Constructor.
checkVersions()  : array<string|int, mixed>
Contact Horde servers and get version information.
configFile()  : mixed
configNoSQL()  : array<string|int, mixed>
Returns the configuration tree for a NoSQL backend configuration to replace a <confignosql> tag.
configSQL()  : array<string|int, mixed>
Returns the configuration tree for an SQL backend configuration to replace a <configsql> tag.
generatePHPConfig()  : string
Generates the content of the application's configuration file.
getPHPConfig()  : string
Returns the file content of the current configuration file.
getVersion()  : string
Get the Horde version string for a config file.
readXMLConfig()  : array<string|int, mixed>
Reads the application's conf.xml file and builds an associative array from its XML tree.
writePHPConfig()  : bool
Generates and writes the content of the application's configuration file.
__default()  : array<string|int, mixed>
Returns a certain value from the current configuration array or a default value, if not found, and which of the values have been returned.
__defaultRaw()  : array<string|int, mixed>
Returns a certain value from the current configuration file or a default value, if not found, and which of the values have been returned.
_configLDAP()  : array<string|int, mixed>
Returns the configuration tree for an LDAP backend configuration to replace a <configldap> tag.
_configLDAPUser()  : array<string|int, mixed>
Returns the configuration tree for an LDAP configuration to search user DNs to replace a <configldapuser> tag.
_configSQLSplitRead()  : array<string|int, mixed>
Returns the configuration items for split-read database setups.
_configVFS()  : array<string|int, mixed>
Returns the configuration tree for a VFS backend configuration to replace a <configvfs> tag.
_default()  : mixed
Returns a certain value from the current configuration array or a default value, if not found.
_defaultRaw()  : mixed
Returns a certain value from the current configuration file or a default value, if not found.
_generatePHPConfig()  : mixed
Generates the configuration file items for a part of the configuration tree.
_getEnumValues()  : array<string|int, mixed>
Returns an associative array containing all possible values of the specified <configenum> tag.
_getNodeOnlyText()  : string
Returns the content of all text node children of the specified node.
_getSwitchValues()  : array<string|int, mixed>
Returns a multidimensional associative array representing the specified <configswitch> tag.
_handleSpecials()  : array<string|int, mixed>
Returns an associative array containing the possible values of a <configspecial> tag as used inside of enum configurations.
_isDefault()  : bool
Returns whether a certain value from the current configuration array exists or a default value will be used.
_isDefaultRaw()  : bool
Returns whether a certain value from the current configuration array exists or a default value will be used.
_parseLevel()  : mixed
Parses one level of the configuration XML tree into the associative array containing the traversed configuration tree.
_quote()  : string
Returns the specified string with escaped single quotes

Properties

$_app

The name of the configured application.

protected string $_app

$_configBegin

The line marking the begin of the generated configuration.

protected string $_configBegin = "/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */\n"

$_configEnd

The line marking the end of the generated configuration.

protected string $_configEnd = "/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */\n"

$_configHash

The SHA-1 hash of the conf.xml file which will be copied into the conf.php file.

protected string $_configHash = ''

$_currentConfig

The current $conf array of the configured application.

protected array<string|int, mixed> $_currentConfig = array()

$_oldConfig

The content of the old configuration file.

protected string $_oldConfig

$_phpConfig

The content of the generated configuration file.

protected string $_phpConfig

$_postConfig

The manual configuration after the generated configuration.

protected string $_postConfig

$_preConfig

The manual configuration in front of the generated configuration.

protected string $_preConfig

$_versionTag

The version tag of the conf.xml file which will be copied into the conf.php file.

protected string $_versionTag = ''
Tags
todo

Remove for Horde 6

$_versionUrl

Horde URL to check version information.

protected string $_versionUrl = 'https://pear.horde.org/packages.json'

$_xmlConfigTree

The XML tree of the configuration file traversed to an associative array.

protected array<string|int, mixed> $_xmlConfigTree = \null

Methods

__construct()

Constructor.

public __construct([string $app = 'horde' ]) : mixed
Parameters
$app : string = 'horde'

The name of the application to be configured.

checkVersions()

Contact Horde servers and get version information.

public checkVersions() : array<string|int, mixed>
Tags
throws
Horde_Exception
throws
Horde_Http_Exception

Horde_Exception

Return values
array<string|int, mixed>

Keys are app names, values are arrays with two keys: 'version' and 'url'.

configFile()

public configFile() : mixed

configNoSQL()

Returns the configuration tree for a NoSQL backend configuration to replace a <confignosql> tag.

public configNoSQL(string $ctx[, DomNode $node = null ][, string $switchname = 'driverconfig' ]) : array<string|int, mixed>

Subnodes will be parsed and added to both the Horde defaults and the custom configuration parts.

Parameters
$ctx : string

The context of the tag.

$node : DomNode = null

The DomNode representation of the tag.

$switchname : string = 'driverconfig'

If DomNode is not set, the value of the tag's switchname attribute.

Return values
array<string|int, mixed>

An associative array with the SQL configuration tree.

configSQL()

Returns the configuration tree for an SQL backend configuration to replace a <configsql> tag.

public configSQL(string $ctx[, DomNode $node = null ][, string $switchname = 'driverconfig' ]) : array<string|int, mixed>

Subnodes will be parsed and added to both the Horde defaults and the Custom configuration parts.

Parameters
$ctx : string

The context of the tag.

$node : DomNode = null

The DomNode representation of the tag.

$switchname : string = 'driverconfig'

If DomNode is not set, the value of the tag's switchname attribute.

Return values
array<string|int, mixed>

An associative array with the SQL configuration tree.

generatePHPConfig()

Generates the content of the application's configuration file.

public generatePHPConfig(Horde_Variables $formvars[, array<string|int, mixed> $custom_conf = null ]) : string
Parameters
$formvars : Horde_Variables

The processed configuration form data.

$custom_conf : array<string|int, mixed> = null

Any settings that shall be included in the generated configuration.

Return values
string

The content of the generated configuration file.

getPHPConfig()

Returns the file content of the current configuration file.

public getPHPConfig() : string
Return values
string

The unparsed configuration file content.

getVersion()

Get the Horde version string for a config file.

public getVersion(string $text) : string
Parameters
$text : string

The text to parse.

Return values
string

The version string or false if not found.

readXMLConfig()

Reads the application's conf.xml file and builds an associative array from its XML tree.

public readXMLConfig([array<string|int, mixed> $custom_conf = null ]) : array<string|int, mixed>
Parameters
$custom_conf : array<string|int, mixed> = null

Any settings that shall be included in the generated configuration.

Return values
array<string|int, mixed>

An associative array representing the configuration tree.

writePHPConfig()

Generates and writes the content of the application's configuration file.

public writePHPConfig(Horde_Variables $formvars[, string &$php = null ]) : bool
Parameters
$formvars : Horde_Variables

The processed configuration form data.

$php : string = null

The content of the generated configuration file.

Return values
bool

True if the configuration file could be written immediately to the file system.

__default()

Returns a certain value from the current configuration array or a default value, if not found, and which of the values have been returned.

protected __default(string $ctx, mixed $default) : array<string|int, mixed>
Parameters
$ctx : string

A string representing the key of the configuration array to return.

$default : mixed

The default value to return if the key wasn't found.

Return values
array<string|int, mixed>

First element: either the value of the configuration array's requested key or the default value if the key wasn't found. Second element: whether the returned value was the default value.

__defaultRaw()

Returns a certain value from the current configuration file or a default value, if not found, and which of the values have been returned.

protected __defaultRaw(string $ctx, mixed $default) : array<string|int, mixed>

It does NOT return the actual value, but the PHP expression as used in the configuration file.

Parameters
$ctx : string

A string representing the key of the configuration array to return.

$default : mixed

The default value to return if the key wasn't found.

Return values
array<string|int, mixed>

First element: either the value of the configuration array's requested key or the default value if the key wasn't found. Second element: whether the returned value was the default value.

_configLDAP()

Returns the configuration tree for an LDAP backend configuration to replace a <configldap> tag.

protected _configLDAP(string $ctx[, DomNode $node = null ][, string $switchname = 'driverconfig' ]) : array<string|int, mixed>

Subnodes will be parsed and added to both the Horde defaults and the Custom configuration parts.

Parameters
$ctx : string

The context of the tag.

$node : DomNode = null

The DomNode representation of the tag.

$switchname : string = 'driverconfig'

If $node is not set, the value of the tag's switchname attribute.

Return values
array<string|int, mixed>

An associative array with the LDAP configuration tree.

_configLDAPUser()

Returns the configuration tree for an LDAP configuration to search user DNs to replace a <configldapuser> tag.

protected _configLDAPUser(string $ctx[, DomNode $node = null ]) : array<string|int, mixed>

Subnodes will be parsed and added.

Parameters
$ctx : string

The context of the tag.

$node : DomNode = null

The DomNode representation of the tag.

Return values
array<string|int, mixed>

A list of associative arrays with the LDAP configuration tree.

_configSQLSplitRead()

Returns the configuration items for split-read database setups.

protected _configSQLSplitRead(string $ctx, DomNode $node, string $phptype) : array<string|int, mixed>
Parameters
$ctx : string

The context of the tag.

$node : DomNode

The DomNode representation of the tag.

$phptype : string

The SQL backend name.

Return values
array<string|int, mixed>

An associative array with the split-read SQL configuration tree.

_configVFS()

Returns the configuration tree for a VFS backend configuration to replace a <configvfs> tag.

protected _configVFS(string $ctx, DomNode $node) : array<string|int, mixed>

Subnodes will be parsed and added to both the Horde defaults and the Custom configuration parts.

Parameters
$ctx : string

The context of the tag.

$node : DomNode

The DomNode representation of the tag.

Return values
array<string|int, mixed>

An associative array with the VFS configuration tree.

_default()

Returns a certain value from the current configuration array or a default value, if not found.

protected _default(string $ctx, mixed $default) : mixed
Parameters
$ctx : string

A string representing the key of the configuration array to return.

$default : mixed

The default value to return if the key wasn't found.

Return values
mixed

Either the value of the configuration array's requested key or the default value if the key wasn't found.

_defaultRaw()

Returns a certain value from the current configuration file or a default value, if not found.

protected _defaultRaw(string $ctx, mixed $default) : mixed

It does NOT return the actual value, but the PHP expression as used in the configuration file.

Parameters
$ctx : string

A string representing the key of the configuration array to return.

$default : mixed

The default value to return if the key wasn't found.

Return values
mixed

Either the value of the configuration file's requested key or the default value if the key wasn't found.

_generatePHPConfig()

Generates the configuration file items for a part of the configuration tree.

protected _generatePHPConfig(array<string|int, mixed> $section, string $prefix, Horde_Variables $formvars) : mixed
Parameters
$section : array<string|int, mixed>

An associative array containing the part of the traversed XML configuration tree that should be processed.

$prefix : string

A configuration prefix determining the current position inside the configuration file. This prefix will be translated to keys of the $conf array in the generated configuration file.

$formvars : Horde_Variables

The processed configuration form data.

_getEnumValues()

Returns an associative array containing all possible values of the specified <configenum> tag.

protected _getEnumValues(DomNode $node) : array<string|int, mixed>

The keys contain the actual enum values while the values contain their corresponding descriptions.

Parameters
$node : DomNode

The DomNode representation of the tag whose values should be returned.

Return values
array<string|int, mixed>

An associative array with all possible enum values.

_getNodeOnlyText()

Returns the content of all text node children of the specified node.

protected _getNodeOnlyText(DomNode $node) : string
Parameters
$node : DomNode

A DomNode object whose text node children to return.

Return values
string

The concatenated values of all text nodes.

_getSwitchValues()

Returns a multidimensional associative array representing the specified <configswitch> tag.

protected _getSwitchValues(DomNode &$node, mixed $curctx) : array<string|int, mixed>
Parameters
$node : DomNode

The DomNode representation of the tag to process.

$curctx : mixed
Return values
array<string|int, mixed>

An associative array representing the node.

_handleSpecials()

Returns an associative array containing the possible values of a <configspecial> tag as used inside of enum configurations.

protected _handleSpecials(DomNode $node) : array<string|int, mixed>
Parameters
$node : DomNode

The DomNode representation of the tag.

Return values
array<string|int, mixed>

An associative array with the possible values.

_isDefault()

Returns whether a certain value from the current configuration array exists or a default value will be used.

protected _isDefault(string $ctx, mixed $default) : bool
Parameters
$ctx : string

A string representing the key of the configuration array to return.

$default : mixed

The default value to return if the key wasn't found.

Return values
bool

Whether the default value will be used.

_isDefaultRaw()

Returns whether a certain value from the current configuration array exists or a default value will be used.

protected _isDefaultRaw(string $ctx, mixed $default) : bool
Parameters
$ctx : string

A string representing the key of the configuration array to return.

$default : mixed

The default value to return if the key wasn't found.

Return values
bool

Whether the default value will be used.

_parseLevel()

Parses one level of the configuration XML tree into the associative array containing the traversed configuration tree.

protected _parseLevel(array<string|int, mixed> &$conf, DOMNodeList $children, string $ctx) : mixed
Parameters
$conf : array<string|int, mixed>

The already existing array where the processed XML tree portion should be appended to.

$children : DOMNodeList

The XML nodes of the level that should be parsed.

$ctx : string

A string representing the current position (context prefix) inside the configuration XML file.

_quote()

Returns the specified string with escaped single quotes

protected _quote(string $string) : string
Parameters
$string : string

A string to escape.

Return values
string

The specified string with single quotes being escaped.


        
On this page

Search results