Index: trunk/extensions/mw-editcount/EditCountPage.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | |
55 | 55 | if ($this->target === null || !strlen($this->target)) { |
56 | 56 | $this->showInputForm(); |
57 | | - wfProfileOut(__METHOD__); |
| 57 | + wfProfileOut(__METHOD__); |
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
— | — | @@ -62,13 +62,13 @@ |
63 | 63 | $nt = Title::newFromURL($this->target); |
64 | 64 | if (!$nt) { |
65 | 65 | $wgOut->addHTML(wfMsg("editcount-notuser", htmlspecialchars($this->target))); |
66 | | - wfProfileOut(__METHOD__); |
| 66 | + wfProfileOut(__METHOD__); |
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | 70 | $ec = new EditCount($nt->getText()); |
71 | 71 | $this->showEditCount($ec); |
72 | | - |
| 72 | + |
73 | 73 | wfProfileOut(__METHOD__); |
74 | 74 | } |
75 | 75 | |
— | — | @@ -81,12 +81,12 @@ |
82 | 82 | function showEditCount($ec) |
83 | 83 | { |
84 | 84 | global $wgOut, $wgContLang; |
85 | | - |
86 | | - wfProfileIn(__METHOD__); |
87 | 85 | |
| 86 | + wfProfileIn(__METHOD__); |
| 87 | + |
88 | 88 | if ($ec->getTotal() == 0) { |
89 | 89 | $wgOut->addHTML(wfMsg("editcount-noedits", $ec->getName())); |
90 | | - wfProfileOut(__METHOD__); |
| 90 | + wfProfileOut(__METHOD__); |
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
— | — | @@ -118,8 +118,8 @@ |
119 | 119 | |
120 | 120 | $table .= wfCloseElement("table"); |
121 | 121 | $wgOut->addHtml($table); |
122 | | - |
123 | | - wfProfileOut(__METHOD__); |
| 122 | + |
| 123 | + wfProfileOut(__METHOD__); |
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | */ |
133 | 133 | function doRow($cells) |
134 | 134 | { |
135 | | - wfProfileIn(__METHOD__); |
| 135 | + wfProfileIn(__METHOD__); |
136 | 136 | $ret = wfElement("tr", null, null); |
137 | 137 | if (count($cells) == 2) { |
138 | 138 | $ret .= wfElement("td", array("style" => $this->border), $cells[0]); |
— | — | @@ -143,8 +143,8 @@ |
144 | 144 | } |
145 | 145 | } |
146 | 146 | $ret .= wfCloseElement("tr"); |
147 | | - |
148 | | - wfProfileOut(__METHOD__); |
| 147 | + |
| 148 | + wfProfileOut(__METHOD__); |
149 | 149 | return $ret; |
150 | 150 | } |
151 | 151 | |
— | — | @@ -156,14 +156,14 @@ |
157 | 157 | */ |
158 | 158 | function showInputForm($user = "") { |
159 | 159 | global $wgOut, $wgScriptPath; |
160 | | - |
161 | | - wfProfileIn(__METHOD__); |
162 | | - |
| 160 | + |
| 161 | + wfProfileIn(__METHOD__); |
| 162 | + |
163 | 163 | $ct = Title::makeTitle(NS_SPECIAL, $this->getName()); |
164 | 164 | $form = ""; |
165 | 165 | $form .= wfElement("p", null, wfMsg("editcount-des")); |
166 | 166 | $form .= wfElement("form", array("name" => "editcountform", "method" => "get", "action" => $wgScriptPath . "/index.php"), null); |
167 | | - $form .= wfElement("input", array("type" => "hidden", "name" => "title", "value" => "Special:EditCount"), "") . " "; |
| 167 | + $form .= wfElement("input", array("type" => "hidden", "name" => "title", "value" => "Special:EditCount"), "") . " "; |
168 | 168 | $form .= wfElement("label", array("for" => "target"), wfMsg("editcount-username")). " "; |
169 | 169 | $form .= wfElement("input", array("type" => "textbox", "name" => "target", "size" => "24", "value" => $user), "") . " "; |
170 | 170 | $form .= wfElement("input", array("type" => "submit", "name" => "doeditcount", "value" => wfMsg("editcount-show"))); |
— | — | @@ -171,8 +171,8 @@ |
172 | 172 | |
173 | 173 | $this->setHeaders(); |
174 | 174 | $wgOut->addHtml($form); |
175 | | - |
176 | | - wfProfileOut(__METHOD__); |
| 175 | + |
| 176 | + wfProfileOut(__METHOD__); |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
— | — | @@ -241,7 +241,7 @@ |
242 | 242 | WHERE $cond AND p.page_namespace = $ns |
243 | 243 | GROUP BY p.page_namespace"); |
244 | 244 | $row = $this->db->fetchRow($result); |
245 | | - |
| 245 | + |
246 | 246 | wfProfileOut(__METHOD__); |
247 | 247 | return ($row["count"]) ? $row["count"] : 0; |
248 | 248 | } |
— | — | @@ -273,7 +273,7 @@ |
274 | 274 | } |
275 | 275 | } |
276 | 276 | ksort($nsResults, SORT_NUMERIC); |
277 | | - |
| 277 | + |
278 | 278 | wfProfileOut(__METHOD__); |
279 | 279 | return $nsResults; |
280 | 280 | } |
— | — | @@ -289,11 +289,11 @@ |
290 | 290 | wfProfileIn(__METHOD__); |
291 | 291 | global $wgDBprefix; |
292 | 292 | if ($this->id == 0) { |
293 | | - wfProfileOut(__METHOD__); |
| 293 | + wfProfileOut(__METHOD__); |
294 | 294 | return $this->db->selectField("{$wgDBprefix}revision", "COUNT(*)", array("rev_user_text" => $this->user->getName()), __METHOD__); |
295 | 295 | } |
296 | | - |
297 | | - wfProfileOut(__METHOD__); |
| 296 | + |
| 297 | + wfProfileOut(__METHOD__); |
298 | 298 | return $this->user->edits($this->id); |
299 | 299 | } |
300 | 300 | |
— | — | @@ -308,4 +308,4 @@ |
309 | 309 | return $this->user->getName(); |
310 | 310 | } |
311 | 311 | } |
312 | | -?> |
\ No newline at end of file |
| 312 | + |
Index: trunk/extensions/mw-editcount/EditCount.i18n.php |
— | — | @@ -117,4 +117,4 @@ |
118 | 118 | "editcount-total" => "Totaal", |
119 | 119 | "editcount-username" => "Gebruikersnaam:" |
120 | 120 | ); |
121 | | -?> |
\ No newline at end of file |
| 121 | + |
Index: trunk/extensions/mw-editcount/EditCount.php |
— | — | @@ -64,38 +64,21 @@ |
65 | 65 | function efEditCount() { |
66 | 66 | global $wgAutoloadClasses, $wgSpecialPages, $wgParser,
|
67 | 67 | $egECParserFunction, $egECEnableSpecialPage, $egECParserFunctionNames, $wgVersion; |
68 | | - |
69 | | - //for cross version compatibility |
70 | | - $before17 = version_compare($wgVersion, "1.7", "<"); |
71 | | - |
72 | | - //Autoload |
| 68 | + |
| 69 | + //Autoload |
73 | 70 | $wgAutoloadClasses["EditCountPage"] = dirname(__FILE__) . "/EditCountPage.php"; |
74 | 71 | $wgAutoloadClasses["EditCount"] = dirname(__FILE__) . "/EditCountPage.php";
|
75 | 72 | if ($before17) {
|
76 | 73 | //autoloading not supported
|
77 | 74 | require_once "EditCountPage.php";
|
78 | 75 | } |
79 | | -
|
| 76 | +
|
80 | 77 | if ($egECEnableSpecialPage) { |
81 | | - //add to special page (object if less than 1.7) |
82 | | - if ($before17) { |
83 | | - $wgSpecialPages["EditCount"] = new EditCountPage; |
84 | | - } |
85 | | - else { |
86 | | - $wgSpecialPages["EditCount"] = "EditCountPage"; |
87 | | - }
|
| 78 | + $wgSpecialPages["EditCount"] = "EditCountPage"; |
88 | 79 | } |
89 | 80 | |
90 | 81 | if ($egECParserFunction) { |
91 | | - if ($before17) {
|
92 | | - //have to do this without magic words
|
93 | | - foreach ($egECParserFunctionNames as $funcName) {
|
94 | | - $wgParser->setFunctionHook("#" . $funcName, "efEditCountParserFunction");
|
95 | | - } |
96 | | - }
|
97 | | - else {
|
98 | | - $wgParser->setFunctionHook("editcount", "efEditCountParserFunction");
|
99 | | - } |
| 82 | + $wgParser->setFunctionHook("editcount", "efEditCountParserFunction");
|
100 | 83 | } |
101 | 84 | |
102 | 85 | efEditCountMsgs(); |
— | — | @@ -124,32 +107,22 @@ |
125 | 108 | function efEditCountMsgs() { |
126 | 109 | global $wgMessageCache, $wgContLang, $wgVersion; |
127 | 110 | static $msgsLoaded = false; |
128 | | - |
129 | | - wfProfileIn(__FUNCTION__);
|
| 111 | + |
| 112 | + wfProfileIn(__FUNCTION__);
|
130 | 113 |
|
131 | 114 | $before17 = version_compare($wgVersion, "1.7", "<");
|
132 | 115 | |
133 | 116 | if (!$msgsLoaded) { |
134 | 117 | $weECMessages = array(); |
135 | 118 | require_once "EditCount.i18n.php";
|
136 | | - if ($before17) {
|
137 | | - //1.6 doesn't support multiple languages |
138 | | - $code = $wgContLang->getCode(); |
139 | | - if (!array_key_exists($code, $weECMessages)) { |
140 | | - $code = "en"; |
141 | | - } |
| 119 | + //add all the message to fill in language gaps
|
| 120 | + foreach ($weECMessages as $code => $msgs) {
|
142 | 121 | $wgMessageCache->addMessages($weECMessages[$code], $code);
|
143 | 122 | }
|
144 | | - else {
|
145 | | - //add all the message to fill in language gaps
|
146 | | - foreach ($weECMessages as $code => $msgs) {
|
147 | | - $wgMessageCache->addMessages($weECMessages[$code], $code);
|
148 | | - }
|
149 | | - }
|
150 | 123 | $msgsLoaded = true; |
151 | 124 | } |
152 | | - |
153 | | - wfProfileOut(__FUNCTION__); |
| 125 | + |
| 126 | + wfProfileOut(__FUNCTION__); |
154 | 127 | } |
155 | 128 |
|
156 | 129 | /**
|
— | — | @@ -187,38 +160,38 @@ |
188 | 161 | */ |
189 | 162 | function efEditCountParserFunction($parser, $param1 = "", $param2 = "") { |
190 | 163 | global $wgContLang; |
191 | | - |
192 | | - wfProfileIn(__FUNCTION__); |
193 | 164 | |
| 165 | + wfProfileIn(__FUNCTION__); |
| 166 | + |
194 | 167 | if ($param1 == "" || !Title::newFromText($param1)) { |
195 | | - wfProfileOut(__FUNCTION__); |
| 168 | + wfProfileOut(__FUNCTION__); |
196 | 169 | return array("found" => false); |
197 | 170 | } |
198 | 171 | |
199 | 172 | $ec = new EditCount($param1); |
200 | 173 | |
201 | 174 | if ($param2 === "") { |
202 | | - wfProfileOut(__FUNCTION__); |
| 175 | + wfProfileOut(__FUNCTION__); |
203 | 176 | return $ec->getTotal(); |
204 | 177 | } |
205 | 178 | |
206 | 179 | if (!is_numeric($param2)) { |
207 | 180 | $index = Namespace::getCanonicalIndex(strtolower($param2)); |
208 | 181 | if ($index === null) { |
209 | | - wfProfileOut(__FUNCTION__); |
| 182 | + wfProfileOut(__FUNCTION__); |
210 | 183 | return array("found" => false); |
211 | 184 | } |
212 | 185 | } |
213 | 186 | else { |
214 | 187 | $namespaces = $wgContLang->getNamespaces(); |
215 | 188 | if (!array_key_exists($param2, $namespaces)) { |
216 | | - wfProfileOut(__FUNCTION__); |
| 189 | + wfProfileOut(__FUNCTION__); |
217 | 190 | return array("found" => false); |
218 | 191 | } |
219 | 192 | $index = $param2; |
220 | 193 | } |
221 | | - |
222 | | - wfProfileOut(__FUNCTION__); |
| 194 | + |
| 195 | + wfProfileOut(__FUNCTION__); |
223 | 196 | return $ec->getByNamespace($index); |
224 | 197 | } |
225 | 198 |
|
— | — | @@ -239,4 +212,3 @@ |
240 | 213 | return true; |
241 | 214 | } |
242 | 215 | |
243 | | -?> |
\ No newline at end of file |
Index: trunk/extensions/mw-editcount/CHANGELOG |
— | — | @@ -1,29 +1,29 @@ |
2 | | -1.0.0 First release
|
3 | | -
|
4 | | -1.0.1 Fixed error when name is not valid
|
5 | | -
|
6 | | -1.1.0 Added parser function
|
7 | | -
|
8 | | -1.1.1 Added link in Monobook toolbox on pages in the NS_USER namespace
|
9 | | -
|
10 | | -1.2.0 Parser function now can report edits for a certain namespace, a German translation
|
11 | | -
|
12 | | -1.2.1 Fixed bugs to allow EditCount to work on 1.6.10 and above
|
13 | | -
|
14 | | -1.2.2 Adminstrators now choose parser functions and more flexible message loading
|
15 | | -
|
16 | | -1.2.3 Documented code and fixed disabling of special page bug
|
17 | | -
|
18 | | -1.2.4 Fixed profiler calls
|
19 | | -
|
20 | | -1.2.5 Fixed disabling of special page bug in MediaWiki 1.6
|
21 | | -
|
22 | | -1.2.6 Fixed SQL querys to use $wgDBPrefix
|
23 | | -
|
24 | | -1.2.7 Added Finish and Polish translation
|
25 | | -
|
26 | | -1.2.8 Fixed problems with $wgDBprefix and ISS
|
27 | | -
|
28 | | -1.2.9 Added Brazilian Portuguese, Dutch, and French translations
|
29 | | -
|
| 2 | +1.0.0 First release |
| 3 | + |
| 4 | +1.0.1 Fixed error when name is not valid |
| 5 | + |
| 6 | +1.1.0 Added parser function |
| 7 | + |
| 8 | +1.1.1 Added link in Monobook toolbox on pages in the NS_USER namespace |
| 9 | + |
| 10 | +1.2.0 Parser function now can report edits for a certain namespace, a German translation |
| 11 | + |
| 12 | +1.2.1 Fixed bugs to allow EditCount to work on 1.6.10 and above |
| 13 | + |
| 14 | +1.2.2 Adminstrators now choose parser functions and more flexible message loading |
| 15 | + |
| 16 | +1.2.3 Documented code and fixed disabling of special page bug |
| 17 | + |
| 18 | +1.2.4 Fixed profiler calls |
| 19 | + |
| 20 | +1.2.5 Fixed disabling of special page bug in MediaWiki 1.6 |
| 21 | + |
| 22 | +1.2.6 Fixed SQL querys to use $wgDBPrefix |
| 23 | + |
| 24 | +1.2.7 Added Finish and Polish translation |
| 25 | + |
| 26 | +1.2.8 Fixed problems with $wgDBprefix and ISS |
| 27 | + |
| 28 | +1.2.9 Added Brazilian Portuguese, Dutch, and French translations |
| 29 | + |
30 | 30 | 1.2.9.1 BUGFIX removed newline + space after ?> in EditCount.i18n.php |
\ No newline at end of file |
Property changes on: trunk/extensions/mw-editcount/CHANGELOG |
___________________________________________________________________ |
Name: svn:eol-style |
31 | 31 | + native |