Updated to MediaWiki 1.42.0

master
落雨楓 1 month ago
parent e955f3e89e
commit e0ac8c7da0

@ -1,19 +1,20 @@
<?php
namespace Isekai\Widgets;
use Title;
use Html;
use MediaWiki\MediaWikiServices;
use MediaWiki\Title\Title;
use MediaWiki\Parser\Parser;
use MediaWiki\Html\Html;
use PPFrame;
class ButtonLinkWidget {
/**
* @param string $text
* @param array $params
* @param \Parser $parser
* @param \PPFrame $frame
* @param Parser $parser
* @param PPFrame $frame
* @return string|string[]
*/
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
$out = $parser->getOutput();
$out->addModules([
"oojs-ui-core"

@ -1,6 +1,10 @@
<?php
namespace Isekai\Widgets;
use MediaWiki\Title\Title;
use MediaWiki\Parser\Parser;
use MediaWiki\Html\Html;
use PPFrame;
use MediaWiki\MediaWikiServices;
class CreatePageWidget {
@ -11,7 +15,7 @@ class CreatePageWidget {
return [$template, "markerType" => 'nowiki'];
}
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
$config = MediaWikiServices::getInstance()->getMainConfig();
$configCreatePageNamespaces = $config->get('IsekaiCreatePageNamespaces');

@ -1,6 +1,9 @@
<?php
namespace Isekai\Widgets;
use MediaWiki\Parser\Parser;
use PPFrame;
class DiscoverWidget {
public static function getHtml() {
ob_start();
@ -9,7 +12,7 @@ class DiscoverWidget {
return [$template, "markerType" => 'nowiki'];
}
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules(['ext.isekai.discover']);
return self::getHtml();

@ -1,11 +1,12 @@
<?php
namespace Isekai\Widgets;
use Html;
use MediaWiki\Parser\Parser;
use MediaWiki\Html\Html;
use PPFrame;
class ExtraFontWidget {
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
$existsFonts = $parser->extIsekaiWidgetsCache->get('extraFonts', INF, []);
$content = $text = $parser->recursiveTagParseFully($text, $frame);

@ -1,6 +1,11 @@
<?php
namespace Isekai\Widgets;
use MediaWiki\Html\TemplateParser;
use MediaWiki\MediaWikiServices;
use MediaWiki\Parser\Parser;
use PPFrame;
class FeedListWidget {
public static function getHtml() {
ob_start();
@ -9,7 +14,7 @@ class FeedListWidget {
return [$template, "markerType" => 'nowiki'];
}
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules(['ext.isekai.feedList']);
return self::getHtml();

@ -1,7 +1,9 @@
<?php
namespace Isekai\Widgets;
use Title;
use MediaWiki\Title\Title;
use MediaWiki\Parser\Parser;
use PPFrame;
use MediaWiki\MediaWikiServices;
class FontFaceWidget {
@ -12,7 +14,7 @@ class FontFaceWidget {
* @param \PPFrame $frame
* @return string|string[]
*/
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
if (empty($params['src']) || empty($params['name'])) {
return '<span class="error">' . wfMessage('isekai-fontface-error-invalid-params')->parse() . '</span>';
}

@ -1,10 +1,12 @@
<?php
namespace Isekai\Widgets;
use Html;
use MediaWiki\Parser\Parser;
use MediaWiki\Html\Html;
use PPFrame;
class Html5Widget {
public static function createDetails(string $text, array $args, \Parser $parser, \PPFrame $frame) {
public static function createDetails(string $text, array $args, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules(['ext.isekai.collapse']);
$allowedAttr = ['class'];
$htmlArgs = array_filter($args, function($k) use($allowedAttr) {
@ -19,7 +21,7 @@ class Html5Widget {
return [Html::rawElement('details', $htmlArgs, $content), "markerType" => 'nowiki'];
}
public static function createSummary(string $text, array $args, \Parser $parser, \PPFrame $frame) {
public static function createSummary(string $text, array $args, Parser $parser, PPFrame $frame) {
$allowedAttr = ['class'];
$htmlArgs = array_filter($args, function($k) use($allowedAttr) {
return in_array($k, $allowedAttr);

@ -1,8 +1,9 @@
<?php
namespace Isekai\Widgets;
use Html;
use MediaWiki\MediaWikiServices;
use MediaWiki\Parser\Parser;
use MediaWiki\Html\Html;
use PPFrame;
class InformationWidget {
public static function parseContent($content, $dataMap, $title) {
@ -86,7 +87,7 @@ class InformationWidget {
return $finalData;
}
public static function buildText(\Parser $parser, \PPFrame $frame, array $dataMap, $title, $picture, $float) {
public static function buildText(Parser $parser, PPFrame $frame, array $dataMap, $title, $picture, $float) {
global $wgIsekaiWidgetInformationTextSeparator;
$sep = $wgIsekaiWidgetInformationTextSeparator;
@ -102,7 +103,7 @@ class InformationWidget {
return [$html, 'markerType' => 'nowiki'];
}
public static function buildInfoBox(\Parser $parser, \PPFrame $frame, array $dataMap, $title, $picture, $float) {
public static function buildInfoBox(Parser $parser, PPFrame $frame, array $dataMap, $title, $picture, $float) {
$parser->getOutput()->addModules(['ext.isekai.information.infobox']);
$tableClasses = ['wikitable-container', 'infobox'];
@ -155,11 +156,11 @@ class InformationWidget {
/**
* @param string $content
* @param array $args
* @param \Parser $parser
* @param \PPFrame $frame
* @param Parser $parser
* @param PPFrame $frame
* @return array|string
*/
public static function create(string $content, array $args, \Parser $parser, \PPFrame $frame) {
public static function create(string $content, array $args, Parser $parser, PPFrame $frame) {
$configKeys = ['type', 'float', 'title_key', 'picture'];
$configArgs = [];
$infoArgs = [];

@ -1,17 +1,19 @@
<?php
namespace Isekai\Widgets;
use Html;
use MediaWiki\Parser\Parser;
use MediaWiki\Html\Html;
use PPFrame;
class MasonryItemWidget {
/**
* @param string $text
* @param array $params
* @param \Parser $parser
* @param \PPFrame $frame
* @param Parser $parser
* @param PPFrame $frame
* @return string|string[]
*/
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
// 获取父级瀑布流参数
$masonryParams = MasonryWidget::getMasonryParams();

@ -1,7 +1,9 @@
<?php
namespace Isekai\Widgets;
use Html;
use MediaWiki\Parser\Parser;
use MediaWiki\Html\Html;
use PPFrame;
class MasonryWidget {
public static $breakpoints = [
@ -60,7 +62,7 @@ class MasonryWidget {
* @param \PPFrame $frame
* @return string|string[]
*/
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules(['ext.isekai.masonry']);
$params['cols'] = intval($params['cols'] ?? 2);

@ -39,7 +39,6 @@ class VEvalTagHandler extends ExtensionTagHandler {
return $extApi->extTagToDOM(
$extArgs,
'',
$src,
[
'wrapperTag' => $wrapperTag,
@ -47,7 +46,7 @@ class VEvalTagHandler extends ExtensionTagHandler {
'extTag' => 'veval',
'context' => $contextType
],
],
);;
]
);
}
}

@ -1,6 +1,9 @@
<?php
namespace Isekai\Widgets;
use MediaWiki\Parser\Parser;
use PPFrame;
class PreviewCardWidget {
public static function getHtml($variables) {
extract($variables);
@ -10,7 +13,7 @@ class PreviewCardWidget {
return [$template, "markerType" => 'nowiki'];
}
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules(['ext.isekai.previewCard']);
$titleChunk = explode('/', $text);

@ -3,11 +3,11 @@ namespace Isekai\Widgets;
use ApiMain;
use Exception;
use FauxRequest;
use Html;
use MediaWiki\Linker\LinkRenderer;
use MediaWiki\MediaWikiServices;
use Title;
use MediaWiki\Request\FauxRequest;
use MediaWiki\Title\Title;
use MediaWiki\Html\Html;
use MediaWiki\Parser\Parser;
use PPFrame;
class PreviewPageListWidget {
public const CONTAINER_CLASS_NAME = 'isekai-card isekai-preview-page-list-card';
@ -41,7 +41,7 @@ class PreviewPageListWidget {
Html::closeElement('div');
}
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules(['ext.isekai.previewPageList']);
$loader = $params['loader'] ?? 'unknown';

@ -2,7 +2,9 @@
namespace Isekai\Widgets;
use Html;
use MediaWiki\Parser\Parser;
use MediaWiki\Html\Html;
use PPFrame;
class TileGroupWidget {
private $content = '';
@ -16,7 +18,7 @@ class TileGroupWidget {
$this->parseArgs($args);
}
public static function create(string $text, array $args, \Parser $parser, \PPFrame $frame) {
public static function create(string $text, array $args, Parser $parser, PPFrame $frame) {
$content = $parser->recursiveTagParse($text, $frame);
$args['content'] = $content;

@ -2,9 +2,11 @@
namespace Isekai\Widgets;
use Html;
use MediaWiki\Title\Title;
use MediaWiki\Html\Html;
use MediaWiki\Parser\Parser;
use PPFrame;
use MediaWiki\MediaWikiServices;
use Title;
class TileWidget {
private $size = 'medium';
@ -25,7 +27,7 @@ class TileWidget {
$this->parseArgs($args);
}
public static function create(string $text, array $args, \Parser $parser, \PPFrame $frame) {
public static function create(string $text, array $args, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules(['ext.isekai.tile']);
$content = '';

@ -1,6 +1,8 @@
<?php
namespace Isekai\Widgets;
use MediaWiki\Html\Html;
class Utils {
public static function safeBase64Encode($input) {
return str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($input));
@ -41,7 +43,7 @@ class Utils {
} else {
$elemAttr = [];
}
$stringBuilder[] = \Html::rawElement('p', $elemAttr, $line);
$stringBuilder[] = Html::rawElement('p', $elemAttr, $line);
}
$stringBuilder[] = $append;
return implode('', $stringBuilder);

@ -1,8 +1,11 @@
<?php
namespace Isekai\Widgets;
use MediaWiki\Parser\Parser;
use PPFrame;
class VEvalWidget {
public static function create($text, $params, \Parser $parser, \PPFrame $frame) {
public static function create($text, $params, Parser $parser, PPFrame $frame) {
$content = $text = $parser->recursiveTagParse($text, $frame);
return [$content, "markerType" => 'nowiki'];
}

@ -3,7 +3,8 @@ namespace Isekai\Widgets;
use MapCacheLRU;
use MediaWiki\MediaWikiServices;
use Parser;
use MediaWiki\Parser\Parser;
use MediaWiki\Output\OutputPage;
class Widgets {
/**
@ -40,7 +41,7 @@ class Widgets {
return true;
}
public static function onLoad(\OutputPage $outputPage) {
public static function onLoad(OutputPage $outputPage) {
$outputPage->addModuleStyles([
"ext.isekai.widgets.global",
"ext.isekai.information.infobox",

Loading…
Cancel
Save