From 207c3a0f1929b27f4c01ffc5b2e84b67d1932db4 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 22 Jul 2011 21:51:06 +0000 Subject: [PATCH] Revert r92864 per discussion on CR --- MathCaptcha.class.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/MathCaptcha.class.php b/MathCaptcha.class.php index 220df31da..5dbbeeb99 100644 --- a/MathCaptcha.class.php +++ b/MathCaptcha.class.php @@ -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 );