2023-07-16 23:53:31
This commit is contained in:
parent
b73b6868ad
commit
d574f27e8d
|
@ -0,0 +1 @@
|
||||||
|
.idea/
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
- Feedback, wishes and suggestions can be sent by email.
|
||||||
|
- Constructive criticism, bug descriptions and other reports are welcome.
|
||||||
|
- Email: mail@ihub.to
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
- [**GitHub**](https://github.com/pkgstore)
|
||||||
|
- [GitLab](https://gitlab.com/pkgstore) (MIRROR)
|
||||||
|
- [Codeberg](https://codeberg.org/pkgstore) (MIRROR)
|
||||||
|
- [MosHub](https://hub.mos.ru/pkgstore) (MIRROR)
|
||||||
|
- [Git.Org.Ru](https://git.org.ru/pkgstore) (MIRROR)
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2023 Package Store
|
Copyright (c) 2023 iHub TO <https://ihub.to>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MediaWiki\Extension\PkgStore;
|
||||||
|
|
||||||
|
use MWException;
|
||||||
|
use Parser, OutputPage, Skin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MW_EXT_List
|
||||||
|
*/
|
||||||
|
class MW_EXT_List
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get JSON data.
|
||||||
|
*
|
||||||
|
* @param $type
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private static function getList($type): array
|
||||||
|
{
|
||||||
|
$get = MW_EXT_Kernel::getJSON(__DIR__ . '/store/list.json');
|
||||||
|
return $get['list'][$type] ?? [] ?: [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register tag function.
|
||||||
|
*
|
||||||
|
* @param Parser $parser
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws MWException
|
||||||
|
*/
|
||||||
|
public static function onParserFirstCallInit(Parser $parser): void
|
||||||
|
{
|
||||||
|
$parser->setFunctionHook('list', [__CLASS__, 'onRenderTag']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render tag function.
|
||||||
|
*
|
||||||
|
* @param Parser $parser
|
||||||
|
* @param string $type
|
||||||
|
* @param string $style
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public static function onRenderTag(Parser $parser, string $type = '', string $style = ''): ?string
|
||||||
|
{
|
||||||
|
// Argument: type.
|
||||||
|
$getType = MW_EXT_Kernel::outClear($type ?? '' ?: '');
|
||||||
|
$outType = MW_EXT_Kernel::outNormalize($getType);
|
||||||
|
|
||||||
|
// Check license type, set error category.
|
||||||
|
if (!self::getList($outType)) {
|
||||||
|
$parser->addTrackingCategory('mw-list-error-category');
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Argument: style.
|
||||||
|
$getStyle = MW_EXT_Kernel::outClear($style ?? '' ?: '');
|
||||||
|
$outStyle = MW_EXT_Kernel::outNormalize($getStyle);
|
||||||
|
|
||||||
|
// Get data.
|
||||||
|
$getList = self::getList($outType);
|
||||||
|
|
||||||
|
// Sort data.
|
||||||
|
asort($getList);
|
||||||
|
|
||||||
|
// Build style class.
|
||||||
|
switch ($outStyle) {
|
||||||
|
case 'grid':
|
||||||
|
$outClass = 'grid';
|
||||||
|
break;
|
||||||
|
case 'list':
|
||||||
|
$outClass = 'list';
|
||||||
|
break;
|
||||||
|
case 'inline':
|
||||||
|
$outClass = 'inline';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$parser->addTrackingCategory('mw-list-error-category');
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set URL item.
|
||||||
|
$outItem = '';
|
||||||
|
|
||||||
|
foreach ($getList as $item) {
|
||||||
|
$title = empty($item['title']) ? '' : $item['title'];
|
||||||
|
$icon = empty($item['icon']) ? 'fas fa-globe' : $item['icon'];
|
||||||
|
$bg_color = empty($item['style']['background-color']) ? '' : 'background-color:' . $item['style']['background-color'] . ';';
|
||||||
|
$color = empty($item['style']['color']) ? '' : 'color:' . $item['style']['color'] . ';';
|
||||||
|
$href = empty($item['url']) ? '' : $item['url'];
|
||||||
|
$desc = MW_EXT_Kernel::getMessageText('list', $item['description']);
|
||||||
|
|
||||||
|
if ($outClass === 'grid') {
|
||||||
|
$outItem .= '<div>';
|
||||||
|
$outItem .= '<div><a style="' . $bg_color . $color . '" title="' . $desc . '" href="' . $href . '" target="_blank"><i class="' . $icon . '"></i></a></div>';
|
||||||
|
$outItem .= '<div><h4><a href="' . $href . '" target="_blank">' . $title . '</a></h4><div>' . $desc . '</div></div>';
|
||||||
|
$outItem .= '</div>';
|
||||||
|
} else if ($outClass === 'list') {
|
||||||
|
$outItem .= '<li><a title="' . $desc . '" href="' . $href . '" target="_blank">' . $title . '</a></li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Out HTML.
|
||||||
|
$outHTML = '<div class="mw-list mw-list-' . $outClass . '">';
|
||||||
|
|
||||||
|
if ($outClass === 'grid') {
|
||||||
|
$outHTML .= '<div class="mw-list-body"><div class="mw-list-content">' . $outItem . '</div></div>';
|
||||||
|
|
||||||
|
} else if ($outClass === 'list') {
|
||||||
|
$outHTML .= '<div class="mw-list-body"><ul class="mw-list-content">' . $outItem . '</ul></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$outHTML .= '</div>';
|
||||||
|
|
||||||
|
// Out parser.
|
||||||
|
return $parser->insertStripItem($outHTML, $parser->getStripState());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load resource function.
|
||||||
|
*
|
||||||
|
* @param OutputPage $out
|
||||||
|
* @param Skin $skin
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function onBeforePageDisplay(OutputPage $out, Skin $skin): void
|
||||||
|
{
|
||||||
|
$out->addModuleStyles(['ext.mw.list.styles']);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internationalization file for extension MW_EXT_List (magic words).
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @ingroup Extensions
|
||||||
|
* @license MIT
|
||||||
|
* @author iHub TO <https://ihub.to>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$magicWords = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* English.
|
||||||
|
*
|
||||||
|
* @author iHub TO <https://ihub.to>
|
||||||
|
* ------------------------------------------------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
$magicWords['en'] = [
|
||||||
|
'list' => [0, 'list'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Russian.
|
||||||
|
*
|
||||||
|
* @author iHub TO <https://ihub.to>
|
||||||
|
* ------------------------------------------------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
$magicWords['ru'] = [
|
||||||
|
'list' => [0, 'list'],
|
||||||
|
];
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Confirm MediaWiki environment.
|
||||||
|
if (!defined('MEDIAWIKI')) {
|
||||||
|
die('This file is a MediaWiki extension and thus not a valid entry point.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function_exists('wfLoadExtension')) {
|
||||||
|
wfLoadExtension('MW_EXT_List');
|
||||||
|
// Keep i18n globals so mergeMessageFileList.php doesn't break.
|
||||||
|
$wgExtensionMessagesFiles['MW_EXT_List'] = __DIR__ . '/i18n';
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
die('This version of the MW_EXT_List extension requires MediaWiki 1.31+');
|
||||||
|
}
|
19
README.md
19
README.md
|
@ -1 +1,18 @@
|
||||||
# mediawiki-ext-list
|
# Information
|
||||||
|
|
||||||
|
Интеграция списка ресурсов.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
1. Загрузите папки и файлы в директорию `extensions/MW_EXT_META_Url`.
|
||||||
|
2. В самый низ файла `LocalSettings.php` добавьте строку:
|
||||||
|
|
||||||
|
```php
|
||||||
|
wfLoadExtension( 'MW_EXT_META_Url' );
|
||||||
|
```
|
||||||
|
|
||||||
|
## Syntax
|
||||||
|
|
||||||
|
```html
|
||||||
|
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"name": "pkgstore/mediawiki-ext-list",
|
||||||
|
"type": "mediawiki-extension",
|
||||||
|
"description": "MediaWiki list extension.",
|
||||||
|
"license": "MIT",
|
||||||
|
"homepage": "https://ihub.to/",
|
||||||
|
"keywords": [
|
||||||
|
"mediawiki",
|
||||||
|
"meta"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "iHub TO",
|
||||||
|
"email": "mail@ihub.to",
|
||||||
|
"homepage": "https://ihub.to/",
|
||||||
|
"role": "Developer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Kitsune Solar",
|
||||||
|
"email": "mail@kitsune.solar",
|
||||||
|
"homepage": "https://kitsune.solar/",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/pkgstore/mediawiki-ext-list/issues",
|
||||||
|
"source": "https://github.com/pkgstore/mediawiki-ext-list"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.2",
|
||||||
|
"composer/installers": "^1.0.1",
|
||||||
|
"pkgstore/mediawiki-ext-kernel": "*"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"MW_EXT_List.class.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"prepend-autoloader": false
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"installer-name": "MW_EXT_List"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
"name": "MW_EXT_List",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"author": [
|
||||||
|
"[https://ihub.to/ iHub TO]",
|
||||||
|
"[https://kitsune.solar/ Kitsune Solar]",
|
||||||
|
"..."
|
||||||
|
],
|
||||||
|
"url": "https://ihub.to/",
|
||||||
|
"descriptionmsg": "mw-meta-desc",
|
||||||
|
"license-name": "[https://choosealicense.com/licenses/mit/ MIT]",
|
||||||
|
"type": "other",
|
||||||
|
"require": {
|
||||||
|
"MediaWiki": ">= 1.30.0",
|
||||||
|
"extensions": {
|
||||||
|
"MW_EXT_Core": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AutoloadClasses": {
|
||||||
|
"MediaWiki\\Extension\\PkgStore\\MW_EXT_List": "MW_EXT_List.class.php"
|
||||||
|
},
|
||||||
|
"Hooks": {
|
||||||
|
"ParserFirstCallInit": [
|
||||||
|
"MediaWiki\\Extension\\PkgStore\\MW_EXT_List::onParserFirstCallInit"
|
||||||
|
],
|
||||||
|
"BeforePageDisplay": [
|
||||||
|
"MediaWiki\\Extension\\PkgStore\\MW_EXT_List::onBeforePageDisplay"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ExtensionMessagesFiles": {
|
||||||
|
"MW_EXT_ListMagic": "MW_EXT_List.i18n.magic.php"
|
||||||
|
},
|
||||||
|
"MessagesDirs": {
|
||||||
|
"MW_EXT_List": [
|
||||||
|
"i18n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ResourceModules": {
|
||||||
|
"ext.mw.list.styles": {
|
||||||
|
"styles": [
|
||||||
|
"styles/theme.css"
|
||||||
|
],
|
||||||
|
"position": "top",
|
||||||
|
"targets": [
|
||||||
|
"desktop",
|
||||||
|
"mobile"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ResourceFileModulePaths": {
|
||||||
|
"localBasePath": "modules",
|
||||||
|
"remoteExtPath": "MW_EXT_List/modules"
|
||||||
|
},
|
||||||
|
"manifest_version": 2
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"@metadata": {
|
||||||
|
"authors": [
|
||||||
|
"iHub TO"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mw-list-desc": "Интеграция списка ресурсов METADATA. Специально для проектов [METADATA / FOUNDATION https://metadata.foundation/].",
|
||||||
|
"mw-list-furs-chat": "Чат сообщества FURRY.",
|
||||||
|
"mw-list-furs-news": "Новости о FURRY.",
|
||||||
|
"mw-list-furs-stream": "Стримы сообщества FURRY.",
|
||||||
|
"mw-list-furs-today": "Журнал сообщества FURRY.",
|
||||||
|
"mw-list-furs-wiki": "WIKI-система сообщества FURRY.",
|
||||||
|
"mw-list-radio-wtf": "Свободная интернет-радиостанция.",
|
||||||
|
"mw-list-metadata-foundation": "Фонд по разработке и поддержке веб-технологий.",
|
||||||
|
"mw-list-metastore-pro": "Платформа по исследованиям и разработкам METADATA.",
|
||||||
|
"mw-list-flarum-help": "Поддержка CMS Flarum.",
|
||||||
|
"mw-list-humhub-help": "Поддержка CMS HumHub.",
|
||||||
|
"mw-list-ipb-help": "Поддержка CMS IPB.",
|
||||||
|
"mw-list-xenforo-help": "Поддержка CMS XenForo."
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
.mw-list {
|
||||||
|
&-grid {
|
||||||
|
.mw-list {
|
||||||
|
&-content {
|
||||||
|
display: grid;
|
||||||
|
grid-gap: 1em;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(20em, 1fr));
|
||||||
|
|
||||||
|
a {
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
i {
|
||||||
|
display: block;
|
||||||
|
color: hsl(0, 0%, 100%);
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-family: 'Roboto Condensed', sans-serif;
|
||||||
|
font-size: 1.2em;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
> div {
|
||||||
|
display: grid;
|
||||||
|
grid-gap: 1em;
|
||||||
|
grid-template-columns: min-content 1fr;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
&:first-child {
|
||||||
|
a {
|
||||||
|
background-color: hsl(217, 71%, 53%);
|
||||||
|
padding: 1em;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
> div {
|
||||||
|
font-size: .9em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
.mw-list-grid .mw-list-content{display:grid;grid-gap:1em;grid-template-columns:repeat(auto-fit, minmax(20em, 1fr))}.mw-list-grid .mw-list-content a{display:block}.mw-list-grid .mw-list-content a:hover{text-decoration:none}.mw-list-grid .mw-list-content a i{display:block;color:#fff;font-size:2em}.mw-list-grid .mw-list-content h4{font-family:'Roboto Condensed', sans-serif;font-size:1.2em;margin:0;padding:0;text-transform:uppercase}.mw-list-grid .mw-list-content>div{display:grid;grid-gap:1em;grid-template-columns:min-content 1fr}.mw-list-grid .mw-list-content>div>div:first-child a{background-color:#3273dc;padding:1em;border-radius:50%}.mw-list-grid .mw-list-content>div>div:last-child>div{font-size:.9em}
|
|
@ -0,0 +1 @@
|
||||||
|
@import 'main.scss';
|
|
@ -0,0 +1,126 @@
|
||||||
|
{
|
||||||
|
"list": {
|
||||||
|
"project": [
|
||||||
|
{
|
||||||
|
"title": "FURS.Chat",
|
||||||
|
"icon": "fas fa-paw",
|
||||||
|
"style": {
|
||||||
|
"background-color": "#f00",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "furs-chat",
|
||||||
|
"url": "https://furs.chat"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "FURS.News",
|
||||||
|
"icon": "fas fa-paw",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "furs-news",
|
||||||
|
"url": "https://furs.news"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "FURS.Stream",
|
||||||
|
"icon": "fas fa-paw",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "furs-stream",
|
||||||
|
"url": "https://furs.stream"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "FURS.Today",
|
||||||
|
"icon": "fas fa-paw",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "furs-today",
|
||||||
|
"url": "https://furs.today"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "FURS.Wiki",
|
||||||
|
"icon": "fas fa-paw",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "furs-wiki",
|
||||||
|
"url": "https://furs.wiki"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Radio.WTF",
|
||||||
|
"icon": "fas fa-broadcast-tower",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "radio-wtf",
|
||||||
|
"url": "https://radio.wtf"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "METADATA / FOUNDATION",
|
||||||
|
"icon": "fas fa-globe",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "metadata-foundation",
|
||||||
|
"url": "https://metadata.foundation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "METASTORE",
|
||||||
|
"icon": "fas fa-store",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "metastore-pro",
|
||||||
|
"url": "https://metastore.pro"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Flarum.HELP",
|
||||||
|
"icon": "fas fa-question-circle",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "flarum-help",
|
||||||
|
"url": "https://flarum.help"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "HumHub.HELP",
|
||||||
|
"icon": "fas fa-question-circle",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "humhub-help",
|
||||||
|
"url": "https://humhub.help"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "IPB.HELP",
|
||||||
|
"icon": "fas fa-question-circle",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "ipb-help",
|
||||||
|
"url": "https://ipb.help"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "XenForo.HELP",
|
||||||
|
"icon": "fas fa-question-circle",
|
||||||
|
"style": {
|
||||||
|
"background-color": "",
|
||||||
|
"color": ""
|
||||||
|
},
|
||||||
|
"description": "xenforo-help",
|
||||||
|
"url": "https://xenforo.help"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue