Class: I2CE Validate: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 38: Line 38:
==Methods==
==Methods==
===checkCurrency()===
===checkCurrency()===
Checks to make sure currency is valid.
Checks to make sure currency is valid. This method checks to make sure a number is valid for currency.  It can have a decimal or comma with 2 digits past.
 
This method checks to make sure a number is valid for currency.  It can have a decimal
or comma with 2 digits past.
*Signature: static public function checkCurrency($data)
*Signature: static public function checkCurrency($data)
*Parameters:
** number $data
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
Parameters:
* number $data
===checkDate()===
===checkDate()===
Checks to make sure a date is valid
Checks to make sure a date is valid
*Signature: static public function checkDate($data)
*Signature: static public function checkDate($data)
*Parameters:
** [[Class: I2CE_Date | I2CE_Date]] $data
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
Parameters:
* [[Class: I2CE_Date | I2CE_Date]] $data
===checkEmail()===
===checkEmail()===
*Signature: static public function checkEmail($email)
*Signature: static public function checkEmail($email)
Parameters:
*Parameters:
*$email  
*$email  
===checkNumber()===
===checkNumber()===
Checks to make sure a number is valid
Checks to make sure a number is valid This method checks to make sure the number is a number and optionally that it is greater than a specific value.
 
This method checks to make sure the number is a number and optionally
that it is greater than a specific value.
*Signature: static public function checkNumber($data,$min_value)
*Signature: static public function checkNumber($data,$min_value)
*Parameters:
** number $data
** number $min_value
***Default Value: false
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
Parameters:
* number $data
* number $min_value
**Default Value: false
===checkString()===
===checkString()===
Checks to make sure a string isn't blank.
Checks to make sure a string isn't blank.
*Signature: static public function checkString($data)
*Signature: static public function checkString($data)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $data
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $data
===checkVersion()===
===checkVersion()===
Checks to see if the versions  meet the demans given by the operator.
Checks to see if the versions  meet the demans given by the operator. Opeartors are '<','lessthan','>','greaterthan','=','equal','equals','exactly','<=','atmost','>=','atleast'
Opeartors are '<','lessthan','>','greaterthan','=','equal','equals','exactly','<=','atmost','>=','atleast'
*Signature: static public function checkVersion($vers1,$operator,$vers2)
*Signature: static public function checkVersion($vers1,$operator,$vers2)
*Returns: true on sucess. false on failure
*Parameters:
Parameters:
*$vers1  
*$vers1  
*$operator  
*$operator  
*$vers2  
*$vers2  
*Returns: true<br/>on sucess. false on failure
===convertToBoolean()===
===convertToBoolean()===
Converts a string such as true/false/yes/no/1/0  to boolean value (stored as either the string '0' or '1')
Converts a string such as true/false/yes/no/1/0  to boolean value (stored as either the string '0' or '1')
*Signature: static public function convertToBoolean($string,$asBool)
*Signature: static public function convertToBoolean($string,$asBool)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ] string or null if it is not recognized
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $string <br/>;
* [http://www.php.net/manual/en/language.types.string.php string ] $string<br/>;
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $asBool <br/>Defaults to false.  If true returns true/false otherwise returns 1/0.  I know ... this is confusing.
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $asBool<br/>Defaults to false.  If true returns true/false otherwise returns 1/0.  I know ... this is confusing.
***Default Value: false
**Default Value: false
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]<br/>string or null if it is not recognized
===isNmToken()===
===isNmToken()===
*Signature: static public function isNmToken($val)
*Signature: static public function isNmToken($val)
Parameters:
*Parameters:
*$val  
*$val  
===isTokenDigit()===
===isTokenDigit()===
*Signature: static public function isTokenDigit($val)
*Signature: static public function isTokenDigit($val)
Parameters:
*Parameters:
*$val  
*$val  
===isTokenLetter()===
===isTokenLetter()===
*Signature: static public function isTokenLetter($val)
*Signature: static public function isTokenLetter($val)
Parameters:
*Parameters:
*$val  
*$val  
===isTokenName()===
===isTokenName()===
*Signature: static public function isTokenName($val)
*Signature: static public function isTokenName($val)
Parameters:
*Parameters:
*$val  
*$val  
===setupTokenRegexps()===
===setupTokenRegexps()===
Line 111: Line 104:
Remove any invalid characters that can't be part of a valid currency value.
Remove any invalid characters that can't be part of a valid currency value.
*Signature: static public function stripCurrency($data)
*Signature: static public function stripCurrency($data)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $data
*Returns: number
*Returns: number
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $data




[[Category:Class Documentation]]
[[Category:Class Documentation]]

Revision as of 22:40, 16 October 2009

This article desrcibes the class I2CE_Validate.

Variables

$false

  • Type: static protected $false

$true

  • Type: static protected $true

$BaseChar

  • Type: static protected $BaseChar

$Ideographic

  • Type: static protected $Ideographic

$Letter

  • Type: static protected $Letter

$Digit

  • Type: static protected $Digit

$CombiningChar

  • Type: static protected $CombiningChar

$Extender

  • Type: static protected $Extender

$NameChar

  • Type: static protected $NameChar

$Name

  • Type: static protected $Name

$tokenRegexps

  • Type: static protected $tokenRegexps

Methods

checkCurrency()

Checks to make sure currency is valid. This method checks to make sure a number is valid for currency. It can have a decimal or comma with 2 digits past.

  • Signature: static public function checkCurrency($data)
  • Parameters:
    • number $data
  • Returns: boolean

checkDate()

Checks to make sure a date is valid

  • Signature: static public function checkDate($data)
  • Parameters:
  • Returns: boolean

checkEmail()

  • Signature: static public function checkEmail($email)
  • Parameters:
  • $email

checkNumber()

Checks to make sure a number is valid This method checks to make sure the number is a number and optionally that it is greater than a specific value.

  • Signature: static public function checkNumber($data,$min_value)
  • Parameters:
    • number $data
    • number $min_value
      • Default Value: false
  • Returns: boolean

checkString()

Checks to make sure a string isn't blank.

  • Signature: static public function checkString($data)
  • Parameters:
  • Returns: boolean

checkVersion()

Checks to see if the versions meet the demans given by the operator. Opeartors are '<','lessthan','>','greaterthan','=','equal','equals','exactly','<=','atmost','>=','atleast'

  • Signature: static public function checkVersion($vers1,$operator,$vers2)
  • Parameters:
  • $vers1
  • $operator
  • $vers2
  • Returns: true
    on sucess. false on failure

convertToBoolean()

Converts a string such as true/false/yes/no/1/0 to boolean value (stored as either the string '0' or '1')

  • Signature: static public function convertToBoolean($string,$asBool)
  • Parameters:
    • string $string
      ;
    • boolean $asBool
      Defaults to false. If true returns true/false otherwise returns 1/0. I know ... this is confusing.
      • Default Value: false
  • Returns: mixed
    string or null if it is not recognized

isNmToken()

  • Signature: static public function isNmToken($val)
  • Parameters:
  • $val

isTokenDigit()

  • Signature: static public function isTokenDigit($val)
  • Parameters:
  • $val

isTokenLetter()

  • Signature: static public function isTokenLetter($val)
  • Parameters:
  • $val

isTokenName()

  • Signature: static public function isTokenName($val)
  • Parameters:
  • $val

setupTokenRegexps()

  • Signature: protected function setupTokenRegexps()

stripCurrency()

Remove any invalid characters that can't be part of a valid currency value.

  • Signature: static public function stripCurrency($data)
  • Parameters:
  • Returns: number