Changeset View
Changeset View
Standalone View
Standalone View
core/units/captcha/captcha_eh.php
Show All 17 Lines | |||||
/** | /** | ||||
* [HOOK] Validates captcha code in item | * [HOOK] Validates captcha code in item | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
*/ | */ | ||||
function OnValidateCode($event) | function OnValidateCode($event) | ||||
{ | { | ||||
/** @var kCaptchaHelper $captcha_helper */ | |||||
$captcha_helper = $this->Application->recallObject('CaptchaHelper'); | $captcha_helper = $this->Application->recallObject('CaptchaHelper'); | ||||
/* @var $captcha_helper kCaptchaHelper */ | |||||
$captcha_helper->validateCode($event->MasterEvent); | $captcha_helper->validateCode($event->MasterEvent); | ||||
} | } | ||||
/** | /** | ||||
* [HOOK] Initializes captcha code processing routine | * [HOOK] Initializes captcha code processing routine | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
*/ | */ | ||||
function OnPrepareCaptcha($event) | function OnPrepareCaptcha($event) | ||||
{ | { | ||||
/** @var kCaptchaHelper $captcha_helper */ | |||||
$captcha_helper = $this->Application->recallObject('CaptchaHelper'); | $captcha_helper = $this->Application->recallObject('CaptchaHelper'); | ||||
/* @var $captcha_helper kCaptchaHelper */ | |||||
// create field for captcha code storage | // create field for captcha code storage | ||||
$virtual_fields = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'VirtualFields'); | $virtual_fields = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'VirtualFields'); | ||||
$virtual_fields['Captcha'] = Array ('type' => 'string', 'default' => ''); | $virtual_fields['Captcha'] = Array ('type' => 'string', 'default' => ''); | ||||
$this->Application->setUnitOption($event->MasterEvent->Prefix, 'VirtualFields', $virtual_fields); | $this->Application->setUnitOption($event->MasterEvent->Prefix, 'VirtualFields', $virtual_fields); | ||||
} | } | ||||
} | } |