Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

(no description)

File Size: 136 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

HTMLPurifier_StringHashParser:: (3 methods):
  parseFile()
  parseMultiFile()
  parseHandle()


Class: HTMLPurifier_StringHashParser  - X-Ref

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.
parseFile($file)   X-Ref
Parses a file that contains a single string-hash.

param: string $file
return: array

parseMultiFile($file)   X-Ref
Parses a file that contains multiple string-hashes delimited by '----'

param: string $file
return: array

parseHandle($fh)   X-Ref
Internal parser that acepts a file handle.

param: resource $fh File handle with pointer at start of valid string-hash
return: array