PHP Класс 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.
Автор: Chuck Hagenbuch ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_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.

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
__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

Описание методов

__construct() публичный Метод

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

__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
$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.
Результат 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() защищенный Метод

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.
Результат 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() защищенный Метод

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.
Результат array An associative array with the LDAP configuration tree.

_configLDAPUser() защищенный Метод

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.
Результат array 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
$ctx string The context of the tag.
$node DomNode The DomNode representation of the tag.
$phptype string The SQL backend name.
Результат array An associative array with the split-read SQL configuration tree.

_configVFS() защищенный Метод

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.
Результат array 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
$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.
Результат mixed Either the value of the configuration array's requested key or the default value if the key wasn't found.

_defaultRaw() защищенный Метод

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.
Результат 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 $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() защищенный Метод

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.
Результат array 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
$node DomNode A DomNode object whose text node children to return.
Результат string The concatenated values of all text nodes.

_getSwitchValues() защищенный Метод

Returns a multidimensional associative array representing the specified tag.
protected _getSwitchValues ( &$node, $curctx ) : array
Результат array An associative array representing the node.

_handleSpecials() защищенный Метод

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.
Результат array 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 ) : 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.
Результат boolean 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 ) : 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.
Результат boolean 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 ( &$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() защищенный Метод

Returns the specified string with escaped single quotes
protected _quote ( string $string ) : string
$string string A string to escape.
Результат string The specified string with single quotes being escaped.

checkVersions() публичный Метод

Contact Horde servers and get version information.
public checkVersions ( ) : array
Результат array Keys are app names, values are arrays with two keys: 'version' and 'url'.

configFile() публичный Метод

public configFile ( )

configNoSQL() публичный Метод

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.
Результат array An associative array with the SQL configuration tree.

configSQL() публичный Метод

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.
Результат array An associative array with the SQL configuration tree.

generatePHPConfig() публичный Метод

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.
Результат string The content of the generated configuration file.

getPHPConfig() публичный Метод

Returns the file content of the current configuration file.
public getPHPConfig ( ) : string
Результат string The unparsed configuration file content.

getVersion() публичный Метод

Get the Horde version string for a config file.
public getVersion ( string $text ) : string
$text string The text to parse.
Результат 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 $custom_conf = null ) : array
$custom_conf array Any settings that shall be included in the generated configuration.
Результат array 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 ) : boolean
$formvars Horde_Variables The processed configuration form data.
$php string The content of the generated configuration file.
Результат boolean True if the configuration file could be written immediately to the file system.

Описание свойств

$_app защищенное свойство

The name of the configured application.
protected string $_app
Результат string

$_configBegin защищенное свойство

The line marking the begin of the generated configuration.
protected string $_configBegin
Результат string

$_configEnd защищенное свойство

The line marking the end of the generated configuration.
protected string $_configEnd
Результат string

$_currentConfig защищенное свойство

The current $conf array of the configured application.
protected array $_currentConfig
Результат array

$_oldConfig защищенное свойство

The content of the old configuration file.
protected string $_oldConfig
Результат string

$_phpConfig защищенное свойство

The content of the generated configuration file.
protected string $_phpConfig
Результат string

$_postConfig защищенное свойство

The manual configuration after the generated configuration.
protected string $_postConfig
Результат string

$_preConfig защищенное свойство

The manual configuration in front of the generated configuration.
protected string $_preConfig
Результат string

$_versionTag защищенное свойство

The version tag of the conf.xml file which will be copied into the conf.php file.
protected string $_versionTag
Результат string

$_versionUrl защищенное свойство

Horde URL to check version information.
protected string $_versionUrl
Результат string

$_xmlConfigTree защищенное свойство

The XML tree of the configuration file traversed to an associative array.
protected array $_xmlConfigTree
Результат array