API Documentation

Service/ReCaptcha.php

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-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Service  
subpackage
ReCaptcha  

\Zend_Service_ReCaptcha

Zend_Service_ReCaptcha

Extends from
\Zend_Service_Abstract
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Service  
subpackage
ReCaptcha  
version
$Id: ReCaptcha.php 24224 2011-07-12 17:45:49Z matthew $  

Constants

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

URI to the regular API

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

URI to the secure API

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

URI to the verify server

string

Properties

Propertyprotectedstring  $_ip= 'null'

Ip address used when verifying user input

Default valuenullDetails
Type
string
Propertyprotectedarray  $_options= 'array'

Options for tailoring reCaptcha

See the different options on http://recaptcha.net/apidocs/captcha/client.html

Default valuearrayDetails
Type
array
Propertyprotectedarray  $_params= 'array'

Parameters for the object

Default valuearrayDetails
Type
array
Propertyprotectedstring  $_privateKey= 'null'

Private key used when verifying user input

Default valuenullDetails
Type
string
Propertyprotectedstring  $_publicKey= 'null'

Public key used when displaying the captcha

Default valuenullDetails
Type
string
Propertyprotected\Zend_Service_ReCaptcha_Response  $_response= 'null'

Response from the verify server

Default valuenullDetails
Type
\Zend_Service_ReCaptcha_Response

Methods

methodpublic__construct( string $publicKey = null, string $privateKey = null, array|array|\Zend_Config $params = null, array $options = null, string $ip = null ) : void

Class constructor

Parameters
Name Type Description
$publicKey string
$privateKey string
$params array|array|\Zend_Config
$options array
$ip string
methodpublic__toString( ) : string

Serialize as 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
Type Description
string
methodprotected_post( string $challengeField, string $responseField ) : \Zend_Http_Response

Post a solution to the verify server

Parameters
Name Type Description
$challengeField string
$responseField string
Returns
Type Description
\Zend_Http_Response
Throws
Exception Description
\Zend_Service_ReCaptcha_Exception
methodpublicgetHtml( null|string $name = null ) : string

Get the HTML code for the captcha

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

Parameters
Name Type Description
$name null|string Base name for recaptcha form elements
Returns
Type Description
string
Throws
Exception Description
\Zend_Service_ReCaptcha_Exception
methodpublicgetHttpClient( ) : \Zend_Http_Client
static

Gets the HTTP client object.

Inherited from: \Zend_Service_Abstract::getHttpClient()
Returns
Type Description
\Zend_Http_Client
methodpublicgetIp( ) : string

Get the ip property

Returns
Type Description
string
methodpublicgetOption( string $key ) : mixed

Get a single option

Parameters
Name Type Description
$key string
Returns
Type Description
mixed
methodpublicgetOptions( ) : array

Get the options array

Returns
Type Description
array
methodpublicgetParam( string $key ) : mixed

Get a single parameter

Parameters
Name Type Description
$key string
Returns
Type Description
mixed
methodpublicgetParams( ) : array

Get the parameter array

Returns
Type Description
array
methodpublicgetPrivateKey( ) : string

Get the private key

Returns
Type Description
string
methodpublicgetPublicKey( ) : string

Get the public key

Returns
Type Description
string
methodpublicsetHttpClient( \Zend_Http_Client $httpClient ) : void
static

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

Inherited from: \Zend_Service_Abstract::setHttpClient()
Parameters
Name Type Description
$httpClient \Zend_Http_Client
methodpublicsetIp( string $ip ) : \Zend_Service_ReCaptcha

Set the ip property

Parameters
Name Type Description
$ip string
Returns
Type Description
\Zend_Service_ReCaptcha
methodpublicsetOption( string $key, string $value ) : \Zend_Service_ReCaptcha

Set a single option

Parameters
Name Type Description
$key string
$value string
Returns
Type Description
\Zend_Service_ReCaptcha
methodpublicsetOptions( array|\Zend_Config $options ) : \Zend_Service_ReCaptcha

Set options

Parameters
Name Type Description
$options array|\Zend_Config
Returns
Type Description
\Zend_Service_ReCaptcha
Throws
Exception Description
\Zend_Service_ReCaptcha_Exception
methodpublicsetParam( string $key, string $value ) : \Zend_Service_ReCaptcha

Set a single parameter

Parameters
Name Type Description
$key string
$value string
Returns
Type Description
\Zend_Service_ReCaptcha
methodpublicsetParams( array|\Zend_Config $params ) : \Zend_Service_ReCaptcha

Set parameters

Parameters
Name Type Description
$params array|\Zend_Config
Returns
Type Description
\Zend_Service_ReCaptcha
Throws
Exception Description
\Zend_Service_ReCaptcha_Exception
methodpublicsetPrivateKey( string $privateKey ) : \Zend_Service_ReCaptcha

Set the private key

Parameters
Name Type Description
$privateKey string
Returns
Type Description
\Zend_Service_ReCaptcha
methodpublicsetPublicKey( string $publicKey ) : \Zend_Service_ReCaptcha

Set the public key

Parameters
Name Type Description
$publicKey string
Returns
Type Description
\Zend_Service_ReCaptcha
methodpublicverify( string $challengeField, string $responseField ) : \Zend_Service_ReCaptcha_Response

Verify the user input

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

Parameters
Name Type Description
$challengeField string
$responseField string
Returns
Type Description
\Zend_Service_ReCaptcha_Response
Documentation was generated by DocBlox 0.13.3.