MediaWiki REL1_39
Interwiki.php
Go to the documentation of this file.
1<?php
26class Interwiki {
27
29 protected $mPrefix;
30
32 protected $mURL;
33
35 protected $mAPI;
36
40 protected $mWikiID;
41
43 protected $mLocal;
44
46 protected $mTrans;
47
48 public function __construct( $prefix = null, $url = '', $api = '', $wikiId = '', $local = 0,
49 $trans = 0
50 ) {
51 $this->mPrefix = $prefix;
52 $this->mURL = $url;
53 $this->mAPI = $api;
54 $this->mWikiID = $wikiId;
55 $this->mLocal = (bool)$local;
56 $this->mTrans = (bool)$trans;
57 }
58
68 public function getURL( $title = null ) {
69 $url = $this->mURL;
70 if ( $title !== null ) {
71 $url = str_replace( "$1", wfUrlencode( $title ), $url );
72 }
73
74 return $url;
75 }
76
82 public function getAPI() {
83 return $this->mAPI;
84 }
85
91 public function getWikiID() {
92 return $this->mWikiID;
93 }
94
101 public function isLocal() {
102 return $this->mLocal;
103 }
104
111 public function isTranscludable() {
112 return $this->mTrans;
113 }
114
120 public function getName() {
121 $msg = wfMessage( 'interwiki-name-' . $this->mPrefix )->inContentLanguage();
122
123 return !$msg->exists() ? '' : $msg->text();
124 }
125
131 public function getDescription() {
132 $msg = wfMessage( 'interwiki-desc-' . $this->mPrefix )->inContentLanguage();
133
134 return !$msg->exists() ? '' : $msg->text();
135 }
136
137}
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Value object for representing interwiki records.
Definition Interwiki.php:26
string $mURL
The URL of the wiki, with "$1" as a placeholder for an article name.
Definition Interwiki.php:32
string $mWikiID
The name of the database (for a connection to be established with LBFactory::getMainLB( 'domainId' ))
Definition Interwiki.php:40
__construct( $prefix=null, $url='', $api='', $wikiId='', $local=0, $trans=0)
Definition Interwiki.php:48
string $mPrefix
The interwiki prefix, (e.g.
Definition Interwiki.php:29
getDescription()
Get a description for this interwiki.
isLocal()
Is this a local link from a sister project, or is it something outside, like Google.
getName()
Get the name for the interwiki site.
getWikiID()
Get the DB name for this wiki.
Definition Interwiki.php:91
bool $mTrans
Whether interwiki transclusions are allowed.
Definition Interwiki.php:46
string $mAPI
The URL of the file api.php.
Definition Interwiki.php:35
getURL( $title=null)
Get the URL for a particular title (or with $1 if no title given)
Definition Interwiki.php:68
isTranscludable()
Can pages from this wiki be transcluded? Still requires $wgEnableScaryTransclusion.
getAPI()
Get the API URL for this wiki.
Definition Interwiki.php:82
bool $mLocal
Whether the wiki is in this project.
Definition Interwiki.php:43