CI_Validation Class Reference

List of all members.

Public Member Functions

 CI_Validation ()
 set_fields ($data= '', $field= '')
 set_rules ($data, $rules= '')
 set_message ($lang, $val= '')
 set_error_delimiters ($prefix= '< p >', $suffix= '</p >')
 run ()
 required ($str)
 matches ($str, $field)
 min_length ($str, $val)
 max_length ($str, $val)
 exact_length ($str, $val)
 valid_email ($str)
 valid_emails ($str)
 valid_ip ($ip)
 alpha ($str)
 alpha_numeric ($str)
 alpha_dash ($str)
 numeric ($str)
 is_numeric ($str)
 integer ($str)
 is_natural ($str)
 is_natural_no_zero ($str)
 valid_base64 ($str)
 set_select ($field= '', $value= '')
 set_radio ($field= '', $value= '')
 set_checkbox ($field= '', $value= '')
 prep_for_form ($data= '')
 prep_url ($str= '')
 strip_image_tags ($str)
 xss_clean ($str)
 encode_php_tags ($str)

Public Attributes

 $CI
 $error_string = ''
 $_error_array = array()
 $_rules = array()
 $_fields = array()
 $_error_messages = array()
 $_current_field = ''
 $_safe_form_data = FALSE
 $_error_prefix = '<p>'
 $_error_suffix = '</p>'


Member Function Documentation

CI_Validation::alpha ( str  ) 

Alpha

public

Parameters:
string 
Returns:
bool

CI_Validation::alpha_dash ( str  ) 

Alpha-numeric with underscores and dashes

public

Parameters:
string 
Returns:
bool

CI_Validation::alpha_numeric ( str  ) 

Alpha-numeric

public

Parameters:
string 
Returns:
bool

CI_Validation::CI_Validation (  ) 

Constructor

CI_Validation::encode_php_tags ( str  ) 

Convert PHP tags to entities

public

Parameters:
string 
Returns:
string

CI_Validation::exact_length ( str,
val 
)

Exact Length

public

Parameters:
string 
value 
Returns:
bool

CI_Validation::integer ( str  ) 

Integer

public

Parameters:
string 
Returns:
bool

CI_Validation::is_natural ( str  ) 

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

public

Parameters:
string 
Returns:
bool

CI_Validation::is_natural_no_zero ( str  ) 

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

public

Parameters:
string 
Returns:
bool

CI_Validation::is_numeric ( str  ) 

Is Numeric

public

Parameters:
string 
Returns:
bool

CI_Validation::matches ( str,
field 
)

Match one field to another

public

Parameters:
string 
field 
Returns:
bool

CI_Validation::max_length ( str,
val 
)

Max Length

public

Parameters:
string 
value 
Returns:
bool

CI_Validation::min_length ( str,
val 
)

Minimum Length

public

Parameters:
string 
value 
Returns:
bool

CI_Validation::numeric ( str  ) 

Numeric

public

Parameters:
string 
Returns:
bool

CI_Validation::prep_for_form ( data = ''  ) 

Prep data for form

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

public

Parameters:
string 
Returns:
string

CI_Validation::prep_url ( str = ''  ) 

Prep URL

public

Parameters:
string 
Returns:
string

CI_Validation::required ( str  ) 

Required

public

Parameters:
string 
Returns:
bool

CI_Validation::run (  ) 

Run the Validator

This function does all the work.

public

Returns:
bool

CI_Validation::set_checkbox ( field = '',
value = '' 
)

Set Checkbox

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

public

Parameters:
string 
string 
Returns:
string

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

Set The Error Delimiter

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

public

Parameters:
string 
string 
Returns:
void

CI_Validation::set_fields ( data = '',
field = '' 
)

Set Fields

This function takes an array of field names as input and generates class variables with the same name, which will either be blank or contain the $_POST value corresponding to it

public

Parameters:
string 
string 
Returns:
void

CI_Validation::set_message ( lang,
val = '' 
)

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.

public

Parameters:
string 
string 
Returns:
string

CI_Validation::set_radio ( field = '',
value = '' 
)

Set Radio

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

public

Parameters:
string 
string 
Returns:
string

CI_Validation::set_rules ( data,
rules = '' 
)

Set Rules

This function takes an array of field names and validation rules as input ad simply stores is for use later.

public

Parameters:
mixed 
string 
Returns:
void

CI_Validation::set_select ( field = '',
value = '' 
)

Set Select

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

public

Parameters:
string 
string 
Returns:
string

CI_Validation::strip_image_tags ( str  ) 

Strip Image Tags

public

Parameters:
string 
Returns:
string

CI_Validation::valid_base64 ( str  ) 

Valid Base64

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

public

Parameters:
string 
Returns:
bool

CI_Validation::valid_email ( str  ) 

Valid Email

public

Parameters:
string 
Returns:
bool

CI_Validation::valid_emails ( str  ) 

Valid Emails

public

Parameters:
string 
Returns:
bool

CI_Validation::valid_ip ( ip  ) 

Validate IP Address

public

Parameters:
string 
Returns:
string

CI_Validation::xss_clean ( str  ) 

XSS Clean

public

Parameters:
string 
Returns:
string


Member Data Documentation

CI_Validation::$_current_field = ''

CI_Validation::$_error_array = array()

CI_Validation::$_error_messages = array()

CI_Validation::$_error_prefix = '<p>'

CI_Validation::$_error_suffix = '</p>'

CI_Validation::$_fields = array()

CI_Validation::$_rules = array()

CI_Validation::$_safe_form_data = FALSE

CI_Validation::$CI

CI_Validation::$error_string = ''


The documentation for this class was generated from the following file:

Generated on Sun Nov 16 16:09:18 2008 for CodeIgniter by  doxygen 1.5.7.1