Class ReCaptcha

Summary

Fully Qualified Name: Laminas\Captcha\ReCaptcha
Extends: AbstractAdapter

Description

ReCaptcha adapter

Allows to insert captchas driven by ReCaptcha service

Methods

Name Description Defined By
__construct() Constructor ReCaptcha
__get() Magic function returns the value of the requested property, if and only if it is the value or a message variable. AbstractValidator
__invoke() Invoke as command AbstractValidator
generate() Generate captcha ReCaptcha
getDefaultTranslator() Get default translation object for all validate objects AbstractValidator
getDefaultTranslatorTextDomain() Get default translation text domain for all validate objects AbstractValidator
getHelperName() Get helper name used to render captcha ReCaptcha
getMessageLength() Returns the maximum allowed message length AbstractValidator
getMessageTemplates() Returns the message templates from the validator AbstractValidator
getMessageVariables() Returns an array of the names of variables that are used in constructing validation failure messages AbstractValidator
getMessages() Returns array of validation failure messages AbstractValidator
getName() Get name AbstractAdapter
getOption() Returns an option AbstractValidator
getOptions() Retrieve options representing object state AbstractAdapter
getPrivKey() Retrieve ReCaptcha secret key (BC version) ReCaptcha
getPubKey() Retrieve ReCaptcha site key (BC version) ReCaptcha
getSecretKey() Retrieve ReCaptcha Secret key ReCaptcha
getService() Retrieve ReCaptcha service object ReCaptcha
getSiteKey() Retrieve ReCaptcha Site key ReCaptcha
getTranslator() Return translation object AbstractValidator
getTranslatorTextDomain() Return the translation text domain AbstractValidator
hasDefaultTranslator() Is there a default translation object set? AbstractValidator
hasTranslator() Does this validator have its own specific translator? AbstractValidator
isTranslatorEnabled() Is translation enabled? AbstractValidator
isValid() Validate captcha. ReCaptcha
isValueObscured() Retrieve flag indicating whether or not value should be obfuscated in messages AbstractValidator
setDefaultTranslator() Set default translation object for all validate objects AbstractValidator
setDefaultTranslatorTextDomain() Set default translation text domain for all validate objects AbstractValidator
setMessage() Sets the validation failure message template for a particular key AbstractValidator
setMessageLength() Sets the maximum allowed message length AbstractValidator
setMessages() 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. AbstractValidator
setName() Set name AbstractAdapter
setOption() Set option ReCaptcha
setOptions() Set object state from options array AbstractAdapter
setPrivKey() Set ReCaptcha secret key (BC version) ReCaptcha
setPubKey() Set ReCaptcha site key (BC version) ReCaptcha
setSecretKey() Set ReCaptcha private key ReCaptcha
setService() Set service object ReCaptcha
setSiteKey() Set ReCaptcha site key ReCaptcha
setTranslator() Set translation object AbstractValidator
setTranslatorEnabled() Indicate whether or not translation should be enabled AbstractValidator
setTranslatorTextDomain() Set translation text domain AbstractValidator
setValueObscured() Set flag indicating whether or not value should be obfuscated in messages AbstractValidator

Method Details

__construct()

Constructor

Parameter Name Type Description
$options null|array|\Traversable

Returns:

__get()

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

Parameter Name Type Description
$property string

Returns: mixed

__invoke()

Invoke as command

Parameter Name Type Description
$value mixed

Returns: bool

generate()

Generate captcha

Returns: string

getDefaultTranslator()

Get default translation object for all validate objects

Returns: \Translator\TranslatorInterface|null

getDefaultTranslatorTextDomain()

Get default translation text domain for all validate objects

Returns: string

getHelperName()

Get helper name used to render captcha

Returns: string

getMessageLength()

Returns the maximum allowed message length

Returns: int

getMessageTemplates()

Returns the message templates from the validator

Returns: array

getMessageVariables()

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

Returns: array

getMessages()

Returns array of validation failure messages

Returns: array

getName()

Get name

Returns: string

getOption()

Returns an option

Parameter Name Type Description
$option string Option

Returns: mixed Returned option

getOptions()

Retrieve options representing object state

Returns: array

getPrivKey()

Retrieve ReCaptcha secret key (BC version)

Returns: string

getPubKey()

Retrieve ReCaptcha site key (BC version)

Returns: string

getSecretKey()

Retrieve ReCaptcha Secret key

Returns: string

getService()

Retrieve ReCaptcha service object

Returns: \ReCaptchaService

getSiteKey()

Retrieve ReCaptcha Site key

Returns: string

getTranslator()

Return translation object

Returns: \Translator\TranslatorInterface|null

getTranslatorTextDomain()

Return the translation text domain

Returns: string

hasDefaultTranslator()

Is there a default translation object set?

Returns: bool

hasTranslator()

Does this validator have its own specific translator?

Returns: bool

isTranslatorEnabled()

Is translation enabled?

Returns: bool

isValid()

Validate captcha.

The value should contain the name of the key within the context that contains the ReCaptcha data. The default within the ReCaptcha service for this is "g-recaptcha-response"

Parameter Name Type Description
$value mixed
$context mixed

Returns: bool

isValueObscured()

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

Returns: bool

setDefaultTranslator()

Set default translation object for all validate objects

Parameter Name Type Description
$translator \Translator\TranslatorInterface|null
$textDomain string (optional)

Returns: void

setDefaultTranslatorTextDomain()

Set default translation text domain for all validate objects

Parameter Name Type Description
$textDomain string

Returns: void

setMessage()

Sets the validation failure message template for a particular key

Parameter Name Type Description
$messageString string
$messageKey string OPTIONAL

Returns: $this Provides a fluent interface

setMessageLength()

Sets the maximum allowed message length

Parameter Name Type Description
$length int

Returns:

setMessages()

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.

Parameter Name Type Description
$messages array

Returns: $this

setName()

Set name

Parameter Name Type Description
$name string

Returns: \AbstractAdapter Provides a fluent interface

setOption()

Set option

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

Parameter Name Type Description
$key string
$value mixed

Returns: \ReCaptcha Provides a fluent interface

setOptions()

Set object state from options array

Parameter Name Type Description
$options array|\Traversable

Returns: \AbstractAdapter Provides a fluent interface

setPrivKey()

Set ReCaptcha secret key (BC version)

Parameter Name Type Description
$key string

Returns: \ReCaptcha Provides a fluent interface

setPubKey()

Set ReCaptcha site key (BC version)

Parameter Name Type Description
$key string

Returns: \ReCaptcha Provides a fluent interface

setSecretKey()

Set ReCaptcha private key

Parameter Name Type Description
$secretKey string

Returns: \ReCaptcha Provides a fluent interface

setService()

Set service object

Parameter Name Type Description
$service \ReCaptchaService

Returns: \ReCaptcha Provides a fluent interface

setSiteKey()

Set ReCaptcha site key

Parameter Name Type Description
$siteKey string

Returns: \ReCaptcha Provides a fluent interface

setTranslator()

Set translation object

Parameter Name Type Description
$translator \Translator\TranslatorInterface|null
$textDomain string (optional)

Returns: $this

setTranslatorEnabled()

Indicate whether or not translation should be enabled

Parameter Name Type Description
$flag bool

Returns: $this

setTranslatorTextDomain()

Set translation text domain

Parameter Name Type Description
$textDomain string

Returns: $this

setValueObscured()

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

Parameter Name Type Description
$flag bool

Returns: $this

Top