Index: trunk/extensions/CreateBox/CreateBox.i18n.php |
— | — | @@ -0,0 +1,35 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for the CreateBox extension. |
| 5 | + * |
| 6 | + * @ingroup Extensions |
| 7 | + * @author Ross McClure |
| 8 | + */ |
| 9 | + |
| 10 | +$messages = array(); |
| 11 | + |
| 12 | +/** English |
| 13 | + * @author Ross McClure |
| 14 | + */ |
| 15 | +$messages['en'] = array( |
| 16 | + 'create' => 'Create', |
| 17 | + 'createbox-exists' => "Sorry, \"'''{{FULLPAGENAME}}'''\" already " . |
| 18 | + "exists.\n\nYou cannot create this page, but you can " . |
| 19 | + "[{{fullurl:{{FULLPAGENAME}}|action=edit}} edit it], " . |
| 20 | + "[{{fullurl:{{FULLPAGENAME}}}} read it], or choose to " . |
| 21 | + "create a different page using the box below.\n\n" . |
| 22 | + "<createbox>break=no</createbox>", |
| 23 | +); |
| 24 | + |
| 25 | +/** Finnish (Suomi) |
| 26 | + * @author Jack Phoenix |
| 27 | + */ |
| 28 | +$messages['fi'] = array ( |
| 29 | + 'create' => 'Luo', |
| 30 | + 'createbox-exists' => "Pahoittelut, \"'''{{FULLPAGENAME}}'''\" on jo " . |
| 31 | + "olemassa.\n\nEt voi luoda tätä sivua, mutta voit " . |
| 32 | + "[{{fullurl:{{FULLPAGENAME}}|action=edit}} muokata sitä], " . |
| 33 | + "[{{fullurl:{{FULLPAGENAME}}}} lukea sitä], tai luoda " . |
| 34 | + "erilaisen sivun allaolevaa laatikkoa käyttäen.\n\n" . |
| 35 | + "<createbox>break=no</createbox>", |
| 36 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/CreateBox/CreateBox.i18n.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 37 | + native |
Index: trunk/extensions/CreateBox/CreateBox.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /* |
4 | 4 | |
5 | | - CreateBox v1.5 -- Specialized Inputbox for page creation |
| 5 | + CreateBox v1.6 -- Specialized Inputbox for page creation |
6 | 6 | |
7 | 7 | Author: Ross McClure |
8 | 8 | http://www.mediawiki.org/wiki/User:Algorithm |
— | — | @@ -24,37 +24,36 @@ |
25 | 25 | http://www.gnu.org/copyleft/gpl.html |
26 | 26 | |
27 | 27 | To install, add following to LocalSettings.php |
28 | | - include("extensions/create.php"); |
29 | | - |
| 28 | + require_once("extensions/create.php"); |
30 | 29 | */ |
31 | 30 | |
32 | | -$wgExtensionFunctions[] = "wfCreateBox"; |
| 31 | +//Avoid unstubbing $wgParser too early on modern (1.12+) MW versions, as per r35980 |
| 32 | +if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { |
| 33 | + $wgHooks['ParserFirstCallInit'][] = 'wfCreateBox'; |
| 34 | +} else { |
| 35 | + $wgExtensionFunctions[] = 'wfCreateBox'; |
| 36 | +} |
| 37 | + |
33 | 38 | $wgHooks['UnknownAction'][] = 'actionCreate'; |
34 | 39 | $wgExtensionCredits['parserhook'][] = array( |
35 | 40 | 'name' => 'CreateBox', |
36 | 41 | 'url' => 'http://www.mediawiki.org/wiki/Extension:CreateBox', |
37 | 42 | 'description' => 'Specialized Inputbox for page creation', |
38 | 43 | 'author' => 'Ross McClure', |
39 | | - 'version' => '1.5' |
| 44 | + 'version' => '1.6' |
40 | 45 | ); |
41 | 46 | |
| 47 | +$dir = dirname(__FILE__) . '/'; |
| 48 | +$wgExtensionMessagesFiles['CreateBox'] = $dir . 'CreateBox.i18n.php'; |
| 49 | + |
42 | 50 | function wfCreateBox() { |
43 | | - global $wgParser, $wgMessageCache; |
44 | | - |
45 | | - $wgMessageCache->addMessages( array( |
46 | | - 'create' => "Create", |
47 | | - 'create_exists' => "Sorry, \"'''{{FULLPAGENAME}}'''\" already " . |
48 | | - "exists.\n\nYou cannot create this page, but you can " . |
49 | | - "[{{fullurl:{{FULLPAGENAME}}|action=edit}} edit it], " . |
50 | | - "[{{fullurl:{{FULLPAGENAME}}}} read it], or choose to " . |
51 | | - "create a different page using the box below.\n\n" . |
52 | | - "<createbox>break=no</createbox>" |
53 | | - )); |
54 | | - |
55 | | - $wgParser->setHook( "createbox", "acMakeBox" ); |
| 51 | + global $wgParser; |
| 52 | + $wgParser->setHook( 'createbox', 'acMakeBox' ); |
| 53 | + return true; |
56 | 54 | } |
57 | 55 | |
58 | 56 | function actionCreate($action, $article) { |
| 57 | + wfLoadExtensionMessages('CreateBox'); |
59 | 58 | if($action != 'create') return true; |
60 | 59 | |
61 | 60 | global $wgRequest; |
— | — | @@ -77,7 +76,7 @@ |
78 | 77 | $text = $article->getTitle()->getPrefixedText(); |
79 | 78 | $wgOut->setPageTitle($text); |
80 | 79 | $wgOut->setHTMLTitle(wfMsg('pagetitle', $text.' - '.wfMsg('create'))); |
81 | | - $wgOut->addWikiText(wfMsg('create_exists')); |
| 80 | + $wgOut->addWikiText(wfMsg('createbox-exists')); |
82 | 81 | } |
83 | 82 | return false; |
84 | 83 | } |
— | — | @@ -91,6 +90,7 @@ |
92 | 91 | } |
93 | 92 | |
94 | 93 | function acMakeBox($input, $argv, &$parser) { |
| 94 | + wfLoadExtensionMessages('CreateBox'); |
95 | 95 | global $wgRequest, $wgScript; |
96 | 96 | if($wgRequest->getVal('action')=='create') { |
97 | 97 | $prefix = $wgRequest->getVal('prefix'); |
— | — | @@ -106,10 +106,10 @@ |
107 | 107 | $text = acGetOption($input,'default'); |
108 | 108 | } |
109 | 109 | $submit = htmlspecialchars($wgScript); |
110 | | - $width = acGetOption($input,'width',0); |
111 | | - $align = acGetOption($input,'align','center'); |
112 | | - $br = ((acGetOption($input,'break','no')=='no') ? '' : '<br />'); |
113 | | - $label = acGetOption($input,'buttonlabel',wfMsgHtml("createarticle")); |
| 110 | + $width = acGetOption($input, 'width', 0); |
| 111 | + $align = acGetOption($input, 'align', 'center'); |
| 112 | + $br = ((acGetOption($input, 'break', 'no')=='no') ? '' : '<br />'); |
| 113 | + $label = acGetOption($input, 'buttonlabel', wfMsgHtml('create')); |
114 | 114 | $output=<<<ENDFORM |
115 | 115 | <div class="createbox" align="{$align}"> |
116 | 116 | <form name="createbox" action="{$submit}" method="get" class="createboxForm"> |