|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Captcha |
|
17 * @subpackage Adapter |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 */ |
|
21 |
|
22 /** @see Zend_Captcha_Word */ |
|
23 require_once 'Zend/Captcha/Word.php'; |
|
24 |
|
25 /** @see Zend_Text_Figlet */ |
|
26 require_once 'Zend/Text/Figlet.php'; |
|
27 |
|
28 /** |
|
29 * Captcha based on figlet text rendering service |
|
30 * |
|
31 * Note that this engine seems not to like numbers |
|
32 * |
|
33 * @category Zend |
|
34 * @package Zend_Captcha |
|
35 * @subpackage Adapter |
|
36 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
37 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
38 * @version $Id: Figlet.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
39 */ |
|
40 class Zend_Captcha_Figlet extends Zend_Captcha_Word |
|
41 { |
|
42 /** |
|
43 * Figlet text renderer |
|
44 * |
|
45 * @var Zend_Text_Figlet |
|
46 */ |
|
47 protected $_figlet; |
|
48 |
|
49 /** |
|
50 * Constructor |
|
51 * |
|
52 * @param null|string|array|Zend_Config $options |
|
53 * @return void |
|
54 */ |
|
55 public function __construct($options = null) |
|
56 { |
|
57 parent::__construct($options); |
|
58 $this->_figlet = new Zend_Text_Figlet($options); |
|
59 } |
|
60 |
|
61 /** |
|
62 * Generate new captcha |
|
63 * |
|
64 * @return string |
|
65 */ |
|
66 public function generate() |
|
67 { |
|
68 $this->_useNumbers = false; |
|
69 return parent::generate(); |
|
70 } |
|
71 |
|
72 /** |
|
73 * Display the captcha |
|
74 * |
|
75 * @param Zend_View_Interface $view |
|
76 * @param mixed $element |
|
77 * @return string |
|
78 */ |
|
79 public function render(Zend_View_Interface $view = null, $element = null) |
|
80 { |
|
81 return '<pre>' |
|
82 . $this->_figlet->render($this->getWord()) |
|
83 . "</pre>\n"; |
|
84 } |
|
85 } |