2
0

Figlet.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /** @see Zend_Captcha_Word */
  22. require_once 'Zend/Captcha/Word.php';
  23. /** @see Zend_Text_Figlet */
  24. require_once 'Zend/Text/Figlet.php';
  25. /**
  26. * Captcha based on figlet text rendering service
  27. *
  28. * Note that this engine seems not to like numbers
  29. *
  30. * @category Zend
  31. * @package Zend_Captcha
  32. * @subpackage Adapter
  33. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  34. * @license http://framework.zend.com/license/new-bsd New BSD License
  35. * @version $Id$
  36. */
  37. class Zend_Captcha_Figlet extends Zend_Captcha_Word
  38. {
  39. /**
  40. * Figlet text renderer
  41. *
  42. * @var Zend_Text_Figlet
  43. */
  44. protected $_figlet;
  45. /**
  46. * Constructor
  47. *
  48. * @param null|string|array|Zend_Config $options
  49. */
  50. public function __construct($options = null)
  51. {
  52. parent::__construct($options);
  53. $this->_figlet = new Zend_Text_Figlet($options);
  54. }
  55. /**
  56. * Generate new captcha
  57. *
  58. * @return string
  59. */
  60. public function generate()
  61. {
  62. $this->_useNumbers = false;
  63. return parent::generate();
  64. }
  65. /**
  66. * Display the captcha
  67. *
  68. * @param Zend_View_Interface $view
  69. * @param mixed $element
  70. * @return string
  71. */
  72. public function render(Zend_View_Interface $view = null, $element = null)
  73. {
  74. return '<pre>'
  75. . $this->_figlet->render($this->getWord())
  76. . "</pre>\n";
  77. }
  78. }