Index: trunk/extensions/Lingo/LingoHooks.php |
— | — | @@ -18,21 +18,14 @@ |
19 | 19 | */ |
20 | 20 | class LingoHooks { |
21 | 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 | 22 | static function setMagicWords( &$magicWords, $langCode ) { |
29 | | - # Add the magic word |
30 | | - $magicWords['nolingo'] = array( 0, '__nolingo__' ); |
| 23 | + $magicWords['noglossary'] = array( 0, '__NOGLOSSARY__', '__' . wfMsgGetKey( 'lingo-noglossary', true, $langCode ) . '__' ); |
31 | 24 | return true; |
32 | 25 | } |
33 | 26 | |
34 | 27 | static function parse( &$parser, &$text ) { |
35 | 28 | |
36 | | - if ( !isset( $parser->mDoubleUnderscores['nolingo'] ) ) { |
| 29 | + if ( !isset( $parser->mDoubleUnderscores['noglossary'] ) ) { |
37 | 30 | LingoParser::parse( $parser, $text ); |
38 | 31 | } |
39 | 32 | |
Index: trunk/extensions/Lingo/LingoMessageLog.php |
— | — | @@ -75,9 +75,13 @@ |
76 | 76 | } |
77 | 77 | |
78 | 78 | $ret = Html::rawElement( 'div', array('class' => 'messages'), |
79 | | - $header . |
80 | | - $parser->parse( $ret, $wgTitle, ParserOptions::newFromUser( $wgUser ) )->getText() |
| 79 | + $header . "\n" . |
| 80 | + $ret |
81 | 81 | ); |
| 82 | + |
| 83 | + $ret = $parser->parse( $ret, $wgTitle, ParserOptions::newFromUser( $wgUser ) ); |
| 84 | + } else { |
| 85 | + $ret = null; |
82 | 86 | } |
83 | 87 | |
84 | 88 | return $ret; |
Index: trunk/extensions/Lingo/LingoParser.php |
— | — | @@ -265,19 +265,20 @@ |
266 | 266 | } |
267 | 267 | |
268 | 268 | protected function loadModules( &$parser ) { |
269 | | - global $wgOut, $wgScriptPath; |
| 269 | + global $wgOut, $wgScriptPath, $wgParser; |
270 | 270 | |
271 | 271 | // load scripts |
272 | 272 | if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) ) { |
273 | | - if ( !is_null( $parser ) && ( $wgOut->isArticle() ) ) { |
274 | | - $parser->getOutput()->addModules( 'ext.Lingo.Scripts' ); |
275 | | - } else { |
| 273 | + $parser->getOutput()->addModules( 'ext.Lingo.Scripts' ); |
| 274 | + if ( !$wgOut->isArticle() ) { |
276 | 275 | $wgOut->addModules( 'ext.Lingo.Scripts' ); |
277 | 276 | } |
278 | 277 | } else { |
279 | | - if ( !is_null( $parser ) && ( $wgOut->isArticle() ) ) { |
280 | | - $parser->getOutput()->addHeadItem( "<script src='$wgScriptPath/extensions/Lingo/libs/Lingo.js'></script>\n", 'ext.Lingo.Scripts' ); |
281 | | - } else { |
| 278 | + global $wgStylePath; |
| 279 | + $parser->getOutput()->addHeadItem( "<script src='$wgStylePath/common/jquery.min.js'></script>\n", 'ext.Lingo.jq' ); |
| 280 | + $parser->getOutput()->addHeadItem( "<script src='$wgScriptPath/extensions/Lingo/libs/Lingo.js'></script>\n", 'ext.Lingo.Scripts' ); |
| 281 | + if ( !$wgOut->isArticle() ) { |
| 282 | + $wgOut->addHeadItem( 'ext.Lingo.jq', "<script src='$wgStylePath/common/jquery.min.js'></script>\n" ); |
282 | 283 | $wgOut->addHeadItem( 'ext.Lingo.Scripts', "<script src='$wgScriptPath/extensions/Lingo/libs/Lingo.js'></script>\n" ); |
283 | 284 | } |
284 | 285 | } |
— | — | @@ -287,15 +288,13 @@ |
288 | 289 | // browsers. This doesn't make any sense for CSS-only modules that don't |
289 | 290 | // need any JS. -> Use ResourceLoader if and when Bug 29308 gets fixed. |
290 | 291 | // if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) ) { |
291 | | -// if ( !is_null( $parser ) && ( $wgOut->isArticle() ) ) { |
292 | | -// $parser->getOutput()->addModules( 'ext.Lingo.Styles' ); |
293 | | -// } else { |
| 292 | +// $parser->getOutput()->addModules( 'ext.Lingo.Styles' ); |
| 293 | +// if ( !$wgOut->isArticle() ) { |
294 | 294 | // $wgOut->addModules( 'ext.Lingo.Styles' ); |
295 | 295 | // } |
296 | 296 | // } else { |
297 | | - if ( !is_null( $parser ) && ( $wgOut->isArticle() ) ) { |
298 | | - $parser->getOutput()->addHeadItem( "<link rel='stylesheet' href='$wgScriptPath/extensions/Lingo/skins/Lingo.css' />\n", 'ext.Lingo.Styles' ); |
299 | | - } else { |
| 297 | + $parser->getOutput()->addHeadItem( "<link rel='stylesheet' href='$wgScriptPath/extensions/Lingo/skins/Lingo.css' />\n", 'ext.Lingo.Styles' ); |
| 298 | + if ( !$wgOut->isArticle() ) { |
300 | 299 | $wgOut->addHeadItem( 'ext.Lingo.Styles', "<link rel='stylesheet' href='$wgScriptPath/extensions/Lingo/skins/Lingo.css' />\n" ); |
301 | 300 | } |
302 | 301 | // } |
Index: trunk/extensions/Lingo/Lingo.i18n.php |
— | — | @@ -13,13 +13,14 @@ |
14 | 14 | 'lingo-terminologypagename' => 'Terminology', |
15 | 15 | 'lingo-noterminologypage' => "Page '$1' does not exist.", |
16 | 16 | 'lingo-terminologypagenotlocal' => "Page '$1' is not a local page.", |
17 | | - |
| 17 | + 'lingo-noglossary' => 'NOGLOSSARY', |
18 | 18 | ); |
19 | 19 | |
20 | 20 | /** Message documentation (Message documentation) */ |
21 | 21 | $messages['qqq'] = array( |
22 | 22 | 'lingo-desc' => '{{desc}}', |
23 | 23 | 'lingo-terminologypagename' => 'Name of the page where the terms and definitions of the glossary are stored', |
| 24 | + 'lingo-noglossary' => 'The magic word which will suppress the application of the glossary for a page.', |
24 | 25 | ); |
25 | 26 | |
26 | 27 | /** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
— | — | @@ -41,6 +42,7 @@ |
42 | 43 | 'lingo-terminologypagename' => 'Glossar', |
43 | 44 | 'lingo-noterminologypage' => 'Seite „$1“ ist nicht vorhanden.', |
44 | 45 | 'lingo-terminologypagenotlocal' => 'Seite „$1“ befindet sich nicht auf diesem Wiki.', |
| 46 | + 'lingo-noglossary' => 'KEIN_GLOSSAR', |
45 | 47 | ); |
46 | 48 | |
47 | 49 | /** French (Français) |
Index: trunk/extensions/Lingo/Lingo.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | // register hook handlers |
49 | 49 | $wgHooks['SpecialVersionExtensionTypes'][] = 'LingoHooks::setCredits'; // set credits |
50 | 50 | $wgHooks['ParserAfterTidy'][] = 'LingoHooks::parse'; // parse page |
51 | | -$wgHooks['ParserFirstCallInit'][] = 'LingoHooks::setup'; // do late setup |
| 51 | +//$wgHooks['ParserFirstCallInit'][] = 'LingoHooks::setup'; // do late setup |
52 | 52 | $wgHooks['LanguageGetMagic'][] = 'LingoHooks::setMagicWords'; // set magic words |
53 | 53 | |
54 | 54 | // register resource modules with the Resource Loader |
— | — | @@ -69,5 +69,7 @@ |
70 | 70 | // 'dependencies' => array( 'jquery.ui.datepicker' ), |
71 | 71 | ); |
72 | 72 | |
| 73 | +MagicWord::$mDoubleUnderscoreIDs[] = 'noglossary'; |
| 74 | + |
73 | 75 | unset( $dir ); |
74 | 76 | |