Class

eZINI

class eZINI

Constants

CONFIG_CACHE_DIR

Constant path to directory for configuration cache

CONFIG_CACHE_REV

Constant integer to check against configuration cache format revision

INJECTED_PATH

Fake path of injected settings used to differentiate those from default, override, extension, ...

Properties

$Charset
$Codec
$BlockValues
$BlockValuesPlacement
$ModifiedBlockValues
$FileName
$RootDir
$UseTextCodec
$CacheFile
$PlacementCacheFile
$UseCache
$UseLocalOverrides
$LocalOverrideDirArray
$DirectAccess
$AddArrayDefinition
$ReadOnlySettingsCheck

Methods

__construct(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)

Initialization of eZINI object

filename()

load(bool $reset = true)

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

loadPlacement(bool $reset = true)

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

findInputFiles($inputFiles, $iniFile)

loadCache(bool $reset = true, bool $placement = false)

Will load a cached version of the ini file if it exists, if not it will parse the original file and create the cache file.

parse($inputFiles = false, $iniFile = false, $reset = true, $placement = false)

parseFile($file, $placement = false)

resetCache()

save($fileName = false, $suffix = false, $useOverride = false, $onlyModified = false, $useRootDir = true, $resetArrays = false, $encapsulateInPHP = true)

reset()

rootDir()

array overrideDirs(string|null|false $scope = null)

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.

static array globalOverrideDirs(string|false|null $scope = null)

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.

static array defaultOverrideDirs()

Default override directories as raw array data

setOverrideDirs(array $newDirs, string|false $scope = false)

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.

static  resetGlobalOverrideDirs()

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

resetOverrideDirs()

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

bool removeOverrideDir(string $identifier, string $scope = 'extension')

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

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

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

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

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

assign($blockName, $varName, $variable)

mixed variable(string $blockName, string $varName)

Reads a variable from the ini file.

false|array variableMulti(string $blockName, string $varNames, array $signatures = array())

Reads multiple variables from the ini file.

bool hasVariable(string $blockName, string $varName)

Checks if a variable is set.

boolean hasSection($sectionName)

Checks if the group $blockName exists

isVariableModified($blockName, $varName)

array variableArray(string $blockName, string $varName)

Reads a variable from the ini file or injected settings.

boolean hasGroup(string $blockName)

Checks if the group $blockName exists

array group(string $blockName)

Fetches a variable group and returns it as an associative array.

isSettingReadOnly($fileName = false, $blockName = false, $settingName = false)

removeGroup($blockName)

removeSetting($blockName, $settingName)

array groups()

Fetches all defined groups and returns them as an associative array

groupPlacements()

string findSettingPlacement(string $path)

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 / injected

settingType($settingValue)

setGroups($groupArray)

setVariables($variables)

setVariable($blockName, $variableName, $variableValue)

array getNamedArray()

Returns BlockValues, which is a nicely named Array

setReadOnlySettingsCheck($readOnly = true)

readOnlySettingsCheck()

Details

at line 155
public __construct(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)

Initialization of eZINI object

Enter description here ...

Parameters

string $fileName
string $rootDir
null|bool $useTextCodec
null|bool $useCache
null|bool $useLocalOverrides
bool $directAccess
bool $addArrayDefinition
bool $load @since 4.5 Lets you disable automatic loading of ini values in cases where changes on instance will be done first.

at line 213
public filename()

at line 356
public load(bool $reset = true)

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

bool $reset Reset ini values on instance

at line 375
public loadPlacement(bool $reset = true)

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

bool $reset Reset ini values on instance

at line 435
public findInputFiles($inputFiles, $iniFile)

Parameters

$inputFiles
$iniFile

at line 543
public loadCache(bool $reset = true, bool $placement = false)

Will load a cached version of the ini file if it exists, if not it will parse the original file and create the cache file.

Parameters

bool $reset Reset ini values on instance
bool $placement Load cache for placment info, not the ini values themself.

at line 720
public parse($inputFiles = false, $iniFile = false, $reset = true, $placement = false)

Parameters

$inputFiles
$iniFile
$reset
$placement

at line 746
public parseFile($file, $placement = false)

Parameters

$file
$placement

at line 894
public resetCache()

at line 909
public save($fileName = false, $suffix = false, $useOverride = false, $onlyModified = false, $useRootDir = true, $resetArrays = false, $encapsulateInPHP = true)

