summaryrefslogtreecommitdiff
path: root/extensions/ConfirmEdit/MathCaptcha.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/ConfirmEdit/MathCaptcha.class.php')
-rw-r--r--extensions/ConfirmEdit/MathCaptcha.class.php14
1 files changed, 4 insertions, 10 deletions
diff --git a/extensions/ConfirmEdit/MathCaptcha.class.php b/extensions/ConfirmEdit/MathCaptcha.class.php
index 220df31d..7874991f 100644
--- a/extensions/ConfirmEdit/MathCaptcha.class.php
+++ b/extensions/ConfirmEdit/MathCaptcha.class.php
@@ -22,7 +22,7 @@ class MathCaptcha extends SimpleCaptcha {
$index = $this->storeCaptcha( array( 'answer' => $answer ) );
$form = '<table><tr><td>' . $this->fetchMath( $sum ) . '</td>';
- $form .= '<td>' . Xml::input( 'wpCaptchaWord', false, false, array( 'tabindex' => '1' ) ) . '</td></tr></table>';
+ $form .= '<td>' . Html::input( 'wpCaptchaWord', false, false, array( 'tabindex' => '1', 'required' ) ) . '</td></tr></table>';
$form .= Html::hidden( 'wpCaptchaId', $index );
return $form;
}
@@ -39,17 +39,11 @@ class MathCaptcha extends SimpleCaptcha {
/** Fetch the math */
function fetchMath( $sum ) {
- // class_exists() unfortunately doesn't work with HipHop, and
- // its replacement, MWInit::classExists(), wasn't added until
- // MW 1.18, and is thus unusable here - so instead, we'll
- // just duplicate the code of MWInit::classExists().
- try {
- $r = new ReflectionClass( 'MathRenderer' );
- } catch( ReflectionException $r ) {
+ if ( MWInit::classExists( 'MathRenderer' ) ) {
+ $math = new MathRenderer( $sum );
+ } else {
throw new MWException( 'MathCaptcha requires the Math extension for MediaWiki versions 1.18 and above.' );
}
-
- $math = new MathRenderer( $sum );
$math->setOutputMode( MW_MATH_PNG );
$html = $math->render();
return preg_replace( '/alt=".*?"/', '', $html );