\Pluf_Form_Widget_ReCaptcha

reCAPTCHA input for your forms.

Based on http://recaptcha.googlecode.com/files/recaptcha-php-1.10.zip

Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net AUTHORS: Mike Crawford Ben Maurer

Summary

Methods
Properties
Constants
render()
__construct()
valueFromFormData()
idForLabel()
getHtml()
$is_hidden
$needs_multipart_form
$input_type
$attrs
$ssl
$pubkey
No constants found
buildAttrs()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$is_hidden

$is_hidden : 

Type

$needs_multipart_form

$needs_multipart_form : 

Type

$input_type

$input_type : 

Type

$attrs

$attrs : 

Type

$ssl

$ssl : 

Type

$pubkey

$pubkey : 

Type

Methods

render()

render(  $name,   $value,   $extra_attrs = array()) : string

Renders the HTML of the input.

Parameters

$name
$value
$extra_attrs

Returns

string —

The HTML string of the input.

__construct()

__construct(  $attrs = array()) 

Parameters

$attrs

valueFromFormData()

valueFromFormData(  $name,   $data) : array

Get the form data from the reCaptcha fields.

We need to get back two fields from the POST request 'recaptcha_challenge_field' and 'recaptcha_response_field'.

They are hardcoded, so we do not even bother checking something else.

Parameters

$name
$data

Returns

array —

Challenge and answer

idForLabel()

idForLabel(  $id) 

Returns the HTML ID attribute of this Widget for use by a <label>, given the ID of the field. Returns None if no ID is available.

This hook is necessary because some widgets have multiple HTML elements and, thus, multiple IDs. In that case, this method should return an ID value that corresponds to the first ID in the widget's tags.

Parameters

$id

getHtml()

getHtml(  $pubkey,   $error = null,   $use_ssl = false) : string

Gets the challenge HTML (javascript and non-javascript version). This is called from the browser, and the resulting reCAPTCHA HTML widget is embedded within the HTML form it was called from.

Parameters

$pubkey
$error
$use_ssl

Returns

string —

The HTML to be embedded in the user's form.

buildAttrs()

buildAttrs(  $attrs,   $extra_attrs = array()) : array

Build the list of attributes for the form.

It should be called this way: $this->buildAttrs(array('name'=>$name, 'type'=>$this->input_type), $extra_attrs);

Parameters

$attrs
$extra_attrs

Returns

array —

The attributes for the field.