XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
Validator Class Reference

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 = ''
 

Detailed Description

Definition at line 10 of file Validator.class.php.

Constructor & Destructor Documentation

Validator::__construct (   $xml_path = '')
Parameters
string$xml_path
Returns
void

Definition at line 78 of file Validator.class.php.

Validator::__destruct ( )
Returns
void

Definition at line 106 of file Validator.class.php.

Member Function Documentation

Validator::_compile2js ( )

Compile a ruleset to a javascript file

Returns
string

Definition at line 695 of file Validator.class.php.

Validator::addFilter (   $name,
  $filter = '' 
)

add filter to filter list

Parameters
string$namerule name
string$filterfilter
Returns
void

Definition at line 554 of file Validator.class.php.

Validator::addRule (   $name,
  $rule = '' 
)

Add a new rule

Parameters
string$namerule name
mixed$rule
Returns
void

Definition at line 506 of file Validator.class.php.

Validator::applyRule (   $name,
  $value 
)

Find whether the field is valid with the rule

Parameters
string$namerule name
string$valuea value to be validated
Returns
boolean TRUE if the field is valid, FALSE otherwise.

Definition at line 608 of file Validator.class.php.

Validator::arrayTrim (   $array)

apply trim recursive

Parameters
string | array$array
Returns
string|array

Definition at line 443 of file Validator.class.php.

Validator::error (   $field,
  $msg 
)

Log an error

Parameters
$msgerror message
Returns
boolean always false

Definition at line 463 of file Validator.class.php.

Validator::getJsPath ( )

Returns compiled javascript file path. The path begins from XE root directory.

Returns
string Compiled JavaScript file path

Definition at line 653 of file Validator.class.php.

Validator::getLastError ( )

Returns the last error infomation including a field name and an error message.

Returns
array The last error infomation

Definition at line 495 of file Validator.class.php.

Validator::load (   $xml_path)

Load a xml file

Parameters
string$xml_pathA file name to be loaded
Returns
boolean

Definition at line 117 of file Validator.class.php.

Validator::mbStrLen (   $str)

if not supported 'mb_strlen' function, this method can use.

Parameters
string$str
Returns
int

Definition at line 639 of file Validator.class.php.

Validator::removeFilter (   $name)

remove filter from filter list

Parameters
string$namerule name
Returns
void

Definition at line 597 of file Validator.class.php.

Validator::removeRule (   $name)

Remove a rule

Parameters
string$namerule name
Returns
void

Definition at line 543 of file Validator.class.php.

Validator::setCacheDir (   $cache_dir)

Set root cache directory

Parameters
string$cache_dirRoot cache directory
Returns
void

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.

Parameters
array$fieldsTarget fields. The keys of the array represents field's name, its values represents field's value.
Returns
boolean TRUE if it is valid, FALSE otherwise.

Definition at line 246 of file Validator.class.php.

Member Data Documentation

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.


The documentation for this class was generated from the following file: