r65197 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65196‎ | r65197 | r65198 >
Date:22:41, 17 April 2010
Author:siebrand
Status:deferred
Tags:
Comment:
Name file as parent folder (i capitalised)
Modified paths:
  • /trunk/extensions/Imagetabs/Imagetabs.php (added) (history)
  • /trunk/extensions/Imagetabs/imagetabs.php (deleted) (history)

Diff [purge]

Index: trunk/extensions/Imagetabs/imagetabs.php
@@ -1,51 +0,0 @@
2 -<?php
3 -/**
4 - * This program is free software; you can redistribute it and/or modify
5 - * it under the terms of the GNU General Public License as published by
6 - * the Free Software Foundation; either version 2 of the License, or
7 - * (at your option) any later version.
8 - *
9 - * @author Roan Kattouw <roan.kattouw@home.nl>
10 - * @copyright Copyright © 2007 Roan Kattouw
11 - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
12 - *
13 - * An extension that shows interwiki tabs above Image: pages
14 - * Original code by Joe Beaudoin Jr. from www.battlestarwiki.org (joe(AT)frakmedia(DOT)net)
15 - * Modified for more generic usage by Roan Kattouw (AKA Catrope) (roan(DOT)kattouw(AT)home(DOT)nl)
16 - * For information how to install and use this extension, see the README file.
17 - *
18 - */
19 -
20 -$wgExtensionFunctions[] = 'createImageTabs_setup';
21 -$wgExtensionCredits['other'][] = array(
22 - 'path' => __FILE__,
23 - 'name' => 'Imagetabs',
24 - 'author' => array('Joe Beaudoin Jr.', 'Roan Kattouw'),
25 - 'description' => 'Adds tabs with interwiki links above Image: pages',
26 - 'version' => '1.0',
27 - 'url' => 'http://www.mediawiki.org/wiki/Extension:Imagetabs'
28 -);
29 -
30 -function createImageTabs_setup() {
31 - global $wgHooks;
32 - $wgHooks['SkinTemplateContentActions'][] = 'createImageTabs_hook';
33 -}
34 -
35 -function createImageTabs_hook(&$content_actions) {
36 - global $wgEnableInterwikiImageTabs, $wgInterwikiImageTabs, $wgTitle, $wgLocalInterwiki;
37 - if($wgEnableInterwikiImageTabs && $wgTitle->getNamespace() == NS_IMAGE) {
38 - $i = 0;
39 - foreach($wgInterwikiImageTabs as $prefix => $caption) {
40 - // Go to prefix:Image:title. Image: is automatically translated if necessary.
41 - $titleObj = Title::newFromText($prefix . ":Image:" . $wgTitle->getText());
42 - // Check that we don't link to ourselves
43 - if($titleObj->getInterwiki() != $wgLocalInterwiki && $titleObj->getFullURL() != $wgTitle->getFullURL())
44 - $content_actions['interwikitab-'.$i++] = array(
45 - 'class' => false,
46 - 'text' => $caption,
47 - 'href' => $titleObj->getFullURL()
48 - );
49 - }
50 - }
51 - return true;
52 -}
Index: trunk/extensions/Imagetabs/Imagetabs.php
@@ -0,0 +1,51 @@
 2+<?php
 3+/**
 4+ * This program is free software; you can redistribute it and/or modify
 5+ * it under the terms of the GNU General Public License as published by
 6+ * the Free Software Foundation; either version 2 of the License, or
 7+ * (at your option) any later version.
 8+ *
 9+ * @author Roan Kattouw <roan.kattouw@home.nl>
 10+ * @copyright Copyright © 2007 Roan Kattouw
 11+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
 12+ *
 13+ * An extension that shows interwiki tabs above Image: pages
 14+ * Original code by Joe Beaudoin Jr. from www.battlestarwiki.org (joe(AT)frakmedia(DOT)net)
 15+ * Modified for more generic usage by Roan Kattouw (AKA Catrope) (roan(DOT)kattouw(AT)home(DOT)nl)
 16+ * For information how to install and use this extension, see the README file.
 17+ *
 18+ */
 19+
 20+$wgExtensionFunctions[] = 'createImageTabs_setup';
 21+$wgExtensionCredits['other'][] = array(
 22+ 'path' => __FILE__,
 23+ 'name' => 'Imagetabs',
 24+ 'author' => array('Joe Beaudoin Jr.', 'Roan Kattouw'),
 25+ 'description' => 'Adds tabs with interwiki links above Image: pages',
 26+ 'version' => '1.0',
 27+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Imagetabs'
 28+);
 29+
 30+function createImageTabs_setup() {
 31+ global $wgHooks;
 32+ $wgHooks['SkinTemplateContentActions'][] = 'createImageTabs_hook';
 33+}
 34+
 35+function createImageTabs_hook(&$content_actions) {
 36+ global $wgEnableInterwikiImageTabs, $wgInterwikiImageTabs, $wgTitle, $wgLocalInterwiki;
 37+ if($wgEnableInterwikiImageTabs && $wgTitle->getNamespace() == NS_IMAGE) {
 38+ $i = 0;
 39+ foreach($wgInterwikiImageTabs as $prefix => $caption) {
 40+ // Go to prefix:Image:title. Image: is automatically translated if necessary.
 41+ $titleObj = Title::newFromText($prefix . ":Image:" . $wgTitle->getText());
 42+ // Check that we don't link to ourselves
 43+ if($titleObj->getInterwiki() != $wgLocalInterwiki && $titleObj->getFullURL() != $wgTitle->getFullURL())
 44+ $content_actions['interwikitab-'.$i++] = array(
 45+ 'class' => false,
 46+ 'text' => $caption,
 47+ 'href' => $titleObj->getFullURL()
 48+ );
 49+ }
 50+ }
 51+ return true;
 52+}
Property changes on: trunk/extensions/Imagetabs/Imagetabs.php
___________________________________________________________________
Name: svn:eol-style
153 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r65198Update documentation per r65197siebrand22:42, 17 April 2010

Status & tagging log