diff --git a/include/functions.php b/include/functions.php index 935b25a..2884c73 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,37 +1,64 @@ #!/usr/bin/php . /** * Shortcuts very useful when you are creating a bot */ /** * Get a single wiki from its UID * * Some known UIDs: * wikidatawiki - Wikidata * commonswiki - Wikimedia Commons * metawiki - Meta-wiki * itwiki - Wikipedia (it) * * @param string $uid * @return mw\StaticSite */ function wiki( $uid ) { return \web\MediaWikis::findFromUID( $uid ); } + +/** + * Get Wikidata + * + * @return wm\Wikidata + */ +function wikidata() { + return wiki( 'wikidatawiki' ); +} + +/** + * Get Wikimedia Commons + * + * @return wm\Wikidata + */ +function commons() { + return wiki( 'commonswiki' ); +} + +/** + * Get the Italian Wikipedia + * + * @return wm\WikipediaIt + */ +function itwiki() { + return wiki( 'itwiki' ); +}