Project
category Form Validation
package FormValidator
author Andy Prevost
copyright 2004-2023 (C) Andy Prevost - All Rights Reserved
version 1.2.0
license MIT - Distributed under the MIT License
namespace codeworxtech\FormValidator;
class FormValidator
const
scope property default value comments
const VERSION '1.2.0'  
public
scope property default value comments
public $error_hash []  
public $lang_code  
public $validator_array []  
protected
scope property default value comments
protected $language []  
Methods
scope function params comments
public __construct $lang_iso='en' Class Constructor
loads language error messages
@param string $lang_iso (two-char based on ISO 639-1)
public AddValidation $variable,$validator,$error='' Adds a validation "rule", form fields can have multiple "rules"
@param mixed $variable (form field name)
@param string $validator "rule"
@param string $error Error to display - overrides default
public GetErrors Gets the error hash generated by the form validation process
@return array
protected Lang $key Returns a message in the appropriate language.
@return string
public SetLanguage $langcode='en', $lang_path='language/' Sets the language for all class error messages.
The default language is English 'en' (as defined below)
Based on ISO 639-1 2-character language code (ie. French: 'fr')
https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
@param string $langcode
@param string $lang_path Path to the language file directory
public ValidateForm Main function to validate all form input
@return boolean
private ValidateObject $validatorobj,$formvariables,&$error_string Validates each individual field
@return boolean
private ValidateProcess $rule,$rule_value,$input_value,&$error_message,$variable_name,$formvariables  
private ChkDataType $input_value,$reg_exp  
private ChkDontSelect $input_value,$rule_value,&$error_message,$variable_name  
private ChkGreaterThan $rule_value,$input_value,$variable_name,&$error_message  
private ChkLessThan $rule_value,$input_value,$variable_name,&$error_message  
private ChkNumeric $input_value,&$validation_success  
private ChkMaxLen $input_value,$max_len,$variable_name,&$error_message  
private ChkMinLen $input_value,$min_len,$variable_name,&$error_message  
private ChkRequired $input_value, &$error_message,$variable_name  
private ChkSelect $input_value,$rule_value,&$error_message,$variable_name