Class FormValidation

Description

This is the base validation class that contains some basic FormElement validation methods.

Located in Program_Root/form/FormValidation.inc (line 33)


	
			
Variable Summary
Method Summary
void FormValidation (FormErrors &$error_obj)
void array_hasempty (mixed $a)
string get_error_code ()
string get_error_message ()
boolean is_alphanum (string $str, [string $from = ""])
TRUE is_alphanumstring (string $str)
TRUE is_ccexp (string $value, [mixed $split_by = "-"])
TRUE is_companyname (string $name)
TRUE is_confirm_password (string $confirmpassword, mixed $password)
TRUE is_countrycode (string $value)
TRUE is_date (string $value, [mixed $split_by = "-"])
TRUE is_dateday (string $day)
TRUE is_datemonth (string $month)
TRUE is_datetime (string $value)
TRUE is_dateyear (string $year)
TRUE is_domainname (string $name, [mixed $forbid_www = FALSE])
TRUE is_email (string $email)
TRUE is_firstname (string $firstname)
TRUE is_float (string $number)
TRUE is_higherzeronumber (string $value)
void is_host (mixed $host)
TRUE is_hostemail (string $name)
TRUE is_hostip (string $hostip)
void is_hostlist (mixed $hostlist)
TRUE is_hostname (string $name)
TRUE is_ip (string $ip)
TRUE is_lastname (string $lastname)
TRUE is_leapyear (string $yyyy)
TRUE is_manyemails (string $emails)
TRUE is_money (string $money)
TRUE is_name (string $name)
TRUE is_notempty (mixed $value)
boolean is_num (string $str, [string $from = ""])
TRUE is_number (string $value)
TRUE is_partial_domainname (string $name)
TRUE is_partial_ip (string $ip)
TRUE is_password (string $password)
TRUE is_path (string $path)
TRUE is_price (string $price)
void is_range (mixed $value, mixed $size, mixed $min, mixed $max)
TRUE is_standalone_hostname (string $name)
TRUE is_strict_url (string $url)
TRUE is_time (string $value)
TRUE is_title (string $name)
TRUE is_url (string $url)
TRUE is_urlpath (string $path)
TRUE is_username (string $username)
TRUE is_valid_domain (string $domain_value, [mixed $allow_www = false])
TRUE is_within_range (mixed $value, int $size, mixed $start, mixed $end, [string $error = FALSE])
TRUE is_zero_onehundred (string $value)
TRUE is_zip (string $zip)
FALSE _error (string $code, [mixed $message = NULL])
Variables
mixed $_error_code = '' (line 38)

This holds the last error code found

mixed $_error_message = '' (line 43)

This holds the last error message

mixed $_FormErrors = NULL (line 48)

This is the FormErrors object

Methods
Constructor FormValidation (line 58)

The constructor used to set the form errors object used by this class to do error text lookups

void FormValidation (FormErrors &$error_obj)
array_hasempty (line 69)

This method checks to make sure an array doesn't have an empty element.

void array_hasempty (mixed $a)
get_error_code (line 109)

This method returns the error code from the last validation error found.

string get_error_code ()
get_error_message (line 120)

This method returns the error message from the last validation error found.

string get_error_message ()
is_alphanum (line 152)

This function checks if the given string contains alphabetical characters or numbers.

It also checks for the allowed additional characters.

  • return:

    FALSE - if any other extraneous characters are found TRUE upon succes.

boolean is_alphanum (string $str, [string $from = ""])
  • string $str:

    - the string to check

  • string $from:

    - list of individual characters to allow besides a-zA-Z

is_alphanumstring (line 265)

This method validates a string as containing only letters and numbers

  • return:

    = succes FALSE = failed

TRUE is_alphanumstring (string $str)
  • string $str:

    - the value to validate

is_ccexp (line 1017)

This tests a string as a valid credit card expiration date.

You can pass in an optional date delimiter string. The default is -

  • return:

    = succes FALSE = failed

TRUE is_ccexp (string $value, [mixed $split_by = "-"])
  • string $value:

    - the value to validate

is_companyname (line 634)

This validates a string as a valid Company name.

It is the same as is_name, with the exception of allowing .

  • return:

    = succes FALSE = failed

TRUE is_companyname (string $name)
  • string $name:

    - the value to validate

is_confirm_password (line 693)

This makes sure that 2 password strings are exactly alike.

  • return:

    = succes FALSE = failed

TRUE is_confirm_password (string $confirmpassword, mixed $password)
  • string $confirmpassword:

    - the value to validate

is_countrycode (line 1048)

This validates a string as a valid "country code" which is a 2 alphanumerical character string

  • return:

    = succes FALSE = failed

TRUE is_countrycode (string $value)
  • string $value:

    - the value to validate

is_date (line 833)

This validates a atring as a valid date format You can provide a seperator string that seperates the fields

NOTE: date is in YYYY-MO-DY format

  • return:

    = succes FALSE = failed

TRUE is_date (string $value, [mixed $split_by = "-"])
  • string $value:

    - the value to validate

is_dateday (line 872)

This validates a string as a valid day of a month It has to be greater then 0 and less then 31

  • return:

    = succes FALSE = failed

TRUE is_dateday (string $day)
  • string $day:

    - the value to validate

is_datemonth (line 885)

This validates a string as a valid month of the year between 1 and 12 inclusive is_datemonth - checks whether its a proper month

  • return:

    = succes FALSE = failed

TRUE is_datemonth (string $month)
  • string $month:

    - the value to validate

is_datetime (line 918)

This validates an array of values as a valid date time

NOTE: array must contain array( "month" => VALUE, "day" => VALUE, "year" => VALUE, "hour" => VALUE, "minutes" => VALUE, "seconds" => VALUE);

  • return:

    = succes FALSE = failed

TRUE is_datetime (string $value)
  • string $value:

    - the value to validate

is_dateyear (line 897)

See if the year is within 1800 and 3000

  • return:

    = succes FALSE = failed

TRUE is_dateyear (string $year)
  • string $year:

    - the value to validate

is_domainname (line 312)

This method validates a string for a valid hostname for a machine.

  • return:

    = succes FALSE = failed

TRUE is_domainname (string $name, [mixed $forbid_www = FALSE])
  • string $name:

    - the value to validate

is_email (line 726)

This function validates a single email address.

It supports email addresses in the format of jane@blah.com or "Jane Doe <jane@blah.com>"

  • return:

    = succes FALSE = failed

TRUE is_email (string $email)
  • string $email:

    - the value to validate

is_firstname (line 977)

This is just a wrapper for

  • return:

    = succes FALSE = failed

TRUE is_firstname (string $firstname)
  • string $firstname:

    - the value to validate

is_float (line 514)

This method validates a string as a valid float formatted number. x.xx

  • return:

    = succes FALSE = failed

TRUE is_float (string $number)
  • string $number:

    - the value to validate

is_higherzeronumber (line 562)

This method validates a string as a number greater then 0.

  • return:

    = succes FALSE = failed

TRUE is_higherzeronumber (string $value)
  • string $value:

    - the value to validate

is_host (line 1158)

no comment

void is_host (mixed $host)
is_hostemail (line 709)

This method tests a string as a valid hostname value or a valid email string

  • return:

    = succes FALSE = failed

TRUE is_hostemail (string $name)
  • string $name:

    - the value to validate

is_hostip (line 432)

This method tries to validate a string as a valid IP address or a hostname

  • return:

    = succes FALSE = failed

TRUE is_hostip (string $hostip)
  • string $hostip:

    - the value to validate

is_hostlist (line 1166)

no comment

void is_hostlist (mixed $hostlist)
is_hostname (line 356)

This is just a wrapper for is_domainname

  • return:

    = succes FALSE = failed

TRUE is_hostname (string $name)
  • string $name:

    - the value to validate

is_ip (line 368)

This validates a string as an IP address This should work with either IPv4 or IPv6

  • return:

    = succes FALSE = failed

TRUE is_ip (string $ip)
  • string $ip:

    - the value to validate

is_lastname (line 988)

This is just a wrapper for

  • return:

    = succes FALSE = failed

TRUE is_lastname (string $lastname)
  • string $lastname:

    - the value to validate

is_leapyear (line 815)

This method validates a string as a leap year.

  • return:

    = succes FALSE = failed

TRUE is_leapyear (string $yyyy)
  • string $yyyy:

    - the value to validate

is_manyemails (line 794)

This function tests a string that may contain many email addresses seperated by commas

  • return:

    = succes FALSE = failed

TRUE is_manyemails (string $emails)
  • string $emails:

    - the value to validate

is_money (line 466)

This method tests a string to make sure it is in a valid money format.

either $x or $x.cents

  • return:

    = succes FALSE = failed

TRUE is_money (string $money)
  • string $money:

    - the value to validate

is_name (line 612)

This validates a string as a valid proper name.

The string can't be longer then VALIDATE_MAXSIZE in length, and it can only contain letters and numbers

  • return:

    = succes FALSE = failed

TRUE is_name (string $name)
  • string $name:

    - the value to validate

is_notempty (line 132)

This function makes sure the data is not empty

  • return:

    = not empty

TRUE is_notempty (mixed $value)
  • mixed $value
is_num (line 186)

This function checks if the given string contains numerical digit characters.

It also checks for the allowed additional characters.

  • return:

    FALSE - if any other extraneous characters are found TRUE upon succes.

