r77430 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77429‎ | r77430 | r77431 >
Date:19:46, 29 November 2010
Author:yaron
Status:deferred
Tags:
Comment:
Added smwfAddPoweredBySMW() function - adds "Powered by Semantic MediaWiki" button to the bottom of every page, for MediaWiki 1.17+. (Might as well add it for every SMW wiki, right?)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php
@@ -288,6 +288,7 @@
289289 }
290290
291291 $wgHooks['SkinAfterContent'][] = 'SMWFactbox::onSkinAfterContent'; // draw Factbox below categories
 292+ $wgHooks['SkinGetPoweredBy'][] = 'smwfAddPoweredBySMW';
292293 $smwgMW_1_14 = true; // assume latest 1.14 API
293294
294295 // Registration of the extension credits, see Special:Version.
@@ -549,3 +550,22 @@
550551
551552 return true; // Always return true, in order not to stop MW's hook processing!
552553 }
 554+
 555+/**
 556+ * Adds the 'Powered by Semantic MediaWiki' button right next to the default
 557+ * 'Powered by MediaWiki' button at the bottom of every page. This works
 558+ * only with MediaWiki 1.17+.
 559+ * It might make sense to make this configurable via a variable, if some
 560+ * admins don't want it.
 561+ *
 562+ * @since 1.5.4
 563+ *
 564+ * @return true
 565+ */
 566+function smwfAddPoweredBySMW( &$text, $skin ) {
 567+ global $smwgScriptPath;
 568+ $url = htmlspecialchars( "$smwgScriptPath/skins/images/smw_button.png" );
 569+ $text .= ' <a href="http://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki"><img src="'. $url . '" alt="Powered by Semantic MediaWiki" /></a>';
 570+
 571+ return true; // Always return true, in order not to stop MW's hook processing!
 572+}

Status & tagging log