Filter/Input.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Filter  
Version
$Id$  

\Zend_Filter_Input

Package: Zend_Filter
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstant  ALLOW_EMPTY = 'allowEmpty'
>VConstant  BREAK_CHAIN = 'breakChainOnFailure'
>VConstant  DEFAULT_VALUE = 'default'
>VConstant  MESSAGES = 'messages'
>VConstant  ESCAPE_FILTER = 'escapeFilter'
>VConstant  FIELDS = 'fields'
>VConstant  FILTER = 'filter'
>VConstant  FILTER_CHAIN = 'filterChain'
>VConstant  MISSING_MESSAGE = 'missingMessage'
>VConstant  INPUT_NAMESPACE = 'inputNamespace'
>VConstant  VALIDATOR_NAMESPACE = 'validatorNamespace'
>VConstant  FILTER_NAMESPACE = 'filterNamespace'
>VConstant  NOT_EMPTY_MESSAGE = 'notEmptyMessage'
>VConstant  PRESENCE = 'presence'
>VConstant  PRESENCE_OPTIONAL = 'optional'
>VConstant  PRESENCE_REQUIRED = 'required'
>VConstant  RULE = 'rule'
>VConstant  RULE_WILDCARD = '*'
>VConstant  VALIDATE = 'validate'
>VConstant  VALIDATOR = 'validator'
>VConstant  VALIDATOR_CHAIN = 'validatorChain'
>VConstant  VALIDATOR_CHAIN_COUNT = 'validatorChainCount'

Properties

>VPropertyprotectedarray $_data = array()

Input data, before processing.

Default valuearray()Details
Type
array
>VPropertyprotected\Zend_Filter_Interface $_defaultEscapeFilter = null

The filter object that is run on values returned by the getEscaped() method.

Default valuenullDetails
Type
\Zend_Filter_Interface
>VPropertyprotectedarray $_defaults = array(self::ALLOW_EMPTY => false, self::BREAK_CHAIN => false, self::ESCAPE_FILTER => 'HtmlEntities', self::MISSING_MESSAGE => "Field '%field%' is required by rule '%rule%', but the field is missing", self::NOT_EMPTY_MESSAGE => "You must give a non-empty value for field '%field%'", self::PRESENCE => self::PRESENCE_OPTIONAL)

Default values to use when processing filters and validators.

Default valuearray(self::ALLOW_EMPTY => false, self::BREAK_CHAIN => false, self::ESCAPE_FILTER => 'HtmlEntities', self::MISSING_MESSAGE => "Field '%field%' is required by rule '%rule%', but the field is missing", self::NOT_EMPTY_MESSAGE => "You must give a non-empty value for field '%field%'", self::PRESENCE => self::PRESENCE_OPTIONAL)Details
Type
array
>VPropertyprotectedarray $_filterRules = array()

Association of rules to filters.

Default valuearray()Details
Type
array
>VPropertyprotectedarray $_invalidErrors = array()

After processing data, this contains mapping of validation rules that did not pass validation to the array of error identifiers returned by the validator chain.

Default valuearray()Details
Type
array
>VPropertyprotectedarray $_invalidMessages = array()

After processing data, this contains mapping of validation rules that did not pass validation to the array of messages returned by the validator chain.

Default valuearray()Details
Type
array
>VPropertyprotectedarray $_loaders = array()
Plugin loaders
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_missingFields = array()

After processing data, this contains mapping of validation rules in which some fields were missing to the array of messages indicating which fields were missing.

Default valuearray()Details
Type
array
>VPropertyprotectedboolean $_processed = false

Set to False initially, this is set to True after the input data have been processed. Reset to False in setData() method.

Default valuefalseDetails
Type
boolean
>VPropertyprotected\Zend_Translate $_translator
Translation object
Details
Type
\Zend_Translate
>VPropertyprotectedBoolean $_translatorDisabled = false
Is translation disabled?
Default valuefalseDetails
Type
Boolean
>VPropertyprotectedarray $_unknownFields = array()

After processing, this contains a copy of $_data elements that were not mentioned in any validation rule.

Default valuearray()Details
Type
array
>VPropertyprotectedarray $_validFields = array()

After processing data, this contains mapping of valid fields to field values.

Default valuearray()Details
Type
array
>VPropertyprotectedarray $_validatorRules = array()

Association of rules to validators.

Default valuearray()Details
Type
array

Methods

methodpublic__construct(array $filterRules, array $validatorRules, array $data = null, array $options = null) : void

Parameters
NameTypeDescription
$filterRulesarray
$validatorRulesarray
$dataarray

OPTIONAL

$optionsarray

OPTIONAL

methodpublic__get(string $fieldName) : mixed

Parameters
NameTypeDescription
$fieldNamestring
Returns
TypeDescription
mixed
methodpublic__isset(string $fieldName) : boolean

Parameters
NameTypeDescription
$fieldNamestring
Returns
TypeDescription
boolean
methodprotected_escapeRecursive( $data) : mixed

Parameters
NameTypeDescription
$data
Returns
TypeDescription
mixed
methodprotected_filter() : void

methodprotected_filterRule(array $filterRule) : void

Parameters
NameTypeDescription
$filterRulearray
methodprotected_getDefaultEscapeFilter() : \Zend_Filter_Interface

Returns
TypeDescription
\Zend_Filter_Interface
methodprotected_getFilter(mixed $classBaseName) : \Zend_Filter_Interface

Parameters
NameTypeDescription
$classBaseNamemixed
Returns
TypeDescription
\Zend_Filter_Interface
methodprotected_getFilterOrValidator(string $type, mixed $classBaseName) : \Zend_Filter_Interface | \Zend_Validate_Interface

