MediaWiki master
Interwiki.php
Go to the documentation of this file.
1<?php
27class Interwiki {
28
30 protected $mPrefix;
31
33 protected $mURL;
34
36 protected $mAPI;
37
41 protected $mWikiID;
42
44 protected $mLocal;
45
47 protected $mTrans;
48
49 public function __construct( $prefix = null, $url = '', $api = '', $wikiId = '', $local = 0,
50 $trans = 0
51 ) {
52 $this->mPrefix = $prefix;
53 $this->mURL = $url;
54 $this->mAPI = $api;
55 $this->mWikiID = $wikiId;
56 $this->mLocal = (bool)$local;
57 $this->mTrans = (bool)$trans;
58 }
59
69 public function getURL( $title = null ) {
70 $url = $this->mURL;
71 if ( $title !== null ) {
72 $url = str_replace( "$1", wfUrlencode( $title ), $url );
73 }
74
75 return $url;
76 }
77
83 public function getAPI() {
84 return $this->mAPI;
85 }
86
92 public function getWikiID() {
93 return $this->mWikiID;
94 }
95
102 public function isLocal() {
103 return $this->mLocal;
104 }
105
112 public function isTranscludable() {
113 return $this->mTrans;
114 }
115
121 public function getName() {
122 $msg = wfMessage( 'interwiki-name-' . $this->mPrefix )->inContentLanguage();
123
124 return !$msg->exists() ? '' : $msg->text();
125 }
126
132 public function getDescription() {
133 $msg = wfMessage( 'interwiki-desc-' . $this->mPrefix )->inContentLanguage();
134
135 return !$msg->exists() ? '' : $msg->text();
136 }
137
138}
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.
An interwiki record value object.
Definition Interwiki.php:27
string $mURL
The article path URL of the wiki, with "$1" as a placeholder for an article name.
Definition Interwiki.php:33
string $mWikiID
The name of the database (for a connection to be established with LBFactory::getMainLB( 'domainId' ))
Definition Interwiki.php:41
__construct( $prefix=null, $url='', $api='', $wikiId='', $local=0, $trans=0)
Definition Interwiki.php:49
string $mPrefix
The interwiki prefix, (e.g.
Definition Interwiki.php:30
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:92
bool $mTrans
Whether interwiki transclusions are allowed.
Definition Interwiki.php:47
string $mAPI
The URL to the api.php entry point of the wiki.
Definition Interwiki.php:36
getURL( $title=null)
Get the URL for a particular title (or with $1 if no title given)
Definition Interwiki.php:69
isTranscludable()
Can pages from this wiki be transcluded? Still requires $wgEnableScaryTransclusion.
getAPI()
Get the API URL for this wiki.
Definition Interwiki.php:83
bool $mLocal
Whether the wiki is in this project.
Definition Interwiki.php:44