Zend Framework
1.12
|
Public Member Functions | |
__construct ($filterRules, $validatorRules, array $data=null, array $options=null) | |
addNamespace ($namespaces) | |
addFilterPrefixPath ($prefix, $path) | |
Add prefix path for all elements. | |
addValidatorPrefixPath ($prefix, $path) | |
Add prefix path for all elements. | |
setPluginLoader (Zend_Loader_PluginLoader_Interface $loader, $type) | |
Set plugin loaders for use with decorators and elements. | |
getPluginLoader ($type) | |
Retrieve plugin loader for given type. | |
getMessages () | |
getErrors () | |
getInvalid () | |
getMissing () | |
getUnknown () | |
getEscaped ($fieldName=null) | |
getUnescaped ($fieldName=null) | |
__get ($fieldName) | |
hasInvalid () | |
hasMissing () | |
hasUnknown () | |
hasValid () | |
isValid ($fieldName=null) | |
__isset ($fieldName) | |
process () | |
setData (array $data) | |
setDefaultEscapeFilter ($escapeFilter) | |
setOptions (array $options) | |
setTranslator ($translator=null) | |
Set translation object. | |
getTranslator () | |
Return translation object. | |
setDisableTranslator ($flag) | |
Indicate whether or not translation should be disabled. | |
translatorIsDisabled () | |
Is translation disabled? | |
Public Attributes | |
const | ALLOW_EMPTY = 'allowEmpty' |
const | BREAK_CHAIN = 'breakChainOnFailure' |
const | DEFAULT_VALUE = 'default' |
const | MESSAGES = 'messages' |
const | ESCAPE_FILTER = 'escapeFilter' |
const | FIELDS = 'fields' |
const | FILTER = 'filter' |
const | FILTER_CHAIN = 'filterChain' |
const | MISSING_MESSAGE = 'missingMessage' |
const | INPUT_NAMESPACE = 'inputNamespace' |
const | VALIDATOR_NAMESPACE = 'validatorNamespace' |
const | FILTER_NAMESPACE = 'filterNamespace' |
const | NOT_EMPTY_MESSAGE = 'notEmptyMessage' |
const | PRESENCE = 'presence' |
const | PRESENCE_OPTIONAL = 'optional' |
const | PRESENCE_REQUIRED = 'required' |
const | RULE = 'rule' |
const | RULE_WILDCARD = '*' |
const | VALIDATE = 'validate' |
const | VALIDATOR = 'validator' |
const | VALIDATOR_CHAIN = 'validatorChain' |
const | VALIDATOR_CHAIN_COUNT = 'validatorChainCount' |
Protected Member Functions | |
_escapeRecursive ($data) | |
_filter () | |
_filterRule (array $filterRule) | |
_getDefaultEscapeFilter () | |
_getMissingMessage ($rule, $field) | |
_getNotEmptyMessage ($rule, $field) | |
_process () | |
_validate () | |
_validateRule (array $validatorRule) | |
_getNotEmptyValidatorInstance ($validatorRule) | |
Check a validatorRule for the presence of a NotEmpty validator instance. | |
_getFilter ($classBaseName) | |
_getValidator ($classBaseName) | |
_getFilterOrValidator ($type, $classBaseName) | |
Protected Attributes | |
$_data = array() | |
$_filterRules = array() | |
$_validatorRules = array() | |
$_validFields = array() | |
$_invalidMessages = array() | |
$_invalidErrors = array() | |
$_missingFields = array() | |
$_unknownFields = array() | |
$_defaultEscapeFilter = null | |
$_loaders = array() | |
$_defaults | |
$_processed = false | |
$_translator | |
$_translatorDisabled = false | |
__construct | ( | $filterRules, | |
$validatorRules, | |||
array | $data = null , |
||
array | $options = null |
||
) |
array | $filterRules | |
array | $validatorRules | |
array | $data | OPTIONAL |
array | $options | OPTIONAL |
__get | ( | $fieldName | ) |
string | $fieldName |
__isset | ( | $fieldName | ) |
string | $fieldName |
|
protected |
mixed | $value |
|
protected |
Make sure we have an array representing this filter chain. Don't typecast to (array) because it might be a Zend_Filter object
Filters are indexed by integer, metacommands are indexed by string. Pick out the filters.
Use defaults for filter metacommands.
Load all the filter classes and add them to the chain.
If the ruleName is the special wildcard rule, then apply the filter chain to all input data. Else just process the field named by the rule.
|
protected |
array | $filterRule |
|
protected |
|
protected |
mixed | $classBaseName |
|
protected |
string | $type | |
mixed | $classBaseName |
Zend_Filter_Exception |
|
protected |
string | $rule | |
string | $field |
|
protected |
|
protected |
Check a validatorRule for the presence of a NotEmpty validator instance.
The purpose is to preserve things like a custom message, that may have been set on the validator outside Zend_Filter_Input.
array | $validatorRule |
|
protected |
mixed | $classBaseName |
|
protected |
|
protected |
Special case: if there are no validators, treat all fields as valid.
Make sure we have an array representing this validator chain. Don't typecast to (array) because it might be a Zend_Validate object
Validators are indexed by integer, metacommands are indexed by string. Pick out the validators.
Use defaults for validation metacommands.
Load all the validator classes and add them to the chain.
we are changing the defaults here, this is alright if all subsequent validators are also a not empty validator, but it goes wrong if one of them is not AND is required!!! that is why we restore the default value at the end of this loop
If the ruleName is the special wildcard rule, then apply the validator chain to all input data. Else just process the field named by the rule.
Unset fields in $_data that have been added to other arrays. We have to wait until all rules have been processed because a given field may be referenced by multiple rules.
Anything left over in $_data is an unknown field.
|
protected |
array | $validatorRule |
Get one or more data values from input, and check for missing fields. Apply defaults if fields are missing.
If any required fields are missing, break the loop.
Evaluate the inputs against the validator chain.
If we got this far, the inputs for this rule pass validation.
addFilterPrefixPath | ( | $prefix, | |
$path | |||
) |
addNamespace | ( | $namespaces | ) |
mixed | $namespaces |
addValidatorPrefixPath | ( | $prefix, | |
$path | |||
) |
getErrors | ( | ) |
getEscaped | ( | $fieldName = null | ) |
string | $fieldName | OPTIONAL |
getInvalid | ( | ) |
getMessages | ( | ) |
getMissing | ( | ) |
getPluginLoader | ( | $type | ) |
Retrieve plugin loader for given type.
$type may be one of:
If a plugin loader does not exist for the given type, defaults are created.
string | $type | 'filter' or 'validate' |
Zend_Filter_Exception | on invalid type |
getTranslator | ( | ) |
Return translation object.
getUnescaped | ( | $fieldName = null | ) |
string | $fieldName | OPTIONAL |
getUnknown | ( | ) |
hasInvalid | ( | ) |
hasMissing | ( | ) |
hasUnknown | ( | ) |
hasValid | ( | ) |
isValid | ( | $fieldName = null | ) |
string | $fieldName |
process | ( | ) |
Zend_Filter_Exception |
setData | ( | array | $data | ) |
setDefaultEscapeFilter | ( | $escapeFilter | ) |
mixed | $escapeFilter |
setDisableTranslator | ( | $flag | ) |
Indicate whether or not translation should be disabled.
bool | $flag |
setOptions | ( | array | $options | ) |
array | $options |
Zend_Filter_Exception | if an unknown option is given |
setPluginLoader | ( | Zend_Loader_PluginLoader_Interface | $loader, |
$type | |||
) |
Set plugin loaders for use with decorators and elements.
Zend_Loader_PluginLoader_Interface | $loader | |
string | $type | 'filter' or 'validate' |
Zend_Filter_Exception | on invalid type |
setTranslator | ( | $translator = null | ) |
Set translation object.
Zend_Translate | Zend_Translate_Adapter | null | $translator |
translatorIsDisabled | ( | ) |
Is translation disabled?
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
const ALLOW_EMPTY = 'allowEmpty' |
const BREAK_CHAIN = 'breakChainOnFailure' |
const DEFAULT_VALUE = 'default' |
const ESCAPE_FILTER = 'escapeFilter' |
const FIELDS = 'fields' |
const FILTER = 'filter' |
const FILTER_CHAIN = 'filterChain' |
const FILTER_NAMESPACE = 'filterNamespace' |
const INPUT_NAMESPACE = 'inputNamespace' |
const MESSAGES = 'messages' |
const MISSING_MESSAGE = 'missingMessage' |
const NOT_EMPTY_MESSAGE = 'notEmptyMessage' |
const PRESENCE = 'presence' |
const PRESENCE_OPTIONAL = 'optional' |
const PRESENCE_REQUIRED = 'required' |
const RULE = 'rule' |
const RULE_WILDCARD = '*' |
const VALIDATE = 'validate' |
const VALIDATOR = 'validator' |
const VALIDATOR_CHAIN = 'validatorChain' |
const VALIDATOR_CHAIN_COUNT = 'validatorChainCount' |
const VALIDATOR_NAMESPACE = 'validatorNamespace' |