r89730 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89729‎ | r89730 | r89731 >
Date:17:03, 8 June 2011
Author:foxtrott
Status:deferred (Comments)
Tags:
Comment:
introduce setting for page to use for glossary
Modified paths:
  • /trunk/extensions/Lingo/Lingo.i18n.php (modified) (history)
  • /trunk/extensions/Lingo/Lingo.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Lingo/Lingo.i18n.php
@@ -9,10 +9,12 @@
1010 $messages = array();
1111
1212 $messages['en'] = array(
13 - 'lingo-desc' => 'Provides hover-over tool tips on pages from words defined on the [[Terminology]] page'
 13+ 'lingo-desc' => 'Provides hover-over tool tips on pages from words defined on the [[$1]] page',
 14+ 'lingo-terminologypage' => 'Terminology'
1415 );
1516
1617 $messages['qqq'] = array(
17 - 'lingo-desc' => '{{desc}}'
 18+ 'lingo-desc' => '{{desc}}',
 19+ 'lingo-terminologypage' => 'Name of the page where the terms and definitions of the glossary are stored'
1820 );
1921
Index: trunk/extensions/Lingo/Lingo.php
@@ -19,39 +19,39 @@
2020
2121 define( 'LINGO_VERSION', '0.2 alpha' );
2222
23 -$wgExtensionCredits['parserhook'][] = array(
24 - 'path' => __FILE__,
25 - 'name' => 'Lingo',
26 - 'author' => array('Barry Coughlan', '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]'),
27 - 'url' => 'http://www.mediawiki.org/wiki/Extension:Lingo',
28 - 'descriptionmsg' => 'lingo-desc',
29 - 'version' => LINGO_VERSION,
30 -);
 23+// set defaults for settings
3124
32 -// server-local path to this file
33 -$wgexLingoDir = dirname( __FILE__ );
34 -
3525 // set LingoBasicBackend as the backend to access the glossary
3626 $wgexLingoBackend = 'LingoBasicBackend';
3727
 28+// set default for Terminology page (null = take from i18n)
 29+$wgexLingoPage = null;
 30+
 31+
 32+// server-local path to this file
 33+$dir = dirname( __FILE__ );
 34+
3835 // register message file
39 -$wgExtensionMessagesFiles['Lingo'] = $wgexLingoDir . '/Lingo.i18n.php';
 36+$wgExtensionMessagesFiles[ 'Lingo' ] = $dir . '/Lingo.i18n.php';
4037 // $wgExtensionMessagesFiles['LingoAlias'] = $dir . '/Lingo.alias.php';
41 -
4238 // register class files with the Autoloader
4339 // $wgAutoloadClasses['LingoSettings'] = $dir . '/LingoSettings.php';
44 -$wgAutoloadClasses['LingoParser'] = $wgexLingoDir . '/LingoParser.php';
45 -$wgAutoloadClasses['LingoTree'] = $wgexLingoDir . '/LingoTree.php';
46 -$wgAutoloadClasses['LingoElement'] = $wgexLingoDir . '/LingoElement.php';
47 -$wgAutoloadClasses['LingoBackend'] = $wgexLingoDir . '/LingoBackend.php';
48 -$wgAutoloadClasses['LingoBasicBackend'] = $wgexLingoDir . '/LingoBasicBackend.php';
49 -$wgAutoloadClasses['LingoMessageLog'] = $wgexLingoDir . '/LingoMessageLog.php';
 40+$wgAutoloadClasses[ 'LingoParser' ] = $dir . '/LingoParser.php';
 41+$wgAutoloadClasses[ 'LingoTree' ] = $dir . '/LingoTree.php';
 42+$wgAutoloadClasses[ 'LingoElement' ] = $dir . '/LingoElement.php';
 43+$wgAutoloadClasses[ 'LingoBackend' ] = $dir . '/LingoBackend.php';
 44+$wgAutoloadClasses[ 'LingoBasicBackend' ] = $dir . '/LingoBasicBackend.php';
 45+$wgAutoloadClasses[ 'LingoMessageLog' ] = $dir . '/LingoMessageLog.php';
5046 // $wgAutoloadClasses['SpecialLingoBrowser'] = $dir . '/SpecialLingoBrowser.php';
5147
52 -$wgHooks['ParserAfterTidy'][] = 'LingoParser::parse';
 48+unset ($dir);
5349
 50+$wgHooks[ 'SpecialVersionExtensionTypes' ][ ] = 'fnLingoSetCredits';
 51+//$wgExtensionFunctions[ ] = 'fnLingoInit';
 52+$wgHooks[ 'ParserAfterTidy' ][ ] = 'LingoParser::parse';
 53+
5454 // register resource modules with the Resource Loader
55 -$wgResourceModules['ext.Lingo'] = array(
 55+$wgResourceModules[ 'ext.Lingo' ] = array(
5656 // JavaScript and CSS styles. To combine multiple file, just list them as an array.
5757 // 'scripts' => 'libs/ext.myExtension.js',
5858 'styles' => 'skins/Lingo.css',
@@ -69,3 +69,27 @@
7070 'remoteExtPath' => 'Lingo'
7171 );
7272
 73+/**
 74+ * Deferred setting of extension credits
 75+ *
 76+ * Setting of extension credits has to be deferred to the
 77+ * SpecialVersionExtensionTypes hook as it uses variable $wgexLingoPage (which
 78+ * might be set only after inclusion of the extension in LocalSettings) and
 79+ * function wfMsg not available before.
 80+ *
 81+ * @return Boolean Always true.
 82+ */
 83+function fnLingoSetCredits() {
 84+
 85+ global $wgExtensionCredits, $wgexLingoPage;
 86+ $wgExtensionCredits[ 'parserhook' ][ ] = array(
 87+ 'path' => __FILE__,
 88+ 'name' => 'Lingo',
 89+ 'author' => array( 'Barry Coughlan', '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]' ),
 90+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Lingo',
 91+ 'descriptionmsg' => array('lingo-desc', $wgexLingoPage?$wgexLingoPage:wfMsg('lingo-terminologypage')),
 92+ 'version' => LINGO_VERSION,
 93+ );
 94+
 95+ return true;
 96+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r89732followup r89730: Use the settingfoxtrott17:44, 8 June 2011
r89734followup r89730: catch non-local settingfoxtrott18:56, 8 June 2011

Comments

#Comment by Nikerabbit (talk | contribs)   18:45, 8 June 2011

Would [[$1|terminology]] be better?

#Comment by F.trott (talk | contribs)   18:54, 8 June 2011

I don't know, would it? I'd rather have it clearly identified without the need to follow (or at least hover over) the link.

Status & tagging log