Hi Again, i can't create issues on ZF Issue tracker, so i will write here.
Today i was playing with Zend_Captcha, and, 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.
ps: Sorry for my English ;)ps2: It's half hour made code, so errors and other issues are possible. It's only proposition.
-- Krzysztof Szatanik
<<attachment: Captcha.php>>
