ZF-5560: Zend_Captcha factory class
Description
I'm really wondered why there isn't any Factory object for this component. It will be very usefully to have such factory that connected with Zend_Config can make our life and project management much more easier. So i decided to write one.
It's based on Zend_Cache::factory, and except ReCaptcha it works well. With ReCaptcha there is small problem with isValid method - it has different syntax, and without changing isValid part inside your code you can't easy change from eg. Zend_Captcha_Image to Zend_Captcha_ReCaptcha.
Using examples:
$captcha = Zend_Captcha::factory(
'Mao_Captcha_FigletCopy',
array(
'name' => 'foo',
'wordLen' => 6
)
);
$captcha = Zend_Captcha::factory(
'Image',
array(
'name' => 'foo',
'wordLen' => 6,
'font' => APPLICATION_PATH .'library/html2pdf/font/verdana.ttf',
'imgDir' => APPLICATION_PATH .'public_html/temp/',
'imgUrl' => '/temp/'
)
);
I hope that one of ZF developer can take a look at it and include such kind of Zend_Captcha::factory into ZF.
Comments
Posted by Krzysztof Szatanik (diabl0) on 2009-01-16T00:36:46.000+0000
Zend_Captcha factory suggestion
Posted by Stanislav Malyshev (stas) on 2010-04-07T18:05:02.000+0000
ivValid seems to have the same signature on both Zend_Captcha_Word and Zend_Captcha_Recaptcha:
public function isValid($value, $context = null)
could you clarify what did you mean?