Initial extension commit
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
commit
a007c80aa3
3 changed files with 86 additions and 0 deletions
38
extension.json
Normal file
38
extension.json
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "Big Buffet",
|
||||
"author": ["Marcin Mikołajczak"],
|
||||
"url": "https://example.com",
|
||||
"descriptionmsg": "",
|
||||
"version": "0.0.0",
|
||||
"license-name": "AGPL",
|
||||
"type": "other",
|
||||
"AutoloadNamespaces": {
|
||||
"MediaWiki\\Extension\\BigBuffet\\": "includes/"
|
||||
},
|
||||
"SpecialPages": {
|
||||
"BigBuffet": "MediaWiki\\Extension\\BigBuffet\\SpecialBigBuffet"
|
||||
},
|
||||
"MessagesDirs": {
|
||||
"BigBuffet": ["i18n"]
|
||||
},
|
||||
"manifest_version": 2,
|
||||
"requires": {
|
||||
"MediaWiki": ">= 1.38.0",
|
||||
"platform": {
|
||||
"php": ">= 5.6"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"BigBuffetBasename": {
|
||||
"value": "index.php/Special:BigBuffet",
|
||||
"description": "Route basename"
|
||||
},
|
||||
"BigBuffetBaseUrl": {
|
||||
"value": "https://pleroma.woodynet.net/",
|
||||
"description": "Instance URL"
|
||||
}
|
||||
},
|
||||
"ConfigRegistry": {
|
||||
"bigbuffet": "GlobalVarConfig::newInstance"
|
||||
}
|
||||
}
|
7
i18n/en.json
Normal file
7
i18n/en.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Marcin Mikołajczak"
|
||||
]
|
||||
}
|
||||
}
|
41
includes/SpecialBigBuffet.php
Normal file
41
includes/SpecialBigBuffet.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
namespace MediaWiki\Extension\BigBuffet;
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
class SpecialBigBuffet extends \SpecialPage
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('BigBuffet');
|
||||
}
|
||||
|
||||
function execute($par)
|
||||
{
|
||||
$output = $this->getOutput();
|
||||
$this->setHeaders();
|
||||
|
||||
$locale = $this->getContext()->getLanguage()->mCode;
|
||||
|
||||
$config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig('bigbuffet');
|
||||
$basename = $config->get('BigBuffetBasename');
|
||||
$baseurl = $config->get('BigBuffetBaseUrl');
|
||||
|
||||
$wikitext = '
|
||||
<script defer="defer" src="/bigbuffet/js/common.js"></script>
|
||||
<script defer="defer" src="/bigbuffet/js/application.js"></script>
|
||||
<div id="bigbuffet" class="text-base"></div>
|
||||
<script>
|
||||
window.BIG_BUFFET_CONFIG = {
|
||||
basename:' . json_encode($basename) . ',
|
||||
baseUrl:' . json_encode($baseurl) . ',
|
||||
mountPoint: "bigbuffet",
|
||||
styles: ["default"],
|
||||
icons: {},
|
||||
locale:' . json_encode($locale) . '
|
||||
};
|
||||
</script>
|
||||
';
|
||||
$output->addHTML($wikitext);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue