lib/ezutils/classes/ezini.php

Show: inherited
Table of Contents

File containing the eZINI class.

Copyright
Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.  
License
eZ Business Use License Agreement Version 2.0  
Package
lib  
Version
4.6.0  

\eZINI

Package: lib

File containing the eZINI class.

Copyright
Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.  
License
eZ Business Use License Agreement Version 2.0  
Version
4.6.0  

Constants

Constantstring  CONFIG_CACHE_DIR = 'var/cache/ini/'

Constant path to directory for configuration cache

string
Constantint  CONFIG_CACHE_REV = 2

Constant integer to check against configuration cache format revision

int

Properties

Propertypublic  $AddArrayDefinition= ''
Details
Type
n/a
Propertypublic  $BlockValues= ''
Details
Type
n/a
Propertypublic  $BlockValuesPlacement= ''
Details
Type
n/a
Propertypublic  $CacheFile= ''
Details
Type
n/a
Propertypublic  $Charset= ''
Details
Type
n/a
Propertypublic  $Codec= ''
Details
Type
n/a
Propertypublic  $DirectAccess= ''
Details
Type
n/a
Propertypublic  $FileName= ''
Details
Type
n/a
Propertyprotected  $GlobalOverrideDirArray= 'null'
static
Default valuenullDetails
Type
n/a
Propertypublic  $LocalOverrideDirArray= ''
Details
Type
n/a
Propertypublic  $ModifiedBlockValues= ''
Details
Type
n/a
Propertypublic  $PlacementCacheFile= ''
Details
Type
n/a
Propertypublic  $ReadOnlySettingsCheck= 'true'
Default valuetrueDetails
Type
n/a
Propertypublic  $RootDir= ''
Details
Type
n/a
Propertypublic  $UseCache= ''
Details
Type
n/a
Propertypublic  $UseLocalOverrides= ''
Details
Type
n/a
Propertypublic  $UseTextCodec= ''
Details
Type
n/a
Propertyprotectedbool  $cacheEnabled= 'true'
static

Contains whether INI cache is globally enabled.

Default valuetrueDetails
Type
bool
Propertyprotectednull|bool  $checkFileMtime= 'null'
static

Set EZP_INI_FILEMTIME_CHECK constant to false to improve performance by not checking modified time on ini files. You can also set it to a string, the name of a ini file you still want to check modified time on, best example would be to set it to 'site.ini' to make the system still check that but not the rest.

Default valuenullDetails
Type
null | bool
Propertyprotectedbool  $debugEnabled= 'false'
static

Contains whether internals debugging is enabled.

Default valuefalseDetails
Type
bool
Propertyprotectednull|int  $filePermission= 'null'
static

set EZP_INI_FILE_PERMISSION constant to the permissions you want saved ini and cache files to have.

Default valuenullDetails
Type
null | int
Propertyprotected\array(eZINI)  $instances= 'array()'
static

Array of eZINI instances

Default valuearray()Details
Type
\array(eZINI)
Propertyprotectedbool  $textCodecEnabled= 'true'
static

Contains whether textcodec conversion is enabled.

Default valuetrueDetails
Type
bool

Methods

methodpublicappendOverrideDir( string $dir, bool $globalDir = false, string | false $identifier = false, string | null $scope = null ) : bool

Appends the override directory $dir to the override directory list.

Appends override dir to 'override' scope if scope is not defined, meaning above anything else. See {@link eZINI::defaultOverrideDirs()} for how these parameters are used.

Parameters
Name Type Description
$dir string
$globalDir bool
$identifier string | false

Will overwrite existing directory with same identifier if set

$scope string | null
Returns
Type Description
bool True if new dir was appended, false if there was a $identifier match and a overwrite
methodpublicassign(  $blockName,  $varName,  $variable ) : void

Parameters
Name Type Description
$blockName
$varName
$variable
methodprotectedcacheFileName(  $placement = false ) : void

Parameters
Name Type Description
$placement
methodpubliccreate(  $fileName = 'site.ini',  $rootDir = 'settings',  $useTextCodec = null,  $useCache = null,  $useLocalOverrides = null ) : void
static

Parameters
Name Type Description
$fileName
$rootDir
$useTextCodec
$useCache
$useLocalOverrides
methodpublicdefaultOverrideDirs( ) : array
static

Default override directories as raw array data

Returns
Type Description
array An associated array of associated arrays of arrays.. First level keys are the scope and values are arrays Second level keys are identifier (numberic if not defined by caller) and value is arrays Third level contains (string) override dir, (bool) global flag if false then relative to {@link $RootDir} and (string|false) optional identifier as used by {@link eZINI::prependOverrideDir()} to match and replace values on.
methodpubliceZINI( string $fileName = 'site.ini', string $rootDir = '', null | bool $useTextCodec = null, null | bool $useCache = null, null | bool $useLocalOverrides = null, bool $directAccess = false, bool $addArrayDefinition = false, bool $load = true ) : void

Initialization of eZINI object

Enter description here ...

Parameters
Name Type Description
$fileName string
$rootDir string
$useTextCodec null | bool
$useCache null | bool
$useLocalOverrides null | bool
$directAccess bool
$addArrayDefinition bool
$load bool

@since 4.5 Lets you disable automatic loading of ini values in cases where changes on instance will be done first.

methodpublicexists(  $fileName = "site.ini",  $rootDir = "settings" ) : void
static

Parameters
Name Type Description
$fileName
$rootDir
methodpublicfetchFromFile(  $fileName,  $useTextCodec = null ) : void
static

Parameters
Name Type Description
$fileName
$useTextCodec
methodpublicfilename( ) : void

methodpublicfindInputFiles(  $inputFiles,  $iniFile ) : void

Parameters
Name Type Description
$inputFiles
$iniFile
methodpublicfindSettingPlacement( string $path ) : string

Gives you the location of a ini file based on it's path, format is same as used internally for $identifer for override dirs- Eg: default / ext-siteaccess: / siteaccess / extension: / override

Parameters
Name Type Description
$path string
Returns
Type Description
string
methodpublicgetNamedArray( ) : void

methodpublicgetSiteAccessIni( string $siteAccess, string $iniFile ) : \eZINI
static

Get ini file for a specific siteaccess (not incl extesnions or overrides) use {@link eZSiteAccess::getIni()} instead if you want to have full ini env.

Parameters
Name Type Description
$siteAccess string
$iniFile string
Returns
Type Description
\eZINI
methodpublicglobalOverrideDirs( string | false | null $scope = null ) : array
static

Return the global override directories witch raw override dir data, or within a scope if $scope is set, see {@link eZINI::defaultOverrideDirs()} for how the raw data looks like.

Parameters
Name Type Description
$scope string | false | null

See {@link eZINI::defaultOverrideDirs()} for possible scope values If false then you'll get raw override dir structure, null (default) is a simplified variant withouth scopes that is easy to iterate over.

Returns
Type Description
array
methodpublicgroup(  $blockName ) : void

Parameters
Name Type Description
$blockName
methodpublicgroupPlacements( ) : void

methodpublicgroups( ) : void

methodpublichasGroup(  $blockName ) : void

Parameters
Name Type Description
$blockName
methodpublichasSection(  $sectionName ) : void

Parameters
Name Type Description
$sectionName
methodpublichasVariable(  $blockName,  $varName ) : void

Parameters
Name Type Description
$blockName
$varName
methodpublicinstance( string $fileName = 'site.ini', string $rootDir = 'settings', null | bool $useTextCodec = null, null | bool $useCache = null, null | bool $useLocalOverrides = null, bool $directAccess = false, bool $addArrayDefinition = false ) : \eZINI
static

Returns a shared instance of the eZINI class pr $fileName, $rootDir and $useLocalOverrides param combinations.

If $useLocalOverrides is set to true you will get a copy of the current overrides, but changes to the override settings will not be global. Direct access is for accessing the filename directly in the specified path. .append and .append.php is automaticly added to filename note: Use create() if you need to get a unique copy which you can alter.

Parameters
Name Type Description
$fileName string
$rootDir string
$useTextCodec null | bool

Default system setting if null (instance not used if not null!)

$useCache null | bool

Default system setting if null (instance not used if not null!)

$useLocalOverrides null | bool

Default system setting if null

$directAccess bool

Direct access to specific file instead of values from several (instance not used if true!)

$addArrayDefinition bool

@deprecated since version 4.5, use "new eZINI()" (instance not used if true!)

Returns
Type Description
\eZINI
methodpublicisCacheEnabled( ) : bool
static

Returns whether INI cache is enabled globally, by default it is true.

Returns
Type Description
bool
Details
See
\setIsCacheEnabled().  
methodpublicisDebugEnabled( ) : bool
static

Returns whether debugging of internals is enabled.

This will display which files are loaded an when cache files are created.

Returns
Type Description
bool
Details
See
\setIsDebugEnabled()  
methodpublicisLoaded( string $fileName = 'site.ini', string $rootDir = 'settings', null | bool $useLocalOverrides = null ) : bool
static

Returns whether the mentioned ini file has been loaded.

Parameters
Name Type Description
$fileName string
$rootDir string
$useLocalOverrides null | bool

