Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.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