[ class tree: HTML_QuickForm2_Captcha ] [ index: HTML_QuickForm2_Captcha ] [ all elements ]

Class: HTML_QuickForm2_Element_Captcha_Numeral

Source Location: /HTML_QuickForm2_Captcha-0.1.2/HTML/QuickForm2/Element/Captcha/Numeral.php

Class Overview


Numeral captcha element for HTML_QuickForm2.



  • Release: 0.1.2



Inherited Variables

Inherited Methods

Class: HTML_QuickForm2_Element_Captcha

Create new instance.
Destroys all captcha session data, so that the previously solved captcha re-appears as unsolved. Question and answers are discarded as well.
Prepares the session data for the captcha.
Returns the HTML for the captcha (question + input element if applicable)
Returns the captcha session object
Returns the name to use for the session variable.
Returns the CAPTCHA type.
Returns the captcha answer input element value.
Sets a new session object.
Sets the input value
Performs the server-side validation.
Checks if the captcha is solved now.
Renders the captcha into a HTML string

Class Details

[line 37]
Numeral captcha element for HTML_QuickForm2.

Asks mathematical questions like "32 + 5".

In case you need to customize the numeral options, use getNumeral() and modify that object.


  • Stable captcha: Question stays the same if you do not solve it correctly the first time

[ Top ]

Class Variables

$numeral =  null

[line 45]

Captcha generator
  • Access: protected

Type:   Text_CAPTCHA_Numeral

[ Top ]

Method Detail

generateCaptcha   [line 85]

boolean generateCaptcha( )

Generates the captcha question and answer and prepares the session data.

Overrides HTML_QuickForm2_Element_Captcha::generateCaptcha() (Prepares the session data for the captcha.)
[ Top ]

getCaptchaHtml   [line 150]

string getCaptchaHtml( )

Returns the HTML for the captcha question and answer.

Used in __toString() and to be used when $data['captchaRender'] is set to false. It is not called when the element is frozen, see getFrozenHtml() for that case. This method is also not called when the captcha has been solved, since $data['captchaSolved'] is shown then.

  • Return: HTML code
  • Access: public
  • Uses: $data['captchaHtmlAttributes'].

Overrides HTML_QuickForm2_Element_Captcha::getCaptchaHtml() (Returns the HTML for the captcha (question + input element if applicable))
[ Top ]

getFrozenHtml   [line 169]

string getFrozenHtml( )

Returns the HTML code when the form is frozen.
  • Return: HTML code
  • Access: public

[ Top ]

getNumeral   [line 54]

Text_CAPTCHA_Numeral getNumeral( )

Returns the Text_CAPTCHA_Numeral object used for generating question and answer.

Useful for changing options.

  • Return: Captcha generator
  • Access: public

[ Top ]

setNumeral   [line 70]

void setNumeral( Text_CAPTCHA_Numeral $numeral)

Sets the Text_CAPTCHA_Numeral object.

Useful for changing options.

  • Access: public


Text_CAPTCHA_Numeral   $numeral   —  New numeral captcha object

[ Top ]

verifyCaptcha   [line 114]

boolean verifyCaptcha( )

Checks if the captcha is solved now.

Uses $capSolved variable or user input, which is compared with the pre-set correct answer.

Calls generateCaptcha() if it has not been called before.

In case user solution and answer match, a session variable is set so that the captcha is seen as completed across form submissions.

Overrides HTML_QuickForm2_Element_Captcha::verifyCaptcha() (Checks if the captcha is solved now.)
[ Top ]

Documentation generated on Wed, 09 Dec 2015 23:06:25 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.