DataValidator Class Reference
Public Member Functions |
| | setDataList ($dataList) |
| | getDataList () |
| | addRule ($dataKey, $errorMessage, $rule, $xtraParamList=array()) |
| | validate ($strict=false) |
| | getWrongDataKeyList () |
| | getRightDataKeyList () |
| | getErrorList ($dataKey=null) |
| | rl_required ($data) |
| | rl_numeric ($data) |
| | rl_alphanumeric ($data) |
| | rl_lettersonly ($data) |
| | rl_regex ($data, $rx) |
| | rl_compare ($dataA, $dataB) |
| | rl_nonzero ($data) |
| | rl_min ($data, $value) |
| | rl_max ($data, $value) |
| | rl_range ($data, $min, $max) |
| | rl_maxlength ($data, $length) |
| | rl_minlength ($data, $length) |
| | rl_rangelength ($data, $minlength, $maxlength) |
| | rl_nopunctuation ($data) |
| | rl_email ($data) |
| | rl_ip ($data) |
| | rl_hostname ($data) |
Data Fields |
| | $dataList = array() |
| | $errorList = array() |
| | $ruleNameList = array() |
| | $ruleParamList = array() |
| | $ruleRelDataKeyList = array() |
| | $ruleRelErrorList = array() |
| | $requiredDataList = array() |
| | $requiredErrorList = array() |
Detailed Description
since Claroline 1.9, use utils/validator.lib.php instead
Definition at line 46 of file datavalidator.lib.php.
Member Function Documentation
| addRule |
( |
$ |
dataKey, |
|
|
$ |
errorMessage, |
|
|
$ |
rule, |
|
|
$ |
xtraParamList = array() | |
|
) |
| | |
- Parameters:
-
| string | $dataKey |
| string | $errorMessage returned if the data doesn't obey to the rule |
| mixed | (string or ressource) $rule The validator class provides a predefined rules (listed below). It is possible to call them just by entering the string name. predefined rules : required, numeric, alphanumeric, lettersonly, regex, compare, nonzero, min, max, range, maxlength, minlength, rangelength, nopunctuation, email, ip, hostname |
| array | $xtraParamList additional parameters required for the function rule |
Definition at line 88 of file datavalidator.lib.php.
| getErrorList |
( |
$ |
dataKey = null |
) |
|
- Parameters:
-
| $dataKey | filter returning only error messages related to this data key |
- Returns:
- array
Definition at line 220 of file datavalidator.lib.php.
| rl_alphanumeric |
( |
$ |
data |
) |
|
| rl_compare |
( |
$ |
dataA, |
|
|
$ |
dataB | |
|
) |
| | |
Predefined validation rule
- Parameters:
-
| $data | |
| string | $rx regular expression |
- Returns:
- boolean
Definition at line 305 of file datavalidator.lib.php.
| rl_lettersonly |
( |
$ |
data |
) |
|
| rl_max |
( |
$ |
data, |
|
|
$ |
value | |
|
) |
| | |
| rl_maxlength |
( |
$ |
data, |
|
|
$ |
length | |
|
) |
| | |
Predefined validation rule
- Parameters:
-
| string | $data |
| int | $length maximum number of characters |
- Returns:
- boolean
Definition at line 365 of file datavalidator.lib.php.
| rl_min |
( |
$ |
data, |
|
|
$ |
value | |
|
) |
| | |
| rl_minlength |
( |
$ |
data, |
|
|
$ |
length | |
|
) |
| | |
Predefined validation rule
- Parameters:
-
| string | $data |
| int | $length minimum number of characters |
- Returns:
- boolean
Definition at line 377 of file datavalidator.lib.php.
| rl_nopunctuation |
( |
$ |
data |
) |
|
| rl_range |
( |
$ |
data, |
|
|
$ |
min, |
|
|
$ |
max | |
|
) |
| | |
Predefined validation rule
- Parameters:
-
| $data | |
| $min | minimum value |
| $max | maximum value |
- Returns:
- boolean
Definition at line 353 of file datavalidator.lib.php.
| rl_rangelength |
( |
$ |
data, |
|
|
$ |
minlength, |
|
|
$ |
maxlength | |
|
) |
| | |
Predefined validation rule
- Parameters:
-
| string | $data |
| int | $minlength minimum number of characters |
| int | $maxlength maximum number of characters |
- Returns:
- boolean
Definition at line 390 of file datavalidator.lib.php.
| rl_regex |
( |
$ |
data, |
|
|
$ |
rx | |
|
) |
| | |
PREDEFINED RULES Predefined validation rule
- Parameters:
-
- Returns:
- boolean
Definition at line 249 of file datavalidator.lib.php.
| setDataList |
( |
$ |
dataList |
) |
|
| validate |
( |
$ |
strict = false |
) |
|
- Parameters:
-
| bool | $strict 'true' apply every rule on every dataKey, even for not required data 'false' (default) leave rule for emtpy data not required |
- Returns:
- boolean
Definition at line 118 of file datavalidator.lib.php.
Field Documentation
| $requiredDataList = array() |
| $requiredErrorList = array() |
| $ruleRelDataKeyList = array() |
| $ruleRelErrorList = array() |
The documentation for this class was generated from the following file: