Index: trunk/extensions/QPoll/i18n/QPoll.i18n.magic.php |
— | — | @@ -0,0 +1,10 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalization file for magic words. |
| 5 | + */ |
| 6 | + |
| 7 | +$magicWords = array(); |
| 8 | + |
| 9 | +$magicWords['en'] = array( |
| 10 | + 'qpuserchoice' => array( 0, 'qpuserchoice' ), |
| 11 | +); |
Property changes on: trunk/extensions/QPoll/i18n/QPoll.i18n.magic.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 12 | + native |
Added: svn:keywords |
2 | 13 | + Id |
Index: trunk/extensions/QPoll/i18n/qp.alias.php |
— | — | @@ -11,6 +11,8 @@ |
12 | 12 | /** English (English) */ |
13 | 13 | $specialPageAliases['en'] = array( |
14 | 14 | 'PollResults' => array( 'PollResults' ), |
| 15 | + 'QPollWebInstall' => array( 'QPollWebInstall' ), |
| 16 | + |
15 | 17 | ); |
16 | 18 | |
17 | 19 | /** Arabic (العربية) */ |
Index: trunk/extensions/QPoll/specials/qp_special.php |
— | — | @@ -33,10 +33,6 @@ |
34 | 34 | * @author QuestPC <questpc@rambler.ru> |
35 | 35 | */ |
36 | 36 | |
37 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
38 | | - die( "This file is part of the QPoll extension. It is not a valid entry point.\n" ); |
39 | | -} |
40 | | - |
41 | 37 | /** |
42 | 38 | * A special page with handy built-in Linker |
43 | 39 | */ |
— | — | @@ -93,7 +89,6 @@ |
94 | 90 | * thus, it is much safer to implement a larger subset of pager itself |
95 | 91 | */ |
96 | 92 | abstract class qp_QueryPage extends qp_SpecialPage { |
97 | | - |
98 | 93 | var $listoutput = false; |
99 | 94 | |
100 | 95 | public function __construct() { |
Index: trunk/extensions/QPoll/specials/qp_results.php |
— | — | @@ -33,19 +33,9 @@ |
34 | 34 | * @author QuestPC <questpc@rambler.ru> |
35 | 35 | */ |
36 | 36 | |
37 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
38 | | - die( "This file is part of the QPoll extension. It is not a valid entry point.\n" ); |
39 | | -} |
40 | | - |
41 | 37 | class PollResults extends qp_SpecialPage { |
42 | | - |
43 | 38 | public function __construct() { |
44 | 39 | parent::__construct( 'PollResults', 'read' ); |
45 | | - # for MW 1.15 (still being used by many customers) |
46 | | - # please do not remove until 2012 |
47 | | - if ( qp_Setup::mediaWikiVersionCompare( '1.16' ) ) { |
48 | | - wfLoadExtensionMessages( 'QPoll' ); |
49 | | - } |
50 | 40 | } |
51 | 41 | |
52 | 42 | static $accessPermissions = array( 'read', 'pollresults' ); |
Index: trunk/extensions/QPoll/specials/qp_webinstall.php |
— | — | @@ -1,15 +1,10 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
5 | | - die( "This file is part of the QPoll extension. It is not a valid entry point.\n" ); |
6 | | -} |
7 | | - |
8 | 4 | /** |
9 | 5 | * Installs/updates DB schema for the people who do not have shell access |
10 | 6 | * (not being able to run maintenance scripts) |
11 | 7 | */ |
12 | 8 | class qp_WebInstall extends qp_SpecialPage { |
13 | | - |
14 | 9 | private $allowed_groups = array( 'sysop', 'bureaucrat' ); |
15 | 10 | |
16 | 11 | public function __construct() { |
— | — | @@ -30,11 +25,11 @@ |
31 | 26 | |
32 | 27 | # only sysops and bureaucrats can update the DB |
33 | 28 | if ( !$this->userCanExecute( $wgUser ) ) { |
| 29 | + // @todo FIXME: i18n missing. |
34 | 30 | $wgOut->addHTML( 'You have to be a member of the following group(s) to perform web install:' . implode( ', ', $this->allowed_groups ) ); |
35 | 31 | return; |
36 | 32 | } |
37 | 33 | # display update result |
38 | 34 | $wgOut->addHTML( qp_SchemaUpdater::checkAndUpdate() ); |
39 | 35 | } |
40 | | - |
41 | | -} /* end of qp_WebInstall class */ |
| 36 | +} |
Index: trunk/extensions/QPoll/ctrl/poll/qp_abstractpoll.php |
— | — | @@ -102,10 +102,8 @@ |
103 | 103 | * @public |
104 | 104 | */ |
105 | 105 | function __construct( array $argv, qp_AbstractPollView $view ) { |
106 | | - global $wgLanguageCode; |
107 | 106 | $this->mResponse = qp_Setup::$request->response(); |
108 | 107 | # Determine which messages will be used, according to the language. |
109 | | - qp_Setup::onLoadAllMessages(); |
110 | 108 | $view->setController( $this ); |
111 | 109 | # *** get visual style poll attributes *** |
112 | 110 | $perRow = intval( array_key_exists( 'perrow', $argv ) ? $argv['perrow'] : 1 ); |
— | — | @@ -289,5 +287,4 @@ |
290 | 288 | } |
291 | 289 | return $showResults; |
292 | 290 | } |
293 | | - |
294 | | -} /* end of qp_AbstractPoll class */ |
| 291 | +} |
Index: trunk/extensions/QPoll/qp_user.php |
— | — | @@ -336,8 +336,9 @@ |
337 | 337 | $wgExtensionMessagesFiles['QPoll'] = self::$ExtDir . '/i18n/qp.i18n.php'; |
338 | 338 | # localized namespace names |
339 | 339 | $wgExtensionMessagesFiles['QPollNamespaces'] = self::$ExtDir . '/i18n/qp.namespaces.php'; |
340 | | - # localized special page titles |
| 340 | + # localized special page titles and magic words. |
341 | 341 | $wgExtensionMessagesFiles['QPollAlias'] = self::$ExtDir . '/i18n/qp.alias.php'; |
| 342 | + $wgExtensionMessagesFiles['QPollMagic'] = self::$ExtDir . '/i18n/QPoll.i18n.magic.php'; |
342 | 343 | |
343 | 344 | # extension setup, hooks handling and content transformation |
344 | 345 | self::autoLoad( array( |
— | — | @@ -419,15 +420,11 @@ |
420 | 421 | 'interpretation/qp_eval.php' => 'qp_Eval' |
421 | 422 | ) ); |
422 | 423 | |
423 | | - # TODO: Use the new technique for i18n of special page aliases |
424 | 424 | $wgSpecialPages['PollResults'] = 'PollResults'; |
425 | 425 | $wgSpecialPages['QPollWebInstall'] = 'qp_WebInstall'; |
426 | | - # TODO: Use the new technique for i18n of magic words |
427 | 426 | # instantiating fake instance for PHP < 5.2.3, which does not support 'Class::method' type of callbacks |
428 | | - $wgHooks['LanguageGetMagic'][] = |
429 | 427 | $wgHooks['MediaWikiPerformAction'][] = |
430 | 428 | $wgHooks['ParserFirstCallInit'][] = |
431 | | - $wgHooks['LoadAllMessages'][] = |
432 | 429 | $wgHooks['ParserAfterTidy'][] = |
433 | 430 | $wgHooks['CanonicalNamespaces'][] = new qp_Setup; |
434 | 431 | $wgHooks['LoadExtensionSchemaUpdates'][] = new qp_SchemaUpdater; |
— | — | @@ -530,35 +527,6 @@ |
531 | 528 | return $attr_vals; |
532 | 529 | } |
533 | 530 | |
534 | | - static function onLoadAllMessages() { |
535 | | - if ( !self::$messagesLoaded ) { |
536 | | - self::$messagesLoaded = true; |
537 | | - # for MW 1.15 which is still being used by many customers |
538 | | - # please do not remove until 2012 |
539 | | - if ( self::mediaWikiVersionCompare( '1.16' ) ) { |
540 | | - wfLoadExtensionMessages( 'QPoll' ); |
541 | | - } |
542 | | - } |
543 | | - return true; |
544 | | - } |
545 | | - |
546 | | - static function ParserFunctionsWords( $lang ) { |
547 | | - $words = array(); |
548 | | - $words[ 'en' ] = array( 'qpuserchoice' => array( 0, 'qpuserchoice' ) ); |
549 | | - # English is used as a fallback, and the English synonyms are |
550 | | - # used if a translation has not been provided for a given word |
551 | | - return ( $lang == 'en' || !array_key_exists( $lang, $words ) ) |
552 | | - ? $words[ 'en' ] |
553 | | - : array_merge( $words[ 'en' ], $words[ $lang ] ); |
554 | | - } |
555 | | - |
556 | | - static function onLanguageGetMagic( &$magicWords, $langCode ) { |
557 | | - foreach ( self::ParserFunctionsWords( $langCode ) as $word => $trans ) { |
558 | | - $magicWords[$word] = $trans; |
559 | | - } |
560 | | - return true; |
561 | | - } |
562 | | - |
563 | 531 | static function clearCache() { |
564 | 532 | if ( self::$cache_control ) { |
565 | 533 | global $parserMemc; |
Index: trunk/extensions/QPoll/includes/qp_functionshook.php |
— | — | @@ -33,10 +33,6 @@ |
34 | 34 | * @author QuestPC <questpc@rambler.ru> |
35 | 35 | */ |
36 | 36 | |
37 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
38 | | - die( "This file is part of the QPoll extension. It is not a valid entry point.\n" ); |
39 | | -} |
40 | | - |
41 | 37 | class qp_FunctionsHook { |
42 | 38 | |
43 | 39 | var $frame; |
— | — | @@ -51,7 +47,6 @@ |
52 | 48 | var $error_message = 'no_such_poll'; |
53 | 49 | |
54 | 50 | function qpuserchoice( Parser &$parser, PPFrame $frame, array $args ) { |
55 | | - qp_Setup::onLoadAllMessages(); |
56 | 51 | $this->frame = $frame; |
57 | 52 | $this->args = &$args; |
58 | 53 | if ( isset( $args[ 0 ] ) ) { |
— | — | @@ -138,4 +133,4 @@ |
139 | 134 | return $result; |
140 | 135 | } |
141 | 136 | |
142 | | -} /* end of qp_FunctionsHook class */ |
| 137 | +} |
\ No newline at end of file |