default system setting if null

Returns
Type Description
bool
methodpublicisNoCacheAdviced( ) : void
static

methodpublicisSettingReadOnly(  $fileName = false,  $blockName = false,  $settingName = false ) : void

Parameters
Name Type Description
$fileName
$blockName
$settingName
methodpublicisTextCodecEnabled( ) : bool
static

Returns whether textcodecs is to be used, this will use the eZTextCodec class in the eZI18N library for text conversion.

Returns
Type Description
bool
Details
See
\setIsTextCodecEnabled()  
methodpublicisVariableModified(  $blockName,  $varName ) : void

Parameters
Name Type Description
$blockName
$varName
methodpublicload( bool $reset = true ) : void

Tries to load the ini file specified in the constructor or instance() function.

If cache files should be used and a cache file is found it loads that instead.

Parameters
Name Type Description
$reset bool

Reset ini values on instance

methodpublicloadPlacement( bool $reset = true ) : void

Tries to load the ini file placement specified in the constructor or instance() function.

If cache files should be used and a cache file is found it loads that instead.

Parameters
Name Type Description
$reset bool

Reset ini values on instance

methodpublicoverrideDirs( string | null | false $scope = null ) : array

Return the override directories witch raw override dir data, or within a scope if $scope is set, see {@link eZINI::defaultOverrideDirs()} for how the raw data looks like.

Parameters
Name Type Description
$scope string | null | false

See {@link eZINI::defaultOverrideDirs()} for possible scope values If false then you'll get raw override dir structure, null (default) is a simplified variant withouth scopes that is easy to iterate over.

Returns
Type Description
array
methodprotectedoverrideDirsByScope( array $dirs, string | null | false $scope = null ) : array
static

Return the override directories witch raw override dir data, or within a scope if $scope is set, see {@link eZINI::defaultOverrideDirs()} for how the raw data looks like.

Parameters
Name Type Description
$dirs array

Directories directly from internal raw structure (see above).

$scope string | null | false

See {@link eZINI::defaultOverrideDirs()} for possible scope values If false then you'll get raw override dir structure, null (default) is a simplified variant withouth scopes that is easy to iterate over.

Returns
Type Description
array
methodpublicparameterSet( string $fileName = 'site.ini', string $rootDir = 'settings', string $section, string $parameter ) : bool
static

Check whether a specified parameter in a specified section is set in a specified file

Parameters
Name Type Description
$fileName string

fileName file name (optional)

$rootDir string

rootDir directory (optional)

$section string

section section name

$parameter string

parameter parameter name

Returns
Type Description
bool True if the the parameter is set.
Details
Deprecated
Since 4.4  
methodpublicparse(  $inputFiles = false,  $iniFile = false,  $reset = true,  $placement = false ) : void

Parameters
Name Type Description
$inputFiles
$iniFile
$reset
$placement
methodpublicparseFile(  $file,  $placement = false ) : void

Parameters
Name Type Description
$file
$placement
methodpublicprependOverrideDir( string $dir, bool $globalDir = false, string | false $identifier = false, string | null $scope = null ) : bool

Prepends the override directory $dir to the override directory list.

Prepends override dir to 'extension' scope by default, bellow siteaccess and override settings. See {@link eZINI::defaultOverrideDirs()} for how these parameters are used.

Parameters
Name Type Description
$dir string
$globalDir bool
$identifier string | false

Will overwrite existing directory with same identifier if set

$scope string | null
Returns
Type Description
bool True if new dir was prepended, false if there was a $identifier match and a overwrite
methodpublicreadOnlySettingsCheck( ) : void

methodpublicremoveGroup(  $blockName ) : void

Parameters
Name Type Description
$blockName
methodpublicremoveOverrideDir( string $identifier, string $scope = 'extension' ) : bool

Removes an override dir by identifier See {@link eZINI::defaultOverrideDirs()} for how these parameters are used.

Parameters
Name Type Description
$identifier string

Will remove existing directory with identifier it it exists

$scope string

By default 'extension'

Returns
Type Description
bool True if new dir was appended, false if there was a $identifier match and a overwrite
methodpublicremoveSetting(  $blockName,  $settingName ) : void

Parameters
Name Type Description
$blockName
$settingName
methodpublicreset( ) : void

methodpublicresetAllGlobals(  $resetGlobalOverrideDirs = true ) : void
static

Reset all eZINI instances as well override dirs ( optional )

Parameters
Name Type Description
$resetGlobalOverrideDirs
Details
Deprecated
since 4.5, use resetAllInstances() instead  
See
\resetAllInstances()  
methodpublicresetAllInstances(  $resetGlobalOverrideDirs = true ) : void
static

Reset all eZINI instances as well override dirs ( optional )

Parameters
Name Type Description
$resetGlobalOverrideDirs
Details
Since
4.5  
methodpublicresetCache( ) : void

methodpublicresetGlobalOverrideDirs( ) : void
static

Reset the global override directories with data from {@link eZINI::defaultOverrideDirs()}

methodpublicresetGlobals( string $fileName = 'site.ini', string $rootDir = 'settings', null | bool $useLocalOverrides = null ) : void
static

Resets a specific instance of eZINI.

Parameters
Name Type Description
$fileName string
$rootDir string
$useLocalOverrides null | bool

default system setting if null

Details
Deprecated
since 4.5, use resetInstance() instead  
See
\resetInstance()  
methodpublicresetInstance( string $fileName = 'site.ini', string $rootDir = 'settings', null | bool $useLocalOverrides = null ) : void
static

Resets a specific instance of eZINI.

Parameters
Name Type Description
$fileName string
$rootDir string
$useLocalOverrides null | bool

default system setting if null

Details
Since
4.5  
methodpublicresetOverrideDirs( ) : void

Reset the override directories with data from {@link eZINI::defaultOverrideDirs()}

methodpublicrootDir( ) : void

methodpublicsave(  $fileName = false,  $suffix = false,  $useOverride = false,  $onlyModified = false,  $useRootDir = true,  $resetArrays = false,  $encapsulateInPHP = true ) : void

Parameters
Name Type Description
$fileName
$suffix
$useOverride
$onlyModified
$useRootDir
$resetArrays
$encapsulateInPHP
methodprotectedsaveCache( string $cachedDir, string $cachedFile, array $data, array $inputFiles, string $iniFile ) : bool

Stores the content of the INI object to the cache file \a $cachedFile.

Parameters
Name Type Description
$cachedDir string

Cache dir, usually "var/cache/ini/"

$cachedFile string

Name of cache file as returned by cacheFileName()

$data array

Configuration data as an associative array structure

$inputFiles array

List of input files used as basis for cache (for use in load cache to check mtime)

$iniFile string

Ini file path string returned by findInputFiles() for main ini file

Returns
Type Description
bool
methodprotectedselectOverrideScope( string | null $scope, string $identifier, string $dir, string $default ) : string
static

Function to handle bc with code from pre 4.4 that does not know about scopes

Parameters
Name Type Description
$scope string | null
$identifier string
$dir string
$default string
Returns
Type Description
string
Details
Since
4.4  
methodpublicsetGroups(  $groupArray ) : void

Parameters
Name Type Description
$groupArray
methodpublicsetIsCacheEnabled( bool $enabled ) : void
static

Sets whether caching is enabled for INI files or not. This setting is global and can be overriden in the instance() function.

Parameters
Name Type Description
$enabled bool
Details
See
\isCacheEnabled().  
methodpublicsetIsDebugEnabled( bool $enabled ) : void
static

Sets whether internal debugging is enabled or not. This setting is global and can be overriden in the instance() function.

Parameters
Name Type Description
$enabled bool
Details
See
\isDebugEnabled().  
methodpublicsetIsTextCodecEnabled( bool $enabled ) : void
static

Sets whether textcodec conversion is enabled or not.

Parameters
Name Type Description
$enabled bool
Details
See
\isTextCodecEnabled().  
methodpublicsetOverrideDirs( array $newDirs, string | false $scope = false ) : void

Set the override directories witch raw override dir data, or within a scope if $scope is set, see {@link eZINI::defaultOverrideDirs()} for how the raw data looks like.

Parameters
Name Type Description
$newDirs array
$scope string | false

See {@link eZINI::defaultOverrideDirs()} for possible scope values

methodpublicsetReadOnlySettingsCheck(  $readOnly = true ) : void

Parameters
Name Type Description
$readOnly
methodpublicsetVariable(  $blockName,  $variableName,  $variableValue ) : void

Parameters
Name Type Description
$blockName
$variableName
$variableValue
methodpublicsetVariables(  $variables ) : void

Parameters
Name Type Description
$variables
methodpublicsettingType(  $settingValue ) : void

Parameters
Name Type Description
$settingValue
methodpublicvariable(  $blockName,  $varName ) : void

Parameters
Name Type Description
$blockName
$varName
methodpublicvariableArray(  $blockName,  $varName ) : void

Parameters
Name Type Description
$blockName
$varName
methodpublicvariableMulti(  $blockName,  $varNames,  $signatures = array() ) : void

Parameters
Name Type Description
$blockName
$varNames
$signatures
Documentation was generated by DocBlox 0.18.1.