Index: trunk/extensions/Lingo/LingoHooks.php |
— | — | @@ -0,0 +1,68 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * File holding the LingoHooks class |
| 6 | + * |
| 7 | + * @author Stephan Gambke |
| 8 | + * @file |
| 9 | + * @ingroup Lingo |
| 10 | + */ |
| 11 | +if ( !defined( 'LINGO_VERSION' ) ) { |
| 12 | + die( 'This file is part of the Lingo extension, it is not a valid entry point.' ); |
| 13 | +} |
| 14 | + |
| 15 | +/** |
| 16 | + * The LingoHooks class. |
| 17 | + * |
| 18 | + * @ingroup Lingo |
| 19 | + */ |
| 20 | +class LingoHooks { |
| 21 | + |
| 22 | + static function setup( &$parser ) { |
| 23 | + # Set a function hook associating the "noglossary" with fnLingoNoGlossary |
| 24 | + MagicWord::getDoubleUnderscoreArray()->add( 'nolingo' ); |
| 25 | + return true; |
| 26 | + } |
| 27 | + |
| 28 | + static function setMagicWords( &$magicWords, $langCode ) { |
| 29 | + # Add the magic word |
| 30 | + $magicWords['nolingo'] = array( 0, '__nolingo__' ); |
| 31 | + return true; |
| 32 | + } |
| 33 | + |
| 34 | + static function parse( &$parser, &$text ) { |
| 35 | + |
| 36 | + if ( !isset( $parser->mDoubleUnderscores['nolingo'] ) ) { |
| 37 | + LingoParser::parse( $parser, $text ); |
| 38 | + } |
| 39 | + |
| 40 | + return true; |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * Deferred setting of extension credits |
| 45 | + * |
| 46 | + * Setting of extension credits has to be deferred to the |
| 47 | + * SpecialVersionExtensionTypes hook as it uses variable $wgexLingoPage (which |
| 48 | + * might be set only after inclusion of the extension in LocalSettings) and |
| 49 | + * function wfMsg not available before. |
| 50 | + * |
| 51 | + * @return Boolean Always true. |
| 52 | + */ |
| 53 | + static function setCredits() { |
| 54 | + |
| 55 | + global $wgExtensionCredits, $wgexLingoPage; |
| 56 | + $wgExtensionCredits['parserhook'][] = array( |
| 57 | + 'path' => __FILE__, |
| 58 | + 'name' => 'Lingo', |
| 59 | + 'author' => array( 'Barry Coughlan', '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]' ), |
| 60 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Lingo', |
| 61 | + 'descriptionmsg' => array( 'lingo-desc', $wgexLingoPage ? $wgexLingoPage : wfMsgForContent( 'lingo-terminologypagename' ) ), |
| 62 | + 'version' => LINGO_VERSION, |
| 63 | + ); |
| 64 | + |
| 65 | + return true; |
| 66 | + } |
| 67 | + |
| 68 | +} |
| 69 | + |
Property changes on: trunk/extensions/Lingo/LingoHooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 70 | + native |
Index: trunk/extensions/Lingo/Lingo.i18n.php |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | * @author Kghbln |
39 | 39 | */ |
40 | 40 | $messages['de'] = array( |
41 | | - 'lingo-desc' => 'Ermöglicht Informationstexte die eingeblendet werden, sobald man mit der Maus über einen auf der Seite [[$1]] hinterlegten Begriff führt', |
| 41 | + 'lingo-desc' => 'Ermöglicht Informationstexte, die eingeblendet werden, sobald man die Maus über einen auf der Seite [[$1]] hinterlegten Begriff führt', |
42 | 42 | 'lingo-terminologypagename' => 'Glossar', |
43 | 43 | 'lingo-noterminologypage' => 'Seite „$1“ ist nicht vorhanden.', |
44 | 44 | 'lingo-terminologypagenotlocal' => 'Seite „$1“ befindet sich nicht auf diesem Wiki.', |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | * @author Sherbrooke |
49 | 49 | */ |
50 | 50 | $messages['fr'] = array( |
51 | | - 'lingo-desc' => 'Dans les pages, affiche une info-bulle si le mot est défini dans la page de [[Terminology|Terminologie]].', |
| 51 | + 'lingo-desc' => 'Dans les pages, affiche une info-bulle si le mot est défini dans la page de [[$1]].', |
52 | 52 | ); |
53 | 53 | |
54 | 54 | /** Galician (Galego) |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | * @author Bjankuloski06 |
66 | 66 | */ |
67 | 67 | $messages['mk'] = array( |
68 | | - 'lingo-desc' => 'Овозможува описи при лебдење над алатките на страниците (од зборови со утврдени значења на страницата [[Terminology|Терминологија]])', |
| 68 | + 'lingo-desc' => 'Овозможува описи при лебдење над алатките на страниците (од зборови со утврдени значења на страницата [[$1]])', |
69 | 69 | 'lingo-terminologypagename' => 'Терминологија', |
70 | 70 | 'lingo-noterminologypage' => 'Страницата „$1“ не постои.', |
71 | 71 | 'lingo-terminologypagenotlocal' => 'Страницата „$1“ не е локална страница.', |
— | — | @@ -84,7 +84,7 @@ |
85 | 85 | * @author Hamilton Abreu |
86 | 86 | */ |
87 | 87 | $messages['pt'] = array( |
88 | | - 'lingo-desc' => 'Permite que a passagem do ponteiro do rato sobre palavras nas páginas, resulte no aparecimento de uma legenda. As palavras são definidas na página [[Terminology]].', |
| 88 | + 'lingo-desc' => 'Permite que a passagem do ponteiro do rato sobre palavras nas páginas, resulte no aparecimento de uma legenda. As palavras são definidas na página [[$1]].', |
89 | 89 | 'lingo-terminologypagename' => 'Terminology', |
90 | 90 | 'lingo-noterminologypage' => "A página '$1' não existe.", |
91 | 91 | 'lingo-terminologypagenotlocal' => "A página '$1' não é uma página local.", |
— | — | @@ -94,6 +94,6 @@ |
95 | 95 | * @author Александр Сигачёв |
96 | 96 | */ |
97 | 97 | $messages['ru'] = array( |
98 | | - 'lingo-desc' => 'Показывает всплывающую подсказку при наведении на слово, присутствующее на странице [[Terminology]]', |
| 98 | + 'lingo-desc' => 'Показывает всплывающую подсказку при наведении на слово, присутствующее на странице [[$1]]', |
99 | 99 | ); |
100 | 100 | |
Index: trunk/extensions/Lingo/Lingo.php |
— | — | @@ -19,9 +19,10 @@ |
20 | 20 | |
21 | 21 | define( 'LINGO_VERSION', '0.2 alpha' ); |
22 | 22 | |
| 23 | + |
23 | 24 | // set defaults for settings |
24 | 25 | |
25 | | -// set LingoBasicBackend as the backend to access the glossary |
| 26 | +// set the backend to access the glossary |
26 | 27 | $wgexLingoBackend = 'LingoBasicBackend'; |
27 | 28 | |
28 | 29 | // set default for Terminology page (null = take from i18n) |
— | — | @@ -32,23 +33,25 @@ |
33 | 34 | $dir = dirname( __FILE__ ); |
34 | 35 | |
35 | 36 | // register message file |
36 | | -$wgExtensionMessagesFiles[ 'Lingo' ] = $dir . '/Lingo.i18n.php'; |
37 | | -// $wgExtensionMessagesFiles['LingoAlias'] = $dir . '/Lingo.alias.php'; |
| 37 | +$wgExtensionMessagesFiles['Lingo'] = $dir . '/Lingo.i18n.php'; |
| 38 | + |
38 | 39 | // register class files with the Autoloader |
39 | | -// $wgAutoloadClasses['LingoSettings'] = $dir . '/LingoSettings.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'; |
46 | | -// $wgAutoloadClasses['SpecialLingoBrowser'] = $dir . '/SpecialLingoBrowser.php'; |
| 40 | +$wgAutoloadClasses['LingoHooks'] = $dir . '/LingoHooks.php'; |
| 41 | +$wgAutoloadClasses['LingoParser'] = $dir . '/LingoParser.php'; |
| 42 | +$wgAutoloadClasses['LingoTree'] = $dir . '/LingoTree.php'; |
| 43 | +$wgAutoloadClasses['LingoElement'] = $dir . '/LingoElement.php'; |
| 44 | +$wgAutoloadClasses['LingoBackend'] = $dir . '/LingoBackend.php'; |
| 45 | +$wgAutoloadClasses['LingoBasicBackend'] = $dir . '/LingoBasicBackend.php'; |
| 46 | +$wgAutoloadClasses['LingoMessageLog'] = $dir . '/LingoMessageLog.php'; |
47 | 47 | |
48 | | -$wgHooks[ 'SpecialVersionExtensionTypes' ][ ] = 'fnLingoSetCredits'; |
49 | | -$wgHooks[ 'ParserAfterTidy' ][ ] = 'LingoParser::parse'; |
| 48 | +// register hook handlers |
| 49 | +$wgHooks['SpecialVersionExtensionTypes'][] = 'LingoHooks::setCredits'; // set credits |
| 50 | +$wgHooks['ParserAfterTidy'][] = 'LingoHooks::parse'; // parse page |
| 51 | +$wgHooks['ParserFirstCallInit'][] = 'LingoHooks::setup'; // do late setup |
| 52 | +$wgHooks['LanguageGetMagic'][] = 'LingoHooks::setMagicWords'; // set magic words |
50 | 53 | |
51 | 54 | // register resource modules with the Resource Loader |
52 | | -$wgResourceModules[ 'ext.Lingo.Styles' ] = array( |
| 55 | +$wgResourceModules['ext.Lingo.Styles'] = array( |
53 | 56 | 'localBasePath' => $dir, |
54 | 57 | 'remoteExtPath' => 'Lingo', |
55 | 58 | // 'scripts' => 'libs/ext.myExtension.js', |
— | — | @@ -57,7 +60,7 @@ |
58 | 61 | // 'dependencies' => array( 'jquery.ui.datepicker' ), |
59 | 62 | ); |
60 | 63 | |
61 | | -$wgResourceModules[ 'ext.Lingo.Scripts' ] = array( |
| 64 | +$wgResourceModules['ext.Lingo.Scripts'] = array( |
62 | 65 | 'localBasePath' => $dir, |
63 | 66 | 'remoteExtPath' => 'Lingo', |
64 | 67 | 'scripts' => 'libs/Lingo.js', |
— | — | @@ -66,29 +69,5 @@ |
67 | 70 | // 'dependencies' => array( 'jquery.ui.datepicker' ), |
68 | 71 | ); |
69 | 72 | |
70 | | -unset ($dir); |
| 73 | +unset( $dir ); |
71 | 74 | |
72 | | -/** |
73 | | - * Deferred setting of extension credits |
74 | | - * |
75 | | - * Setting of extension credits has to be deferred to the |
76 | | - * SpecialVersionExtensionTypes hook as it uses variable $wgexLingoPage (which |
77 | | - * might be set only after inclusion of the extension in LocalSettings) and |
78 | | - * function wfMsg not available before. |
79 | | - * |
80 | | - * @return Boolean Always true. |
81 | | - */ |
82 | | -function fnLingoSetCredits() { |
83 | | - |
84 | | - global $wgExtensionCredits, $wgexLingoPage; |
85 | | - $wgExtensionCredits[ 'parserhook' ][ ] = array( |
86 | | - 'path' => __FILE__, |
87 | | - 'name' => 'Lingo', |
88 | | - 'author' => array( 'Barry Coughlan', '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]' ), |
89 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:Lingo', |
90 | | - 'descriptionmsg' => array('lingo-desc', $wgexLingoPage ? $wgexLingoPage : wfMsgForContent( 'lingo-terminologypagename' )), |
91 | | - 'version' => LINGO_VERSION, |
92 | | - ); |
93 | | - |
94 | | - return true; |
95 | | -} |