Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 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: 198 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

HTMLPurifier_VarParser:: (6 methods):
  parse()
  parseImplementation()
  error()
  errorInconsistent()
  errorGeneric()
  getTypeName()


Class: HTMLPurifier_VarParser  - X-Ref

Parses string representations into their corresponding native PHP
variable type. The base implementation does a simple type-check.

parse($var, $type, $allow_null = false)   X-Ref
Validate a variable according to type.
It may return NULL as a valid type if $allow_null is true.

param: mixed $var Variable to validate
param: int $type Type of variable, see HTMLPurifier_VarParser->types
param: bool $allow_null Whether or not to permit null as a value
return: string Validated and type-coerced variable

parseImplementation($var, $type, $allow_null)   X-Ref
Actually implements the parsing. Base implementation does not
do anything to $var. Subclasses should overload this!

param: mixed $var
param: int $type
param: bool $allow_null
return: string

error($msg)   X-Ref
Throws an exception.


errorInconsistent($class, $type)   X-Ref
Throws an inconsistency exception.

param: string $class
param: int $type

errorGeneric($var, $type)   X-Ref
Generic error for if a type didn't work.

param: mixed $var
param: int $type

getTypeName($type)   X-Ref

param: int $type
return: string