PHP Class Horde_Config, horde

Copyright 2002-2016 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.
Author: Chuck Hagenbuch ([email protected])
Afficher le fichier Open project: horde/horde Class Usage Examples

Protected Properties

Свойство Type Description
$_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.
$_currentConfig array 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 The XML tree of the configuration file traversed to an associative array.

Méthodes publiques

Méthode Description
__construct ( string $app = 'horde' ) Constructor.
checkVersions ( ) : array Contact Horde servers and get version information.
configFile ( )
configNoSQL ( string $ctx, DomNode $node = null, string $switchname = 'driverconfig' ) : array Returns the configuration tree for a NoSQL backend configuration to replace a tag.
configSQL ( string $ctx, DomNode $node = null, string $switchname = 'driverconfig' ) : array Returns the configuration tree for an SQL backend configuration to replace a tag.
generatePHPConfig ( Horde_Variables $formvars, array $custom_conf = null ) : string Generates the content of the application's configuration file.
getPHPConfig ( ) : string Returns the file content of the current configuration file.
getVersion ( string $text ) : string Get the Horde version string for a config file.
readXMLConfig ( array $custom_conf = null ) : array Reads the application's conf.xml file and builds an associative array from its XML tree.
writePHPConfig ( Horde_Variables $formvars, string &$php = null ) : boolean Generates and writes the content of the application's configuration file.

Méthodes protégées

Méthode Description
__default ( string $ctx, mixed $default ) : array 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 ( string $ctx, mixed $default ) : array 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 ( string $ctx, DomNode $node = null, string $switchname = 'driverconfig' ) : array Returns the configuration tree for an LDAP backend configuration to replace a tag.
_configLDAPUser ( string $ctx, DomNode $node = null ) : array Returns the configuration tree for an LDAP configuration to search user DNs to replace a tag.
_configSQLSplitRead ( string $ctx, DomNode $node, string $phptype ) : array Returns the configuration items for split-read database setups.
_configVFS ( string $ctx, DomNode $node ) : array Returns the configuration tree for a VFS backend configuration to replace a tag.
_default ( string $ctx, mixed $default ) : mixed Returns a certain value from the current configuration array or a default value, if not found.
_defaultRaw ( string $ctx, mixed $default ) : mixed Returns a certain value from the current configuration file or a default value, if not found.
_generatePHPConfig ( array $section, string $prefix, Horde_Variables $formvars ) Generates the configuration file items for a part of the configuration tree.
_getEnumValues ( DomNode $node ) : array Returns an associative array containing all possible values of the specified tag.
_getNodeOnlyText ( DomNode $node ) : string Returns the content of all text node children of the specified node.
_getSwitchValues ( &$node, $curctx ) : array Returns a multidimensional associative array representing the specified tag.
_handleSpecials ( DomNode $node ) : array Returns an associative array containing the possible values of a tag as used inside of enum configurations.
_isDefault ( string $ctx, mixed $default ) : boolean Returns whether a certain value from the current configuration array exists or a default value will be used.
_isDefaultRaw ( string $ctx, mixed $default ) : boolean Returns whether a certain value from the current configuration array exists or a default value will be used.
_parseLevel ( &$conf, DOMNodeList $children, string $ctx ) Parses one level of the configuration XML tree into the associative array containing the traversed configuration tree.
_quote ( string $string ) : string Returns the specified string with escaped single quotes

Method Details

__construct() public méthode

Constructor.
public __construct ( string $app = 'horde' )
$app string The name of the application to be configured.

__default() protected méthode

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
$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.
Résultat array 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() protected méthode

It does NOT return the actual value, but the PHP expression as used in the configuration file.
protected __defaultRaw ( string $ctx, mixed $default ) : array
$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.
Résultat array 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() protected méthode

Subnodes will be parsed and added to both the Horde defaults and the Custom configuration parts.
protected _configLDAP ( string $ctx, DomNode $node = null, string $switchname = 'driverconfig' ) : array
$ctx string The context of the tag.
$node DomNode The DomNode representation of the tag.
$switchname string If $node is not set, the value of the tag's switchname attribute.
Résultat array An associative array with the LDAP configuration tree.

_configLDAPUser() protected méthode

Subnodes will be parsed and added.
protected _configLDAPUser ( string $ctx, DomNode $node = null ) : array
$ctx string The context of the tag.
$node DomNode The DomNode representation of the tag.
Résultat array A list of associative arrays with the LDAP configuration tree.

_configSQLSplitRead() protected méthode

Returns the configuration items for split-read database setups.
protected _configSQLSplitRead ( string $ctx, DomNode $node, string $phptype ) : array
$ctx string The context of the tag.
$node DomNode The DomNode representation of the tag.
$phptype string The SQL backend name.
Résultat array An associative array with the split-read SQL configuration tree.

_configVFS() protected méthode

Subnodes will be parsed and added to both the Horde defaults and the Custom configuration parts.
protected _configVFS ( string $ctx, DomNode $node ) : array
$ctx string The context of the tag.
$node DomNode The DomNode representation of the tag.
Résultat array An associative array with the VFS configuration tree.

_default() protected méthode

Returns a certain value from the current configuration array or a default value, if not found.
protected _default ( string $ctx, mixed $default ) : mixed
$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.
Résultat mixed Either the value of the configuration array's requested key or the default value if the key wasn't found.

_defaultRaw() protected méthode

It does NOT return the actual value, but the PHP expression as used in the configuration file.
protected _defaultRaw ( string $ctx, mixed $default ) : mixed
$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.
Résultat mixed Either the value of the configuration file's requested key or the default value if the key wasn't found.

