system/helpers/valid.php

Class: valid_Core

class valid_Core

Validation helper class.

valid_Core :: email

public static function email

Validate email, commonly used characters only

Parameters:

string email
email address

Return: boolean


valid_Core :: email_rfc

public static function email_rfc

Validate email, RFC compliant version Note: This function is LESS strict than valid_email. Choose carefully.

Parameters:

string email
email address

See:

  • Originally by Cal Henderson, modified to fit Kohana syntax standards:
  • http://www.iamcal.com/publish/articles/php/parsing_email/
  • http://www.w3.org/Protocols/rfc822/

Return: boolean


valid_Core :: url

public static function url

Validate URL

Parameters:

string url
URL
string scheme
(string http) protocol

Return: boolean


valid_Core :: ip

public static function ip

Validate IP

Parameters:

string ip
IP address

Return: boolean


valid_Core :: credit_card

public static function credit_card

Validates a credit card number using the Luhn (mod10) formula.

Parameters:

integer number
credit card number
string type
(string default) card type

See: http://en.wikipedia.org/wiki/Luhn_algorithm

Return: boolean


valid_Core :: phone

public static function phone

Checks if a phone number is valid.

Parameters:

string number
phone number to check

Todo: This function is not l10n-compatible.

Return: boolean


valid_Core :: alpha

public static function alpha

Checks whether a string consists of alphabetical characters only.

Parameters:

string str
input string
boolean utf8
(FALSE) trigger UTF-8 compatibility

Return: boolean


valid_Core :: alpha_numeric

public static function alpha_numeric

Checks whether a string consists of alphabetical characters and numbers only.

Parameters:

string str
input string
boolean utf8
(FALSE) trigger UTF-8 compatibility

Return: boolean


valid_Core :: alpha_dash

public static function alpha_dash

Checks whether a string consists of alphabetical characters, numbers, underscores and dashes only.

Parameters:

string str
input string
boolean utf8
(FALSE) trigger UTF-8 compatibility

Return: boolean


valid_Core :: digit

public static function digit

Checks whether a string consists of digits only (no dots or dashes).

Parameters:

string str
input string
boolean utf8
(FALSE) trigger UTF-8 compatibility

Return: boolean


valid_Core :: numeric

public static function numeric

Checks whether a string is a valid number (negative and decimal numbers allowed).

Parameters:

string str
input string

Return: boolean


valid_Core :: standard_text

public static function standard_text

Checks whether a string is a valid text.

Parameters:

string str
$str

Return: boolean