class MathCaptcha extends SimpleCaptcha {
/** Validate a captcha response */
- function keyMatch( $req, $info ) {
- return (int)$req->getVal( 'wpCaptchaAnswer' ) == (int)$info['answer'];
+ function keyMatch( $answer, $info ) {
+ return (int)$answer == (int)$info['answer'];
+ }
+
+ function addCaptchaAPI(&$resultArr) {
+ list( $sum, $answer ) = $this->pickSum();
+ $index = $this->storeCaptcha( array('answer' => $answer ) );
+ $resultArr['captcha']['type'] = 'math';
+ $resultArr['captcha']['mime'] = 'text/tex';
+ $resultArr['captcha']['id'] = $index;
+ $resultArr['captcha']['question'] = $sum;
}
/** Produce a nice little form */