_generatePHPConfig() protected méthode

Generates the configuration file items for a part of the configuration tree.
protected _generatePHPConfig ( array $section, string $prefix, Horde_Variables $formvars )
$section array 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() protected méthode

The keys contain the actual enum values while the values contain their corresponding descriptions.
protected _getEnumValues ( DomNode $node ) : array
$node DomNode The DomNode representation of the tag whose values should be returned.
Résultat array An associative array with all possible enum values.

_getNodeOnlyText() protected méthode

Returns the content of all text node children of the specified node.
protected _getNodeOnlyText ( DomNode $node ) : string
$node DomNode A DomNode object whose text node children to return.
Résultat string The concatenated values of all text nodes.

_getSwitchValues() protected méthode

Returns a multidimensional associative array representing the specified tag.
protected _getSwitchValues ( &$node, $curctx ) : array
Résultat array An associative array representing the node.

_handleSpecials() protected méthode

Returns an associative array containing the possible values of a tag as used inside of enum configurations.
protected _handleSpecials ( DomNode $node ) : array
$node DomNode The DomNode representation of the tag.
Résultat array An associative array with the possible values.

_isDefault() protected méthode

Returns whether a certain value from the current configuration array exists or a default value will be used.
protected _isDefault ( string $ctx, mixed $default ) : boolean
$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.
Résultat boolean Whether the default value will be used.

_isDefaultRaw() protected méthode

Returns whether a certain value from the current configuration array exists or a default value will be used.
protected _isDefaultRaw ( string $ctx, mixed $default ) : boolean
$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.
Résultat boolean Whether the default value will be used.

_parseLevel() protected méthode

Parses one level of the configuration XML tree into the associative array containing the traversed configuration tree.
protected _parseLevel ( &$conf, DOMNodeList $children, string $ctx )
$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() protected méthode

Returns the specified string with escaped single quotes
protected _quote ( string $string ) : string
$string string A string to escape.
Résultat string The specified string with single quotes being escaped.

checkVersions() public méthode

Contact Horde servers and get version information.
public checkVersions ( ) : array
Résultat array Keys are app names, values are arrays with two keys: 'version' and 'url'.

configFile() public méthode

public configFile ( )

configNoSQL() public méthode

Subnodes will be parsed and added to both the Horde defaults and the custom configuration parts.
public configNoSQL ( string $ctx, DomNode $node = null, string $switchname = 'driverconfig' ) : array
$ctx string The context of the tag.
$node DomNode The DomNode representation of the tag.
$switchname string If DomNode is not set, the value of the tag's switchname attribute.
Résultat array An associative array with the SQL configuration tree.

configSQL() public méthode

Subnodes will be parsed and added to both the Horde defaults and the Custom configuration parts.
public configSQL ( string $ctx, DomNode $node = null, string $switchname = 'driverconfig' ) : array
$ctx string The context of the tag.
$node DomNode The DomNode representation of the tag.
$switchname string If DomNode is not set, the value of the tag's switchname attribute.
Résultat array An associative array with the SQL configuration tree.

generatePHPConfig() public méthode

Generates the content of the application's configuration file.
public generatePHPConfig ( Horde_Variables $formvars, array $custom_conf = null ) : string
$formvars Horde_Variables The processed configuration form data.
$custom_conf array Any settings that shall be included in the generated configuration.
Résultat string The content of the generated configuration file.

getPHPConfig() public méthode

Returns the file content of the current configuration file.
public getPHPConfig ( ) : string
Résultat string The unparsed configuration file content.

getVersion() public méthode

Get the Horde version string for a config file.
public getVersion ( string $text ) : string
$text string The text to parse.
Résultat string The version string or false if not found.

readXMLConfig() public méthode

Reads the application's conf.xml file and builds an associative array from its XML tree.
public readXMLConfig ( array $custom_conf = null ) : array
$custom_conf array Any settings that shall be included in the generated configuration.
Résultat array An associative array representing the configuration tree.

writePHPConfig() public méthode

Generates and writes the content of the application's configuration file.
public writePHPConfig ( Horde_Variables $formvars, string &$php = null ) : boolean
$formvars Horde_Variables The processed configuration form data.
$php string The content of the generated configuration file.
Résultat boolean True if the configuration file could be written immediately to the file system.

Property Details

$_app protected_oe property

The name of the configured application.
protected string $_app
Résultat string

$_configBegin protected_oe property

The line marking the begin of the generated configuration.
protected string $_configBegin
Résultat string

$_configEnd protected_oe property

The line marking the end of the generated configuration.
protected string $_configEnd
Résultat string

$_currentConfig protected_oe property

The current $conf array of the configured application.
protected array $_currentConfig
Résultat array

$_oldConfig protected_oe property

The content of the old configuration file.
protected string $_oldConfig
Résultat string

$_phpConfig protected_oe property

The content of the generated configuration file.
protected string $_phpConfig
Résultat string

$_postConfig protected_oe property

The manual configuration after the generated configuration.
protected string $_postConfig
Résultat string

$_preConfig protected_oe property

The manual configuration in front of the generated configuration.
protected string $_preConfig
Résultat string

$_versionTag protected_oe property

The version tag of the conf.xml file which will be copied into the conf.php file.
protected string $_versionTag
Résultat string

$_versionUrl protected_oe property

Horde URL to check version information.
protected string $_versionUrl
Résultat string

$_xmlConfigTree protected_oe property

The XML tree of the configuration file traversed to an associative array.
protected array $_xmlConfigTree
Résultat array