Static Public Member Functions

FormValidators Class Reference

List of all members.

Static Public Member Functions

static have ($validator)
static validate_url ($text, $control, $form, $warning=null, $schemes=array( 'http', 'https'))
static validate_email ($text, $control, $form, $warning=null)
static validate_required ($value, $control, $form, $warning=null)
static validate_username ($value, $control, $form, $allowed_name=null, $warning=null)
static validate_groupname ($value, $control, $form, $allowed_name=null, $warning=null)
static validate_same ($value, $control, $form, $matcher, $warning=null)
static validate_regex ($value, $control, $container, $regex, $warning=null)
static validate_range ($value, $control, $container, $min, $max, $warning=null)
static validate_wsse ($value, $control, $form, $warning=null)

Detailed Description

FormValidators Class

Extend this class to supply your own validators, by default we supply most common

Definition at line 10 of file formvalidators.php.


Member Function Documentation

static FormValidators::have ( validator  )  [static]

Determine if a validator is implemented in this class

Parameters:
string $validator The name of a validator to find
Returns:
bool True if this class implements the specified validator

Definition at line 18 of file formvalidators.php.

Referenced by FormControl::validate().

static FormValidators::validate_email ( text,
control,
form,
warning = null 
) [static]

A validation function that returns an error if the value passed in is not a valid Email Address, as per RFC2822 and RFC2821.

Parameters:
string $text A string to test if it is a valid Email Address
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
string $warning An optional error message
Returns:
array An empty array if the string is a valid Email Address, or an array with strings describing the errors

Definition at line 65 of file formvalidators.php.

static FormValidators::validate_groupname ( value,
control,
form,
allowed_name = null,
warning = null 
) [static]

A validation function that returns an error if the the passed group name is unavailable

Parameters:
string $text A value to test as group name
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
string $allowed_name An optional name which overrides the check and is always allowed
string $warning An optional error message
Returns:
array An empty array if the value exists, or an array with strings describing the errors

Definition at line 126 of file formvalidators.php.

static FormValidators::validate_range ( value,
control,
container,
min,
max,
warning = null 
) [static]

A validation function that returns an error if the value passed is not within a specified range

Parameters:
string $value A value to test if it is empty
FormControl $control The control that defines the value
FormContainer $container The container that holds the control
float $min The minimum value, inclusive
float $max The maximum value, inclusive
string $warning An optional error message
Returns:
array An empty array if the value is value, or an array with strings describing the errors

Definition at line 192 of file formvalidators.php.

static FormValidators::validate_regex ( value,
control,
container,
regex,
warning = null 
) [static]

A validation function that returns an error if the value passed does not match the regex specified.

Parameters:
string $value A value to test if it is empty
FormControl $control The control that defines the value
FormContainer $container The container that holds the control
string $regex The regular expression to test against
string $warning An optional error message
Returns:
array An empty array if the value exists, or an array with strings describing the errors

Definition at line 168 of file formvalidators.php.

static FormValidators::validate_required ( value,
control,
form,
warning = null 
) [static]

A validation function that returns an error if the value passed in is not set.

Parameters:
string $text A value to test if it is empty
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
string $warning An optional error message
Returns:
array An empty array if the value exists, or an array with strings describing the errors

Definition at line 85 of file formvalidators.php.

static FormValidators::validate_same ( value,
control,
form,
matcher,
warning = null 
) [static]

A validation function that returns an error if the passed control values do not match

Parameters:
string $text A value to test for similarity
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
FormControl $matcher The control which should have a matching value
string $warning An optional error message
Returns:
array An empty array if the value exists, or an array with strings describing the errors

Definition at line 149 of file formvalidators.php.

static FormValidators::validate_url ( text,
control,
form,
warning = null,
schemes = array( 'http', 'https' ) 
) [static]

A validation function that returns an error if the value passed in is not a valid URL.

Parameters:
string $text A string to test if it is a valid URL
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
string $warning An optional error message
Returns:
array An empty array if the string is a valid URL, or an array with strings describing the errors

Definition at line 33 of file formvalidators.php.

static FormValidators::validate_username ( value,
control,
form,
allowed_name = null,
warning = null 
) [static]

A validation function that returns an error if the the passed username is unavailable

Parameters:
string $text A value to test as username
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
string $allowed_name An optional name which overrides the check and is always allowed
string $warning An optional error message
Returns:
array An empty array if the value exists, or an array with strings describing the errors

Definition at line 104 of file formvalidators.php.

static FormValidators::validate_wsse ( value,
control,
form,
warning = null 
) [static]

A validation function that returns an error if the form's WSSE values don't pass

Parameters:
string $value The container's value, not very useful
FormControl $control The container that holds the WSSE controls
FormContainer $form The form that holds the container, probalby the same value
string $warning An optional error message
Returns:
array An empty array if the value exists, or an array with strings describing the errors

Definition at line 220 of file formvalidators.php.


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