MediaWiki  1.29.1
WikiReference Class Reference

Reference to a locally-hosted wiki. More...

Public Member Functions

 __construct ( $canonicalServer, $path, $server=null)
 
 getCanonicalServer ()
 Get a canonical server URL. More...
 
 getCanonicalUrl ( $page, $fragmentId=null)
 Get a canonical (i.e. More...
 
 getDisplayName ()
 Get the URL in a way to be displayed to the user More or less Wikimedia specific. More...
 
 getFullUrl ( $page, $fragmentId=null)
 Get a URL based on $wgServer, like Title::getFullURL() would produce when called locally on the wiki. More...
 
 getUrl ( $page, $fragmentId=null)
 Alias for getCanonicalUrl(), for backwards compatibility. More...
 

Private Member Functions

 getLocalUrl ( $page, $fragmentId=null)
 Helper function for getUrl() More...
 

Private Attributes

 $mCanonicalServer
 canonical server URL, e.g. 'https://www.mediawiki.org' More...
 
 $mPath
 path, '/wiki/$1' More...
 
 $mServer
 server URL, may be protocol-relative, e.g. '//www.mediawiki.org' More...
 

Detailed Description

Reference to a locally-hosted wiki.

Definition at line 182 of file WikiMap.php.

Constructor & Destructor Documentation

◆ __construct()

WikiReference::__construct (   $canonicalServer,
  $path,
  $server = null 
)
Parameters
string$canonicalServer
string$path
null | string$server

Definition at line 192 of file WikiMap.php.

References $path.

Member Function Documentation

◆ getCanonicalServer()

WikiReference::getCanonicalServer ( )

Get a canonical server URL.

Returns
string

Definition at line 252 of file WikiMap.php.

References $mCanonicalServer.

◆ getCanonicalUrl()

WikiReference::getCanonicalUrl (   $page,
  $fragmentId = null 
)

Get a canonical (i.e.

based on $wgCanonicalServer) URL to a page on this foreign wiki

Parameters
string$pagePage name (must be normalised before calling this function!)
string | null$fragmentId
Returns
string Url

Definition at line 244 of file WikiMap.php.

References $page, and getLocalUrl().

Referenced by getUrl().

◆ getDisplayName()

WikiReference::getDisplayName ( )

Get the URL in a way to be displayed to the user More or less Wikimedia specific.

Returns
string

Definition at line 204 of file WikiMap.php.

References $mCanonicalServer, and wfParseUrl().

◆ getFullUrl()

WikiReference::getFullUrl (   $page,
  $fragmentId = null 
)

Get a URL based on $wgServer, like Title::getFullURL() would produce when called locally on the wiki.

Parameters
string$pagePage name (must be normalized before calling this function!)
string | null$fragmentId
Returns
string URL

Definition at line 276 of file WikiMap.php.

References $page, and getLocalUrl().

◆ getLocalUrl()

WikiReference::getLocalUrl (   $page,
  $fragmentId = null 
)
private

Helper function for getUrl()

Todo:
FIXME: This may be generalized...
Parameters
string$pagePage name (must be normalised before calling this function! May contain a section part.)
string | null$fragmentId
Returns
string relative URL, without the server part.

Definition at line 226 of file WikiMap.php.

References $page, and wfUrlencode().

Referenced by getCanonicalUrl(), and getFullUrl().

◆ getUrl()

WikiReference::getUrl (   $page,
  $fragmentId = null 
)

Alias for getCanonicalUrl(), for backwards compatibility.

Parameters
string$page
string | null$fragmentId
Returns
string

Definition at line 263 of file WikiMap.php.

References $page, and getCanonicalUrl().

Member Data Documentation

◆ $mCanonicalServer

WikiReference::$mCanonicalServer
private

canonical server URL, e.g. 'https://www.mediawiki.org'

Definition at line 183 of file WikiMap.php.

Referenced by getCanonicalServer(), and getDisplayName().

◆ $mPath

WikiReference::$mPath
private

path, '/wiki/$1'

Definition at line 185 of file WikiMap.php.

◆ $mServer

WikiReference::$mServer
private

server URL, may be protocol-relative, e.g. '//www.mediawiki.org'

Definition at line 184 of file WikiMap.php.


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