/** Fetch the math */ function fetchMath($sum) { $math = new MathRenderer($sum); $math->setOutputMode(MW_MATH_PNG); $html = $math->render(); return preg_replace('/alt=".*"/', '', $html); }
/** Fetch the math */ function fetchMath($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); $html = $math->render(); return preg_replace('/alt=".*?"/', '', $html); }
/** 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) { 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); }
/** * Check of a formula exists, rendering if not * This will return either an image tag with link to image (complicated formulas) * or html (simple) * * @param string $tex LaTeX formula * @param array $params Parameters (not used?) * @return string */ public static function renderMath($tex, $params = array()) { $math = new MathRenderer($tex, $params); return $math->render(); }
public static function renderMath($tex, $params = array(), ParserOptions $parserOptions = null) { $math = new MathRenderer($tex, $params); if ($parserOptions) { $math->setOutputMode($parserOptions->getMath()); } return $math->render(); }
function renderMath($tex) { global $wgUser; $math = new MathRenderer($tex); $math->setOutputMode($wgUser->getOption('math')); return $math->render(); }
public static function renderMath($tex, $params = array()) { global $wgUser; $math = new MathRenderer($tex, $params); $math->setOutputMode($wgUser->getOption('math')); return $math->render(); }
public static function renderMath($tex, $params = array()) { global $wgUser; # SEAN: We need this since XML code like & < cannot # be processed as is. $tex = html_entity_decode($tex); $math = new MathRenderer($tex, $params); $math->setOutputMode($wgUser->getOption('math')); return $math->render(); }