r98338 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98337‎ | r98338 | r98339 >
Date:17:53, 28 September 2011
Author:dasch
Status:resolved (Comments)
Tags:
Comment:
Adding Extension RelationLinks
Modified paths:
  • /trunk/extensions/RelationLinks (added) (history)
  • /trunk/extensions/RelationLinks/RelationLinks.php (added) (history)

Diff [purge]

Index: trunk/extensions/RelationLinks/RelationLinks.php
@@ -0,0 +1,33 @@
 2+<?php
 3+/**
 4+* @addtogroup Extensions
 5+*/
 6+// Check environment
 7+if ( !defined( 'MEDIAWIKI' ) ) {
 8+ echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" );
 9+ die( -1 );
 10+}
 11+
 12+/* Configuration */
 13+
 14+// Credits
 15+$wgExtensionCredits['other'][] = array(
 16+ 'path' => __FILE__,
 17+ 'name' => 'RelationLinks',
 18+ 'author' => '[http://www.dasch-tour.de DaSch]',
 19+ 'description' => 'Adds link rel to header, that can used for navigation and for SEO',
 20+ 'version' => '0.2.1',
 21+ 'url' => 'http://www.mediawiki.org/wiki/Extension:RelationLinks',
 22+);
 23+
 24+$wgHooks['ParserBeforeTidy'][] = 'addRelationLinks';
 25+
 26+function addRelationLinks( &$parser, &$text ) {
 27+ global $wgArticlePath, $wgTitle;
 28+ $parser->mOutput->addHeadItem('<link rel="start" type="text/html" title="'. wfMsg('Mainpage') .'" href="'. str_replace( '$1', wfMsg('Mainpage'), $wgArticlePath ) .'" />');
 29+ $parser->mOutput->addHeadItem('<link rel="up" type="text/html" title="'. $wgTitle->getBaseText() .'" href="'. str_replace( '$1', $wgTitle->getBaseText(), $wgArticlePath ) .'" />');
 30+ $parser->mOutput->addHeadItem('<link rel="help" type="text/html" title="'. wfMsg('Helppage') .'" href="'. str_replace( '$1', wfMsg('Helppage'), $wgArticlePath ) .'" />');
 31+ $parser->mOutput->addHeadItem('<link rel="index" type="text/html" title="'. wfMsg('Allpages') .'" href="'. str_replace( '$1', 'Special:AllPages', $wgArticlePath ) . '" />');
 32+ $parser->mOutput->addHeadItem('<link rel="search" type="text/html" title="'. wfMsg('Search') .'" href="'. str_replace( '$1', 'Special:Search', $wgArticlePath ) . '" />');
 33+ return true;
 34+}
Property changes on: trunk/extensions/RelationLinks/RelationLinks.php
___________________________________________________________________
Added: svn:eol-style
135 + native

Sign-offs

UserFlagDate
DaSchinspected16:52, 26 October 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r98350fixing r98338 (adding localisation)dasch19:06, 28 September 2011

Comments

#Comment by Siebrand (talk | contribs)   18:33, 28 September 2011

Should use 'descriptionmsg' property in $wgExtensionCredits to allow for localisation of extension description on Special:Version.

Status & tagging log