Posted By: Tony Baird
Last Updated: Wednesday September 3, 2008
Zend Framework 1.6 was just released and we already have it on all our servers. I can honestly say I did not have time to play around with the release candidate versions so my knowledge of it is not great. I am however as I write this working on porting our website to use Zend Framework 1.6. This basically means I need to drop in the new folder and confirm the smarty view system works fine which it does! I’ve actually already found one use for it which is the Zend_Service_ReCaptcha functionality as it is the quickest solution. Our site currently makes use of it using an outside library I’m assuming (Cody setup the captcha). Here’s a quick run down of how easy this is to implement:
[sourcecode language=‘php’]
$recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey); [/sourcecode]
Putting in our pubKey and privKey obviously. Then from there to display it all I need to do is:
[sourcecode language=‘php’] $this->view->captcha = $recaptcha->getHTML(); [/sourcecode]
Obviously I assigned it to my view but you could just print it if you wanted to.
[sourcecode language=‘php’] $result = $recaptcha->verify( $_POST[‘recaptcha_challenge_field’], $_POST[‘recaptcha_response_field’] ); if (!$result->isValid()) { // Failed validation } [/sourcecode]
It’s just that easy :)
Here’s a quick run down of some of the other features:
There are some useful features there like the Captcha one I mentioned. The other big one I’ll probably make use of in the near future is the paginator. I have my own one I created, but I figure no point reinventing the wheel so switching to use the Zend one makes sense.