Parameters
NameTypeDescription
$typestring
$classBaseNamemixed
Returns
TypeDescription
\Zend_Filter_Interface | \Zend_Validate_Interface
Throws
ExceptionDescription
\Zend_Filter_Exception
methodprotected_getMissingMessage(string $rule, string $field) : string

Parameters
NameTypeDescription
$rulestring
$fieldstring
Returns
TypeDescription
string
methodprotected_getNotEmptyMessage( $rule,  $field) : string

Parameters
NameTypeDescription
$rule
$field
Returns
TypeDescription
string
methodprotected_getNotEmptyValidatorInstance(array $validatorRule) : mixed

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.
Parameters
NameTypeDescription
$validatorRulearray
Returns
TypeDescription
mixedfalse if none is found, Zend_Validate_NotEmpty instance if found
methodprotected_getValidator(mixed $classBaseName) : \Zend_Validate_Interface

Parameters
NameTypeDescription
$classBaseNamemixed
Returns
TypeDescription
\Zend_Validate_Interface
methodprotected_process() : void

methodprotected_validate() : void

methodprotected_validateRule(array $validatorRule) : void

Parameters
NameTypeDescription
$validatorRulearray
methodpublicaddFilterPrefixPath(string $prefix, string $path) : \Zend_Filter_Input

Add prefix path for all elements

Parameters
NameTypeDescription
$prefixstring
$pathstring
Returns
TypeDescription
\Zend_Filter_Input
methodpublicaddNamespace(mixed $namespaces) : \Zend_Filter_Input

Parameters
NameTypeDescription
$namespacesmixed
Returns
TypeDescription
\Zend_Filter_Input
Details
Deprecated
since 1.5.0RC1 - use addFilterPrefixPath() or addValidatorPrefixPath instead.  
methodpublicaddValidatorPrefixPath(string $prefix, string $path) : \Zend_Filter_Input

Add prefix path for all elements

Parameters
NameTypeDescription
$prefixstring
$pathstring
Returns
TypeDescription
\Zend_Filter_Input
methodpublicgetErrors() : array

Returns
TypeDescription
array
methodpublicgetEscaped(string $fieldName = null) : mixed

Parameters
NameTypeDescription
$fieldNamestring

OPTIONAL

Returns
TypeDescription
mixed
methodpublicgetInvalid() : array

Returns
TypeDescription
array
methodpublicgetMessages() : array

Returns
TypeDescription
array
methodpublicgetMissing() : array

Returns
TypeDescription
array
methodpublicgetPluginLoader(string $type) : \Zend_Loader_PluginLoader_Interface

Retrieve plugin loader for given type

$type may be one of: - filter - validator If a plugin loader does not exist for the given type, defaults are created.
Parameters
NameTypeDescription
$typestring

'filter' or 'validate'

Returns
TypeDescription
\Zend_Loader_PluginLoader_Interface
Throws
ExceptionDescription
\Zend_Filter_Exceptionon invalid type
methodpublicgetTranslator() : \Zend_Translate_Adapter | null

Return translation object

Returns
TypeDescription
\Zend_Translate_Adapter | null
methodpublicgetUnescaped(string $fieldName = null) : mixed

Parameters
NameTypeDescription
$fieldNamestring

OPTIONAL

Returns
TypeDescription
mixed
methodpublicgetUnknown() : array

Returns
TypeDescription
array
methodpublichasInvalid() : boolean

Returns
TypeDescription
boolean
methodpublichasMissing() : boolean

Returns
TypeDescription
boolean
methodpublichasUnknown() : boolean

Returns
TypeDescription
boolean
methodpublichasValid() : boolean

Returns
TypeDescription
boolean
methodpublicisValid(string $fieldName = null) : boolean

Parameters
NameTypeDescription
$fieldNamestring
Returns
TypeDescription
boolean
methodpublicprocess() : \Zend_Filter_Input

Returns
TypeDescription
\Zend_Filter_Input
Throws
ExceptionDescription
\Zend_Filter_Exception
methodpublicsetData(array $data) : \Zend_Filter_Input

Parameters
NameTypeDescription
$dataarray
Returns
TypeDescription
\Zend_Filter_Input
methodpublicsetDefaultEscapeFilter(mixed $escapeFilter) : \Zend_Filter_Interface

Parameters
NameTypeDescription
$escapeFiltermixed
Returns
TypeDescription
\Zend_Filter_Interface
methodpublicsetDisableTranslator(bool $flag) : \Zend_Filter_Input

Indicate whether or not translation should be disabled

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Filter_Input
methodpublicsetOptions(array $options) : \Zend_Filter_Input

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
\Zend_Filter_Input
Throws
ExceptionDescription
\Zend_Filter_Exceptionif an unknown option is given
methodpublicsetPluginLoader(\Zend_Loader_PluginLoader_Interface $loader, string $type) : \Zend_Filter_Input

Set plugin loaders for use with decorators and elements

Parameters
NameTypeDescription
$loader\Zend_Loader_PluginLoader_Interface
$typestring

'filter' or 'validate'

Returns
TypeDescription
\Zend_Filter_Input
Throws
ExceptionDescription
\Zend_Filter_Exceptionon invalid type
methodpublicsetTranslator(\Zend_Translate | \Zend_Translate_Adapter | null $translator = null) : \Zend_Filter_Input

Set translation object

Parameters
NameTypeDescription
$translator\Zend_Translate | \Zend_Translate_Adapter | null
Returns
TypeDescription
\Zend_Filter_Input
methodpublictranslatorIsDisabled() : bool

Is translation disabled?

Returns
TypeDescription
bool
Documentation was generated by phpDocumentor 2.2.0 .