MediaWiki master
MediaWiki\WikiMap\WikiReference Class Reference

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

Public Member Functions

 __construct (string $canonicalServer, string $path, ?string $server=null)
 
 getCanonicalServer ()
 Get the canonical server (i.e.
 
 getCanonicalUrl ( $page, $fragmentId=null)
 Create a full canonical URL to a page on the given wiki.
 
 getDisplayName ()
 Extract the server name from wgCanonicalServer.
 
 getFullUrl ( $page, $fragmentId=null)
 Create a full URL like Title::getFullURL() to a page, based on $wgServer.
 
 getUrl ( $page, $fragmentId=null)
 Alias for getCanonicalUrl(), for backwards compatibility.
 

Detailed Description

Reference to a locally-hosted wiki.

Definition at line 14 of file WikiReference.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\WikiMap\WikiReference::__construct ( string $canonicalServer,
string $path,
?string $server = null )
Parameters
string$canonicalServer
string$path
null | string$server

Definition at line 27 of file WikiReference.php.

References $path.

Member Function Documentation

◆ getCanonicalServer()

MediaWiki\WikiMap\WikiReference::getCanonicalServer ( )

Get the canonical server (i.e.

$wgCanonicalServer)

Returns
string E.g. "https://en.example.org".

Definition at line 38 of file WikiReference.php.

◆ getCanonicalUrl()

MediaWiki\WikiMap\WikiReference::getCanonicalUrl ( $page,
$fragmentId = null )

Create a full canonical URL to a page on the given wiki.

Parameters
string$pagePage name (must be normalised before calling this function!)
string | null$fragmentId
Returns
string URL E.g. "https://en.example.org/wiki/Foo#Bar".

Definition at line 60 of file WikiReference.php.

Referenced by MediaWiki\WikiMap\WikiReference\getUrl().

◆ getDisplayName()

MediaWiki\WikiMap\WikiReference::getDisplayName ( )

Extract the server name from wgCanonicalServer.

Returns
string Hostname, e.g. "en.example.org".

Definition at line 47 of file WikiReference.php.

◆ getFullUrl()

MediaWiki\WikiMap\WikiReference::getFullUrl ( $page,
$fragmentId = null )

Create a full URL like Title::getFullURL() to a page, based on $wgServer.

This is similar to what Title::getFullURL() would produce when called locally on the wiki, and may differ from the canonical URL, depending on site configuration, as it uses $wgServer instead of $wgCanonicalServer.

Parameters
string$pagePage name (must be normalized before calling this function!)
string | null$fragmentId
Returns
string URL E.g. "//en.example.org/wiki/Foo#Bar".

Definition at line 86 of file WikiReference.php.

◆ getUrl()

MediaWiki\WikiMap\WikiReference::getUrl ( $page,
$fragmentId = null )

Alias for getCanonicalUrl(), for backwards compatibility.

Parameters
string$page
string | null$fragmentId
Returns
string E.g. "https://en.example.org/wiki/Foo#Bar".

Definition at line 71 of file WikiReference.php.

References MediaWiki\WikiMap\WikiReference\getCanonicalUrl().


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