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

Commit

Permalink
Merge remote-tracking branch 'zf2/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 28 changed files with 173 additions and 526 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

14 changes: 0 additions & 14 deletions .travis/run-tests.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .travis/skipped-components

This file was deleted.

61 changes: 0 additions & 61 deletions .travis/tested-components

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
69 changes: 28 additions & 41 deletions src/Word.php → src/AbstractWord.php
Original file line number Diff line number Diff line change
@@ -1,48 +1,35 @@
<?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;

/**
* 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 @@ -93,10 +80,10 @@ abstract class Word extends AbstractAdapter
* @var integer
*/
protected $timeout = 300;

/**
* Should generate() keep session or create a new one?
*
*
* @var boolean
*/
protected $keepSession = false;
Expand All @@ -113,7 +100,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 +127,7 @@ public function getSessionClass()
* Set session class for persistence
*
* @param string $sessionClass
* @return Word
* @return AbstractWord
*/
public function setSessionClass($sessionClass)
{
Expand All @@ -162,7 +149,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 +186,7 @@ protected function setId ($id)
* Set timeout for session token
*
* @param int $ttl
* @return Word
* @return AbstractWord
*/
public function setTimeout($ttl)
{
Expand All @@ -219,19 +206,19 @@ 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)
public function setKeepSession($keepSession)
{
$this->keepSession = $keepSession;
return $this;
}

/**
* Numbers should be included in the pattern?
*
*
* @return bool
*/
public function getUseNumbers()
Expand All @@ -241,9 +228,9 @@ 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 +261,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 +290,7 @@ public function getWord()
* Set captcha word
*
* @param string $word
* @return Word
* @return AbstractWord
*/
protected function setWord($word)
{
Expand Down Expand Up @@ -347,7 +334,7 @@ protected function generateWord()
public function generate()
{
if (!$this->keepSession) {
$this->session = null;
$this->session = null;
}
$id = $this->generateRandomId();
$this->setId($id);
Expand All @@ -358,7 +345,7 @@ public function generate()

/**
* Generate a random identifier
*
*
* @return void
*/
protected function generateRandomId()
Expand Down Expand Up @@ -417,6 +404,6 @@ public function isValid($value, $context = null)
*/
public function getHelperName()
{
return "captcha\word";
return 'captcha/word';
}
}
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
Loading

0 comments on commit d0ceadd

Please sign in to comment.