Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added µf.org version of OverrideEntryTitle, and README describing usa…
…ge and documenting known caching issues.
- Loading branch information
Ben Ward
committed
Dec 27, 2008
0 parents
commit 593d766
Showing
4 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** @class OverrideEntryTitle. | ||
* This extension adds an <entry-title> element into MediaWiki mark-up | ||
* allowing pages to have the displayed title overriden. For example: | ||
* | ||
* The page /wiki/hcard can have its displayed title overridden to 'hCard' | ||
* The page /wiki/hcard-issues can have a title 'hCard Issue Tracking' | ||
* The page /wiki/t can have an overridden title 'Tantek Çelik' | ||
* | ||
* @author Ben Ward | ||
*/ | ||
class OverrideEntryTitle { | ||
|
||
public static function parseEntryTitle($text, $attributes, $parser) { | ||
global $wgOut; | ||
$parser->disableCache(); // EPIC hack. Need to instead cache/restore this value | ||
$wgOut->mPagetitle = $text; | ||
return ''; | ||
} | ||
|
||
public static function registerHooks() { | ||
global $wgParser; | ||
$wgParser->setHook('entry-title', array('OverrideEntryTitle', 'parseEntryTitle')); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/** Extension: OverrideEntryTitle. | ||
* This extension adds an <entry-title> element into MediaWiki mark-up | ||
* allowing pages to have the displayed title overriden. For example: | ||
* | ||
* The page /wiki/hcard can have its displayed title overridden to 'hCard' | ||
* The page /wiki/hcard-issues can have a title 'hCard Issue Tracking' | ||
* The page /wiki/t can have an overridden title 'Tantek Çelik' | ||
* | ||
* English strings | ||
* @lang English | ||
* @author Ben Ward | ||
*/ | ||
|
||
|
||
$messages = array(); | ||
|
||
$messages['en'] = array( | ||
'overrideentrytitle-desc' => 'Allows you to override the title of a wiki entry by using an <entry-title> element in the entry.' | ||
); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** Extension: OverrideEntryTitle. | ||
* This extension adds an <entry-title> element into MediaWiki mark-up | ||
* allowing pages to have the displayed title overriden. For example: | ||
* | ||
* The page /wiki/hcard can have its displayed title overridden to 'hCard' | ||
* The page /wiki/hcard-issues can have a title 'hCard Issue Tracking' | ||
* The page /wiki/t can have an overridden title 'Tantek Çelik' | ||
* | ||
* @author Ben Ward | ||
*/ | ||
|
||
if( !defined( 'MEDIAWIKI' ) ) | ||
die(); | ||
|
||
$wgExtensionCredits['parserhook']['OverrideEntryTitle'] = array( | ||
'name' => 'Override Entry Title', | ||
'svn-date' => '$LastChangedDate: 2008-07-16 23:44:00 +0100 (Wed, 16 July 2008) $', | ||
'svn-revision' => '$LastChangedRevision: $', | ||
'author' => array( 'Ben Ward' ), | ||
'description' => 'Allows you to override the title of a wiki entry by using an <entry-title> element in the entry.', | ||
'descriptionmsg' => 'overrideentrytitle-desc', | ||
'url' => 'http://www.mediawiki.org/wiki/Extension:OverrideEntryTitle', | ||
); | ||
|
||
$dir = dirname(__FILE__) . '/'; | ||
$wgExtensionMessagesFiles['OverrideEntryTitle'] = $dir . 'OverrideEntryTitle.i18n.php'; | ||
$wgAutoloadClasses['OverrideEntryTitle'] = $dir . 'OverrideEntryTitle.class.php'; | ||
$wgHooks['ParserFirstCallInit'][] = 'initOverrideEntryTitle'; | ||
|
||
/** | ||
* Register parser hook | ||
*/ | ||
function initOverrideEntryTitle() { | ||
require_once('OverrideEntryTitle.class.php'); | ||
OverrideEntryTitle::registerHooks(); | ||
return true; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
MediaWiki Extension — Override Entry Title | ||
|
||
OverrideEntryTitle is a crude and rather hacky MediaWiki extension to allow | ||
you to override a MediaWiki page name with someone more human legible, for | ||
instance, the page `/wiki/hatom` may be overridden to ‘hAtom 0.3’. | ||
|
||
Usage: | ||
----- | ||
|
||
This extension adds an `<entry-title>` element to the MediaWiki syntax (named | ||
for its correspondence to marking up entries in hAtom). The content of that | ||
element overrides the default title of the page at render time, and removes | ||
that content from the document body. | ||
|
||
Known Issues: | ||
------------ | ||
|
||
1. This extension disables caching of rendered page content. | ||
|
||
To Do: | ||
----- | ||
|
||
1. Add a more wiki-esque shorthand syntax (perhaps `!! Page Title !!`) | ||
2. Support caching of the override title and apply the override on every page | ||
load, not just when the content is parsed. | ||
|
||
|
||
|
||
Originally written for microformats.org/wiki, by Ben Ward | ||
|
||
* http://microformats.org/wiki/ | ||
* http://ben-ward.co.uk |