r53746 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53745‎ | r53746 | r53747 >
Date:14:28, 25 July 2009
Author:demon
Status:ok (Comments)
Tags:
Comment:
(bug 10812) Interwiki links can have names and descriptions, fetched from message 'interwiki-desc-PREFIX', not really used anywhere yet though
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Interwiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Interwiki.php
@@ -17,7 +17,7 @@
1818
1919 protected $mPrefix, $mURL, $mLocal, $mTrans;
2020
21 - function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ) {
 21+ public function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ) {
2222 $this->mPrefix = $prefix;
2323 $this->mURL = $url;
2424 $this->mLocal = $local;
@@ -186,7 +186,7 @@
187187 * @param $title string What text to put for the article name
188188 * @return string The URL
189189 */
190 - function getURL( $title = null ) {
 190+ public function getURL( $title = null ) {
191191 $url = $this->mURL;
192192 if( $title != null ) {
193193 $url = str_replace( "$1", $title, $url );
@@ -194,12 +194,41 @@
195195 return $url;
196196 }
197197
198 - function isLocal() {
 198+ /**
 199+ * Is this a local link from a sister project, or is
 200+ * it something outside, like Google
 201+ * @return bool
 202+ */
 203+ public function isLocal() {
199204 return $this->mLocal;
200205 }
201206
202 - function isTranscludable() {
 207+ /**
 208+ * Can pages from this wiki be transcluded?
 209+ * Still requires $wgEnableScaryTransclusion
 210+ * @return bool
 211+ */
 212+ public function isTranscludable() {
203213 return $this->mTrans;
204214 }
205215
 216+ /**
 217+ * Get the name for the interwiki site
 218+ * @return String
 219+ */
 220+ public function getName() {
 221+ $key = 'interwiki-name-' . $this->mPrefix;
 222+ $msg = wfMsgForContent( $key );
 223+ return wfEmptyMsg( $key, $msg ) ? '' : $msg;
 224+ }
 225+
 226+ /**
 227+ * Get a description for this interwiki
 228+ * @return String
 229+ */
 230+ public function getDescription() {
 231+ $key = 'interwiki-desc-' . $this->mPrefix;
 232+ $msg = wfMsgForContent( $key );
 233+ return wfEmptyMsg( $key, $msg ) ? '' : $msg;
 234+ }
206235 }
Index: trunk/phase3/RELEASE-NOTES
@@ -161,6 +161,8 @@
162162 * (bug 19900) The "listgrouprights-key" message is now wrapped in a div with
163163 class "mw-listgrouprights-key"
164164 * (bug 471) Allow RSS feeds for watchlist, using an opt-in security token
 165+* (bug 10812) Interwiki links can have names and descriptions, fetched from
 166+ message 'interwiki-desc-PREFIX', not really used anywhere yet though
165167
166168 === Bug fixes in 1.16 ===
167169

Follow-up revisions

RevisionCommit summaryAuthorDate
r53747Merge r45494-r53746 from trunk. Want to try and revive this :)demon14:39, 25 July 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   21:11, 21 August 2009

Hmmmm... not sure if this is best done in the DB or the localization area. Probably not unreasonable, as long as we can think of a nice UI for managing all these later. :)

Status & tagging log