|
| getValue () |
|
| setValue (&$value) |
|
| addRule ($type, $prm=null, $msg=null) |
|
| hasRule ($type) |
|
| delRule ($type) |
|
| getRules () |
|
| isValid () |
|
| isRequired ($val, $prm=null) |
|
| isNumeric ($val, $prm=null) |
|
| isInt ($val, $prm=null) |
|
| isDifferent ($val, $prm=null) |
|
| isIn ($val, $prm=null) |
|
| isEqual ($val, $prm=null) |
|
| isGroupedFields ($val, $prm=null) |
|
| isAtLeastOneField ($val, $prm=null) |
|
| isCallback ($val, $prm=null) |
|
| isUrl ($val, $prm=null) |
|
| isEmail ($val, $prm=null) |
|
| isDbUnique ($val, array $prm) |
|
| isDbExists ($val, array $prm) |
|
| setMessage ($name, $msg) |
|
| getErrors () |
|
| getAttr ($name) |
|
| setAttr ($name, $value) |
|
| getCfg () |
|
Class using for validate a data
Definition at line 10 of file valid.class.php.
◆ addRule()
addRule |
( |
|
$type, |
|
|
|
$prm = null , |
|
|
|
$msg = null |
|
) |
| |
Add a rule from the valdiation
- Parameters
-
string | $type | Validation type |
array | $prm | Parameter for this rule |
string | $msg | The error message |
Definition at line 44 of file valid.class.php.
◆ afterInit()
Call just after the configuration initialisation
Definition at line 40 of file object.class.php.
◆ beforeInit()
Call just before the configuration initialisation
Definition at line 35 of file object.class.php.
◆ delRule()
Delete a rule from the valdiation
- Parameters
-
string | $type | Validation type |
Definition at line 67 of file valid.class.php.
◆ getAttr()
Get an attribute
- Parameters
-
string | $name | Attribute name |
- Returns
- mixed|null The attribute or null if not set
Definition at line 48 of file object.class.php.
◆ getCfg()
Get the configuration object
- Returns
- config
Definition at line 67 of file object.class.php.
◆ getErrors()
Get all the errors for the last validation
- Returns
- array The errors, empty if no errors
Definition at line 375 of file valid.class.php.
◆ getMessage()
Get a message for an error
- Parameters
-
- Returns
- string The message
Definition at line 356 of file valid.class.php.
◆ getRules()
Get the validation rules array
- Returns
- array
Definition at line 76 of file valid.class.php.
◆ getValue()
◆ hasRule()
Indicates if a rule is set for the valid object;
- Parameters
-
strong | $type | Validation type |
- Returns
- bool
Definition at line 58 of file valid.class.php.
◆ isAtLeastOneField()
isAtLeastOneField |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if all at least one of the paramtred fields is present
- Parameters
-
mixed | $val | The value to test against (not used) |
array | $prm | An array with the keys:
- form form: The form where to retrieve the values
- array fields: The fields names
|
- Returns
- bool True if valid
Definition at line 239 of file valid.class.php.
◆ isCallback()
isCallback |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if the value using a callback
- Parameters
-
mixed | $val | The value to test against |
mixed | $prm | A valid PHP callback. This callback should true if valid or false if not or a string if a specific message should be used |
- Returns
- bool True if valid
Definition at line 261 of file valid.class.php.
◆ isDbExists()
isDbExists |
( |
|
$val, |
|
|
array |
$prm |
|
) |
| |
Check if the value exists in a database table
- Parameters
-
mixed | $val | The value to test against |
array | $prm | The parameter for the test with keys:
- db_table|string: Table object or tablename (required)
- string field: Fieldname to test against
|
- Returns
- bool True if valid
Definition at line 337 of file valid.class.php.
◆ isDbUnique()
isDbUnique |
( |
|
$val, |
|
|
array |
$prm |
|
) |
| |
Check if the value is not present in a database table
- Parameters
-
mixed | $val | The value to test against |
array | $prm | The parameter for the test with keys:
- mixed value: a value to ignore the test
- db_table|string: Table object or tablename (required)
- string field: Fieldname to test against
|
- Returns
- bool True if valid
Definition at line 312 of file valid.class.php.
◆ isDifferent()
isDifferent |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if the value is different. Strandard PHP test is done
- Parameters
-
mixed | $val | The value to test against |
mixed | $prm | The parameter for the test. Key 0 should be here and is the value to test against |
- Returns
- bool True if valid
Definition at line 153 of file valid.class.php.
◆ isEmail()
isEmail |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if the value is an email address
- Parameters
-
mixed | $val | The value to test against |
null | $prm | The parameter for the test (not used here) |
- Returns
- bool True if valid
Definition at line 294 of file valid.class.php.
◆ isEqual()
isEqual |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if the value is equal to another
- Parameters
-
mixed | $val | The value to test against |
form_abstract | string | $prm | The parameter for the test. If form_abstract is provided, the rawValue will be used for the test |
- Returns
- bool True if valid
Definition at line 189 of file valid.class.php.
◆ isGroupedFields()
isGroupedFields |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if all parametred fields of a form are all eiher empty or all present
- Parameters
-
mixed | $val | The value to test against (not used) |
array | $prm | An array with the keys:
- form form: The form where to retrieve the values
- array fields: The grouped fields names
|
- Returns
- bool True if valid
Definition at line 214 of file valid.class.php.
◆ isIn()
isIn |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if the value is contained in an array
- Parameters
-
mixed | $val | The value to test against |
array | string | $prm | The parameter for the test Array to search in or string to test directly against |
- Returns
- bool True if valid
Definition at line 168 of file valid.class.php.
◆ isInt()
isInt |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if the value is integer
- Parameters
-
mixed | $val | The value to test against |
null | $prm | The parameter for the test (not used here) |
- Returns
- bool True if valid
Definition at line 138 of file valid.class.php.
◆ isNumeric()
isNumeric |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if the value is numeric
- Parameters
-
mixed | $val | The value to test against |
null | $prm | The parameter for the test (not used here) |
- Returns
- bool True if valid
Definition at line 123 of file valid.class.php.
◆ isRequired()
isRequired |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if the value is here
- Parameters
-
mixed | $val | The value to test against |
null | $prm | The parameter for the test (not used here) |
- Returns
- bool True if valid
Definition at line 108 of file valid.class.php.
◆ isUrl()
isUrl |
( |
|
$val, |
|
|
|
$prm = null |
|
) |
| |
Check if the value is an URL (starting with http)
- Parameters
-
mixed | $val | The value to test against |
null | $prm | The parameter for the test (not used here) |
- Returns
- bool True if valid
Definition at line 279 of file valid.class.php.
◆ isValid()
Process to the validation
- Returns
- bool True if valid
Definition at line 85 of file valid.class.php.
◆ setAttr()
setAttr |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
|
inherited |
Set an attribute
- Parameters
-
string | $name | Attribute name |
mixed | $value | Attribute value |
Definition at line 58 of file object.class.php.
◆ setMessage()
setMessage |
( |
|
$name, |
|
|
|
$msg |
|
) |
| |
Set an error message
- Parameters
-
string | $name | Message keyname |
string | $msg | The message |
Definition at line 366 of file valid.class.php.
◆ setValue()
◆ $cfg
◆ $errors
The documentation for this class was generated from the following file: