API - XOOPS 2.5.11 Beta 2
By monxoops.fr
HTMLPurifier_StringHashParser Class Reference

Public Member Functions

 parseFile ($file)
 
 parseMultiFile ($file)
 

Data Fields

 $default = 'ID'
 

Protected Member Functions

 parseHandle ($fh)
 

Detailed Description

Parses string hash files. File format is as such:

 DefaultKeyValue
 KEY: Value
 KEY2: Value2
 --MULTILINE-KEY--
 Multiline
 value.

Which would output something similar to:

 array(
     'ID' => 'DefaultKeyValue',
     'KEY' => 'Value',
     'KEY2' => 'Value2',
     'MULTILINE-KEY' => "Multiline\nvalue.\n",
 )

We use this as an easy to use file-format for configuration schema files, but the class itself is usage agnostic.

You can use -— to forcibly terminate parsing of a single string-hash; this marker is used in multi string-hashes to delimit boundaries.

Member Function Documentation

◆ parseFile()

parseFile (   $file)

Parses a file that contains a single string-hash.

Parameters
string$file
Returns
array
Here is the call graph for this function:

◆ parseHandle()

parseHandle (   $fh)
protected

Internal parser that acepts a file handle.

Note
While it's possible to simulate in-memory parsing by using custom stream wrappers, if such a use-case arises we should factor out the file handle into its own class.
Parameters
resource$fhFile handle with pointer at start of valid string-hash block.
Returns
array
Here is the caller graph for this function:

◆ parseMultiFile()

parseMultiFile (   $file)

Parses a file that contains multiple string-hashes delimited by '-—'

Parameters
string$file
Returns
array
Here is the call graph for this function:

Field Documentation

◆ $default

$default = 'ID'

@type string


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