r36305 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36304‎ | r36305 | r36306 >
Date:18:50, 15 June 2008
Author:demon
Status:old
Tags:
Comment:
Refactor Extension:InterwikiList and put it into SVN.
Modified paths:
  • /trunk/extensions/InterwikiList (added) (history)
  • /trunk/extensions/InterwikiList/InterwikiList.i18n.php (added) (history)
  • /trunk/extensions/InterwikiList/InterwikiList.php (added) (history)
  • /trunk/extensions/InterwikiList/InterwikiList_body.php (added) (history)

Diff [purge]

Index: trunk/extensions/InterwikiList/InterwikiList_body.php
@@ -0,0 +1,49 @@
 2+<?php
 3+
 4+// Class definition for Extension:InterwikiList
 5+
 6+class InterwikiList extends SpecialPage {
 7+
 8+ /**
 9+ * Constructor
 10+ */
 11+ public function InterwikiList() {
 12+ SpecialPage::SpecialPage("InterwikiList");
 13+ wfLoadExtensionMessages('InterwikiList');
 14+ }
 15+
 16+ /**
 17+ * Execute
 18+ */
 19+ public function execute( $par ) {
 20+ global $wgOut;
 21+ $wgOut->setPagetitle( wfMsg( 'interwikilist' ) );
 22+ $selfTitle = Title::makeTitle( NS_SPECIAL, 'InterwikiList' );
 23+ $wgOut->addHTML( $this->getInterwikis() );
 24+ }
 25+
 26+ /**
 27+ * Get all Interwiki Links - the heart of the function
 28+ */
 29+ private function getInterwikis() {
 30+ $dbr = wfGetDB( DB_SLAVE );
 31+
 32+ $results = $dbr->select( 'interwiki', array( 'iw_prefix', 'iw_url' ) );
 33+
 34+ $text = Xml::openElement( 'table', array( 'id' => 'sv-software' ) ) . "<tr>
 35+ <th>" . wfMsg( 'interwikilist-linkname' ) . "</th>
 36+ <th>" . wfMsg( 'interwikilist-target' ) . "</th>
 37+ </tr>\n";
 38+
 39+ while ( $row = $dbr->fetchObject( $results ) ) {
 40+ $text .= " <tr>
 41+ <td>" . $row->iw_prefix . "</td>
 42+ <td>" . $row->iw_url . "</td>
 43+ </tr>\n";
 44+ }
 45+ $text .= Xml::closeElement( 'table' );
 46+ $dbr->freeResult ( $results );
 47+
 48+ return $text;
 49+ }
 50+}
\ No newline at end of file
Property changes on: trunk/extensions/InterwikiList/InterwikiList_body.php
___________________________________________________________________
Added: svn:eol-style
151 + native
Index: trunk/extensions/InterwikiList/InterwikiList.i18n.php
@@ -0,0 +1,12 @@
 2+<?php
 3+
 4+// Internationalization file for Extension:InterwikiList
 5+
 6+$messages = array();
 7+
 8+$messages['en'] = array (
 9+ 'interwikilist' => 'Interwiki list',
 10+ 'interwikilist-desc' => 'Adds a [[Special:Interwikilist|special page]] to view available interwiki links',
 11+ 'interwikilist-linkname' => 'Interwiki link',
 12+ 'interwikilist-target' => 'Target URL',
 13+);
\ No newline at end of file
Property changes on: trunk/extensions/InterwikiList/InterwikiList.i18n.php
___________________________________________________________________
Added: svn:eol-style
114 + native
Index: trunk/extensions/InterwikiList/InterwikiList.php
@@ -0,0 +1,33 @@
 2+<?php
 3+/**
 4+ * Extension:InterwikiList - Display a list of available interwiki prefixes
 5+ * that editors can use.
 6+ *
 7+ * This program is free software; you can redistribute it and/or modify
 8+ * it under the terms of the GNU General Public License as published by
 9+ * the Free Software Foundation; either version 2 of the License, or
 10+ * (at your option) any later version.
 11+ *
 12+ * @author Chad Horohoe <innocentkiller@gmail.com>
 13+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 14+ */
 15+
 16+// Not a valid entry point, skip unless MEDIAWIKI is defined
 17+if ( !defined('MEDIAWIKI') ) {
 18+ die( "NOT A VALID ENTRY" );
 19+}
 20+
 21+$wgExtensionCredits['specialpage'][] = array(
 22+ 'name' => 'Interwiki List',
 23+ 'version' => '0.2',
 24+ 'url' => 'http://mediawiki.org/wiki/Extension:InterwikiList',
 25+ 'description' => 'Adds a [[Special:Interwikilist|special page]] to view available interwiki links',
 26+ 'author' => '[mailto:innocentkiller@gmail.com Chad Horohoe]',
 27+ 'descriptionmsg' => 'interwikilist-desc',
 28+);
 29+
 30+$dir = dirname(__FILE__) . '/';
 31+$wgSpecialPages['InterwikiList'] = 'InterwikiList';
 32+$wgAutoloadClasses['InterwikiList'] = $dir . 'InterwikiList_body.php';
 33+$wgExtensionMessagesFiles['InterwikiList'] = $dir . 'InterwikiList.i18n.php';
 34+$wgSpecialPageGroups['InterwikiList'] = 'wiki';
\ No newline at end of file
Property changes on: trunk/extensions/InterwikiList/InterwikiList.php
___________________________________________________________________
Added: svn:eol-style
135 + native

Status & tagging log