diff --git a/include/web/MediaWikis.php b/include/web/MediaWikis.php index 532fa05..da7f351 100644 --- a/include/web/MediaWikis.php +++ b/include/web/MediaWikis.php @@ -1,90 +1,92 @@ . # websites in the Internet namespace web; /** * All the MediaWiki instances in the Internet :^) */ abstract class MediaWikis { /** * Get all the registered MediaWiki classes * * TODO: Smarter way. * * @return array */ protected static function allClasses() { return [ \wm\WikipediaIt ::class, \wm\WikipediaEn ::class, \wm\WikipediaEs ::class, \wm\WikipediaFr ::class, \wm\WikipediaDe ::class, \wm\Wikidata ::class, \wm\Commons ::class, \wm\MetaWiki ::class, \web\WikimediaCH ::class, \web\LandscapeforWiki::class, + \web\WikiTrek ::class, + \web\DataTrek ::class, ]; } /** * Get all the registered MediaWiki instances * * @generator */ public static function all() { foreach( self::allClasses() as $classname ) { yield $classname::instance(); } } /** * Get a specific MediaWiki instance from its UID * * @param $uid string * @return mw\StaticSite|false */ public static function findFromUID( $uid ) { foreach( self::all() as $one ) { if( $one::UID === $uid ) { return $one; } } return false; } /** * Get all the registered MediaWiki UIDs ordered alphabetically * * @return array */ public static function allUIDs() { $all = []; foreach( self::all() as $wiki ) { $all[] = $wiki::UID; } sort( $all ); return $all; } } diff --git a/include/web/WikiTrek.php b/include/web/WikiTrek.php new file mode 100644 index 0000000..bf4b618 --- /dev/null +++ b/include/web/WikiTrek.php @@ -0,0 +1,128 @@ +. + +# website in the Internet +namespace web; + +/** + * MediaWiki instance for websites of the WikiTrek family + * + * @see https://wikitrek.org/ + * @see https://data.wikitrek.org/ + */ +class WikiTrek extends \mw\StaticSite +{ + + /** + * @override + */ + const UID = 'wikitrek'; + + /** + * @override + */ + const API_URL = 'https://wikitrek.org/wt/api.php'; + + /** + * @override + */ + protected static function create() + { + $site = parent::create(); + $site->setNamespaces([ + new \mw\Ns(-2, 'Media'), + new \mw\Ns(-1, 'Special'), + new \mw\Ns(1, 'Talk'), + new \mw\Ns(2, 'User'), + new \mw\Ns(3, 'User talk'), + new \mw\Ns(4, 'Project'), + new \mw\Ns(5, 'Project talk'), + new \mw\Ns(6, 'File'), + new \mw\Ns(7, 'File talk'), + new \mw\Ns(8, 'MediaWiki'), + new \mw\Ns(9, 'MediaWiki talk'), + new \mw\Ns(10, 'Template'), + new \mw\Ns(11, 'Template talk'), + new \mw\Ns(12, 'Help'), + new \mw\Ns(13, 'Help talk'), + new \mw\Ns(14, 'Category'), + new \mw\Ns(15, 'Category talk'), + new \mw\Ns(102, 'Propriet\u00e0'), + new \mw\Ns(103, 'Discussione propriet\u00e0'), + new \mw\Ns(108, 'Concetto'), + new \mw\Ns(109, 'Discussione concetto'), + new \mw\Ns(112, 'smw/schema'), + new \mw\Ns(113, 'smw/schema talk'), + new \mw\Ns(114, 'Rule'), + new \mw\Ns(115, 'Rule talk'), + new \mw\Ns(828, 'Module'), + new \mw\Ns(829, 'Module talk'), + new \mw\Ns(3046, 'TC'), + new \mw\Ns(3047, 'TC talk'), + ]); + return $site; + } +} +class DataTrek extends \mw\StaticWikibaseSite +{ + + /** + * @override + */ + const UID = 'datatrek'; + + /** + * @override + */ + const API_URL = 'https://data.wikitrek.org/dt/api.php'; + + /** + * @override + */ + protected static function create() + { + $site = parent::create(); + $site->setNamespaces([ + new \mw\Ns(-2, 'Media'), + new \mw\Ns(-1, 'Special'), + new \mw\Ns(1, 'Talk'), + new \mw\Ns(2, 'User'), + new \mw\Ns(3, 'User talk'), + new \mw\Ns(4, 'Project'), + new \mw\Ns(5, 'Project talk'), + new \mw\Ns(6, 'File'), + new \mw\Ns(7, 'File talk'), + new \mw\Ns(8, 'MediaWiki'), + new \mw\Ns(9, 'MediaWiki talk'), + new \mw\Ns(10, 'Template'), + new \mw\Ns(11, 'Template talk'), + new \mw\Ns(12, 'Help'), + new \mw\Ns(13, 'Help talk'), + new \mw\Ns(14, 'Category'), + new \mw\Ns(15, 'Category talk'), + new \mw\Ns(120, 'Item'), + new \mw\Ns(121, 'Item talk'), + new \mw\Ns(122, 'Property'), + new \mw\Ns(123, 'Property talk'), + new \mw\Ns(828, 'Module'), + new \mw\Ns(829, 'Module talk'), + new \mw\Ns(1198, 'Translations'), + new \mw\Ns(1199, 'Translations talk'), + ]); + return $site; + } +}