├── OverrideEntryTitle.i18n.php ├── OverrideEntryTitle.class.php ├── README └── OverrideEntryTitle.php /OverrideEntryTitle.i18n.php: -------------------------------------------------------------------------------- 1 | element into MediaWiki mark-up 4 | * allowing pages to have the displayed title overriden. For example: 5 | * 6 | * The page /wiki/hcard can have its displayed title overridden to 'hCard' 7 | * The page /wiki/hcard-issues can have a title 'hCard Issue Tracking' 8 | * The page /wiki/t can have an overridden title 'Tantek Çelik' 9 | * 10 | * English strings 11 | * @lang English 12 | * @author Ben Ward 13 | */ 14 | 15 | 16 | $messages = array(); 17 | 18 | $messages['en'] = array( 19 | 'overrideentrytitle-desc' => 'Allows you to override the title of a wiki entry by using an <entry-title> element in the entry.' 20 | ); 21 | 22 | ?> 23 | -------------------------------------------------------------------------------- /OverrideEntryTitle.class.php: -------------------------------------------------------------------------------- 1 | element into MediaWiki mark-up 4 | * allowing pages to have the displayed title overriden. For example: 5 | * 6 | * The page /wiki/hcard can have its displayed title overridden to 'hCard' 7 | * The page /wiki/hcard-issues can have a title 'hCard Issue Tracking' 8 | * The page /wiki/t can have an overridden title 'Tantek Çelik' 9 | * 10 | * @author Ben Ward 11 | */ 12 | class OverrideEntryTitle { 13 | 14 | public static function parseEntryTitle($text, $attributes, $parser) { 15 | global $wgOut; 16 | $parser->disableCache(); // EPIC hack. Need to instead cache/restore this value 17 | $wgOut->mPagetitle = $text; 18 | return ''; 19 | } 20 | 21 | public static function registerHooks() { 22 | global $wgParser; 23 | $wgParser->setHook('entry-title', array('OverrideEntryTitle', 'parseEntryTitle')); 24 | } 25 | } 26 | ?> -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | MediaWiki Extension — Override Entry Title 2 | 3 | OverrideEntryTitle is a crude and rather hacky MediaWiki extension to allow 4 | you to override a MediaWiki page name with someone more human legible, for 5 | instance, the page `/wiki/hatom` may be overridden to ‘hAtom 0.3’. 6 | 7 | Usage: 8 | ----- 9 | 10 | This extension adds an `` element to the MediaWiki syntax (named 11 | for its correspondence to marking up entries in hAtom). The content of that 12 | element overrides the default title of the page at render time, and removes 13 | that content from the document body. 14 | 15 | Known Issues: 16 | ------------ 17 | 18 | 1. This extension disables caching of rendered page content. 19 | 20 | To Do: 21 | ----- 22 | 23 | 1. Add a more wiki-esque shorthand syntax (perhaps `!! Page Title !!`) 24 | 2. Support caching of the override title and apply the override on every page 25 | load, not just when the content is parsed. 26 | 27 | 28 | 29 | Originally written for microformats.org/wiki, by Ben Ward 30 | 31 | * http://microformats.org/wiki/ 32 | * http://ben-ward.co.uk -------------------------------------------------------------------------------- /OverrideEntryTitle.php: -------------------------------------------------------------------------------- 1 | element into MediaWiki mark-up 5 | * allowing pages to have the displayed title overriden. For example: 6 | * 7 | * The page /wiki/hcard can have its displayed title overridden to 'hCard' 8 | * The page /wiki/hcard-issues can have a title 'hCard Issue Tracking' 9 | * The page /wiki/t can have an overridden title 'Tantek Çelik' 10 | * 11 | * @author Ben Ward 12 | */ 13 | 14 | if( !defined( 'MEDIAWIKI' ) ) 15 | die(); 16 | 17 | $wgExtensionCredits['parserhook']['OverrideEntryTitle'] = array( 18 | 'name' => 'Override Entry Title', 19 | 'svn-date' => '$LastChangedDate: 2008-07-16 23:44:00 +0100 (Wed, 16 July 2008) $', 20 | 'svn-revision' => '$LastChangedRevision: $', 21 | 'author' => array( 'Ben Ward' ), 22 | 'description' => 'Allows you to override the title of a wiki entry by using an <entry-title> element in the entry.', 23 | 'descriptionmsg' => 'overrideentrytitle-desc', 24 | 'url' => 'http://www.mediawiki.org/wiki/Extension:OverrideEntryTitle', 25 | ); 26 | 27 | $dir = dirname(__FILE__) . '/'; 28 | $wgExtensionMessagesFiles['OverrideEntryTitle'] = $dir . 'OverrideEntryTitle.i18n.php'; 29 | $wgAutoloadClasses['OverrideEntryTitle'] = $dir . 'OverrideEntryTitle.class.php'; 30 | $wgHooks['ParserFirstCallInit'][] = 'initOverrideEntryTitle'; 31 | 32 | /** 33 | * Register parser hook 34 | */ 35 | function initOverrideEntryTitle() { 36 | require_once('OverrideEntryTitle.class.php'); 37 | OverrideEntryTitle::registerHooks(); 38 | return true; 39 | } 40 | 41 | ?> 42 | --------------------------------------------------------------------------------