import v1.0.0-RC4 | 2009-05-20
This commit is contained in:
38
libs/Monkeys/Form/Element/Captcha.php
Normal file
38
libs/Monkeys/Form/Element/Captcha.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
/**
|
||||
* I was obliged to do this because of a mayor flaw of Zend_Form_Element_Captcha
|
||||
* not letting using custom captcha adapters
|
||||
* (if the adapter is not defined in the construct, an exception is thrown, so I don't
|
||||
* even have a chance to call addPrefixPath() on the element...)
|
||||
*/
|
||||
class Monkeys_Form_Element_Captcha extends Zend_Form_Element_Captcha
|
||||
{
|
||||
private $_decorator;
|
||||
|
||||
public function __construct($spec, $options = null)
|
||||
{
|
||||
$this->addPrefixPath('Monkeys_Captcha', 'Monkeys/Captcha/', 'captcha');
|
||||
$options = array_merge($options, array('disableLoadDefaultDecorators' =>true));
|
||||
parent::__construct($spec, $options);
|
||||
|
||||
$this->_decorator = new Monkeys_Form_Decorator_Composite();
|
||||
$this->addDecorator($this->_decorator);
|
||||
}
|
||||
|
||||
public function setDecoratorOptions(array $options)
|
||||
{
|
||||
$this->_decorator->setOptions($options);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user