Public Member Functions | |
__construct ($xml_path= '') | |
__destruct () | |
load ($xml_path) | |
setCacheDir ($cache_dir) | |
validate ($fields_=null) | |
arrayTrim ($array) | |
error ($field, $msg) | |
getLastError () | |
addRule ($name, $rule= '') | |
removeRule ($name) | |
addFilter ($name, $filter= '') | |
removeFilter ($name) | |
applyRule ($name, $value) | |
mbStrLen ($str) | |
getJsPath () | |
_compile2js () | |
Public Attributes | |
$_cache_dir = '' | |
$_last_error | |
$_xml_ruleset = NULL | |
$_rules | |
$_filters | |
$_messages | |
$_fieldNames | |
$_has_mb_func | |
$_version = '1.0' | |
$_xml_path = '' | |
Definition at line 10 of file Validator.class.php.
Validator::__construct | ( | $xml_path = '' | ) |
Validator::__destruct | ( | ) |
Definition at line 106 of file Validator.class.php.
Validator::_compile2js | ( | ) |
Compile a ruleset to a javascript file
Definition at line 695 of file Validator.class.php.
Validator::addFilter | ( | $name, | |
$filter = '' |
|||
) |
add filter to filter list
string | $name | rule name |
string | $filter | filter |
Definition at line 554 of file Validator.class.php.
Validator::addRule | ( | $name, | |
$rule = '' |
|||
) |
Add a new rule
string | $name | rule name |
mixed | $rule |
Definition at line 506 of file Validator.class.php.
Validator::applyRule | ( | $name, | |
$value | |||
) |
Find whether the field is valid with the rule
string | $name | rule name |
string | $value | a value to be validated |
Definition at line 608 of file Validator.class.php.
Validator::arrayTrim | ( | $array | ) |
apply trim recursive
string | array | $array |
Definition at line 443 of file Validator.class.php.
Validator::error | ( | $field, | |
$msg | |||
) |
Log an error
$msg | error message |
Definition at line 463 of file Validator.class.php.
Validator::getJsPath | ( | ) |
Returns compiled javascript file path. The path begins from XE root directory.
Definition at line 653 of file Validator.class.php.
Validator::getLastError | ( | ) |
Returns the last error infomation including a field name and an error message.
Definition at line 495 of file Validator.class.php.
Validator::load | ( | $xml_path | ) |
Load a xml file
string | $xml_path | A file name to be loaded |
Definition at line 117 of file Validator.class.php.
Validator::mbStrLen | ( | $str | ) |
if not supported 'mb_strlen' function, this method can use.
string | $str |
Definition at line 639 of file Validator.class.php.
Validator::removeFilter | ( | $name | ) |
remove filter from filter list
string | $name | rule name |
Definition at line 597 of file Validator.class.php.
Validator::removeRule | ( | $name | ) |
Remove a rule
string | $name | rule name |
Definition at line 543 of file Validator.class.php.
Validator::setCacheDir | ( | $cache_dir | ) |
Set root cache directory
string | $cache_dir | Root cache directory |
Definition at line 233 of file Validator.class.php.
Validator::validate | ( | $fields_ = null | ) |
Validate the fields. If the fields aren't passed, validation will be execute on the Context variables.
array | $fields | Target fields. The keys of the array represents field's name, its values represents field's value. |
Definition at line 246 of file Validator.class.php.
Validator::$_cache_dir = '' |
Definition at line 17 of file Validator.class.php.
Validator::$_fieldNames |
Definition at line 53 of file Validator.class.php.
Validator::$_filters |
Definition at line 41 of file Validator.class.php.
Validator::$_has_mb_func |
Definition at line 59 of file Validator.class.php.
Validator::$_last_error |
Definition at line 23 of file Validator.class.php.
Validator::$_messages |
Definition at line 47 of file Validator.class.php.
Validator::$_rules |
Definition at line 35 of file Validator.class.php.
Validator::$_version = '1.0' |
Definition at line 65 of file Validator.class.php.
Validator::$_xml_path = '' |
Definition at line 71 of file Validator.class.php.
Validator::$_xml_ruleset = NULL |
Definition at line 29 of file Validator.class.php.