PHP 클래스 PEAR_Config

저자: Stig Bakken ([email protected])
저자: Greg Beaver ([email protected])
상속: extends PEAR
파일 보기 프로젝트 열기: sourcefabric/newscoop 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$_channelConfigInfo array All other configuration values can only have a global value
$_channels array Channels that can be accessed
$_errorsFound integer amount of errors found while parsing config
$_installRoot string | false This variable is used to control the directory values returned
$_lastError
$_noRegistry boolean
$_regInitialized array
$_registry PEAR_Registry If requested, this will always refer to the registry contained in php_dir
$configuration The order in the first dimension is important! Earlier layers will shadow later ones when a config value is requested (if a 'user' value exists, it will be returned first, then 'system' and finally 'default').
$configuration_info Information about the configuration data. Stores the type, default value and a documentation string for each configuration value.
$files Array of config files used.
$layers

공개 메소드들

메소드 설명
PEAR_Config ( $user_file = '', $system_file = '', $ftp_file = false, $strict = true ) Constructor.
_addConfigVars ( $class, $vars ) : true | PEAR_Error
_decodeInput ( &$data ) : boolean Decodes/unscrambles configuration data after reading from files.
_encodeOutput ( &$data ) : boolean Encodes/scrambles configuration data before writing to files.
_getChannelValue ( $key, $layer, $channel ) : mixed Returns a channel-specific configuration value, prioritizing layers as per the layers property.
_lazyChannelSetup ( $uselayer = false )
_prependPath ( $path, $prepend )
_readConfigDataFrom ( $file ) : array Reads configuration data from a file and returns the parsed data in an array.
_setupChannels ( ) Reads the existing configurations and creates the _channels array from it
apiVersion ( )
arrayMergeRecursive ( $arr2, $arr1 ) : array
definedBy ( $key, $returnchannel = false ) : string | array Tells what config layer that gets to define a key.
deleteChannel ( $channel )
get ( $key, $layer = null, $channel = false ) : mixed Returns a configuration value, prioritizing layers as per the layers property.
getConfFile ( string $layer ) Gets the file used for storing the config for a layer
getDefaultChannel ( $layer = null ) : string | false Retrieve the default channel.
getDefaultConfigFiles ( ) Return the default locations of user and system configuration files
getDocs ( $key ) : string Get the documentation for a config value.
getFTP ( ) : PEAR_FTP | false The ftp server is set in {@link readFTPConfigFile()}. It exists only if a remote configuration file has been specified
getGroup ( $key ) : string Get the parameter group for a config key.
getGroupKeys ( string $group ) : array Get the list of the parameters in a group.
getGroups ( ) : array Get the list of parameter groups.
getKeys ( ) : array Get all the current config keys.
getLayers ( ) : array Returns the layers defined (except the 'default' one)
getPrompt ( $key ) : string Get the short documentation for a config value.
getREST ( $version, $options = [] ) : PEAR_REST
getRegistry ( $use = null ) : PEAR_Registry
getSetValues ( $key ) : array Get the list of allowed set values for a config value. Returns NULL for config values that are not sets.
getType ( $key ) : string Get the type of a config value.
isDefined ( $key ) : boolean Tells whether a given key exists as a config value.
isDefinedLayer ( $layer ) : boolean Tells whether a given config layer exists.
mergeConfigFile ( $file, $override = true, $layer = 'user', $strict = true ) : boolean Merges data into a config layer from a file. Does the same thing as readConfigFile, except it does not replace all existing values in the config layer.
noRegistry ( )
readConfigFile ( $file = null, $layer = 'user', $strict = true ) : boolean Reads configuration data from a file. All existing values in the config layer are discarded and replaced with data from the file.
readFTPConfigFile ( $path ) : true | PEAR_Error
remove ( $key, $layer = 'user', $channel = null ) : boolean Remove the a config key from a specific config layer.
removeLayer ( $layer ) : boolean Temporarily remove an entire config layer. USE WITH CARE!
set ( $key, $value, $layer = 'user', $channel = false ) : boolean Set a config value in a specific layer (defaults to 'user').
setChannels ( $channels, $merge = false ) : boolean Set the list of channels.
setInstallRoot ( $root )
setRegistry ( &$reg, $layer = 'user' ) : boolean This is to allow customization like the use of installroot
singleton ( $user_file = '', $system_file = '', $strict = true ) : object Static singleton method. If you want to keep only one instance of this class in use, this method will give you a reference to the last created PEAR_Config object if one exists, or create a new object.
store ( $layer = 'user', $data = null ) : boolean Stores configuration data in a layer.
validConfiguration ( ) : boolean Determine whether any configuration files have been detected, and whether a registry object can be retrieved from this configuration.
writeConfigFile ( $file = null, $layer = 'user', $data = null ) : boolean Writes data into a config layer from a file.

