UNA
BxDolCaptcha Class Reference
Inheritance diagram for BxDolCaptcha:
BxDolFactory iBxDolFactoryObject BxBaseCaptchaHCaptcha BxBaseCaptchaReCAPTCHAInvisible BxBaseCaptchaReCAPTCHANew BxTemplCaptchaHCaptcha BxTemplCaptchaReCAPTCHAInvisible BxTemplCaptchaReCAPTCHANew

Public Member Functions

 display ($bDynamicMode=false)
 
 check ()
 
 getUserResponse ()
 
 isAvailable ()
 

Static Public Member Functions

static getObjectInstance ($sObject=false)
 

Protected Member Functions

 __construct ($aObject, $oTemplate)
 

Detailed Description

CAPTCHA objects.

Default captcha is stored in 'sys_captcha_default' setting option.

Creating the Captcha object:

Add record to 'sys_objects_captcha' table:

  • object: name of the captcha object, in the format: vendor prefix, underscore, module prefix, underscore, internal identifier or nothing; for example: bx_blogs - custom captcha in blogs module.
  • title: captcha title.
  • override_class_name: user defined class name which is derived from one of base captcha classes.
  • override_class_file: the location of the user defined class, leave it empty if class is located in system folders.

Example of usage

Display captcha:

$oCaptcha = BxDolCaptcha::getObjectInstance(); // get default captcha object instance
if ($oCaptcha) // check if captcha is available for using
echo $oCaptcha->display (); // output HTML which will automatically show captcha

Check captcha:

$oCaptcha = BxDolCaptcha::getObjectInstance(); // get default captcha object instance
if ($oCaptcha && $oCaptcha->check ()) // check if captcha is correct
echo 'captcha is OK';
else
echo 'captcha is incorrect'; //

Constructor & Destructor Documentation

◆ __construct()

BxDolCaptcha::__construct (   $aObject,
  $oTemplate 
)
protected

Constructor

Parameters
$aObjectarray of captcha options

Member Function Documentation

◆ check()

BxDolCaptcha::check ( )

Check captcha.

◆ display()

BxDolCaptcha::display (   $bDynamicMode = false)

Display captcha.

Parameters
$bDynamicMode- is AJAX mode or not, if true then HTML code with captcha is loaded dynamically.

◆ getObjectInstance()

static BxDolCaptcha::getObjectInstance (   $sObject = false)
static

Get captcha object instance by object name

Parameters
$sObjectobject name
Returns
object instance or false on error

Implements iBxDolFactoryObject.

◆ getUserResponse()

BxDolCaptcha::getUserResponse ( )

Return text entered by user

◆ isAvailable()

BxDolCaptcha::isAvailable ( )

Check if captcha is available, like all API keys are specified.


The documentation for this class was generated from the following file: