ReCaptcha adapter

Allows to insert captchas driven by ReCaptcha service

see
category Zend
package Zend_Captcha
subpackage Adapter
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
version $Id$
inherited_from \Zend_Captcha_Base

 Methods

Constructor

__construct(array|\Zend_Config $options = null
inherited_from \Zend_Captcha_Base::__construct()

Parameters

$options

array\Zend_Config

Constructor

__construct(array|\Zend_Config $options = null
Inherited

Parameters

$options

array\Zend_Config

Magic function returns the value of the requested property, if and only if it is the value or a message variable.

__get(string $property) : mixed
Inherited

Parameters

$property

string

Exceptions

\Zend_Validate_Exception

Returns

mixed

Generate captcha

generate() : string
see

Returns

string

Get captcha decorator

getDecorator() : string

By default, return null, indicating no extra decorator needed.

inherited_from \Zend_Captcha_Base::getDecorator()

Returns

string

Get optional decorator

getDecorator() : null
Inherited

By default, return null, indicating no extra decorator needed.

inherited_from \Zend_Captcha_Adapter::getDecorator()

Returns

null

Get default translation object for all validate objects

getDefaultTranslator() : \Zend_Translate_Adapter | null
InheritedStatic

Returns

\Zend_Translate_Adapternull

Returns array of validation failure message codes

getErrors() : array
Inherited
deprecated Since 1.5.0

Returns

array

Returns the maximum allowed message length

getMessageLength() : integer
InheritedStatic

Returns

integer

Returns the message templates from the validator

getMessageTemplates() : array
Inherited

Returns

array

Returns an array of the names of variables that are used in constructing validation failure messages

getMessageVariables() : array
Inherited

Returns

array

Returns array of validation failure messages

getMessages() : array
Inherited

If isValid() was never called or if the most recent isValid() call returned true, then this method returns an empty array.

inherited_from \Zend_Validate_Interface::getMessages()

Returns

array

Get name

getName() : string
Inherited
inherited_from \Zend_Captcha_Adapter::getName()

Returns

string

Retrieve flag indicating whether or not value should be obfuscated in messages

getObscureValue() : boolean
Inherited

Returns

boolean

Retrieve options representing object state

getOptions() : array
Inherited

Returns

array

Retrieve ReCaptcha Private key

getPrivkey() : string

Returns

string

Retrieve ReCaptcha Public key

getPubkey() : string

Returns

string

Retrieve ReCaptcha service object

getService() : \Zend_Service_ReCaptcha

Returns

\Zend_Service_ReCaptcha

Return translation object

getTranslator() : \Zend_Translate_Adapter | null
Inherited

Returns

\Zend_Translate_Adapternull

Is there a default translation object set?

hasDefaultTranslator() : boolean
InheritedStatic

Returns

boolean

Does this validator have its own specific translator?

hasTranslator() : boolean
Inherited

Returns

boolean

Validate captcha

isValid(mixed $value, array|null $context = null) : boolean
see

Parameters

$value

mixed

$context

arraynull

Returns

boolean

Render captcha

render(\Zend_View_Interface $view = null, mixed $element = null) : string

Parameters

$view

\Zend_View_Interface

$element

mixed

Returns

string

Set object state from config object

setConfig(\Zend_Config $config) : \Zend_Captcha_Base
Inherited

Parameters

$config

\Zend_Config

Returns

\Zend_Captcha_Base

Set default translation object for all validate objects

setDefaultTranslator(\Zend_Translate|\Zend_Translate_Adapter|null $translator = null
InheritedStatic

Parameters

$translator

\Zend_Translate\Zend_Translate_Adapternull

Exceptions

\Zend_Validate_Exception

Indicate whether or not translation should be disabled

setDisableTranslator(boolean $flag) : \Zend_Validate_Abstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_Validate_Abstract

Sets the validation failure message template for a particular key

setMessage(string $messageString, string $messageKey = null) : \Zend_Validate_Abstract
Inherited

Parameters

$messageString

string

$messageKey

string

OPTIONAL

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_AbstractProvides a fluent interface

Sets the maximum allowed message length

setMessageLength(integer $length = -1
InheritedStatic

Parameters

$length

integer

Sets validation failure message templates given as an array, where the array keys are the message keys, and the array values are the message template strings.

setMessages(array $messages) : \Zend_Validate_Abstract
Inherited

Parameters

$messages

array

Returns

\Zend_Validate_Abstract

Set name

setName(string $name) : \Zend_Captcha_Adapter
Inherited
inherited_from \Zend_Captcha_Adapter::setName()

Parameters

$name

string

Returns

\Zend_Captcha_Adapter

Set flag indicating whether or not value should be obfuscated in messages

setObscureValue(boolean $flag) : \Zend_Validate_Abstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_Validate_Abstract

Set option

setOption(string $key, mixed $value) : \Zend_Captcha_ReCaptcha

If option is a service parameter, proxies to the service. The same goes for any service options (distinct from service params)

inherited_from \Zend_Captcha_Base::setOption()

Parameters

$key

string

$value

mixed

Returns

\Zend_Captcha_ReCaptcha

Set single option for the object

setOption(string $key, string $value) : \Zend_Form_Element
Inherited

Parameters

$key

string

$value

string

Returns

\Zend_Form_Element

Set object state from options array

setOptions(array $options = null) : \Zend_Form_Element
Inherited

Parameters

$options

array

Returns

\Zend_Form_Element

Set ReCaptcha Private key

setPrivkey(string $privkey) : \Zend_Captcha_ReCaptcha

Parameters

$privkey

string

Returns

\Zend_Captcha_ReCaptcha

Set ReCaptcha public key

setPubkey(string $pubkey) : \Zend_Captcha_ReCaptcha

Parameters

$pubkey

string

Returns

\Zend_Captcha_ReCaptcha

Set service object

setService(\Zend_Service_ReCaptcha $service) : \Zend_Captcha_ReCaptcha

Parameters

$service

\Zend_Service_ReCaptcha

Returns

\Zend_Captcha_ReCaptcha

Set translation object

setTranslator(\Zend_Translate|\Zend_Translate_Adapter|null $translator = null) : \Zend_Validate_Abstract
Inherited

Parameters

$translator

\Zend_Translate\Zend_Translate_Adapternull

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_Abstract

Is translation disabled?

translatorIsDisabled() : boolean
Inherited

Returns

boolean

Constructs and returns a validation failure message with the given message key and value.

_createMessage(string $messageKey, string $value) : string
Inherited

Returns null if and only if $messageKey does not correspond to an existing template.

If a translator is available and a translation exists for $messageKey, the translation will be used.

Parameters

$messageKey

string

$value

string

Returns

string

_error()

_error(string $messageKey, string $value = null) : void
Inherited

Parameters

$messageKey

string

$value

string

OPTIONAL

Joins elements of a multidimensional array

_implodeRecursive(array $pieces) : string
Inherited

Parameters

$pieces

array

Returns

string

Sets the value to be validated and clears the messages and errors arrays

_setValue(mixed $value) : void
Inherited

Parameters

$value

mixed

 Properties

 

$_CHALLENGE

$_CHALLENGE 

Default

'recaptcha_challenge_field'
 

$_RESPONSE

$_RESPONSE 

Default

'recaptcha_response_field'
 

Default translation object for all validate objects

$_defaultTranslator : \Zend_Translate

Default

Static
 

Array of validation failure message codes

$_errors : array

Default

array()
deprecated Since 1.5.0
 

Limits the maximum returned length of a error message

$_messageLength : Integer

Default

-1
Static
 

Error messages

$_messageTemplates : array

Default

array(self::MISSING_VALUE => 'Missing captcha fields', self::ERR_CAPTCHA => 'Failed to validate captcha', self::BAD_CAPTCHA => 'Captcha value is wrong: %value%')
 

Validation failure message template definitions

$_messageTemplates : array

Default

array()
 

Additional variables available for validation failure messages

$_messageVariables : array

Default

array()
 

Array of validation failure messages

$_messages : array

Default

array()
 

Element name

$_name : string

Default

Useful to generate/check form fields

 

Flag indidcating whether or not value should be obfuscated in error messages

$_obscureValue : boolean

Default

false
 

Captcha options

$_options : array

Default

array()
 

Recaptcha service object

$_service : \Zend_Service_Recaptcha

Default

 

Options defined by the service

$_serviceOptions : array

Default

array()
 

Parameters defined by the service

$_serviceParams : array

Default

array()
 

Options to skip when processing options

$_skipOptions : array

Default

array('options', 'config')
 

Translation object

$_translator : \Zend_Translate

Default

 

Is translation disabled?

$_translatorDisabled : Boolean

Default

false
 

The value to be validated

$_value : mixed

Default

 Constants

 

BAD_CAPTCHA

BAD_CAPTCHA = 'badCaptcha' 
 

ERR_CAPTCHA

ERR_CAPTCHA = 'errCaptcha' 
 

MISSING_VALUE

MISSING_VALUE = 'missingValue'