Captcha

Extends \JObject

Joomla! Captcha base object

abstract
package

Joomla.Libraries

subpackage

Captcha

since

2.5

Methods

__construct

Class constructor.

__construct(string $captcha, array $options) 
since

2.5

Arguments

$captcha

stringThe editor to use.

$options

arrayAssociative array of options.

_load

Load the Captcha plugin.

_load(array $options = array()) : void
since

2.5

throws

\RuntimeException

Arguments

$options

arrayAssociative array of options.

attach

Attach an observer object

attach(object $observer) : void
since

2.5

Arguments

$observer

objectAn observer object to attach

checkAnswer

Checks if the answer is correct.

checkAnswer(string $code) : mixed
since

2.5

Arguments

$code

stringThe answer.

Response

mixedThe return value of the function "onCheckAnswer" of the selected Plugin.

detach

Detach an observer object

detach(object $observer) : boolean
since

2.5

Arguments

$observer

objectAn observer object to detach.

Response

booleanTrue if the observer object was detached.

display

Get the HTML for the captcha.

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

2.5

Arguments

$name

stringThe control name.

$id

stringThe id for the control.

$class

stringValue for the HTML class attribute

Response

mixedThe return value of the function "onDisplay" of the selected Plugin.

getInstance

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

getInstance(string $captcha, array $options = array()) : \Joomla\CMS\Captcha\Captcha|null
static
since

2.5

Arguments

$captcha

stringThe plugin to use.

$options

arrayAssociative array of options.

Response

\Joomla\CMS\Captcha\Captcha|nullInstance of this class.

getState

Get the state of the Captcha object

getState() : mixed
since

2.5

Response

mixedThe state of the object.

initialise

Fire the onInit event to initialise the captcha plugin.

initialise(string $id) : boolean
since

2.5

Arguments

$id

stringThe id of the field.

Response

booleanTrue on success

Properties

_observers

An array of Observer objects to notify

Type(s)

array

_state

The state of the observable object

Type(s)

mixed

_methods

A multi dimensional array of [function][] = key for observers

Type(s)

array

_captcha

Captcha Plugin object

_name

Editor Plugin name

Type(s)

string

_instances

Array of instances of this class.

static

Type(s)

array<mixed,\Joomla\CMS\Captcha\Captcha>