class Captcha extends JObject

Joomla! Captcha base object

Methods

__construct( string $captcha, array $options)

Class constructor.

static  Captcha|null
getInstance( string $captcha, array $options = array())

Returns the global Captcha object, only creating it if it doesn't already exist.

boolean
initialise( string $id)

Fire the onInit event to initialise the captcha plugin.

mixed
display( string $name, string $id, string $class = '')

Get the HTML for the captcha.

bool
checkAnswer( string $code)

Checks if the answer is correct.

void
setupField( CaptchaField $field, SimpleXMLElement $element)

Method to react on the setup of a captcha field. Gives the possibility to change the field and/or the XML element for the field.

mixed
getState()

Get the state of the Captcha object

void
attach( object $observer)

Attach an observer object

boolean
detach( object $observer)

Detach an observer object

Details

__construct( string $captcha, array $options)

Class constructor.

Parameters

string $captcha The plugin to use.
array $options Associative array of options.

Exceptions

RuntimeException

static Captcha|null getInstance( string $captcha, array $options = array())

Returns the global Captcha object, only creating it if it doesn't already exist.

Parameters

string $captcha The plugin to use.
array $options Associative array of options.

Return Value

Captcha|null Instance of this class.

Exceptions

RuntimeException

boolean initialise( string $id)

Fire the onInit event to initialise the captcha plugin.

Parameters

string $id The id of the field.

Return Value

boolean True on success

Exceptions

RuntimeException

mixed display( string $name, string $id, string $class = '')

Get the HTML for the captcha.

Parameters

string $name The control name.
string $id The id for the control.
string $class Value for the HTML class attribute

Return Value

mixed The return value of the function "onDisplay" of the selected Plugin.

Exceptions

RuntimeException

bool checkAnswer( string $code)

Checks if the answer is correct.

Parameters

string $code The answer.

Return Value

bool Whether the provided answer was correct

Exceptions

RuntimeException

void setupField( CaptchaField $field, SimpleXMLElement $element)

Method to react on the setup of a captcha field. Gives the possibility to change the field and/or the XML element for the field.

Parameters

CaptchaField $field Captcha field instance
SimpleXMLElement $element XML form definition

Return Value

void

mixed getState()

Get the state of the Captcha object

Return Value

mixed The state of the object.

void attach( object $observer)

Attach an observer object

Parameters

object $observer An observer object to attach

Return Value

void

boolean detach( object $observer)

Detach an observer object

Parameters

object $observer An observer object to detach.

Return Value

boolean True if the observer object was detached.