wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
InifileParser Class Reference

Public Member Functions

getInstance ()
 
 getErrorMsg ()
 
 isModified ()
 
 parseIniFile ($filename, $processValues=true)
 
 getData ()
 
 getSections ()
 
 getSection ($section)
 
 getValue ($key, $section)
 
 setData ($data)
 
 isHidden ($section)
 
 isEditable ($section)
 
 createSection ($section)
 
 removeSection ($section)
 
 renameSection ($oldname, $newname)
 
 setValue ($key, $value, $section, $createSection=true)
 
 removeKey ($key, $section)
 
 renameKey ($oldname, $newname, $section)
 
 writeIniFile ($filename=null)
 
 _parse_ini_file ($filename)
 
 processValues ()
 
 processValue (&$value)
 
 configMerge ($array1, $array2, $override)
 
 serialize ()
 
 unserialize ($parsedFiles)
 
 getSerializeFilename ($parsedFiles)
 
 checkFileDate ($fileList, $referenceFile)
 

Public Attributes

 $_errorMsg = ''
 
 $_filename = null
 
 $_iniArray = array()
 
 $_comments = array()
 
 $_isModified = false
 
 $_parsedFiles = array()
 
 $_useCache = true
 

Detailed Description

InifileParser provides basic services for parsing a ini file from the file system.

wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id:
class.InifileParser.php 1462 2014-02-04 23:52:27Z iherwig
Note
This class only supports ini files with sections.
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 31 of file class.InifileParser.php.

Member Function Documentation

& InifileParser::getInstance ( )

InifileParser public readonly Interface Returns an instance of the class.

Returns
A reference to the only instance of the Singleton object

Definition at line 51 of file class.InifileParser.php.

Referenced by RPCClient\__construct(), RightsManager\activate(), Controller\assignViewDefaults(), DefaultControlRenderer\configure_color(), DefaultControlRenderer\configure_fckeditor(), DefaultControlRenderer\configure_fileex(), ObjectFactory\createInstanceFromConfig(), I18nUtil\createPOFile(), RightsManager\deactivate(), CreateInstanceController\executeKernel(), DisplayController\executeKernel(), DBUtil\executeScript(), g_getBackupNames(), Message\get(), get_path(), Message\getAll(), BackupController\getBackupDir(), CreateInstanceController\getBaseLocation(), LinkConverter\getBaseUrl(), WCMFInifileParser\getBestActionKey(), AuthUser\getClassDefinitionFiles(), ObjectFactory\getClassfileFromConfig(), RemotingFacade\getClient(), MySQLBackupController\getConnectionParameters(), WCMFInifileParser\getData(), Localization\getDefaultLanguage(), WCMFInifileParser\getErrorMsg(), PageExportController\getExportDir(), SaveController\getImageConstraints(), Localization\getIncludedInputTypes(), SearchUtil\getIndexPath(), FormUtil\getInputFieldDelimiter(), WCMFInifileParser\getInstance(), LockManager\getInstance(), PersistenceFacade\getKnownTypes(), FormUtil\getListMap(), LockManagerRDB\getLockImpl(), PersistenceFacadeImpl\getMapper(), DefaultControlRenderer\getMaxFileSize(), CreateInstanceController\getNewInstanceDatabase(), SimplePagingController\getOIDs(), RemotingFacade\getRemoteUser(), ResourceListController\getResourceBaseDir(), UserManager\getRoleClassName(), TreeViewController\getRootOIDs(), WCMFInifileParser\getSection(), WCMFInifileParser\getSections(), Localization\getSupportedLanguages(), CopyController\getTargetMapper(), Localization\getTranslationType(), SaveController\getUploadDir(), UserManager\getUserClassName(), AuthUserRDB\getUserData(), WCMFInifileParser\getValue(), XMLExportController\initExport(), LoginController\initialize(), SearchUtil\isActivated(), RightsManager\isAnonymous(), ObjectFactory\loadClassDefinitionFromConfig(), AuthUser\login(), NodeToSingleTableMapper\NodeToSingleTableMapper(), UserManagerRDB\openConnection(), WCMFInifileParser\parseIniFile(), DefaultControlRenderer\renderControl(), DefaultValueRenderer\renderValue(), SaveController\saveUploadFile(), View\setup(), smarty_function_configvalue(), SOAPController\soapSearch(), FileUtil\uploadFile(), and UserManager\UserManager().

InifileParser::getErrorMsg ( )

Returns the errorMsg.

Returns
The error message.

Definition at line 65 of file class.InifileParser.php.

References $_errorMsg.

InifileParser::isModified ( )

