/** * Forgery constructor * * @param string $renderUrl */ public function __forge($renderUrl = null) { $this->captcha = \Magelight\Webform\Models\Captcha\Captcha::forge(); if (empty($renderUrl)) { $this->captcha->loadCodeFromSession()->generate()->saveCodeToSession(); $this->captcha->save(); } $this->set('image_url', !empty($renderUrl) ? $renderUrl : $this->url($this->captcha->getSavedFileName())); $this->addClass('form-group'); }
/** * Check value with rule * Returns: * - true if rule passed. * - false if value doesn`t match the rule. * * @param mixed $value * @return bool */ public function check($value) { return \Magelight\Webform\Models\Captcha\Captcha::forge()->check($value); }
/** * Render captcha image action */ public function render_captchaAction() { \Magelight\Webform\Models\Captcha\Captcha::forge()->generate()->saveCodeToSession()->render(); }