Index: trunk/extensions/ConfirmEdit/MathCaptcha.class.php |
— | — | @@ -39,11 +39,17 @@ |
40 | 40 | |
41 | 41 | /** Fetch the math */ |
42 | 42 | function fetchMath( $sum ) { |
43 | | - if( MWInit::classExists( 'MathRenderer' ) ){ |
44 | | - $math = new MathRenderer( $sum ); |
45 | | - } else { |
| 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 ) { |
46 | 50 | throw new MWException( 'MathCaptcha requires the Math extension for MediaWiki versions 1.18 and above.' ); |
47 | 51 | } |
| 52 | + |
| 53 | + $math = new MathRenderer( $sum ); |
48 | 54 | $math->setOutputMode( MW_MATH_PNG ); |
49 | 55 | $html = $math->render(); |
50 | 56 | return preg_replace( '/alt=".*?"/', '', $html ); |