/** Fetch the math */ function fetchMath($sum) { if (class_exists('MathRenderer')) { $math = MathRenderer::getRenderer($sum, array(), MW_MATH_PNG); } else { throw new Exception('MathCaptcha requires the Math extension for MediaWiki versions 1.18 and above.'); } $html = $math->render(); return preg_replace('/alt=".*?"/', '', $html); }