boolean is_num (string $str, [string $from = ""])
  • string $str:

    - the string to check

  • string $from:

    - list of individual characters to allow besides a-zA-Z

is_number (line 450)

This tests a string to make sure it is a valid number.

  • return:

    = succes FALSE = failed

TRUE is_number (string $value)
  • string $value:

    - the value to validate

is_partial_domainname (line 330)

This method validates a string for a valid partial hostname for a machine.

  • return:

    = succes FALSE = failed

TRUE is_partial_domainname (string $name)
  • string $name:

    - the value to validate

is_partial_ip (line 403)

This validates a string as a portion of an IP address.

This should work with either IPv4 or IPv6

  • return:

    = succes FALSE = failed

TRUE is_partial_ip (string $ip)
  • string $ip:

    - the value to validate

is_password (line 675)

This tries to validate a string as a password It can't be empty and has to be less then VALIDATE_MAXSIZE characters in length

NOTE: password is case sensitive, and spaces are ignored.

  • return:

    = succes FALSE = failed

TRUE is_password (string $password)
  • string $password:

    - the value to validate

is_path (line 579)

This method validates a string as a path to a file.

  • return:

    = succes FALSE = failed

TRUE is_path (string $path)
  • string $path:

    - the value to validate

is_price (line 492)

This method tries to validate a string as a valid price. It can't be zero (a la free!)

  • return:

    = succes FALSE = failed

TRUE is_price (string $price)
  • string $price:

    - the value to validate

is_range (line 218)

is_range

This is the range check that the can be used in checks_array. Valarray should be: array('val' => $val, 'size' => $size OPTIONAL 'min' => $min, 'max' => $max, )

void is_range (mixed $value, mixed $size, mixed $min, mixed $max)
is_standalone_hostname (line 280)

this method tests to see if this is a valid hostname value minus the domain name portion.

  • return:

    = succes FALSE = failed

TRUE is_standalone_hostname (string $name)
  • string $name:

    - the value to validate

is_strict_url (line 1105)

This method validates a strict url.

It is the same as is_url, except that it requires the prefix http://

  • return:

    = succes FALSE = failed

TRUE is_strict_url (string $url)
  • string $url:

    - the value to validate

is_time (line 950)

This validates an array of fields as a valid time of the day

NOTE: array must contain array( "hour" => VALUE, "minutes" => VALUE, "seconds" => VALUE);

  • return:

    = succes FALSE = failed

TRUE is_time (string $value)
  • string $value:

    - the value to validate

is_title (line 1123)

Validate if the string is a good candidate to become an Title

  • return:

    = succes FALSE = failed

TRUE is_title (string $name)
  • string $name:

    - the value to validate

is_url (line 1066)

This method validates a string as a valid url It inclues the prefix, hostname/ip, port number and path.

NOTE: format is in [http://] hostip [:port number] [path]

  • return:

    = succes FALSE = failed

TRUE is_url (string $url)
  • string $url:

    - the value to validate

is_urlpath (line 595)

This method validates a string as a valid url path to a file

  • return:

    = succes FALSE = failed

TRUE is_urlpath (string $path)
  • string $path:

    - the value to validate

is_username (line 649)

This method tests to see if a string value

is a valid 'account' name. The string can't be larger then VALIDATE_MAXSIZE, and can only contain alphanum characters

  • return:

    = succes FALSE = failed

TRUE is_username (string $username)
  • string $username:

    - the value to validate

is_valid_domain (line 1138)

Validate domain Will check if a domain is valid

  • return:

    = succes FALSE = failed

TRUE is_valid_domain (string $domain_value, [mixed $allow_www = false])
  • string $domain_value:

    - the value to validate

is_within_range (line 237)

This method makes sure a value lies within a given range of values.

The error message can be customized by passing in a customer error code

  • return:

    = succes FALSE = failed

TRUE is_within_range (mixed $value, int $size, mixed $start, mixed $end, [string $error = FALSE])
  • mixed $value:

    - the value u want to check

  • int $size:

    - the size

  • mixed $start:

    - the lower bound value

  • mixed $end:

    - the upper bound value

  • string $error:

    - the error code if any

is_zero_onehundred (line 541)

This validates a string as a valid number between 0 and 100

  • return:

    = succes FALSE = failed

TRUE is_zero_onehundred (string $value)
  • string $value:

    - the value to validate

is_zip (line 1001)

This validates a string as a valid zipcode

numbers, whitespace allowed

  • return:

    = succes FALSE = failed

TRUE is_zip (string $zip)
  • string $zip:

    - the value to validate

_error (line 90)

A wrapper method to set the error message and error code before returning FALSE

FALSE _error (string $code, [mixed $message = NULL])
  • string $code:

    - error code

Documention generated on Thu, 31 Jul 2003 18:32:45 -0700 by phpDocumentor 1.2.0