Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 24 changed files with 70 additions and 142 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.4-dev",
"dev-develop": "2.5-dev"
"dev-master": "2.2-dev",
"dev-develop": "2.3-dev"
}
},
"autoload-dev": {
Expand Down
13 changes: 4 additions & 9 deletions src/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha;
Expand All @@ -17,10 +16,6 @@
* Base class for Captcha adapters
*
* Provides some utility functionality to build on
*
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
*/
abstract class AbstractAdapter extends AbstractValidator implements AdapterInterface
{
Expand Down Expand Up @@ -84,10 +79,10 @@ public function setOption($key, $value)
return $this;
}

$method = 'set' . ucfirst ($key);
if (method_exists ($this, $method)) {
$method = 'set' . ucfirst($key);
if (method_exists($this, $method)) {
// Setter exists; use it
$this->$method ($value);
$this->$method($value);
$this->options[$key] = $value;
} elseif (property_exists($this, $key)) {
// Assume it's metadata
Expand Down
25 changes: 10 additions & 15 deletions src/AbstractWord.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,19 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha;

use Zend\Session\Container;
use Zend\Math\Rand;
use Zend\Session\Container;

/**
* AbstractWord-based captcha adapter
*
* Generates random word which user should recognise
*
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
*/
abstract class AbstractWord extends AbstractAdapter
{
Expand Down Expand Up @@ -64,28 +59,28 @@ abstract class AbstractWord extends AbstractAdapter
/**
* Should the numbers be used or only letters
*
* @var boolean
* @var bool
*/
protected $useNumbers = true;

/**
* Should both cases be used or only lowercase
*
* @var boolean
* @var bool
*/
// protected $useCase = false;

/**
* Session lifetime for the captcha data
*
* @var integer
* @var int
*/
protected $timeout = 300;

/**
* Should generate() keep session or create a new one?
*
* @var boolean
* @var bool
*/
protected $keepSession = false;

Expand All @@ -110,7 +105,7 @@ abstract class AbstractWord extends AbstractAdapter
/**
* Length of the word to generate
*
* @var integer
* @var int
*/
protected $wordlen = 8;

Expand Down Expand Up @@ -139,7 +134,7 @@ public function setSessionClass($sessionClass)
/**
* Retrieve word length to use when generating captcha
*
* @return integer
* @return int
*/
public function getWordlen()
{
Expand All @@ -149,7 +144,7 @@ public function getWordlen()
/**
* Set word length of captcha
*
* @param integer $wordlen
* @param int $wordlen
* @return AbstractWord
*/
public function setWordlen($wordlen)
Expand Down Expand Up @@ -253,7 +248,7 @@ public function getSession()
throw new Exception\InvalidArgumentException("Session class $this->sessionClass not found");
}
$this->session = new $this->sessionClass('Zend_Form_Captcha_' . $id);
$this->session->setExpirationHops(1, null, true);
$this->session->setExpirationHops(1, null);
$this->session->setExpirationSeconds($this->getTimeout());
}
return $this->session;
Expand Down
7 changes: 1 addition & 6 deletions src/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha;
Expand All @@ -16,10 +15,6 @@
* Generic Captcha adapter interface
*
* Each specific captcha implementation should implement this interface
*
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
*/
interface AdapterInterface extends ValidatorInterface
{
Expand Down
6 changes: 1 addition & 5 deletions src/Dumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha;
Expand All @@ -16,9 +15,6 @@
* Note that only rendering is necessary for word-based captcha
*
* @todo This likely needs its own validation since it expects the word entered to be the strrev of the word stored.
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
*/
class Dumb extends AbstractWord
{
Expand Down
8 changes: 1 addition & 7 deletions src/Exception/DomainException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha\Exception;

/**
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
*/
class DomainException extends \DomainException implements ExceptionInterface
{
}
7 changes: 1 addition & 6 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha\Exception;

/**
* Exception for Zend_Form component.
*
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
*/
interface ExceptionInterface
{
Expand Down
7 changes: 1 addition & 6 deletions src/Exception/ExtensionNotLoadedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha\Exception;

/**
* Exception for Zend_Form component.
*
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
*/
class ExtensionNotLoadedException extends RuntimeException
{
Expand Down
7 changes: 1 addition & 6 deletions src/Exception/ImageNotLoadableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha\Exception;

/**
* Exception for Zend_Form component.
*
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
*/
class ImageNotLoadableException extends RuntimeException
{
Expand Down
8 changes: 1 addition & 7 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha\Exception;

/**
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
*/
class InvalidArgumentException extends \InvalidArgumentException implements
ExceptionInterface
{
Expand Down
7 changes: 1 addition & 6 deletions src/Exception/NoFontProvidedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha\Exception;

/**
* Exception for Zend_Form component.
*
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
*/
class NoFontProvidedException extends InvalidArgumentException
{
Expand Down
8 changes: 1 addition & 7 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha\Exception;

/**
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
*/
class RuntimeException extends \RuntimeException implements ExceptionInterface
{}
7 changes: 1 addition & 6 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha;

use Traversable;
use Zend\Stdlib\ArrayUtils;

/**
* @category Zend
* @package Zend_Captcha
*/
abstract class Factory
{
/**
Expand Down
7 changes: 1 addition & 6 deletions src/Figlet.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Captcha
*/

namespace Zend\Captcha;
Expand All @@ -16,10 +15,6 @@
* Captcha based on figlet text rendering service
*
* Note that this engine seems not to like numbers
*
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
*/
class Figlet extends AbstractWord
{
Expand Down
Loading

0 comments on commit b0a48ab

Please sign in to comment.