MediaWiki REL1_28
WikiMap Class Reference

Helper tools for dealing with other wikis. More...

Static Public Member Functions

static foreignUserLink ( $wikiID, $user, $text=null)
 Convenience to get a link to a user page on a foreign wiki.
 
static getForeignURL ( $wikiID, $page, $fragmentId=null)
 Convenience to get a url to a page on a foreign wiki.
 
static getWiki ( $wikiID)
 Get a WikiReference object for $wikiID.
 
static getWikiName ( $wikiID)
 Convenience to get the wiki's display name.
 
static makeForeignLink ( $wikiID, $page, $text=null)
 Convenience to get a link to a page on a foreign wiki.
 

Static Private Member Functions

static getWikiReferenceFromWgConf ( $wikiID)
 
static getWikiWikiReferenceFromSites ( $wikiID)
 

Detailed Description

Helper tools for dealing with other wikis.

Definition at line 26 of file WikiMap.php.

Member Function Documentation

◆ foreignUserLink()

static WikiMap::foreignUserLink (   $wikiID,
  $user,
  $text = null 
)
static

Convenience to get a link to a user page on a foreign wiki.

Parameters
string$wikiIDWiki'd id (generally database name)
string$userUser name (must be normalised before calling this function!)
string$textLink's text; optional, default to "User:$user"
Returns
string HTML link or false if the wiki was not found

Definition at line 134 of file WikiMap.php.

References makeForeignLink().

Referenced by RightsLogFormatter\makePageLink(), and WikiMapTest\testForeignUserLink().

◆ getForeignURL()

static WikiMap::getForeignURL (   $wikiID,
  $page,
  $fragmentId = null 
)
static

Convenience to get a url to a page on a foreign wiki.

Parameters
string$wikiIDWiki'd id (generally database name)
string$pagePage name (must be normalised before calling this function!)
string | null$fragmentId
Returns
string|bool URL or false if the wiki was not found

Definition at line 168 of file WikiMap.php.

References $page, and getWiki().

Referenced by Linker\makeCommentLink(), makeForeignLink(), and WikiMapTest\testGetForeignURL().

◆ getWiki()

static WikiMap::getWiki (   $wikiID)
static

Get a WikiReference object for $wikiID.

Parameters
string$wikiIDWiki'd id (generally database name)
Returns
WikiReference|null WikiReference object or null if the wiki was not found

Definition at line 34 of file WikiMap.php.

References getWikiReferenceFromWgConf(), and getWikiWikiReferenceFromSites().

Referenced by getForeignURL(), getWikiName(), and WikiMapTest\testGetWiki().

◆ getWikiName()

static WikiMap::getWikiName (   $wikiID)
static

Convenience to get the wiki's display name.

Todo:
We can give more info than just the wiki id!
Parameters
string$wikiIDWiki'd id (generally database name)
Returns
string|int Wiki's name or $wiki_id if the wiki was not found

Definition at line 117 of file WikiMap.php.

References getWiki().

Referenced by WikiMapTest\testGetWikiName().

◆ getWikiReferenceFromWgConf()

static WikiMap::getWikiReferenceFromWgConf (   $wikiID)
staticprivate
Parameters
string$wikiID
Returns
WikiReference|null WikiReference object or null if the wiki was not found

Definition at line 48 of file WikiMap.php.

References $path, $wgConf, global, and list.

Referenced by getWiki().

◆ getWikiWikiReferenceFromSites()

static WikiMap::getWikiWikiReferenceFromSites (   $wikiID)
staticprivate
Parameters
string$wikiID
Returns
WikiReference|null WikiReference object or null if the wiki was not found

Definition at line 83 of file WikiMap.php.

References $path, and wfParseUrl().

Referenced by getWiki().

◆ makeForeignLink()

static WikiMap::makeForeignLink (   $wikiID,
  $page,
  $text = null 
)
static

Convenience to get a link to a page on a foreign wiki.

Parameters
string$wikiIDWiki'd id (generally database name)
string$pagePage name (must be normalised before calling this function!)
string$textLink's text; optional, default to $page
Returns
string HTML link or false if the wiki was not found

Definition at line 146 of file WikiMap.php.

References $page, getForeignURL(), and Linker\makeExternalLink().

Referenced by foreignUserLink(), and WikiMapTest\testMakeForeignLink().


The documentation for this class was generated from the following file: