dolibarr  17.0.4
Public Member Functions | Protected Member Functions | List of all members
Validate Class Reference

Class toolbox to validate values. More...

Public Member Functions

 __construct ($db, $outputLang=null)
 Constructor. More...
 
 isEmail ($email, $maxLength=false)
 Check for e-mail validity. More...
 
 isPrice ($price)
 Check for price validity. More...
 
 isTimestamp ($stamp)
 Check for timestamp validity. More...
 
 isPhone ($phone)
 Check for phone validity. More...
 
 isMaxLength ($string, $length)
 Check for string max length validity. More...
 
 isNotEmptyString ($string)
 Check for string not empty. More...
 
 isMinLength ($string, $length)
 Check for string min length validity. More...
 
 isUrl ($url)
 Check url validity. More...
 
 isDuration ($duration)
 Check Duration validity. More...
 
 isNumeric ($string)
 Check numeric validity. More...
 
 isBool ($bool)
 Check for boolean validity. More...
 
 isInDb ($values, $table, $col)
 Check for all values in db. More...
 

Protected Member Functions

 clear ()
 Use to clear errors msg or other ghost vars. More...
 
 setError ($errMsg)
 Use to clear errors msg or other ghost vars. More...
 

Detailed Description

Class toolbox to validate values.

Definition at line 28 of file validate.class.php.

Constructor & Destructor Documentation

◆ __construct()

Validate::__construct (   $db,
  $outputLang = null 
)

Constructor.

Parameters
DoliDB$dbDatabase handler
Translate$outputLangOutput lang for error

Definition at line 54 of file validate.class.php.

Member Function Documentation

◆ clear()

Validate::clear ( )
protected

Use to clear errors msg or other ghost vars.

Returns
null

Definition at line 77 of file validate.class.php.

◆ isBool()

Validate::isBool (   $bool)

Check for boolean validity.

Parameters
boolean$boolBoolean to validate
Returns
boolean Validity is ok or not

Definition at line 252 of file validate.class.php.

◆ isDuration()

Validate::isDuration (   $duration)

Check Duration validity.

Parameters
mixed$durationto validate
Returns
boolean Validity is ok or not

Definition at line 222 of file validate.class.php.

◆ isEmail()

Validate::isEmail (   $email,
  $maxLength = false 
)

Check for e-mail validity.

Parameters
string$emaile-mail address to validate
int$maxLengthstring max length
Returns
boolean Validity is ok or not

Definition at line 100 of file validate.class.php.

◆ isInDb()

Validate::isInDb (   $values,
  $table,
  $col 
)

Check for all values in db.

Parameters
array$valuesBoolean to validate
string$tablethe db table name without $this->db->prefix()
string$colthe target col
Returns
boolean Validity is ok or not
Exceptions
Exception

Definition at line 270 of file validate.class.php.

◆ isMaxLength()

Validate::isMaxLength (   $string,
  $length 
)

Check for string max length validity.

Parameters
string$stringto validate
int$lengthmax length
Returns
boolean Validity is ok or not

Definition at line 161 of file validate.class.php.

◆ isMinLength()

Validate::isMinLength (   $string,
  $length 
)

Check for string min length validity.

Parameters
string$stringto validate
int$lengthmax length
Returns
boolean Validity is ok or not

Definition at line 192 of file validate.class.php.

◆ isNotEmptyString()

Validate::isNotEmptyString (   $string)

Check for string not empty.

Parameters
string$stringto validate
Returns
boolean Validity is ok or not

Definition at line 176 of file validate.class.php.

◆ isNumeric()

Validate::isNumeric (   $string)

Check numeric validity.

Parameters
mixed$stringto validate
Returns
boolean Validity is ok or not

Definition at line 237 of file validate.class.php.

◆ isPhone()

Validate::isPhone (   $phone)

Check for phone validity.

Parameters
string$phonePhone string to validate
Returns
boolean Validity is ok or not

Definition at line 145 of file validate.class.php.

◆ isPrice()

Validate::isPrice (   $price)

Check for price validity.

Parameters
string$pricePrice to validate
Returns
boolean Validity is ok or not

Definition at line 115 of file validate.class.php.

◆ isTimestamp()

Validate::isTimestamp (   $stamp)

Check for timestamp validity.

Parameters
string | int$stamptimestamp to validate
Returns
boolean Validity is ok or not

Definition at line 130 of file validate.class.php.

◆ isUrl()

Validate::isUrl (   $url)

Check url validity.

Parameters
string$urlto validate
Returns
boolean Validity is ok or not

Definition at line 207 of file validate.class.php.

◆ setError()

Validate::setError (   $errMsg)
protected

Use to clear errors msg or other ghost vars.

Parameters
string$errMsgyour error message
Returns
null

Definition at line 88 of file validate.class.php.


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