Zend_Service_ReCaptcha

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

 Methods

Class constructor

__construct(string $publicKey = null, string $privateKey = null, array|\Zend_Config $params = null, array $options = null, string $ip = null

Parameters

$publicKey

string

$privateKey

string

$params

arrayarray\Zend_Config

$options

array

$ip

string

Serialize as string

__toString() : string

When the instance is used as a string it will display the recaptcha. Since we can't throw exceptions within this method we will trigger a user warning instead.

Returns

string

Get the HTML code for the captcha

getHtml(null|string $name = null) : string

This method uses the public key to fetch a recaptcha form.

Parameters

$name

nullstring

Base name for recaptcha form elements

Exceptions

\Zend_Service_ReCaptcha_Exception

Returns

string

Gets the HTTP client object.

getHttpClient() : \Zend_Http_Client
InheritedStatic

Returns

\Zend_Http_Client

Get the ip property

getIp() : string

Returns

string

Get a single option

getOption(string $key) : mixed

Parameters

$key

string

Returns

mixed

Get the options array

getOptions() : array

Returns

array

Get a single parameter

getParam(string $key) : mixed

Parameters

$key

string

Returns

mixed

Get the parameter array

getParams() : array

Returns

array

Get the private key

getPrivateKey() : string

Returns

string

Get the public key

getPublicKey() : string

Returns

string

Sets the HTTP client object to use for retrieving the feeds. If none is set, the default Zend_Http_Client will be used.

setHttpClient(\Zend_Http_Client $httpClient) 
InheritedStatic

Parameters

$httpClient

\Zend_Http_Client

Set the ip property

setIp(string $ip) : \Zend_Service_ReCaptcha

Parameters

$ip

string

Returns

\Zend_Service_ReCaptcha

Set a single option

setOption(string $key, string $value) : \Zend_Service_ReCaptcha

Parameters

$key

string

$value

string

Returns

\Zend_Service_ReCaptcha

Set options

setOptions(array|\Zend_Config $options) : \Zend_Service_ReCaptcha

Parameters

$options

array\Zend_Config

Exceptions

\Zend_Service_ReCaptcha_Exception

Returns

\Zend_Service_ReCaptcha

Set a single parameter

setParam(string $key, string $value) : \Zend_Service_ReCaptcha

Parameters

$key

string

$value

string

Returns

\Zend_Service_ReCaptcha

Set parameters

setParams(array|\Zend_Config $params) : \Zend_Service_ReCaptcha

Parameters

$params

array\Zend_Config

Exceptions

\Zend_Service_ReCaptcha_Exception

Returns

\Zend_Service_ReCaptcha

Set the private key

setPrivateKey(string $privateKey) : \Zend_Service_ReCaptcha

Parameters

$privateKey

string

Returns

\Zend_Service_ReCaptcha

Set the public key

setPublicKey(string $publicKey) : \Zend_Service_ReCaptcha

Parameters

$publicKey

string

Returns

\Zend_Service_ReCaptcha

Verify the user input

verify(string $challengeField, string $responseField) : \Zend_Service_ReCaptcha_Response

This method calls up the post method and returns a Zend_Service_ReCaptcha_Response object.

Parameters

$challengeField

string

$responseField

string

Returns

\Zend_Service_ReCaptcha_Response

Post a solution to the verify server

_post(string $challengeField, string $responseField) : \Zend_Http_Response

Parameters

$challengeField

string

$responseField

string

Exceptions

\Zend_Service_ReCaptcha_Exception

Returns

\Zend_Http_Response

 Properties

 

HTTP Client used to query all web services

$_httpClient : \Zend_Http_Client

Default

null
Static
 

Ip address used when verifying user input

$_ip : string

Default

null
 

Options for tailoring reCaptcha

$_options : array

Default

array('theme' => 'red', 'lang' => 'en', 'custom_translations' => array())
 

Parameters for the object

$_params : array

Default

array('ssl' => false, 'error' => null, 'xhtml' => false)
 

Private key used when verifying user input

$_privateKey : string

Default

null
 

Public key used when displaying the captcha

$_publicKey : string

Default

null
 

Response from the verify server

$_response : \Zend_Service_ReCaptcha_Response

Default

null

 Constants

 

URI to the secure API

API_SECURE_SERVER = 'https://www.google.com/recaptcha/api' : string
 

URI to the regular API

API_SERVER = 'http://www.google.com/recaptcha/api' : string
 

URI to the verify server

VERIFY_SERVER = 'http://www.google.com/recaptcha/api/verify' : string