From a007c80aa3fce171f79d78fe2a52dd9a8069a3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Mon, 26 Jun 2023 00:05:35 +0200 Subject: [PATCH] Initial extension commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- extension.json | 38 ++++++++++++++++++++++++++++++++ i18n/en.json | 7 ++++++ includes/SpecialBigBuffet.php | 41 +++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 extension.json create mode 100644 i18n/en.json create mode 100644 includes/SpecialBigBuffet.php diff --git a/extension.json b/extension.json new file mode 100644 index 0000000..4414ffa --- /dev/null +++ b/extension.json @@ -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" + } +} diff --git a/i18n/en.json b/i18n/en.json new file mode 100644 index 0000000..ddfede4 --- /dev/null +++ b/i18n/en.json @@ -0,0 +1,7 @@ +{ + "@metadata": { + "authors": [ + "Marcin Mikołajczak" + ] + } +} diff --git a/includes/SpecialBigBuffet.php b/includes/SpecialBigBuffet.php new file mode 100644 index 0000000..eb6acc0 --- /dev/null +++ b/includes/SpecialBigBuffet.php @@ -0,0 +1,41 @@ +getOutput(); + $this->setHeaders(); + + $locale = $this->getContext()->getLanguage()->mCode; + + $config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig('bigbuffet'); + $basename = $config->get('BigBuffetBasename'); + $baseurl = $config->get('BigBuffetBaseUrl'); + + $wikitext = ' + + +
+ + '; + $output->addHTML($wikitext); + } +}