Recaptcha Styling Using Zend PHP

I use Zend_Service_ReCaptcha in the project and I want to adjust the color scheme of the window, however I am completely fixated on which function to use for this. http://framework.zend.com/manual/en/zend.form.standardElements.html#zend.form.standardElements.captcha does not seem to shed any light.

Answers are welcome, thanks.

+4
source share
3 answers

Setting these parameters using the form element parameters will not work! These parameters ("theme" and "lang") should be passed to the service instead.

Here is the constructor of Zend_Service_ReCaptcha:

public function __construct($publicKey = null, $privateKey = null, $params = null, $options = null, $ip = null) { … 

Using:

 $options = array('theme' => 'white', 'lang' => 'ru'); $recaptcha = new Zend_Service_ReCaptcha($publicKey, $privateKey, null, $options); $this->view->recaptcha = $recaptcha->getHtml(); 

Otherwise, if you want to use form elements, you must first get the service object. Try something like this:

 $options = array('theme' => 'white', 'lang' => 'ru'); $form->getElement('captcha')->getCaptcha()->getService()->setOptions($options); 
+8
source

You need to pass the theme parameter through captcha parameters to the form element:

Sort of:

 $element = new Zend_Form_Element_Captcha('foo', array( 'label' => "Please verify you're a human", 'captcha' => array( 'captcha' => 'Recaptcha', 'timeout' => 300, 'theme' => 'red' ), )); 
+3
source

You get public and private keys when you register at http://recaptcha.net/ and install them in your form as follows: $ recaptcha_service = new Zend_Service_ReCaptcha ($ public, $ private);

0
source

All Articles