Class WFKeyValueValidators

Description

Built-in Key-Value Validators.

The WFKeyValueValidators class provides a bunch of commonly used validators.

Located in /framework/util/WFKeyValueValidators.php (line 18)

WFObject
   |
   --WFKeyValueValidators
Method Summary
static boolean validateEmail (mixed &$value, boolean &$edited, array &$errors, [array $options = array()])
static boolean validatePhone (mixed &$value, boolean &$edited, array &$errors, [array $options = array()])
static boolean validatePostalCode (mixed &$value, boolean &$edited, array &$errors, [array $options = array()])
static boolean validateUrl (mixed &$value, boolean &$edited, array &$errors, [array $options = array()])
Methods
static method validateEmail (line 33)

Validate email addresses.

Options: required: Whether to make the value required. Default false. key: What to display as the "field" title in error messages. Default: "Email".

  • return: TRUE indicates a valid value, FALSE indicates an error.
  • access: public
static boolean validateEmail (mixed &$value, boolean &$edited, array &$errors, [array $options = array()])
  • mixed &$value: A reference to value to check. Passed by reference so that the implementation can normalize the data.
  • boolean &$edited: A reference to a boolean. This value will always be FALSE when the method is called. If the implementation edits the $value, set to TRUE.
  • array &$errors: An array of WFError objects describing the error. The array is empty by default; you can add new error entries.
  • array $options: An array of options.
static method validatePhone (line 136)

Validate a phone number.

Pretty flexible; allows any character(s) as separators. Just tries to be sure that there are the right number of digits in the right number of groups.

Doesn't allow extensions.

Options: required: Whether to make the value required. Default false. key: What to display as the "field" title in error messages. Default: "Email". country: Country Code to use for validation. Default US.

  • return: TRUE indicates a valid value, FALSE indicates an error.
  • access: public
static boolean validatePhone (mixed &$value, boolean &$edited, array &$errors, [array $options = array()])
  • mixed &$value: A reference to value to check. Passed by reference so that the implementation can normalize the data.
  • boolean &$edited: A reference to a boolean. This value will always be FALSE when the method is called. If the implementation edits the $value, set to TRUE.
  • array &$errors: An array of WFError objects describing the error. The array is empty by default; you can add new error entries.
  • array $options: An array of options.
static method validatePostalCode (line 197)

Validate a postal code.

Options: required: Whether to make the value required. Default false. key: What to display as the "field" title in error messages. Default: "Email". country: Country Code to use for validation. Default US.

  • return: TRUE indicates a valid value, FALSE indicates an error.
  • access: public
static boolean validatePostalCode (mixed &$value, boolean &$edited, array &$errors, [array $options = array()])
  • mixed &$value: A reference to value to check. Passed by reference so that the implementation can normalize the data.
  • boolean &$edited: A reference to a boolean. This value will always be FALSE when the method is called. If the implementation edits the $value, set to TRUE.
  • array &$errors: An array of WFError objects describing the error. The array is empty by default; you can add new error entries.
  • array $options: An array of options.
static method validateUrl (line 81)

Validate URL.

Uses filter_var($value, FILTER_VALIDATE_URL) to verify a URL. Will also try pre-pending http:// if no scheme is present.

Options: required: Whether to make the value required. Default false. key: What to display as the "field" title in error messages. Default: "Email".

  • return: TRUE indicates a valid value, FALSE indicates an error.
  • access: public
static boolean validateUrl (mixed &$value, boolean &$edited, array &$errors, [array $options = array()])
  • mixed &$value: A reference to value to check. Passed by reference so that the implementation can normalize the data.
  • boolean &$edited: A reference to a boolean. This value will always be FALSE when the method is called. If the implementation edits the $value, set to TRUE.
  • array &$errors: An array of WFError objects describing the error. The array is empty by default; you can add new error entries.
  • array $options: An array of options.

Inherited Methods

Inherited From WFObject

WFObject::__construct()
WFObject::exposedProperties()
WFObject::getClass()
WFObject::keyPathToTargetAndKey()
WFObject::setValueForKey()
WFObject::setValueForKeyPath()
WFObject::setValuesForKeys()
WFObject::validatedSetValueForKey()
WFObject::validatedSetValueForKeyPath()
WFObject::validateObject()
WFObject::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForStaticKey()
WFObject::valueForStaticKeyPath()
WFObject::valueForTargetAndKeyPath()
WFObject::valueForUndefinedKey()
WFObject::valueForUndefinedStaticKey()
WFObject::valuesForKeyPaths()
WFObject::valuesForKeys()
WFObject::_valueForStaticKey()
WFObject::__toString()

Documentation generated on Thu, 14 May 2009 16:20:08 -0400 by phpDocumentor 1.4.2