/** * Registers the image button to receive postback data during postback. * This is necessary because an image button, when postback, does not have * direct mapping between post data and the image button name. * This method overrides the parent implementation and is invoked before render. * @param mixed event parameter */ public function onPreRender($param) { parent::onPreRender($param); $this->getPage()->registerRequiresPostData($this); }
/** * Configures the image URL that shows the token. * @param mixed event parameter */ public function onPreRender($param) { parent::onPreRender($param); if (!self::checkRequirements()) { throw new TConfigurationException('captcha_imagettftext_required'); } if (!$this->getViewState('TokenGenerated', 0)) { $manager = $this->getApplication()->getAssetManager(); $manager->publishFilePath($this->getFontFile()); $url = $manager->publishFilePath($this->getCaptchaScriptFile()); $url .= '?options=' . urlencode($this->getTokenImageOptions()); $this->setImageUrl($url); $this->setViewState('TokenGenerated', time()); } }