Properties

$CI

$CI : 

Type

$_field_data

$_field_data : 

Type

$_config_rules

$_config_rules : 

Type

$_error_array

$_error_array : 

Type

$_error_messages

$_error_messages : 

Type

$_error_prefix

$_error_prefix : 

Type

$_error_suffix

$_error_suffix : 

Type

$error_string

$error_string : 

Type

$_safe_form_data

$_safe_form_data : 

Type

Methods

__construct()

__construct(  $rules = array()) 

Constructor

Parameters

$rules

set_rules()

set_rules(  $field,   $label = '',   $rules = '') : void

Set Rules

This function takes an array of field names and validation rules as input, validates the info, and stores it

Parameters

$field
$label
$rules

set_message()

set_message(  $lang,   $val = '') : string

Set Error Message

Lets users set their own error messages on the fly. Note: The key name has to match the function name that it corresponds to.

Parameters

$lang
$val

Returns

string

set_error_delimiters()

set_error_delimiters(  $prefix = '<p>',   $suffix = '</p>') : void

Set The Error Delimiter

Permits a prefix/suffix to be added to each error message

Parameters

$prefix
$suffix

error()

error(  $field = '',   $prefix = '',   $suffix = '') : void

Get Error Message

Gets the error message associated with a particular field

Parameters

$field
$prefix
$suffix

error_string()

error_string(  $prefix = '',   $suffix = '') : \str

Error String

Returns the error messages as a string, wrapped in the error delimiters

Parameters

$prefix
$suffix

Returns

\str

run()

run(  $group = '') : boolean

Run the Validator

This function does all the work.

Parameters

$group

Returns

boolean

set_value()

set_value(  $field = '',   $default = '') : void

Get the value from a form

Permits you to repopulate a form field with the value it was submitted with, or, if that value doesn't exist, with the default

Parameters

$field
$default

set_select()

set_select(  $field = '',   $value = '',   $default = FALSE) : string

Set Select

Enables pull-down lists to be set to the value the user selected in the event of an error

Parameters

$field
$value
$default

Returns

string

set_radio()

set_radio(  $field = '',   $value = '',   $default = FALSE) : string

Set Radio

Enables radio buttons to be set to the value the user selected in the event of an error

Parameters

$field
$value
$default

Returns

string

set_checkbox()

set_checkbox(  $field = '',   $value = '',   $default = FALSE) : string

Set Checkbox

Enables checkboxes to be set to the value the user selected in the event of an error

Parameters

$field
$value
$default

Returns

string

required()

required(  $str) : boolean

Required

Parameters

$str

Returns

boolean

regex_match()

regex_match(  $str,   $regex) : boolean

Performs a Regular Expression match test.

Parameters

$str
$regex

Returns

boolean

matches()

matches(  $str,   $field) : boolean

Match one field to another

Parameters

$str
$field

Returns

boolean

is_unique()

is_unique(  $str,   $field) : boolean

Match one field to another

Parameters

$str
$field

Returns

boolean

min_length()

min_length(  $str,   $val) : boolean

Minimum Length

Parameters

$str
$val

Returns

boolean

max_length()

max_length(  $str,   $val) : boolean

Max Length

Parameters

$str
$val

Returns

boolean

exact_length()

exact_length(  $str,   $val) : boolean

Exact Length

Parameters

$str
$val

Returns

boolean

valid_email()

valid_email(  $str) : boolean

Valid Email

Parameters

$str

Returns

boolean

valid_emails()

valid_emails(  $str) : boolean

Valid Emails

Parameters

$str

Returns

boolean

valid_ip()

valid_ip(  $ip,   $which = '') : string

Validate IP Address

Parameters

$ip
$which

Returns

string

alpha()

alpha(  $str) : boolean

Alpha

Parameters

$str

Returns

boolean

alpha_numeric()

alpha_numeric(  $str) : boolean

Alpha-numeric

Parameters

$str

Returns

boolean

alpha_dash()

alpha_dash(  $str) : boolean

Alpha-numeric with underscores and dashes

Parameters

$str

Returns

boolean

numeric()

numeric(  $str) : boolean

Numeric

Parameters

$str

Returns

boolean

is_numeric()

is_numeric(  $str) : boolean

Is Numeric

Parameters

$str

Returns

boolean

integer()

integer(  $str) : boolean

Integer

Parameters

$str

Returns

boolean

decimal()

decimal(  $str) : boolean

Decimal number

Parameters

$str

Returns

boolean

greater_than()

greater_than(  $str,   $min) : boolean

Greather than

Parameters

$str
$min

Returns

boolean

less_than()

less_than(  $str,   $max) : boolean

Less than

Parameters

$str
$max

Returns

boolean

is_natural()

is_natural(  $str) : boolean

Is a Natural number (0,1,2,3, etc.)

Parameters

$str

Returns

boolean

is_natural_no_zero()

is_natural_no_zero(  $str) : boolean

Is a Natural number, but not a zero (1,2,3, etc.)

Parameters

$str

Returns

boolean

valid_base64()

valid_base64(  $str) : boolean

Valid Base64

Tests a string for characters outside of the Base64 alphabet as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045

Parameters

$str

Returns

boolean

prep_for_form()

prep_for_form(  $data = '') : string

Prep data for form

This function allows HTML to be safely shown in a form. Special characters are converted.

Parameters

$data

Returns

string

prep_url()

prep_url(  $str = '') : string

Prep URL

Parameters

$str

Returns

string

strip_image_tags()

strip_image_tags(  $str) : string

Strip Image Tags

Parameters

$str

Returns

string

xss_clean()

xss_clean(  $str) : string

XSS Clean

Parameters

$str

Returns

string

encode_php_tags()

encode_php_tags(  $str) : string

Convert PHP tags to entities

Parameters

$str

Returns

string

_reduce_array()

_reduce_array(  $array,   $keys,   $i) : mixed

Traverse a multidimensional $_POST array index until the data is found

Parameters

$array
$keys
$i

Returns

mixed

_reset_post_array()

_reset_post_array() : null

Re-populate the _POST array with our finalized and processed data

Returns

null

_execute()

_execute(  $row,   $rules,   $postdata = NULL,   $cycles) : mixed

Executes the Validation routines

Parameters

$row
$rules
$postdata
$cycles

Returns

mixed

_translate_fieldname()

_translate_fieldname(  $fieldname) : string

Translate a field name

Parameters

$fieldname

Returns

string