import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -24,7 +24,7 @@ require_once 'Zend/Validate/Interface.php';
|
||||
|
||||
/**
|
||||
* Generic Captcha adapter interface
|
||||
*
|
||||
*
|
||||
* Each specific captcha implementation should implement this interface
|
||||
*
|
||||
* @category Zend
|
||||
@ -32,9 +32,9 @@ require_once 'Zend/Validate/Interface.php';
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Adapter.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Adapter.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
interface Zend_Captcha_Adapter extends Zend_Validate_Interface
|
||||
interface Zend_Captcha_Adapter extends Zend_Validate_Interface
|
||||
{
|
||||
/**
|
||||
* Generate a new captcha
|
||||
@ -62,7 +62,7 @@ interface Zend_Captcha_Adapter extends Zend_Validate_Interface
|
||||
|
||||
/**
|
||||
* Get captcha name
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
|
@ -27,7 +27,7 @@ require_once 'Zend/Validate/Abstract.php';
|
||||
|
||||
/**
|
||||
* Base class for Captcha adapters
|
||||
*
|
||||
*
|
||||
* Provides some utility functionality to build on
|
||||
*
|
||||
* @category Zend
|
||||
@ -35,13 +35,13 @@ require_once 'Zend/Validate/Abstract.php';
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Base.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Base.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_Captcha_Adapter
|
||||
abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_Captcha_Adapter
|
||||
{
|
||||
/**
|
||||
* Element name
|
||||
*
|
||||
*
|
||||
* Useful to generate/check form fields
|
||||
*
|
||||
* @var string
|
||||
@ -49,8 +49,8 @@ abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_
|
||||
protected $_name;
|
||||
|
||||
/**
|
||||
* Captcha options
|
||||
*
|
||||
* Captcha options
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_options = array();
|
||||
@ -63,23 +63,23 @@ abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_
|
||||
'options',
|
||||
'config',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName($name)
|
||||
public function setName($name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
return $this;
|
||||
@ -88,7 +88,7 @@ abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array|Zend_Config $options
|
||||
* @param array|Zend_Config $options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($options = null)
|
||||
@ -98,9 +98,9 @@ abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_
|
||||
$this->setOptions($options);
|
||||
} else if ($options instanceof Zend_Config) {
|
||||
$this->setConfig($options);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set single option for the object
|
||||
*
|
||||
@ -126,11 +126,11 @@ abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set object state from options array
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @param array $options
|
||||
* @return Zend_Form_Element
|
||||
*/
|
||||
public function setOptions($options = null)
|
||||
@ -140,10 +140,10 @@ abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve options representing object state
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
@ -153,8 +153,8 @@ abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_
|
||||
|
||||
/**
|
||||
* Set object state from config object
|
||||
*
|
||||
* @param Zend_Config $config
|
||||
*
|
||||
* @param Zend_Config $config
|
||||
* @return Zend_Captcha_Base
|
||||
*/
|
||||
public function setConfig(Zend_Config $config)
|
||||
@ -164,12 +164,12 @@ abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_
|
||||
|
||||
/**
|
||||
* Get optional decorator
|
||||
*
|
||||
*
|
||||
* By default, return null, indicating no extra decorator needed.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function getDecorator()
|
||||
public function getDecorator()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -24,15 +24,15 @@ require_once 'Zend/Captcha/Word.php';
|
||||
|
||||
/**
|
||||
* Example dumb word-based captcha
|
||||
*
|
||||
*
|
||||
* Note that only rendering is necessary for word-based captcha
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Captcha
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Dumb.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Dumb.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
class Zend_Captcha_Dumb extends Zend_Captcha_Word
|
||||
{
|
||||
|
0
libs/Zend/Captcha/Exception.php
Executable file → Normal file
0
libs/Zend/Captcha/Exception.php
Executable file → Normal file
@ -27,7 +27,7 @@ require_once 'Zend/Text/Figlet.php';
|
||||
|
||||
/**
|
||||
* Captcha based on figlet text rendering service
|
||||
*
|
||||
*
|
||||
* Note that this engine seems not to like numbers
|
||||
*
|
||||
* @category Zend
|
||||
@ -35,7 +35,7 @@ require_once 'Zend/Text/Figlet.php';
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Figlet.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Figlet.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
class Zend_Captcha_Figlet extends Zend_Captcha_Word
|
||||
{
|
||||
@ -45,11 +45,11 @@ class Zend_Captcha_Figlet extends Zend_Captcha_Word
|
||||
* @var Zend_Text_Figlet
|
||||
*/
|
||||
protected $_figlet;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param null|string|array|Zend_Config $options
|
||||
*
|
||||
* @param null|string|array|Zend_Config $options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($options = null)
|
||||
@ -57,7 +57,7 @@ class Zend_Captcha_Figlet extends Zend_Captcha_Word
|
||||
parent::__construct($options);
|
||||
$this->_figlet = new Zend_Text_Figlet($options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate new captcha
|
||||
*
|
||||
@ -66,7 +66,7 @@ class Zend_Captcha_Figlet extends Zend_Captcha_Word
|
||||
public function generate()
|
||||
{
|
||||
$this->_useNumbers = false;
|
||||
return parent::generate();
|
||||
return parent::generate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Image.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Image.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Captcha_Word */
|
||||
@ -423,8 +423,8 @@ class Zend_Captcha_Image extends Zend_Captcha_Word
|
||||
$tries = 5;
|
||||
// If there's already such file, try creating a new ID
|
||||
while($tries-- && file_exists($this->getImgDir() . $id . $this->getSuffix())) {
|
||||
$id = $this->_generateRandomId();
|
||||
$this->_setId($id);
|
||||
$id = $this->_generateRandomId();
|
||||
$this->_setId($id);
|
||||
}
|
||||
$this->_generateImage($id, $this->getWord());
|
||||
|
||||
|
@ -37,7 +37,7 @@ require_once 'Zend/Service/ReCaptcha.php';
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ReCaptcha.php 16201 2009-06-21 18:51:15Z thomas $
|
||||
* @version $Id: ReCaptcha.php 18166 2009-09-17 13:28:35Z padraic $
|
||||
*/
|
||||
class Zend_Captcha_ReCaptcha extends Zend_Captcha_Base
|
||||
{
|
||||
@ -63,6 +63,13 @@ class Zend_Captcha_ReCaptcha extends Zend_Captcha_Base
|
||||
*/
|
||||
protected $_serviceParams = array();
|
||||
|
||||
/**
|
||||
* Options defined by the service
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_serviceOptions = array();
|
||||
|
||||
/**#@+
|
||||
* Error codes
|
||||
* @const string
|
||||
@ -136,6 +143,7 @@ class Zend_Captcha_ReCaptcha extends Zend_Captcha_Base
|
||||
{
|
||||
$this->setService(new Zend_Service_ReCaptcha());
|
||||
$this->_serviceParams = $this->getService()->getParams();
|
||||
$this->_serviceOptions = $this->getService()->getOptions();
|
||||
|
||||
parent::__construct($options);
|
||||
|
||||
@ -172,7 +180,8 @@ class Zend_Captcha_ReCaptcha extends Zend_Captcha_Base
|
||||
/**
|
||||
* Set option
|
||||
*
|
||||
* If option is a service parameter, proxies to the service.
|
||||
* If option is a service parameter, proxies to the service. The same
|
||||
* goes for any service options (distinct from service params)
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
@ -185,6 +194,10 @@ class Zend_Captcha_ReCaptcha extends Zend_Captcha_Base
|
||||
$service->setParam($key, $value);
|
||||
return $this;
|
||||
}
|
||||
if (isset($this->_serviceOptions[$key])) {
|
||||
$service->setOption($key, $value);
|
||||
return $this;
|
||||
}
|
||||
return parent::setOption($key, $value);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user