]> ToastFreeware Gitweb - toast/cookiecaptcha.git/blobdiff - MathCaptcha.class.php
Localisation updates for extension messages from translatewiki.net (2009-06-29 20...
[toast/cookiecaptcha.git] / MathCaptcha.class.php
index a51e7fae6b857ab4f987f2613eca0643a698b6dd..9348d873b28b68251ea452a0b2428650a5b3b04c 100644 (file)
@@ -11,8 +11,9 @@ class MathCaptcha extends SimpleCaptcha {
                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']['sum'] = $sum;
+               $resultArr['captcha']['question'] = $sum;
        }
        
        /** Produce a nice little form */
@@ -21,8 +22,8 @@ class MathCaptcha extends SimpleCaptcha {
                $index = $this->storeCaptcha( array( 'answer' => $answer ) );
                
                $form = '<table><tr><td>' . $this->fetchMath( $sum ) . '</td>';
-               $form .= '<td>' . wfInput( 'wpCaptchaAnswer', false, false, array( 'tabindex' => '1' ) ) . '</td></tr></table>';
-               $form .= wfHidden( 'wpCaptchaId', $index );
+               $form .= '<td>' . Xml::input( 'wpCaptchaWord', false, false, array( 'tabindex' => '1' ) ) . '</td></tr></table>';
+               $form .= Xml::hidden( 'wpCaptchaId', $index );
                return $form;
        }
        
@@ -41,7 +42,7 @@ class MathCaptcha extends SimpleCaptcha {
                $math = new MathRenderer( $sum );
                $math->setOutputMode( MW_MATH_PNG );
                $html = $math->render();
-               return preg_replace( '/alt=".*"/', '', $html );
+               return preg_replace( '/alt=".*?"/', '', $html );
        }
 
 }