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>' | |
| CI_Validation::alpha | ( | $ | str | ) |
Alpha
public
| string |
| CI_Validation::alpha_dash | ( | $ | str | ) |
Alpha-numeric with underscores and dashes
public
| string |
| CI_Validation::alpha_numeric | ( | $ | str | ) |
Alpha-numeric
public
| string |
| CI_Validation::CI_Validation | ( | ) |
Constructor
| CI_Validation::encode_php_tags | ( | $ | str | ) |
Convert PHP tags to entities
public
| string |
| CI_Validation::exact_length | ( | $ | str, | |
| $ | val | |||
| ) |
Exact Length
public
| string | ||
| value |
| CI_Validation::integer | ( | $ | str | ) |
Integer
public
| string |
| CI_Validation::is_natural | ( | $ | str | ) |
Is a Natural number (0,1,2,3, etc.)
public
| string |
| CI_Validation::is_natural_no_zero | ( | $ | str | ) |
Is a Natural number, but not a zero (1,2,3, etc.)
public
| string |
| CI_Validation::is_numeric | ( | $ | str | ) |
Is Numeric
public
| string |
| CI_Validation::matches | ( | $ | str, | |
| $ | field | |||
| ) |
Match one field to another
public
| string | ||
| field |
| CI_Validation::max_length | ( | $ | str, | |
| $ | val | |||
| ) |
Max Length
public
| string | ||
| value |
| CI_Validation::min_length | ( | $ | str, | |
| $ | val | |||
| ) |
Minimum Length
public
| string | ||
| value |
| CI_Validation::numeric | ( | $ | str | ) |
Numeric
public
| string |
| 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
| string |
| CI_Validation::prep_url | ( | $ | str = '' |
) |
Prep URL
public
| string |
| CI_Validation::required | ( | $ | str | ) |
Required
public
| string |
| CI_Validation::run | ( | ) |
Run the Validator
This function does all the work.
public
| 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
| string | ||
| 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
| string | ||
| string |
| 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
| string | ||
| string |
| 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
| string | ||
| 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
| string | ||
| 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
| mixed | ||
| string |
| 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
| string | ||
| string |
| CI_Validation::strip_image_tags | ( | $ | str | ) |
Strip Image Tags
public
| 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
| string |
| CI_Validation::valid_email | ( | $ | str | ) |
Valid Email
public
| string |
| CI_Validation::valid_emails | ( | $ | str | ) |
Valid Emails
public
| string |
| CI_Validation::valid_ip | ( | $ | ip | ) |
Validate IP Address
public
| string |
| CI_Validation::xss_clean | ( | $ | str | ) |
XSS Clean
public
| string |
| 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 = '' |
1.5.7.1