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

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 26 changed files with 177 additions and 436 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zendframework/zend-captcha",
"description": "Zend\\Captcha component",
"description": " ",
"license": "BSD-3-Clause",
"keywords": [
"zf2",
Expand All @@ -9,11 +9,11 @@
"homepage": "https://github.com/zendframework/zend-captcha",
"autoload": {
"psr-4": {
"Zend\\Captcha\\": "src/"
"Zend\\Captcha": "src/"
}
},
"require": {
"php": ">=5.3.23",
"php": ">=5.3.3",
"zendframework/zend-math": "self.version",
"zendframework/zend-stdlib": "self.version"
},
Expand Down
23 changes: 5 additions & 18 deletions src/AbstractAdapter.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 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 @@ -32,8 +21,6 @@
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class AbstractAdapter extends AbstractValidator implements AdapterInterface
{
Expand Down
54 changes: 21 additions & 33 deletions src/Word.php → src/AbstractWord.php
Original file line number Diff line number Diff line change
@@ -1,48 +1,36 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 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;

/**
* Word-based captcha adapter
* AbstractWord-based captcha adapter
*
* Generates random word which user should recognise
*
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Word extends AbstractAdapter
abstract class AbstractWord extends AbstractAdapter
{
/**#@+
* @var array Character sets
*/
static $V = array("a", "e", "i", "o", "u", "y");
static $VN = array("a", "e", "i", "o", "u", "y","2","3","4","5","6","7","8","9");
static $C = array("b","c","d","f","g","h","j","k","m","n","p","q","r","s","t","u","v","w","x","z");
static $CN = array("b","c","d","f","g","h","j","k","m","n","p","q","r","s","t","u","v","w","x","z","2","3","4","5","6","7","8","9");
public static $V = array("a", "e", "i", "o", "u", "y");
public static $VN = array("a", "e", "i", "o", "u", "y","2","3","4","5","6","7","8","9");
public static $C = array("b","c","d","f","g","h","j","k","m","n","p","q","r","s","t","u","v","w","x","z");
public static $CN = array("b","c","d","f","g","h","j","k","m","n","p","q","r","s","t","u","v","w","x","z","2","3","4","5","6","7","8","9");
/**#@-*/

/**
Expand Down Expand Up @@ -113,7 +101,7 @@ abstract class Word extends AbstractAdapter
* Error messages
* @var array
*/
protected $_messageTemplates = array(
protected $messageTemplates = array(
self::MISSING_VALUE => 'Empty captcha value',
self::MISSING_ID => 'Captcha ID field is missing',
self::BAD_CAPTCHA => 'Captcha value is wrong',
Expand All @@ -140,7 +128,7 @@ public function getSessionClass()
* Set session class for persistence
*
* @param string $sessionClass
* @return Word
* @return AbstractWord
*/
public function setSessionClass($sessionClass)
{
Expand All @@ -162,7 +150,7 @@ public function getWordlen()
* Set word length of captcha
*
* @param integer $wordlen
* @return Word
* @return AbstractWord
*/
public function setWordlen($wordlen)
{
Expand Down Expand Up @@ -199,7 +187,7 @@ protected function setId ($id)
* Set timeout for session token
*
* @param int $ttl
* @return Word
* @return AbstractWord
*/
public function setTimeout($ttl)
{
Expand All @@ -221,7 +209,7 @@ public function getTimeout()
* Sets if session should be preserved on generate()
*
* @param $keepSession Should session be kept on generate()?
* @return Word
* @return AbstractWord
*/
public function setKeepSession($keepSession)
{
Expand All @@ -243,7 +231,7 @@ public function getUseNumbers()
* Set if numbers should be included in the pattern
*
* @param bool $useNumbers numbers should be included in the pattern?
* @return Word
* @return AbstractWord
*/
public function setUseNumbers($useNumbers)
{
Expand Down Expand Up @@ -274,7 +262,7 @@ public function getSession()
* Set session namespace object
*
* @param Container $session
* @return Word
* @return AbstractWord
*/
public function setSession(Container $session)
{
Expand Down Expand Up @@ -303,7 +291,7 @@ public function getWord()
* Set captcha word
*
* @param string $word
* @return Word
* @return AbstractWord
*/
protected function setWord($word)
{
Expand Down Expand Up @@ -363,7 +351,7 @@ public function generate()
*/
protected function generateRandomId()
{
return md5(mt_rand(0, 1000) . microtime(true));
return md5(Rand::getBytes(32));
}

/**
Expand Down
23 changes: 5 additions & 18 deletions src/AdapterInterface.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 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 @@ -31,8 +20,6 @@
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface AdapterInterface extends ValidatorInterface
{
Expand Down
27 changes: 7 additions & 20 deletions src/Dumb.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 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 @@ -30,10 +19,8 @@
* @category Zend
* @package Zend_Captcha
* @subpackage Adapter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Dumb extends Word
class Dumb extends AbstractWord
{
/**
* CAPTCHA label
Expand Down Expand Up @@ -61,7 +48,7 @@ public function getLabel()

/**
* Retrieve optional view helper name to use when rendering this captcha
*
*
* @return string
*/
public function getHelperName()
Expand Down
23 changes: 5 additions & 18 deletions src/Exception/DomainException.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 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;
Expand All @@ -25,8 +14,6 @@
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class DomainException extends \DomainException implements ExceptionInterface
{
Expand Down
23 changes: 5 additions & 18 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 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;
Expand All @@ -27,8 +16,6 @@
* @category Zend
* @package Zend_Captcha
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface ExceptionInterface
{
Expand Down
Loading

0 comments on commit 7ecfaa2

Please sign in to comment.