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

Class: HTML_QuickForm2_Element_Captcha_TextCAPTCHA

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

Class Overview

HTML_QuickForm2_Element_Input
   |
   --HTML_QuickForm2_Element_Captcha
      |
      --HTML_QuickForm2_Element_Captcha_TextCAPTCHA

Quickform2 captcha element that uses the Text_CAPTCHA package as captcha generator.


Author(s):

Version:

  • Release: 0.1.2

Variables

Methods


Child classes:

HTML_QuickForm2_Element_Captcha_Image
Image captcha element for HTML_QuickForm2.

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 34]
Quickform2 captcha element that uses the Text_CAPTCHA package as captcha generator.

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



[ Top ]


Class Variables

$adapter =

[line 40]

  • Access: protected

Type:   Text_CAPTCHA


[ Top ]



Method Detail

__construct (Constructor)   [line 57]

HTML_QuickForm2_Element_Captcha_TextCAPTCHA __construct( [string $name = null], [mixed $attributes = null], [array $data = array()])

Constructor. Set adapter specific data attributes.

Text_CAPTCHA settings are provided in $data. $data['captchaType'] specifies the Text_CAPTCHA driver name, e.g. "Equation", "Figlet" or "Word". All other $data settings are passed to it's init() method.

Do not use this class directly for the "Image" type, there is an own class for that one.

  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Element_Captcha_Image::__construct()
Set adapter specific data attributes.

Overrides HTML_QuickForm2_Element_Captcha::__construct() (Create new instance.)

Parameters:

string   $name   —  Element name
mixed   $attributes   —  Attributes (either a string or an array)
array   $data   —  Element data (special captcha settings)

[ Top ]

generateCaptcha   [line 103]

boolean generateCaptcha( )

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

Overridden in child classes as:

HTML_QuickForm2_Element_Captcha_Image::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 ]

getAdapter   [line 76]

Text_CAPTCHA getAdapter( )

Return the Text_CAPTCHA adapter
  • Return: Captcha generator
  • Access: public

[ Top ]

getCaptchaHtml   [line 205]

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.

  • 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 216]

string getFrozenHtml( )

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

[ Top ]

loadAdapter   [line 120]

void loadAdapter( )

Load the adapter instance
  • Throws: HTML_QuickForm2_Element_Captcha_Exception When the Text_CAPTCHA adapter cannot be initialized correctly
  • Access: protected

[ Top ]

renderQuestion   [line 227]

string renderQuestion( )

Renders the CAPTCHA question in HTML and returns it.

Returns empty string when "captchaRender" option is false.

  • Return: HTML
  • Access: protected

Overridden in child classes as:

HTML_QuickForm2_Element_Captcha_Image::renderQuestion()
Renders the CAPTCHA question in HTML and returns it.

[ Top ]

setAdapter   [line 88]

void setAdapter( Text_CAPTCHA $adapter)

Set the captcha generator
  • Access: public

Parameters:

Text_CAPTCHA   $adapter   —  Captcha generator

[ Top ]

verifyCaptcha   [line 169]

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.