|
| parse ($var, $type, $allow_null=false) |
| Validate a variable according to type.
|
|
|
const | ALIST = 9 |
|
const | C_BOOL = 7 |
|
const | C_FLOAT = 6 |
|
const | C_INT = 5 |
|
const | C_MIXED = 11 |
|
const | C_STRING = 1 |
|
const | HASH = 10 |
|
const | ISTRING = 2 |
|
const | ITEXT = 4 |
|
const | LOOKUP = 8 |
|
const | TEXT = 3 |
|
|
static | $stringTypes |
| Lookup table of types that are string, and can have aliases or allowed value lists.
|
|
static | $types |
| Lookup table of allowed types.
|
|
◆ error()
HTMLPurifier_VarParser::error |
( |
| $msg | ) |
|
|
protectedinherited |
Throws an exception.
- Exceptions
-
◆ errorGeneric()
HTMLPurifier_VarParser::errorGeneric |
( |
| $var, |
|
|
| $type ) |
|
protectedinherited |
Generic error for if a type didn't work.
- Parameters
-
◆ errorInconsistent()
HTMLPurifier_VarParser::errorInconsistent |
( |
| $class, |
|
|
| $type ) |
|
protectedinherited |
Throws an inconsistency exception.
- Note
- This should not ever be called. It would be called if we extend the allowed values of HTMLPurifier_VarParser without updating subclasses.
- Parameters
-
- Exceptions
-
◆ evalExpression()
HTMLPurifier_VarParser_Native::evalExpression |
( |
| $expr | ) |
|
|
protected |
- Parameters
-
- Return values
-
- Exceptions
-
◆ getTypeName()
static HTMLPurifier_VarParser::getTypeName |
( |
| $type | ) |
|
|
staticinherited |
◆ parse()
HTMLPurifier_VarParser::parse |
( |
| $var, |
|
|
| $type, |
|
|
| $allow_null = false ) |
|
finalinherited |
Validate a variable according to type.
It may return NULL as a valid type if $allow_null is true.
- Parameters
-
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 |
- Return values
-
string | Validated and type-coerced variable |
- Exceptions
-
◆ parseImplementation()
HTMLPurifier_VarParser_Native::parseImplementation |
( |
| $var, |
|
|
| $type, |
|
|
| $allow_null ) |
|
protected |
◆ $stringTypes
HTMLPurifier_VarParser::$stringTypes |
|
staticinherited |
Initial value:= array(
self::C_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.
◆ $types
HTMLPurifier_VarParser::$types |
|
staticinherited |
Initial value:= array(
'string' => self::C_STRING,
'istring' => self::ISTRING,
'text' => self::TEXT,
'itext' => self::ITEXT,
'int' => self::C_INT,
'float' => self::C_FLOAT,
'bool' => self::C_BOOL,
'lookup' => self::LOOKUP,
'list' => self::ALIST,
'hash' => self::HASH,
'mixed' => self::C_MIXED
)
Lookup table of allowed types.
Mainly for backwards compatibility, but also convenient for transforming string type names to the integer constants.
The documentation for this class was generated from the following file:
- lib/htmlpurifier/HTMLPurifier/VarParser/Native.php