Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is 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