\PlgCaptchaRecaptcha
Recaptcha Plugin.
Based on the official recaptcha library( https://developers.google.com/recaptcha/docs/php )
Synopsis
class PlgCaptchaRecaptcha
extends JPlugin
{
- // constants
- const RECAPTCHA_API_SERVER = "http://www.google.com/recaptcha/api";
- const RECAPTCHA_API_SECURE_SERVER = "https://www.google.com/recaptcha/api";
- const RECAPTCHA_VERIFY_SERVER = "www.google.com";
- // members
- protected $autoloadLanguage;
- // Inherited members from JPlugin
- public JRegistry $params;
- protected $_name;
- protected $_type;
- protected $autoloadLanguage;
- // Inherited members from JEvent
- protected $_subject;
- // Inherited members from JObject
- protected $_errors;
- // methods
- public Boolean onInit()
- public string onDisplay()
- public True onCheckAnswer()
- private string _recaptcha_qsencode()
- private array _recaptcha_http_post()
- private string _getLanguage()
- // Inherited methods from JPlugin
- public void __construct()
- public boolean loadLanguage()
- // Inherited methods from JEvent
- public void __construct()
- public mixed update()
- // Inherited methods from JObject
- public void __construct()
- public string __toString()
- public mixed def()
- public mixed get()
- public array getProperties()
- public string getError()
- public array getErrors()
- public mixed set()
- public boolean setProperties()
- public void setError()
Hierarchy
Extends
Constants
Name | Value |
---|---|
RECAPTCHA_API_SERVER | "http://www.google.com/recaptcha/api" |
RECAPTCHA_API_SECURE_SERVER | "https://www.google.com/recaptcha/api" |
RECAPTCHA_VERIFY_SERVER | "www.google.com" |
Members
protected
- $_errors
—
array
An array of error messages or Exception objects. - $_name
—
string
The name of the plugin - $_subject
—
Event object to observe. - $_type
—
string
The plugin type - $autoloadLanguage
—
boolean
Load the language file on instantiation. - $autoloadLanguage
—
boolean
Affects constructor behavior. If true, language files will be loaded automatically.
public
- $params
—
JRegistry
A JRegistry object holding the parameters for the plugin
Methods
private
- _getLanguage() — Get the language tag or a custom translation
- _recaptcha_http_post() — Submits an HTTP POST to a reCAPTCHA server.
- _recaptcha_qsencode() — Encodes the given data into a query string format.
public
- onCheckAnswer() — Calls an HTTP POST function to verify if the user's guess was correct
- onDisplay() — Gets the challenge HTML
- onInit() — Initialise the captcha
Inherited from JPlugin
public
- loadLanguage() — Loads the plugin language file
Inherited from JEvent
public
- update() — Method to trigger events.
Inherited from JObject
public
- __toString() — Magic method to convert the object to a string gracefully.
- def() — Sets a default value if not alreay assigned
- get() — Returns a property of the object or the default value if the property is not set.
- getError() — Get the most recent error message.
- getErrors() — Return all errors, if any.
- getProperties() — Returns an associative array of object properties.
- set() — Modifies a property of the object, creating it if it does not already exist.
- setError() — Add an error message.
- setProperties() — Set the object properties based on a named array/hash.