prefix = $params['prefix']; } } /** * Get the captcha body. Don't include any of the surrounding table cells/rows * * @param $value String * @return String */ public function getInputHTML( $value ) { # TODO } public function validate( $data, $alldata ) { // We sent back the exists status of the captcha before. If it *doesn't* exist // we actually want to validate this as true, because we don't want an angry red // error message, just for the user to put the captcha in again if ( $data === false ) { return true; } } /** * @param $request WebRequest * @return void */ public function loadDataFromRequest( $request ) { $this->captcha = Captcha::factory(); $this->captcha->loadFromRequest( $request, $this ); if ( !$this->captcha->exists() ) { // The captcha doesn't exist; probably because it's already been used and // then deleted for security. Load the field up with a new captcha which // will be shown to the user when the validation of said new object fails $this->captcha = Captcha::newRandom(); } // This will be useful as the difference between "the captcha doesn't exist" and // "you answered the captcha wrongly" return $this->captcha->exists(); } }