Inheritance diagram for Validation:

Public Member Functions | |
| __reset () | |
| _check () | |
| _extract ($params) | |
| _luhn () | |
| alphaNumeric ($check) | |
| between ($check, $min, $max) | |
| blank ($check) | |
| boolean ($check) | |
| cc ($check, $type= 'fast', $deep=false, $regex=null) | |
| comparison ($check1, $operator=null, $check2=null) | |
| custom ($check, $regex=null) | |
| date ($check, $format= 'ymd', $regex=null) | |
| decimal ($check, $places=null, $regex=null) | |
| email ($check, $deep=false, $regex=null) | |
| equalTo ($check, $comparedTo) | |
| extension ($check, $extensions=array('gif', 'jpeg', 'png', 'jpg')) | |
| file ($check) | |
| inList ($check, $list) | |
| ip ($check) | |
| maxLength ($check, $max) | |
| minLength ($check, $min) | |
| money ($check, $symbolPosition= 'left') | |
| multiple ($check, $options=array()) | |
| notEmpty ($check) | |
| numeric ($check) | |
| phone ($check, $regex=null, $country= 'all') | |
| postal ($check, $regex=null, $country=null) | |
| range ($check, $lower=null, $upper=null) | |
| ssn ($check, $regex=null, $country=null) | |
| time ($check) | |
| url ($check, $strict=false) | |
| userDefined ($check, $object, $method, $args=null) | |
Static Public Member Functions | |
| & | getInstance () |
Public Attributes | |
| $__pattern | |
| $check = null | |
| $country = null | |
| $deep = null | |
| $errors = array() | |
| $regex = null | |
| $type = null | |
Definition at line 55 of file validation.php.
| Validation::__reset | ( | ) |
Reset internal variables for another validation run.
Definition at line 919 of file validation.php.
| Validation::_check | ( | ) |
Runs a regular expression match.
Definition at line 846 of file validation.php.
| Validation::_extract | ( | $ | params | ) |
Get the values to use when value sent to validation method is an array.
| array | $params Parameters sent to validation method |
Definition at line 864 of file validation.php.
| Validation::_luhn | ( | ) |
| Validation::alphaNumeric | ( | $ | check | ) |
Checks that a string contains only integer or letters
Returns true if string contains only integer or letters
$check can be passed as an array: array('check' => 'valueToCheck');
| mixed | $check Value to check |
Definition at line 165 of file validation.php.
References $check, check(), and getInstance().
| Validation::between | ( | $ | check, | |
| $ | min, | |||
| $ | max | |||
| ) |
Checks that a string length is within s specified range. Spaces are included in the character count. Returns true is string matches value min, max, or between min and max,
| string | $check Value to check for length | |
| integer | $min Minimum value in range (inclusive) | |
| integer | $max Maximum value in range (inclusive) |
Definition at line 191 of file validation.php.
References $check.
| Validation::blank | ( | $ | check | ) |
Returns true if field is left blank -OR- only whitespace characters are present in it's value Whitespace characters include Space, Tab, Carriage Return, Newline
$check can be passed as an array: array('check' => 'valueToCheck');
| mixed | $check Value to check |
Definition at line 206 of file validation.php.
References $check, and getInstance().
| Validation::boolean | ( | $ | check | ) |
Boolean validation, determines if value passed is a boolean integer or true/false.
| string | $check a valid boolean |
Definition at line 449 of file validation.php.
References $check.
| Validation::cc | ( | $ | check, | |
| $ | type = 'fast', |
|||
| $ | deep = false, |
|||
| $ | regex = null | |||
| ) |
Validation of credit card numbers. Returns true if $check is in the proper credit card format.
| mixed | $check credit card number to validate | |
| mixed | $type 'all' may be passed as a sting, defaults to fast which checks format of most major credit cards if an array is used only the values of the array are checked. Example: array('amex', 'bankcard', 'maestro') | |
| boolean | $deep set to true this will check the Luhn algorithm of the credit card. | |
| string | $regex A custom regex can also be passed, this will be used instead of the defined regex values |
Definition at line 232 of file validation.php.
References $check, $regex, _check(), check(), and getInstance().
| Validation::comparison | ( | $ | check1, | |
| $ | operator = null, |
|||
| $ | check2 = null | |||
| ) |
Used to compare 2 numeric values.
| mixed | $check1 if string is passed for a string must also be passed for $check2 used as an array it must be passed as array('check1' => value, 'operator' => 'value', 'check2' -> value) | |
| string | $operator Can be either a word or operand is greater >, is less <, greater or equal >= less or equal <=, is less <, equal to ==, not equal != | |
| integer | $check2 only needed if $check1 is a string |
Definition at line 305 of file validation.php.
References __(), and getInstance().
| Validation::custom | ( | $ | check, | |
| $ | regex = null | |||
| ) |
Used when a custom regular expression is needed.
| mixed | $check When used as a string, $regex must also be a valid regular expression. As and array: array('check' => value, 'regex' => 'valid regular expression') | |
| string | $regex If $check is passed as a string, $regex must also be set to valid regular expression |
Definition at line 364 of file validation.php.
References $check, $regex, __(), a(), and getInstance().
| Validation::date | ( | $ | check, | |
| $ | format = 'ymd', |
|||
| $ | regex = null | |||
| ) |
Date validation, determines if the string passed is a valid date. keys that expect full month, day and year will validate leap years
| string | $check a valid date string | |
| mixed | $format Use a string or an array of the keys below. Arrays should be passed as array('dmy', 'mdy', etc) Keys: dmy 27-12-2006 or 27-12-06 separators can be a space, period, dash, forward slash mdy 12-27-2006 or 12-27-06 separators can be a space, period, dash, forward slash ymd 2006-12-27 or 06-12-27 separators can be a space, period, dash, forward slash dMy 27 December 2006 or 27 Dec 2006 Mdy December 27, 2006 or Dec 27, 2006 comma is optional My December 2006 or Dec 2006 my 12/2006 separators can be a space, period, dash, forward slash | |
| string | $regex If a custom regular expression is used this is the only validation that will occur. |
Definition at line 395 of file validation.php.
References $check, $regex, _check(), getInstance(), and r().
| Validation::decimal | ( | $ | check, | |
| $ | places = null, |
|||
| $ | regex = null | |||
| ) |
Checks that a value is a valid decimal. If $places is null, the $check is allowed to be a scientific float If no decimal point is found a false will be returned. Both the sign and exponent are optional.
| integer | $check The value the test for decimal | |
| integer | $places if set $check value must have exactly $places after the decimal point | |
| string | $regex If a custom regular expression is used this is the only validation that will occur. |
Definition at line 464 of file validation.php.
References $check, $regex, and getInstance().
| Validation::email | ( | $ | check, | |
| $ | deep = false, |
|||
| $ | regex = null | |||
| ) |
Validates for an email address.
| string | $check Value to check | |
| boolean | $deep Perform a deeper validation (if true), by also checking availability of host | |
| string | $regex Regex to use (if none it will use built in regex) |
Definition at line 488 of file validation.php.
References $check, $regex, a(), check(), and getInstance().
| Validation::equalTo | ( | $ | check, | |
| $ | comparedTo | |||
| ) |
Check that value is exactly $comparedTo.
| mixed | $check Value to check | |
| mixed | $comparedTo Value to compare |
Definition at line 522 of file validation.php.
References $check.
| Validation::extension | ( | $ | check, | |
| $ | extensions = array('gif', 'jpeg', 'png', 'jpg') | |||
| ) |
Check that value has a valid file extension.
| mixed | $check Value to check | |
| array | $extensions file extenstions to allow |
Definition at line 533 of file validation.php.
References $check.
| Validation::file | ( | $ | check | ) |
Check that value is a file name
| mixed | $check Value to check public |
Definition at line 552 of file validation.php.
| & Validation::getInstance | ( | ) | [static] |
Gets a reference to the Validation object instance
Definition at line 118 of file validation.php.
Referenced by alphaNumeric(), blank(), cc(), comparison(), custom(), date(), decimal(), email(), Model::invalidFields(), ip(), money(), notEmpty(), phone(), postal(), ssn(), time(), and url().
| Validation::inList | ( | $ | check, | |
| $ | list | |||
| ) |
Checks if a value is in a given list.
| string | $check Value to check | |
| array | $list List to check against |
Definition at line 824 of file validation.php.
| Validation::ip | ( | $ | check | ) |
Validation of an IPv4 address.
| string | $check The string to test. |
Definition at line 571 of file validation.php.
References $check, and getInstance().
Referenced by CakeSocket::address(), CakeSocket::addresses(), and CakeSocket::host().
| Validation::maxLength | ( | $ | check, | |
| $ | max | |||
| ) |
Checks whether the length of a string is smaller or equal to a maximal length..
| string | $check The string to test | |
| integer | $max The maximal string length |
Definition at line 597 of file validation.php.
References $check.
| Validation::minLength | ( | $ | check, | |
| $ | min | |||
| ) |
Checks whether the length of a string is greater or equal to a minimal length.
| string | $check The string to test | |
| integer | $min The minimal string length |
Definition at line 585 of file validation.php.
References $check.
| Validation::money | ( | $ | check, | |
| $ | symbolPosition = 'left' | |||
| ) |
Checks that a value is a monetary amount.
| string | $check Value to check | |
| string | $symbolPosition Where symbol is located (left/right) |
Definition at line 609 of file validation.php.
References $check, and getInstance().
| Validation::multiple | ( | $ | check, | |
| $ | options = array() | |||
| ) |
Validate a multiple select.
| mixed | $check Value to check | |
| mixed | $options Options for the check. Valid options in => provide a list of choices that selections must be made from max => maximun number of non-zero choices that can be made min => minimum number of non-zero choices that can be made |
Definition at line 632 of file validation.php.
References $check.
| Validation::notEmpty | ( | $ | check | ) |
Checks that a string contains something other than whitespace
Returns true if string contains something other than whitespace
$check can be passed as an array: array('check' => 'valueToCheck');
| mixed | $check Value to check |
Definition at line 138 of file validation.php.
References $check, check(), and getInstance().
| Validation::numeric | ( | $ | check | ) |
Checks if a value is numeric.
| string | $check Value to check |
Definition at line 661 of file validation.php.
References $check.
| Validation::phone | ( | $ | check, | |
| $ | regex = null, |
|||
| $ | country = 'all' | |||
| ) |
Check that a value is a valid phone number.
| mixed | $check Value to check (string or array) | |
| string | $regex Regular expression to use | |
| string | $country Country code (defaults to 'all') |
Definition at line 673 of file validation.php.
References $check, $regex, and getInstance().
| Validation::postal | ( | $ | check, | |
| $ | regex = null, |
|||
| $ | country = null | |||
| ) |
Checks that a given value is a valid postal code.
| mixed | $check Value to check | |
| string | $regex Regular expression to use | |
| string | $country Country to use for formatting |
Definition at line 702 of file validation.php.
References $check, $regex, and getInstance().
| Validation::range | ( | $ | check, | |
| $ | lower = null, |
|||
| $ | upper = null | |||
| ) |
Validate that a number is in specified range. if $lower and $upper are not set, will return true if $check is a legal finite on this platform
| string | $check Value to check | |
| integer | $lower Lower limit | |
| integer | $upper Upper limit |
Definition at line 745 of file validation.php.
References $check.
| Validation::ssn | ( | $ | check, | |
| $ | regex = null, |
|||
| $ | country = null | |||
| ) |
Checks that a value is a valid Social Security Number.
| mixed | $check Value to check | |
| string | $regex Regular expression to use | |
| string | $country Country |
Definition at line 763 of file validation.php.
References $check, $regex, and getInstance().
| Validation::time | ( | $ | check | ) |
Time validation, determines if the string passed is a valid time. Validates time as 24hr (HH:MM) or am/pm ([H]H:MM[a|p]m) Does not allow/validate seconds.
| string | $check a valid time string |
Definition at line 434 of file validation.php.
References $check, and getInstance().
| Validation::url | ( | $ | check, | |
| $ | strict = false | |||
| ) |
Checks that a value is a valid URL according to http://www.w3.org/Addressing/URL/url-spec.txt
The regex checks for the following component parts: a valid, optional, scheme a valid ip address OR a valid domain name as defined by section 2.3.1 of http://www.ietf.org/rfc/rfc1035.txt with an optional port number an optional valid path an optional query string (get parameters) an optional fragment (anchor tag)
| string | $check Value to check | |
| boolean | $strict Require URL to be prefixed by a valid scheme (one of http(s)/ftp(s)/file/news/gopher) |
Definition at line 805 of file validation.php.
References $check, and getInstance().
| Validation::userDefined | ( | $ | check, | |
| $ | object, | |||
| $ | method, | |||
| $ | args = null | |||
| ) |
Runs an user-defined validation.
| mixed | $check value that will be validated in user-defined methods. | |
| object | $object class that holds validation method | |
| string | $method class method name for validation to run | |
| array | $args arguments to send to method |
Definition at line 837 of file validation.php.
| Validation::$__pattern |
Initial value:
array(
'ip' => '(?:(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])',
'hostname' => '(?:[a-z0-9][-a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,4}|museum|travel)'
)
Definition at line 77 of file validation.php.
| Validation::$check = null |
Definition at line 62 of file validation.php.
Referenced by alphaNumeric(), between(), blank(), boolean(), cc(), custom(), date(), decimal(), email(), equalTo(), extension(), ip(), maxLength(), minLength(), money(), multiple(), notEmpty(), numeric(), phone(), postal(), range(), ssn(), time(), and url().
| Validation::$country = null |
Definition at line 88 of file validation.php.
| Validation::$deep = null |
Definition at line 95 of file validation.php.
| Validation::$errors = array() |
Definition at line 110 of file validation.php.
| Validation::$regex = null |
| Validation::$type = null |
Definition at line 102 of file validation.php.
1.4.7