Class: validator
Source Location: /system/classes/validator.class.php
This class allows you to make a validation given input values along with its rules.
Author(s):
|
|
|
Class Details
Class Variables
Class Methods
static method getInstance [line 97]
static object Validation &getInstance(
)
|
|
Gets a reference to the Validation object instance
Tags:
method alphaNumeric [line 176]
boolean alphaNumeric(
mixed
$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');
Tags:
Parameters:
method between [line 203]
boolean between(
string
$check, integer
$min, integer
$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,
Tags:
Parameters:
method blank [line 219]
boolean blank(
mixed
$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');
Tags:
Parameters:
method boolean [line 390]
boolean boolean(
string
$check)
|
|
Boolean validation, determines if value passed is a boolean integer or true/false.
Tags:
Parameters:
method comparison [line 244]
boolean comparison(
mixed
$check1, [string
$operator = null], [integer
$check2 = null])
|
|
Used to compare 2 numeric values.
Tags:
Parameters:
method custom [line 304]
boolean custom(
mixed
$check, [string
$regex = null])
|
|
Used when a custom regular expression is needed.
Tags:
Parameters:
method date [line 336]
boolean date(
string
$check, [mixed
$format = 'ymd'], [string
$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
Tags:
Parameters:
method decimal [line 405]
boolean decimal(
integer
$check, [integer
$places = null], [string
$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.
Tags:
Parameters:
method dispatchMethod [line 116]
mixed dispatchMethod(
string
$method, [array
$params = array()])
|
|
Calls a method on this object with the given parameters. Provides an OO wrapper for call_user_func_array, and improves performance by using straight method calls in most cases.
Tags:
Parameters:
method email [line 429]
boolean email(
string
$check, [string
$regex = null])
|
|
Validates for an email address.
Tags:
Parameters:
method equalTo [line 458]
boolean equalTo(
mixed
$check, mixed
$comparedTo)
|
|
Check that value is exactly $comparedTo.
Tags:
Parameters:
method extension [line 470]
boolean extension(
mixed
$check, [array
$extensions = array('gif', 'jpeg', 'png', 'jpg')])
|
|
Check that value has a valid file extension.
Tags:
Parameters:
method inList [line 761]
boolean inList(
string
$check, array
$list, [boolean
$strict = false])
|
|
Checks if a value is in a given list.
Tags:
Parameters:
method ip [line 496]
boolean ip(
string
$check, [string
$type = 'both'])
|
|
Validation of an IP address. Valid IP version strings for type restriction are: - both: Check both IPv4 and IPv6, return true if the supplied address matches either version
- IPv4: Version 4 (Eg: 127.0.0.1, 192.168.10.123, 203.211.24.8)
- IPv6: Version 6 (Eg: ::1, 2001:0db8::1428:57ab)
Tags:
Parameters:
method maxLength [line 564]
boolean maxLength(
string
$check, integer
$max)
|
|
Checks whether the length of a string is smaller or equal to a maximal length..
Tags:
Parameters:
method minLength [line 551]
boolean minLength(
string
$check, integer
$min)
|
|
Checks whether the length of a string is greater or equal to a minimal length.
Tags:
Parameters:
method multiple [line 583]
boolean multiple(
mixed
$check, [mixed
$options = array()])
|
|
Validate a multiple select. 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
Tags:
Parameters:
method notEmpty [line 148]
boolean notEmpty(
mixed
$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');
Tags:
Parameters:
method numeric [line 613]
boolean numeric(
string
$check)
|
|
Checks if a value is numeric.
Tags:
Parameters:
method phone [line 625]
boolean phone(
mixed
$check, [string
$regex = null])
|
|
Check that a value is a valid phone number.
Tags:
Parameters:
method range [line 653]
boolean range(
string
$check, [integer
$lower = null], [integer
$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
Tags:
Parameters:
method string [line 676]
boolean string(
mixed
$check)
|
|
Checks that a string contains something Returns true if string contains any characters. Function added so old validation would be bypassed. $check can be passed as an array: array('check' => 'valueToCheck');
Tags:
Parameters:
method stringOrEmpty [line 706]
boolean stringOrEmpty(
mixed
$check)
|
|
Checks that a string contains either nothing or something Returns true if string contains nothing or any characters. Function added so old validation would be bypassed. $check can be passed as an array: array('check' => 'valueToCheck');
Tags:
Parameters:
method time [line 375]
boolean time(
string
$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.
Tags:
Parameters:
method url [line 738]
boolean url(
string
$check, [boolean
$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)
Tags:
Parameters:
method userDefined [line 775]
mixed userDefined(
mixed
$check, object
$object, string
$method, [array
$args = null])
|
|
Runs an user-defined validation.
Tags:
Parameters:
method _check [line 785]
Runs a regular expression match.
Tags:
method _extract [line 804]
void _extract(
array
$params)
|
|
Get the values to use when value sent to validation method is an array.
Tags:
Parameters:
method _ipv4 [line 516]
boolean _ipv4(
string
$check)
|
|
Validation of IPv4 addresses.
Tags:
Parameters:
method _ipv6 [line 533]
boolean _ipv6(
string
$check)
|
|
Validation of IPv6 addresses.
Tags:
Parameters:
method __populateIp [line 825]
|
|