메소드 상세

PEAR_Config() 공개 메소드

Constructor.
또한 보기: PEAR_Config::singleton
public PEAR_Config ( $user_file = '', $system_file = '', $ftp_file = false, $strict = true )

_addConfigVars() 공개 메소드

public _addConfigVars ( $class, $vars ) : true | PEAR_Error
리턴 true | PEAR_Error

_decodeInput() 공개 메소드

Decodes/unscrambles configuration data after reading from files.
또한 보기: PEAR_Config::_encodeOutput
public _decodeInput ( &$data ) : boolean
리턴 boolean TRUE on success

_encodeOutput() 공개 메소드

Currently, 'password' values will be base64-encoded as to avoid that people spot cleartext passwords by accident.
public _encodeOutput ( &$data ) : boolean
리턴 boolean TRUE on success

_getChannelValue() 공개 메소드

Returns a channel-specific configuration value, prioritizing layers as per the layers property.
public _getChannelValue ( $key, $layer, $channel ) : mixed
리턴 mixed the config value, or NULL if not found

_lazyChannelSetup() 공개 메소드

public _lazyChannelSetup ( $uselayer = false )

_prependPath() 공개 메소드

public _prependPath ( $path, $prepend )

_readConfigDataFrom() 공개 메소드

Reads configuration data from a file and returns the parsed data in an array.
public _readConfigDataFrom ( $file ) : array
리턴 array configuration data or a PEAR error on failure

_setupChannels() 공개 메소드

Reads the existing configurations and creates the _channels array from it
public _setupChannels ( )

apiVersion() 공개 메소드

public apiVersion ( )

arrayMergeRecursive() 공개 메소드

public arrayMergeRecursive ( $arr2, $arr1 ) : array
리턴 array

definedBy() 공개 메소드

Tells what config layer that gets to define a key.
public definedBy ( $key, $returnchannel = false ) : string | array
리턴 string | array the config layer, or an empty string if not found. if $returnchannel, the return is an array array('layer' => layername, 'channel' => channelname), or an empty string if not found

deleteChannel() 공개 메소드

public deleteChannel ( $channel )

get() 공개 메소드

Returns a configuration value, prioritizing layers as per the layers property.
public get ( $key, $layer = null, $channel = false ) : mixed
리턴 mixed the config value, or NULL if not found

getConfFile() 공개 메소드

Gets the file used for storing the config for a layer
public getConfFile ( string $layer )
$layer string 'user' or 'system'

getDefaultChannel() 공개 메소드

On startup, channels are not initialized, so if the default channel is not pear.php.net, then initialize the config.
public getDefaultChannel ( $layer = null ) : string | false
리턴 string | false

getDefaultConfigFiles() 공개 메소드

Return the default locations of user and system configuration files

getDocs() 공개 메소드

Get the documentation for a config value.
public getDocs ( $key ) : string
리턴 string documentation string

getFTP() 공개 메소드

The ftp server is set in {@link readFTPConfigFile()}. It exists only if a remote configuration file has been specified
public getFTP ( ) : PEAR_FTP | false
리턴 PEAR_FTP | false

getGroup() 공개 메소드

Get the parameter group for a config key.
public getGroup ( $key ) : string
리턴 string parameter group

getGroupKeys() 공개 메소드

Get the list of the parameters in a group.
public getGroupKeys ( string $group ) : array
$group string parameter group
리턴 array list of parameters in $group

getGroups() 공개 메소드

Get the list of parameter groups.
public getGroups ( ) : array
리턴 array list of parameter groups

getKeys() 공개 메소드

Get all the current config keys.
public getKeys ( ) : array
리턴 array simple array of config keys

getLayers() 공개 메소드

Returns the layers defined (except the 'default' one)
public getLayers ( ) : array
리턴 array of the defined layers

getPrompt() 공개 메소드

Get the short documentation for a config value.
public getPrompt ( $key ) : string
리턴 string short documentation string

getREST() 공개 메소드

public getREST ( $version, $options = [] ) : PEAR_REST
리턴 PEAR_REST

getRegistry() 공개 메소드

public getRegistry ( $use = null ) : PEAR_Registry
리턴 PEAR_Registry

getSetValues() 공개 메소드

Get the list of allowed set values for a config value. Returns NULL for config values that are not sets.
public getSetValues ( $key ) : array
리턴 array enumerated array of set values, or NULL if the config key is unknown or not a set

getType() 공개 메소드

Get the type of a config value.
public getType ( $key ) : string
리턴 string type, one of "string", "integer", "file", "directory", "set" or "password".

isDefined() 공개 메소드

Tells whether a given key exists as a config value.
public isDefined ( $key ) : boolean
리턴 boolean whether exists in this object

isDefinedLayer() 공개 메소드

Tells whether a given config layer exists.
public isDefinedLayer ( $layer ) : boolean
리턴 boolean whether exists in this object

mergeConfigFile() 공개 메소드

Merges data into a config layer from a file. Does the same thing as readConfigFile, except it does not replace all existing values in the config layer.
public mergeConfigFile ( $file, $override = true, $layer = 'user', $strict = true ) : boolean
리턴 boolean TRUE on success or a PEAR error on failure

noRegistry() 공개 메소드

public noRegistry ( )

readConfigFile() 공개 메소드

Reads configuration data from a file. All existing values in the config layer are discarded and replaced with data from the file.
public readConfigFile ( $file = null, $layer = 'user', $strict = true ) : boolean
리턴 boolean TRUE on success or a PEAR error on failure

readFTPConfigFile() 공개 메소드

public readFTPConfigFile ( $path ) : true | PEAR_Error
리턴 true | PEAR_Error

remove() 공개 메소드

Remove the a config key from a specific config layer.
public remove ( $key, $layer = 'user', $channel = null ) : boolean
리턴 boolean TRUE on success, FALSE on failure

removeLayer() 공개 메소드

Temporarily remove an entire config layer. USE WITH CARE!
public removeLayer ( $layer ) : boolean
리턴 boolean TRUE on success, FALSE on failure

set() 공개 메소드

Enforces the types defined in the configuration_info array. An integer config variable will be cast to int, and a set config variable will be validated against its legal values.
public set ( $key, $value, $layer = 'user', $channel = false ) : boolean
리턴 boolean TRUE on success, FALSE on failure

setChannels() 공개 메소드

This should be set via a call to {@link PEAR_Registry::listChannels()}
public setChannels ( $channels, $merge = false ) : boolean
리턴 boolean success of operation

setInstallRoot() 공개 메소드

public setInstallRoot ( $root )

setRegistry() 공개 메소드

This is to allow customization like the use of installroot
public setRegistry ( &$reg, $layer = 'user' ) : boolean
리턴 boolean

singleton() 공개 메소드

Static singleton method. If you want to keep only one instance of this class in use, this method will give you a reference to the last created PEAR_Config object if one exists, or create a new object.
또한 보기: PEAR_Config::PEAR_Config
public singleton ( $user_file = '', $system_file = '', $strict = true ) : object
리턴 object an existing or new PEAR_Config instance

store() 공개 메소드

Stores configuration data in a layer.
public store ( $layer = 'user', $data = null ) : boolean
리턴 boolean TRUE on success, or PEAR error on failure

validConfiguration() 공개 메소드

Determine whether any configuration files have been detected, and whether a registry object can be retrieved from this configuration.
public validConfiguration ( ) : boolean
리턴 boolean

writeConfigFile() 공개 메소드

Writes data into a config layer from a file.
public writeConfigFile ( $file = null, $layer = 'user', $data = null ) : boolean
리턴 boolean TRUE on success or a PEAR error on failure

프로퍼티 상세

$_channelConfigInfo 공개적으로 프로퍼티

All other configuration values can only have a global value
public array $_channelConfigInfo
리턴 array

$_channels 공개적으로 프로퍼티

Channels that can be accessed
또한 보기: setChannels()
public array $_channels
리턴 array

$_errorsFound 공개적으로 프로퍼티

amount of errors found while parsing config
public int $_errorsFound
리턴 integer

$_installRoot 공개적으로 프로퍼티

This variable is used to control the directory values returned
public string|false $_installRoot
리턴 string | false

$_lastError 공개적으로 프로퍼티

public $_lastError

$_noRegistry 공개적으로 프로퍼티

public bool $_noRegistry
리턴 boolean

$_regInitialized 공개적으로 프로퍼티

public array $_regInitialized
리턴 array

$_registry 공개적으로 프로퍼티

If requested, this will always refer to the registry contained in php_dir
public PEAR_Registry $_registry
리턴 PEAR_Registry

$configuration 공개적으로 프로퍼티

The order in the first dimension is important! Earlier layers will shadow later ones when a config value is requested (if a 'user' value exists, it will be returned first, then 'system' and finally 'default').
public $configuration

$configuration_info 공개적으로 프로퍼티

Information about the configuration data. Stores the type, default value and a documentation string for each configuration value.
public $configuration_info

$files 공개적으로 프로퍼티

Array of config files used.
public $files

$layers 공개적으로 프로퍼티

public $layers