File indexing completed on 2024-05-12 06:02:19

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Captcha
0017  * @subpackage Adapter
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  */
0021 
0022 /** @see Zend_Captcha_Word */
0023 // require_once 'Zend/Captcha/Word.php';
0024 
0025 /** @see Zend_Text_Figlet */
0026 // require_once 'Zend/Text/Figlet.php';
0027 
0028 /**
0029  * Captcha based on figlet text rendering service
0030  *
0031  * Note that this engine seems not to like numbers
0032  *
0033  * @category   Zend
0034  * @package    Zend_Captcha
0035  * @subpackage Adapter
0036  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0037  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0038  * @version    $Id$
0039  */
0040 class Zend_Captcha_Figlet extends Zend_Captcha_Word
0041 {
0042     /**
0043      * Figlet text renderer
0044      *
0045      * @var Zend_Text_Figlet
0046      */
0047     protected $_figlet;
0048 
0049     /**
0050      * Constructor
0051      *
0052      * @param null|string|array|Zend_Config $options
0053      */
0054     public function __construct($options = null)
0055     {
0056         parent::__construct($options);
0057         $this->_figlet = new Zend_Text_Figlet($options);
0058     }
0059 
0060     /**
0061      * Generate new captcha
0062      *
0063      * @return string
0064      */
0065     public function generate()
0066     {
0067         $this->_useNumbers = false;
0068         return parent::generate();
0069     }
0070 
0071     /**
0072      * Display the captcha
0073      *
0074      * @param Zend_View_Interface $view
0075      * @param mixed $element
0076      * @return string
0077      */
0078     public function render(Zend_View_Interface $view = null, $element = null)
0079     {
0080         return '<pre>'
0081              . $this->_figlet->render($this->getWord())
0082              . "</pre>\n";
0083     }
0084 }