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 |
1 | 35 | + native |