' . wfMessage('isekai-fontface-error-invalid-params')->parse() . '';
}
$service = MediaWikiServices::getInstance();
/** @var \MediaWiki\Parser\ParserOutput */
$out = $parser->getOutput();
$fontName = 'extra-' . $params['name'];
$existsFonts = $out->getExtensionData('IsekaiWidgets.extraFonts');
if (!$existsFonts) {
$existsFonts = [];
}
if (isset($existsFonts[$fontName])) {
return '' .
wfMessage('isekai-fontface-error-font-already-defined', $params['name'])->parse() .
'';
}
if (preg_match('/[`~!@#$%^&*()+=<>?:"{}|,.\/;\'\\\\\[\]]\r\n/', $fontName)) {
return '' .
wfMessage('isekai-fontface-error-font-name-invalid')->parse() .
'';
}
$title = Title::newFromText($params['src'], NS_FILE);
$file = $service->getRepoGroup()->findFile($title);
if (!$file) {
return '' .
wfMessage('isekai-fontface-error-font-not-exists', $params['src'])->parse() .
'';
}
$fontUrl = $file->getUrl();
$fontId = substr(Utils::safeBase64Encode(md5($fontName, true)), 0, 8);
$css = "";
$existsFonts[$fontName] = $fontId;
$out->setExtensionData('IsekaiWidgets.extraFonts', $existsFonts);
return [$css, "markerType" => 'nowiki'];
}
}