MathCaptcha requires the texvc functions, which are now in the Math extension.

This commit is contained in:
Happy-melon 2011-04-24 11:11:10 +00:00
parent 2894a23d5e
commit 4d62315053

View file

@ -39,7 +39,11 @@ class MathCaptcha extends SimpleCaptcha {
/** Fetch the math */ /** Fetch the math */
function fetchMath( $sum ) { function fetchMath( $sum ) {
$math = new MathRenderer( $sum ); 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->setOutputMode( MW_MATH_PNG ); $math->setOutputMode( MW_MATH_PNG );
$html = $math->render(); $html = $math->render();
return preg_replace( '/alt=".*?"/', '', $html ); return preg_replace( '/alt=".*?"/', '', $html );