mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-27 17:40:11 +00:00
Add extension.json dependency on Math to MathCaptcha
Change-Id: I7b20114365cb22536cf9e9e74ee5dd00b85a41d5
This commit is contained in:
parent
f96b1eda5b
commit
ae67c81991
|
@ -3,6 +3,11 @@
|
||||||
"author": [
|
"author": [
|
||||||
"..."
|
"..."
|
||||||
],
|
],
|
||||||
|
"requires": {
|
||||||
|
"extensions": {
|
||||||
|
"Math": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"url": "https://www.mediawiki.org/wiki/Extension:ConfirmEdit#MathCaptcha",
|
"url": "https://www.mediawiki.org/wiki/Extension:ConfirmEdit#MathCaptcha",
|
||||||
"descriptionmsg": "mathcaptcha-desc",
|
"descriptionmsg": "mathcaptcha-desc",
|
||||||
"license-name": "GPL-2.0-or-later",
|
"license-name": "GPL-2.0-or-later",
|
||||||
|
|
|
@ -73,12 +73,7 @@ class MathCaptcha extends SimpleCaptcha {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function fetchMath( $sum ) {
|
private function fetchMath( $sum ) {
|
||||||
if ( class_exists( MathRenderer::class ) ) {
|
|
||||||
$math = MathRenderer::getRenderer( $sum, [], 'png' );
|
$math = MathRenderer::getRenderer( $sum, [], 'png' );
|
||||||
} else {
|
|
||||||
throw new LogicException(
|
|
||||||
'MathCaptcha requires the Math extension for MediaWiki versions 1.18 and above.' );
|
|
||||||
}
|
|
||||||
$math->render();
|
$math->render();
|
||||||
$html = $math->getHtmlOutput();
|
$html = $math->getHtmlOutput();
|
||||||
return preg_replace( '/alt=".*?"/', '', $html );
|
return preg_replace( '/alt=".*?"/', '', $html );
|
||||||
|
|
Loading…
Reference in a new issue