Check if file is modified.

Returns
True/False whether modified.

Definition at line 74 of file class.InifileParser.php.

References $_isModified.

Referenced by serialize(), and unserialize().

InifileParser::parseIniFile (   $filename,
  $processValues = true 
)

Parses an ini file and puts an array with all the key-values pairs into the object.

Parameters
filenameThe filename of the ini file to parse
processValuesTrue/False whether values should be processed after parsing (e.g. make arrays) [default: true]
Note
ini files referenced in section 'config' key 'include' are parsed afterwards
Returns
True/False whether method succeeded.

Definition at line 86 of file class.InifileParser.php.

References $_parsedFiles, _parse_ini_file(), configMerge(), getValue(), processValue(), processValues(), serialize(), and unserialize().

+ Here is the call graph for this function:

InifileParser::getData ( )

Returns the data of the formerly parsed ini file.

Returns
The data of the parsed ini file.

Definition at line 135 of file class.InifileParser.php.

References $_iniArray.

InifileParser::getSections ( )

Get all section names.

Returns
An array of section names.

Definition at line 144 of file class.InifileParser.php.

InifileParser::getSection (   $section)

Get a section.

Parameters
sectionThe section to return (case insensitive).
Returns
An assoziative array holding the key/value pairs belonging to the section or False if the section does not exist (use getErrorMsg() for detailed information).

Definition at line 155 of file class.InifileParser.php.

References ArrayUtil\get_matching_values_i().

Referenced by createSection(), getValue(), removeSection(), renameSection(), and setValue().

+ Here is the call graph for this function:

InifileParser::getValue (   $key,
  $section 
)

Get a value from the formerly parsed ini file.

Parameters
keyThe name of the entry (case insensitive).
sectionThe section the key belongs to (case insensitive).
Returns
The results of the parsed ini file or False in the case of wrong parameters (use getErrorMsg() for detailed information).

Definition at line 178 of file class.InifileParser.php.

References ArrayUtil\get_matching_values_i(), and getSection().

Referenced by isEditable(), isHidden(), parseIniFile(), removeKey(), and renameKey().

+ Here is the call graph for this function:

InifileParser::setData (   $data)

InifileParser public modification Interface Set ini file data.

Parameters
dataThe ini file data.

Definition at line 206 of file class.InifileParser.php.

InifileParser::isHidden (   $section)

Check if a section is hidden.

Parameters
sectionThe name of the section.
Note
hidden sections are defined as an array in section 'config' key 'hiddenSections'

Definition at line 217 of file class.InifileParser.php.

References getValue(), and processValue().

+ Here is the call graph for this function:

InifileParser::isEditable (   $section)

Check if a section is editable.

Parameters
sectionThe name of the section.
Note
readyonly sections are defined as an array in section 'config' key 'readonlySections'

Definition at line 233 of file class.InifileParser.php.

References getValue(), and processValue().

Referenced by removeKey(), removeSection(), renameKey(), renameSection(), and setValue().

+ Here is the call graph for this function:

InifileParser::createSection (   $section)

Create a section.

Parameters
sectionThe name of the section (will be trimmed).
Returns
True/false whether successful.

Definition at line 249 of file class.InifileParser.php.

References getSection().

+ Here is the call graph for this function:

InifileParser::removeSection (   $section)

Remove a section.

Parameters
sectionThe name of the section.
Returns
True/false whether successful.

Definition at line 272 of file class.InifileParser.php.

References getSection(), and isEditable().

+ Here is the call graph for this function:

InifileParser::renameSection (   $oldname,
  $newname 
)

Rename a section.

Parameters
oldnameThe name of the section.
newnameThe new name of the section (will be trimmed).
Returns
True/false whether successful.

Definition at line 292 of file class.InifileParser.php.

References getSection(), isEditable(), and ArrayUtil\key_array_rename().

+ Here is the call graph for this function:

InifileParser::setValue (   $key,
  $value,
  $section,
  $createSection = true 
)

Create a key/value pair in a section.

Parameters
keyThe name of the key (will be trimmed).
valueThe value of the key.
sectionThe name of the section.
createSectionThe name of the section.
Returns
True/False whether successful.

Definition at line 325 of file class.InifileParser.php.

References getSection(), and isEditable().

+ Here is the call graph for this function:

InifileParser::removeKey (   $key,
  $section 
)

Remove a key from a section.

Parameters
keyThe name of the key.
sectionThe name of the section.
Returns
True/False whether successful.

Definition at line 351 of file class.InifileParser.php.

References getValue(), and isEditable().

+ Here is the call graph for this function:

InifileParser::renameKey (   $oldname,
  $newname,
  $section 
)

Rename a key in a section.

Parameters
oldnameThe name of the section.
newnameThe new name of the section (will be trimmed).
sectionThe name of the section.
Returns
True/false whether successful.

Definition at line 372 of file class.InifileParser.php.

References getValue(), isEditable(), and ArrayUtil\key_array_rename().

+ Here is the call graph for this function:

InifileParser::writeIniFile (   $filename = null)

Write the ini data to a file.

Parameters
filenameThe filename to write to, if null the original file will be used [default: null].
Returns
True/False whether successful

Definition at line 402 of file class.InifileParser.php.

References $_filename.

InifileParser::_parse_ini_file (   $filename)

InifileParser private Interface Load in the ini file specified in filename, and return the settings in a multidimensional array, with the section names and settings included.

Parameters
filenameThe filename of the ini file to parse
Returns
An associative array containing the data / false if any error occured
Author
: Sebastien Cevey seb@c.nosp@m.ine7.nosp@m..net Original Code base: info@.nosp@m.mega.nosp@m.man.n.nosp@m.l Added comment handling/Removed process sections flag: Ingo Herwig

Definition at line 459 of file class.InifileParser.php.

References WCMFException\throwEx().

Referenced by parseIniFile().

+ Here is the call graph for this function:

InifileParser::processValues ( )

Process the values in the ini array. This method turns string values that hold array definitions (comma separated values enclosed by curly brackets) into array values.

Attention
Internal use only.

Definition at line 511 of file class.InifileParser.php.

Referenced by parseIniFile().

InifileParser::processValue ( $value)

Process the values in the ini array. This method turns string values that hold array definitions (comma separated values enclosed by curly brackets) into array values.

Parameters
valueA reference to the value
Attention
Internal use only.

Definition at line 523 of file class.InifileParser.php.

References StringUtil\quotesplit().

Referenced by isEditable(), isHidden(), and parseIniFile().

+ Here is the call graph for this function:

InifileParser::configMerge (   $array1,
  $array2,
  $override 
)

Merge two arrays, preserving entries in first one unless they are overridden by ones in the second.

Parameters
array1First array.
array2Second array.
overrideTrue/False whether values defined in array1 should be overriden by values defined in array2.
Returns
The merged array.

Definition at line 549 of file class.InifileParser.php.

Referenced by parseIniFile().

InifileParser::serialize ( )

Store the instance in the filesystem. If the instance is modified, this call is ignored.

Definition at line 569 of file class.InifileParser.php.

References getSerializeFilename(), and isModified().

Referenced by parseIniFile().

+ Here is the call graph for this function:

InifileParser::unserialize (   $parsedFiles)

Retrieve parsed ini data from the filesystem and update the current instance. If the current instance is modified or the last file given in parsedFiles is newer than the seriralized data, this call is ignored.

Parameters
parsedFilesAn array of ini filenames that must be contained in the data.
True/Falsewether the data could be retrieved or not

Definition at line 591 of file class.InifileParser.php.

References checkFileDate(), getSerializeFilename(), and isModified().

Referenced by parseIniFile().

+ Here is the call graph for this function:

InifileParser::getSerializeFilename (   $parsedFiles)

Get the filename for the serialized data that correspond to the the given ini file sequence.

Parameters
parsedFilesAn array of parsed filenames

Definition at line 635 of file class.InifileParser.php.

Referenced by serialize(), and unserialize().

InifileParser::checkFileDate (   $fileList,
  $referenceFile 
)

Check if one file in fileList is newer than the referenceFile.

Parameters
fileListAn array of files
referenceFileThe file to check against
Returns
True, if one of the files is newer, false else

Definition at line 649 of file class.InifileParser.php.

Referenced by unserialize().

Member Data Documentation

InifileParser::$_errorMsg = ''

Definition at line 33 of file class.InifileParser.php.

Referenced by getErrorMsg().

InifileParser::$_filename = null

Definition at line 34 of file class.InifileParser.php.

Referenced by writeIniFile().

InifileParser::$_iniArray = array()

Definition at line 35 of file class.InifileParser.php.

Referenced by getData().

InifileParser::$_comments = array()

Definition at line 36 of file class.InifileParser.php.

InifileParser::$_isModified = false

Definition at line 39 of file class.InifileParser.php.

Referenced by isModified().

InifileParser::$_parsedFiles = array()

Definition at line 40 of file class.InifileParser.php.

Referenced by parseIniFile().

InifileParser::$_useCache = true

Definition at line 41 of file class.InifileParser.php.


The documentation for this class was generated from the following file: