Index: trunk/extensions/WhatIsMyIP/WhatIsMyIP_body.php |
— | — | @@ -1,27 +1,35 @@ |
2 | 2 | <?php |
3 | | - |
4 | | -if (!defined('MEDIAWIKI')) { |
| 3 | +/** |
| 4 | + * Main class for WhatIsMyIP |
| 5 | + * @file |
| 6 | + * @ingroup Extensions |
| 7 | + */ |
| 8 | +if ( !defined( 'MEDIAWIKI' ) ) { |
5 | 9 | echo "This is a MediaWiki extension named WhatIsMyIP.\n"; |
6 | | - exit(1); |
| 10 | + exit( 1 ); |
7 | 11 | } |
8 | 12 | |
9 | 13 | class WhatIsMyIP extends SpecialPage { |
10 | | - function __construct() { |
11 | | - parent::__construct('WhatIsMyIP' /*class*/); |
12 | | - } |
13 | 14 | |
14 | | - function WhatIsMyIP(){ |
15 | | - SpecialPage::SpecialPage( 'WhatIsMyIP', 'whatismyip' ); |
| 15 | + /** |
| 16 | + * Constructor |
| 17 | + */ |
| 18 | + public function __construct() { |
| 19 | + parent::__construct( 'WhatIsMyIP'/*class*/, 'whatismyip'/*restriction*/ ); |
16 | 20 | } |
17 | 21 | |
18 | | - function execute(){ |
| 22 | + /** |
| 23 | + * Show the special page |
| 24 | + * |
| 25 | + * @param $par Mixed: parameter passed to the page or null |
| 26 | + */ |
| 27 | + public function execute( $par ){ |
19 | 28 | global $wgOut; |
20 | 29 | |
21 | | - wfLoadExtensionMessages('WhatIsMyIP'); |
| 30 | + wfLoadExtensionMessages( 'WhatIsMyIP' ); |
22 | 31 | |
23 | | - $wgOut->setPageTitle(wfMsg('whatismyip')); |
24 | | - // $wgOut->addWikiText( wfMsg('whatismyip-username'). " $user" ); |
| 32 | + $wgOut->setPageTitle( wfMsg( 'whatismyip' ) ); |
25 | 33 | $ip = wfGetIP(); |
26 | | - $wgOut->addWikiText( wfMsg('whatismyip-out'). " $ip" ); |
| 34 | + $wgOut->addWikiText( wfMsg( 'whatismyip-out' ). " $ip" ); |
27 | 35 | } |
28 | | -} |
| 36 | +} |
\ No newline at end of file |
Index: trunk/extensions/WhatIsMyIP/WhatIsMyIP.i18n.php |
— | — | @@ -2,6 +2,7 @@ |
3 | 3 | /** |
4 | 4 | * Internationalization file for WhatIsMyIP extension. |
5 | 5 | * |
| 6 | + * @file |
6 | 7 | * @ingroup Extensions |
7 | 8 | */ |
8 | 9 | |
— | — | @@ -14,6 +15,8 @@ |
15 | 16 | 'whatismyip' => 'What is my IP', |
16 | 17 | 'whatismyip-desc' => 'Shows current user\'s IP address on [[Special:WhatIsMyIP]]', |
17 | 18 | 'whatismyip-out' => 'Your IP:', |
| 19 | + // For Special:ListGroupRights |
| 20 | + 'right-whatismyip' => 'View their own IP address on [[Special:WhatIsMyIP]]', |
18 | 21 | ); |
19 | 22 | |
20 | 23 | /** Message documentation (Message documentation) |
— | — | @@ -188,6 +191,7 @@ |
189 | 192 | 'whatismyip' => 'Mikä IP-osoitteeni on', |
190 | 193 | 'whatismyip-desc' => 'Näyttää käyttäjän nykyisen IP-osoitteen sivulla [[Special:WhatIsMyIP]]', |
191 | 194 | 'whatismyip-out' => 'IP-osoitteesi:', |
| 195 | + 'right-whatismyip' => 'Katsoa oman IP-osoitteensa sivulla [[Special:WhatIsMyIP]]', |
192 | 196 | ); |
193 | 197 | |
194 | 198 | /** French (Français) |
Index: trunk/extensions/WhatIsMyIP/WhatIsMyIP.php |
— | — | @@ -16,25 +16,30 @@ |
17 | 17 | * require_once("$IP/extensions/WhatIsMyIP/WhatIsMyIP.php"); |
18 | 18 | */ |
19 | 19 | |
20 | | -if (!defined('MEDIAWIKI')) { |
| 20 | +if ( !defined('MEDIAWIKI') ) { |
21 | 21 | echo "This is a MediaWiki extension named WhatIsMyIP.\n"; |
22 | 22 | exit( 1 ); |
23 | 23 | } |
| 24 | + |
| 25 | +// Extension credits that show up on Special:Version |
24 | 26 | $wgExtensionCredits['specialpage'][] = array( |
25 | 27 | 'name' => 'WhatIsMyIP', |
26 | | - 'version' => '1.1', |
| 28 | + 'version' => '1.2', |
27 | 29 | 'description' => 'Shows current user\'s IP address on [[Special:WhatIsMyIP]]', |
28 | 30 | 'author' => 'Łukasz Galezewski', |
29 | 31 | 'url' => 'http://www.mediawiki.org/wiki/Extension:WhatIsMyIP', |
30 | 32 | 'descriptionmsg' => 'whatismyip-desc' |
31 | 33 | ); |
32 | 34 | |
33 | | -global $wgAvailableRights, $wgGroupPermissions; |
| 35 | +// New user right, given to everyone by default (so even anonymous users can access the special page) |
34 | 36 | $wgAvailableRights[] = 'whatismyip'; |
35 | 37 | $wgGroupPermissions['*']['whatismyip'] = true; |
36 | 38 | |
| 39 | +// Set up the special page |
37 | 40 | $dir = dirname(__FILE__) . '/'; |
38 | 41 | $wgExtensionMessagesFiles['WhatIsMyIP'] = $dir . 'WhatIsMyIP.i18n.php'; |
39 | 42 | $wgExtensionAliasesFiles['WhatIsMyIP'] = $dir . 'WhatIsMyIP.alias.php'; |
40 | 43 | $wgAutoloadClasses['WhatIsMyIP'] = $dir. 'WhatIsMyIP_body.php'; |
41 | 44 | $wgSpecialPages['WhatIsMyIP'] = 'WhatIsMyIP'; |
| 45 | +// Special page group for MediaWiki 1.13+ |
| 46 | +$wgSpecialPageGroups['WhatIsMyIP'] = 'users'; |
\ No newline at end of file |
Index: trunk/extensions/WhatIsMyIP/WhatIsMyIP.alias.php |
— | — | @@ -1,11 +1,14 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Aliases for special pages |
| 4 | + * Aliases for WhatIsMyIP extension. |
5 | 5 | * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
6 | 8 | */ |
7 | 9 | |
8 | 10 | $aliases = array(); |
9 | 11 | |
| 12 | +/** English */ |
10 | 13 | $aliases['en'] = array( |
11 | 14 | 'WhatIsMyIP' => array( 'WhatIsMyIP' ), |
12 | 15 | ); |