$class
$class :
Store the name of the class.
Add ReCaptcha control to your forms.
You need first to get a ReCaptcha account, create a domain and get the API keys for your domain. Check http://recaptcha.net/ for more information.
The recaptcha field needs to know the IP address of the user submitting the form and if the request is made over SSL or not. This means that you need to provide the $request object in the extra parameters of your form.
To add the ReCaptcha field to your form, simply add the following to your form object (note the use of $extra['request']):
$ssl = (!empty($extra['request']->SERVER['HTTPS']) and $extra['request']->SERVER['HTTPS'] != 'off'); $this->fields['recaptcha'] = new Pluf_Form_Field_ReCaptcha( array('required' => true, 'label' => __('Please solve this challenge'), 'privkey' => 'PRIVATE_RECAPTCHA_KEY_HERE', 'remoteip' => $extra['request']->remote_addr, 'widget_attrs' => array( 'pubkey' => 'PUBLIC_RECAPTCHA_KEY_HERE', ), ));
Then in your template, you simply need to add the ReCaptcha field:
{if $form.f.recaptcha.errors}{$form.f.recaptcha.fieldErrors}{/if} {$form.f.recaptcha|safe}
Based on http://recaptcha.googlecode.com/files/recaptcha-php-1.10.zip
Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net AUTHORS: Mike Crawford Ben Maurer
multiClean( $value) : array
Multi-clean a value.
If you are getting multiple values, you need to go through all of them and validate them against the requirements. This will do that for you. Basically, it is cloning the field, marking it as not multiple and validate each value. It will throw an exception in case of failure.
If you are implementing your own field which could be filled by a "multiple" widget, you need to perform a check on $this->multiple.
$value |
Values
checkAnswer(string $privkey, string $remoteip, string $challenge, string $response, array $extra_params = array()) : boolean
Calls an HTTP POST function to verify if the user's guess was correct
string | $privkey | |
string | $remoteip | |
string | $challenge | |
string | $response | |
array | $extra_params | an array of extra variables to post to the server |
success of process