Index: trunk/extensions/ConfirmEdit/MathCaptcha.class.php |
— | — | @@ -39,17 +39,11 @@ |
40 | 40 | |
41 | 41 | /** Fetch the math */ |
42 | 42 | function fetchMath( $sum ) { |
43 | | - // class_exists() unfortunately doesn't work with HipHop, and |
44 | | - // its replacement, MWInit::classExists(), wasn't added until |
45 | | - // MW 1.18, and is thus unusable here - so instead, we'll |
46 | | - // just duplicate the code of MWInit::classExists(). |
47 | | - try { |
48 | | - $r = new ReflectionClass( 'MathRenderer' ); |
49 | | - } catch( ReflectionException $r ) { |
| 43 | + if( MWInit::classExists( 'MathRenderer' ) ){ |
| 44 | + $math = new MathRenderer( $sum ); |
| 45 | + } else { |
50 | 46 | throw new MWException( 'MathCaptcha requires the Math extension for MediaWiki versions 1.18 and above.' ); |
51 | 47 | } |
52 | | - |
53 | | - $math = new MathRenderer( $sum ); |
54 | 48 | $math->setOutputMode( MW_MATH_PNG ); |
55 | 49 | $html = $math->render(); |
56 | 50 | return preg_replace( '/alt=".*?"/', '', $html ); |