ILIAS
Release_5_0_x_branch Revision 61816
|
Parses string representations into their corresponding native PHP variable type. More...
Public Member Functions | |
parse ($var, $type, $allow_null=false) | |
Validate a variable according to type. |
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 |
Lookup table of allowed types. | |
static | $stringTypes |
Lookup table of types that are string, and can have aliases or allowed value lists. |
Protected Member Functions | |
parseImplementation ($var, $type, $allow_null) | |
Actually implements the parsing. | |
error ($msg) | |
Throws an exception. | |
errorInconsistent ($class, $type) | |
Throws an inconsistency exception. | |
errorGeneric ($var, $type) | |
Generic error for if a type didn't work. |
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.
|
protected |
Throws an exception.
HTMLPurifier_VarParserException |
Definition at line 147 of file VarParser.php.
Referenced by errorGeneric(), and parse().
|
protected |
Generic error for if a type didn't work.
mixed | $var | |
int | $type |
Definition at line 174 of file VarParser.php.
References error(), and getTypeName().
Referenced by parse(), and HTMLPurifier_VarParser_Flexible\parseImplementation().
|
protected |
Throws an inconsistency exception.
string | $class | |
int | $type |
HTMLPurifier_Exception |
Definition at line 161 of file VarParser.php.
References getTypeName().
Referenced by parse(), and HTMLPurifier_VarParser_Flexible\parseImplementation().
|
static |
int | $type |
Definition at line 184 of file VarParser.php.
References $types.
Referenced by errorGeneric(), errorInconsistent(), and HTMLPurifier_Config\set().
|
final |
Validate a variable according to type.
It may return NULL as a valid type if $allow_null is true.
mixed | $var | Variable to validate |
int | $type | Type of variable, see HTMLPurifier_VarParser->types |
bool | $allow_null | Whether or not to permit null as a value |
HTMLPurifier_VarParserException |
Definition at line 61 of file VarParser.php.
References $types, error(), errorGeneric(), errorInconsistent(), and parseImplementation().
|
protected |
Actually implements the parsing.
Base implementation does not do anything to $var. Subclasses should overload this!
mixed | $var | |
int | $type | |
bool | $allow_null |
Reimplemented in HTMLPurifier_VarParser_Flexible, and HTMLPurifier_VarParser_Native.
Definition at line 138 of file VarParser.php.
Referenced by parse().
|
static |
Lookup table of types that are string, and can have aliases or allowed value lists.
Definition at line 44 of file VarParser.php.
Referenced by HTMLPurifier_ConfigSchema_Validator\validateDirective().
|
static |
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.
Referenced by HTMLPurifier_ConfigSchema\add(), getTypeName(), parse(), and HTMLPurifier_ConfigSchema_Validator\validateDirective().
const HTMLPurifier_VarParser::ALIST = 9 |
Definition at line 18 of file VarParser.php.
Referenced by HTMLPurifier_Printer_ConfigForm_default\render().
const HTMLPurifier_VarParser::BOOL = 7 |
Definition at line 16 of file VarParser.php.
Referenced by HTMLPurifier_Printer_ConfigForm\__construct().
const HTMLPurifier_VarParser::FLOAT = 6 |
Definition at line 15 of file VarParser.php.
const HTMLPurifier_VarParser::HASH = 10 |
Definition at line 19 of file VarParser.php.
Referenced by HTMLPurifier_Printer_ConfigForm_default\render().
const HTMLPurifier_VarParser::INT = 5 |
Definition at line 14 of file VarParser.php.
const HTMLPurifier_VarParser::ISTRING = 2 |
Definition at line 11 of file VarParser.php.
const HTMLPurifier_VarParser::ITEXT = 4 |
Definition at line 13 of file VarParser.php.
Referenced by HTMLPurifier_Printer_ConfigForm_default\render().
const HTMLPurifier_VarParser::LOOKUP = 8 |
Definition at line 17 of file VarParser.php.
Referenced by HTMLPurifier_Printer_ConfigForm_default\render().
const HTMLPurifier_VarParser::MIXED = 11 |
Definition at line 20 of file VarParser.php.
Referenced by HTMLPurifier_Printer_ConfigForm_default\render().
const HTMLPurifier_VarParser::STRING = 1 |
Definition at line 10 of file VarParser.php.
const HTMLPurifier_VarParser::TEXT = 3 |
Definition at line 12 of file VarParser.php.
Referenced by HTMLPurifier_Printer_ConfigForm_default\render().