Parameters

$fileName
$suffix
$useOverride
$onlyModified
$useRootDir
$resetArrays
$encapsulateInPHP

at line 1109
public reset()

at line 1120
public rootDir()

at line 1134
public array overrideDirs(string|null|false $scope = null)

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

string|null|false $scope 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.

Return Value

array

at line 1153
static public array globalOverrideDirs(string|false|null $scope = null)

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

string|false|null $scope 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.

Return Value

array

at line 1192
static public array defaultOverrideDirs()

Default override directories as raw array data

Return Value

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.

at line 1210
public setOverrideDirs(array $newDirs, string|false $scope = false)

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

array $newDirs
string|false $scope See {@link eZINI::defaultOverrideDirs()} for possible scope values

at line 1230
static public resetGlobalOverrideDirs()

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

at line 1238
public resetOverrideDirs()

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

at line 1251
public bool removeOverrideDir(string $identifier, string $scope = 'extension')

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

Parameters

string $identifier Will remove existing directory with identifier it it exists
string $scope By default 'extension'

Return Value

bool True if new dir was appended, false if there was a $identifier match and a overwrite

at line 1292
public bool prependOverrideDir(string $dir, bool $globalDir = false, string|false $identifier = false, string|null $scope = null)

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

string $dir
bool $globalDir
string|false $identifier Will overwrite existing directory with same identifier if set
string|null $scope

Return Value

bool True if new dir was prepended, false if there was a $identifier match and a overwrite

at line 1336
public bool appendOverrideDir(string $dir, bool $globalDir = false, string|false $identifier = false, string|null $scope = null)

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

string $dir
bool $globalDir
string|false $identifier Will overwrite existing directory with same identifier if set
string|null $scope

Return Value

bool True if new dir was appended, false if there was a $identifier match and a overwrite

at line 1403
public assign($blockName, $varName, $variable)

Parameters

$blockName
$varName
$variable

at line 1421
public mixed variable(string $blockName, string $varName)

Reads a variable from the ini file.

Returns false, if the variable was not found.

Parameters

string $blockName
string $varName

Return Value

mixed

at line 1462
public false|array variableMulti(string $blockName, string $varNames, array $signatures = array())

Reads multiple variables from the ini file.

Returns false, if the block does not exist.

Parameters

string $blockName
string $varNames
array $signatures

Return Value

false|array

at line 1519
public bool hasVariable(string $blockName, string $varName)

Checks if a variable is set.

Parameters

string $blockName
string $varName

Return Value

bool

at line 1549
public boolean hasSection($sectionName)

Checks if the group $blockName exists

Parameters

$sectionName

Return Value

boolean

at line 1558
public isVariableModified($blockName, $varName)

Parameters

$blockName
$varName

at line 1572
public array variableArray(string $blockName, string $varName)

Reads a variable from the ini file or injected settings.

The variable will be returned as an array. ; is used as delimiter.

Parameters

string $blockName
string $varName

Return Value

array

at line 1599
public boolean hasGroup(string $blockName)

Checks if the group $blockName exists

Parameters

string $blockName

Return Value

boolean

at line 1612
public array group(string $blockName)

Fetches a variable group and returns it as an associative array.

Parameters

string $blockName

Return Value

array

at line 1635
public isSettingReadOnly($fileName = false, $blockName = false, $settingName = false)

Parameters

$fileName
$blockName
$settingName

at line 1663
public removeGroup($blockName)

Parameters

$blockName

at line 1669
public removeSetting($blockName, $settingName)

Parameters

$blockName
$settingName

at line 1684
public array groups()

Fetches all defined groups and returns them as an associative array

Return Value

array

at line 1726
public groupPlacements()

at line 1744
public string findSettingPlacement(string $path)

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 / injected

Parameters

string $path

Return Value

string

at line 1788
public settingType($settingValue)

Parameters

$settingValue

at line 1811
public setGroups($groupArray)

Parameters

$groupArray

at line 1837
public setVariables($variables)

Parameters

$variables

at line 1855
public setVariable($blockName, $variableName, $variableValue)

Parameters

$blockName
$variableName
$variableValue

at line 1869
public array getNamedArray()

Returns BlockValues, which is a nicely named Array

Return Value

array

at line 1964
public setReadOnlySettingsCheck($readOnly = true)

Parameters

$readOnly

at line 1972
public readOnlySettingsCheck()