Word.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. /**
  4. * Element for HTML_QuickForm to display a CAPTCHA "Word"
  5. *
  6. * The HTML_QuickForm_CAPTCHA package adds an element to the
  7. * HTML_QuickForm package to display a CAPTCHA "word".
  8. *
  9. * This package requires the use of a PHP session.
  10. *
  11. * PHP versions 4 and 5
  12. *
  13. * @category HTML
  14. * @package HTML_QuickForm_CAPTCHA
  15. * @author Philippe Jausions <Philippe.Jausions@11abacus.com>
  16. * @copyright 2006-2008 by Philippe Jausions / 11abacus
  17. * @license http://www.opensource.org/licenses/bsd-license.php New BSD
  18. * @version CVS: $Id: Word.php,v 1.1 2008/04/26 23:27:30 jausions Exp $
  19. * @link http://pear.php.net/package/HTML_QuickForm_CAPTCHA
  20. */
  21. /**
  22. * Required packages
  23. */
  24. require_once 'HTML/QuickForm/CAPTCHA.php';
  25. require_once 'Text/CAPTCHA/Driver/Word.php';
  26. /**
  27. * Element for HTML_QuickForm to display a CAPTCHA "word" question
  28. *
  29. * The HTML_QuickForm_CAPTCHA package adds an element to the
  30. * HTML_QuickForm package to display a CAPTCHA "word" question.
  31. *
  32. * Options for the element
  33. * <ul>
  34. * <li>'length' (integer) the length of the Word.</li>
  35. * <li>'mode' (string) 'single' for separated words.</li>
  36. * <li>'locale' (string) locale for Numbers_Words package</li>
  37. * <li>'sessionVar' (string) name of session variable containing
  38. * the Text_CAPTCHA instance (defaults to
  39. * _HTML_QuickForm_CAPTCHA.)</li>
  40. * </ul>
  41. *
  42. * This package requires the use of a PHP session.
  43. *
  44. * @category HTML
  45. * @package HTML_QuickForm_CAPTCHA
  46. * @author Philippe Jausions <Philippe.Jausions@11abacus.com>
  47. * @copyright 2006-2008 by Philippe Jausions / 11abacus
  48. * @license http://www.opensource.org/licenses/bsd-license.php New BSD
  49. * @version Release: 0.3.0
  50. * @link http://pear.php.net/package/HTML_QuickForm_CAPTCHA
  51. * @see Text_CAPTCHA_Driver_Equation
  52. */
  53. class HTML_QuickForm_CAPTCHA_Word extends HTML_QuickForm_CAPTCHA
  54. {
  55. /**
  56. * Default options
  57. *
  58. * @var array
  59. * @access protected
  60. */
  61. var $_options = array(
  62. 'sessionVar' => '_HTML_QuickForm_CAPTCHA',
  63. 'length' => 4,
  64. 'mode' => 'single',
  65. 'locale' => 'en_US',
  66. 'phrase' => null,
  67. );
  68. /**
  69. * CAPTCHA driver
  70. *
  71. * @var string
  72. * @access protected
  73. */
  74. var $_CAPTCHA_driver = 'Word';
  75. }
  76. /**
  77. * Registers the class with QuickForm
  78. */
  79. if (class_exists('HTML_QuickForm')) {
  80. HTML_QuickForm::registerElementType('CAPTCHA_Word',
  81. 'HTML/QuickForm/CAPTCHA/Word.php', 'HTML_QuickForm_CAPTCHA_Word');
  82. }
  83. ?>