HTML_QuickForm2_Captcha
[ 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

HTML_QuickForm2_Element_Input
   |
   --HTML_QuickForm2_Element_Captcha
      |
      --HTML_QuickForm2_Element_Captcha_Numeral

Numeral captcha element for HTML_QuickForm2.


Author(s):

Version:

  • Release: 0.1.2

Variables

Methods


Inherited Variables

Inherited Methods

Class: HTML_QuickForm2_Element_Captcha

HTML_QuickForm2_Element_Captcha::__construct()
Create new instance.
HTML_QuickForm2_Element_Captcha::clearCaptchaSession()
Destroys all captcha session data, so that the previously solved captcha re-appears as unsolved. Question and answers are discarded as well.
HTML_QuickForm2_Element_Captcha::generateCaptcha()
Prepares the session data for the captcha.
HTML_QuickForm2_Element_Captcha::getCaptchaHtml()
Returns the HTML for the captcha (question + input element if applicable)
HTML_QuickForm2_Element_Captcha::getSession()
Returns the captcha session object
HTML_QuickForm2_Element_Captcha::getSessionVarName()
Returns the name to use for the session variable.
HTML_QuickForm2_Element_Captcha::getType()
Returns the CAPTCHA type.
HTML_QuickForm2_Element_Captcha::getValue()
Returns the captcha answer input element value.
HTML_QuickForm2_Element_Captcha::setSession()
Sets a new session object.
HTML_QuickForm2_Element_Captcha::setValue()
Sets the input value
HTML_QuickForm2_Element_Captcha::validate()
Performs the server-side validation.
HTML_QuickForm2_Element_Captcha::verifyCaptcha()
Checks if the captcha is solved now.
HTML_QuickForm2_Element_Captcha::__toString()
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.

Features:

  • 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

Parameters:

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 Mon, 11 Mar 2019 15:55:05 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.