Cheetah
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
ChWsbCaptcha Class Reference
Inheritance diagram for ChWsbCaptcha:
ChBaseCaptchaReCAPTCHA ChTemplCaptchaReCAPTCHA

Public Member Functions

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

Static Public Member Functions

static getObjectInstance ($sObject=false)
 

Protected Attributes

 $_sObject
 
 $_aObject
 

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:

Example of usage

Display captcha:

ch_import('ChWsbCaptcha'); // import captcha class
$oCaptcha = ChWsbCaptcha::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:

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

Definition at line 54 of file ChWsbCaptcha.php.

Constructor & Destructor Documentation

◆ __construct()

ChWsbCaptcha::__construct (   $aObject)

Constructor

Parameters
$aObjectarray of captcha options

Definition at line 63 of file ChWsbCaptcha.php.

Member Function Documentation

◆ check()

ChWsbCaptcha::check ( )

Check captcha.

Reimplemented in ChBaseCaptchaReCAPTCHA.

Definition at line 114 of file ChWsbCaptcha.php.

◆ display()

ChWsbCaptcha::display (   $bDynamicMode = false)

Display captcha.

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

Reimplemented in ChBaseCaptchaReCAPTCHA.

Definition at line 106 of file ChWsbCaptcha.php.

◆ getObjectInstance()

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

Get captcha object instance by object name

Parameters
$sObjectobject name
Returns
object instance or false on error

Definition at line 74 of file ChWsbCaptcha.php.

◆ getUserResponse()

ChWsbCaptcha::getUserResponse ( )

Return text entered by user

Reimplemented in ChBaseCaptchaReCAPTCHA.

Definition at line 122 of file ChWsbCaptcha.php.

◆ isAvailable()

ChWsbCaptcha::isAvailable ( )

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

Reimplemented in ChBaseCaptchaReCAPTCHA.

Definition at line 130 of file ChWsbCaptcha.php.

Member Data Documentation

◆ $_aObject

ChWsbCaptcha::$_aObject
protected

Definition at line 57 of file ChWsbCaptcha.php.

◆ $_sObject

ChWsbCaptcha::$_sObject
protected

Definition at line 56 of file ChWsbCaptcha.php.


The documentation for this class was generated from the following file:
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChWsbCaptcha\getObjectInstance
static getObjectInstance($sObject=false)
Definition: ChWsbCaptcha.php:74