|
Moodle
2.2.1
http://www.collinsharper.com
|

Public Member Functions | |
| parse ($var, $type, $allow_null=false) | |
Static Public Member Functions | |
| static | getTypeName ($type) |
Data Fields | |
| const | STRING = 1 |
| const | ISTRING = 2 |
| const | TEXT = 3 |
| const | ITEXT = 4 |
| const | INT = 5 |
| const | FLOAT = 6 |
| const | BOOL = 7 |
| const | LOOKUP = 8 |
| const | ALIST = 9 |
| const | HASH = 10 |
| const | MIXED = 11 |
Static Public Attributes | |
| static | $types |
| static | $stringTypes |
Protected Member Functions | |
| parseImplementation ($var, $type, $allow_null) | |
| error ($msg) | |
| errorInconsistent ($class, $type) | |
| errorGeneric ($var, $type) | |
Parses string representations into their corresponding native PHP variable type. The base implementation does a simple type-check.
Definition at line 7 of file VarParser.php.
| error | ( | $ | msg | ) | [protected] |
Throws an exception.
Definition at line 120 of file VarParser.php.

| errorGeneric | ( | $ | var, |
| $ | type | ||
| ) | [protected] |
Generic error for if a type didn't work.
Definition at line 137 of file VarParser.php.


| errorInconsistent | ( | $ | class, |
| $ | type | ||
| ) | [protected] |
Throws an inconsistency exception.
Definition at line 130 of file VarParser.php.


| static getTypeName | ( | $ | type | ) | [static] |
| parse | ( | $ | var, |
| $ | type, | ||
| $ | allow_null = false |
||
| ) | [final] |
Validate a variable according to type. Throws HTMLPurifier_VarParserException if invalid. It may return NULL as a valid type if $allow_null is true.
| $var | Variable to validate |
| $type | Type of variable, see HTMLPurifier_VarParser->types |
| $allow_null | Whether or not to permit null as a value |
Definition at line 61 of file VarParser.php.

| parseImplementation | ( | $ | var, |
| $ | type, | ||
| $ | allow_null | ||
| ) | [protected] |
Actually implements the parsing. Base implementation is to not do anything to $var. Subclasses should overload this!
Reimplemented in HTMLPurifier_VarParser_Flexible, and HTMLPurifier_VarParser_Native.
Definition at line 113 of file VarParser.php.

$stringTypes [static] |
array( self::STRING => true, self::ISTRING => true, self::TEXT => true, self::ITEXT => true, )
Lookup table of types that are string, and can have aliases or allowed value lists.
Definition at line 44 of file VarParser.php.
$types [static] |
array( 'string' => self::STRING, 'istring' => self::ISTRING, 'text' => self::TEXT, 'itext' => self::ITEXT, 'int' => self::INT, 'float' => self::FLOAT, 'bool' => self::BOOL, 'lookup' => self::LOOKUP, 'list' => self::ALIST, 'hash' => self::HASH, 'mixed' => self::MIXED )
Lookup table of allowed types. Mainly for backwards compatibility, but also convenient for transforming string type names to the integer constants.
Definition at line 26 of file VarParser.php.
| const ALIST = 9 |
Definition at line 18 of file VarParser.php.
| const BOOL = 7 |
Definition at line 16 of file VarParser.php.
| const FLOAT = 6 |
Definition at line 15 of file VarParser.php.
| const HASH = 10 |
Definition at line 19 of file VarParser.php.
| const INT = 5 |
Definition at line 14 of file VarParser.php.
| const ISTRING = 2 |
Definition at line 11 of file VarParser.php.
| const ITEXT = 4 |
Definition at line 13 of file VarParser.php.
| const LOOKUP = 8 |
Definition at line 17 of file VarParser.php.
| const MIXED = 11 |
Definition at line 20 of file VarParser.php.
| const STRING = 1 |
Definition at line 10 of file VarParser.php.
| const TEXT = 3 |
Definition at line 12 of file VarParser.php.