r68615 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68614‎ | r68615 | r68616 >
Date:04:31, 27 June 2010
Author:dantman
Status:deferred
Tags:
Comment:
Cleanup newlines, inconsistent indentation (mix of tab indents and space indents), and remote ?> from the end of files.
Modified paths:
  • /trunk/extensions/mw-editcount/CHANGELOG (modified) (history)
  • /trunk/extensions/mw-editcount/EditCount.i18n.php (modified) (history)
  • /trunk/extensions/mw-editcount/EditCount.php (modified) (history)
  • /trunk/extensions/mw-editcount/EditCountPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/mw-editcount/EditCountPage.php
@@ -53,7 +53,7 @@
5454
5555 if ($this->target === null || !strlen($this->target)) {
5656 $this->showInputForm();
57 - wfProfileOut(__METHOD__);
 57+ wfProfileOut(__METHOD__);
5858 return;
5959 }
6060
@@ -62,13 +62,13 @@
6363 $nt = Title::newFromURL($this->target);
6464 if (!$nt) {
6565 $wgOut->addHTML(wfMsg("editcount-notuser", htmlspecialchars($this->target)));
66 - wfProfileOut(__METHOD__);
 66+ wfProfileOut(__METHOD__);
6767 return;
6868 }
6969
7070 $ec = new EditCount($nt->getText());
7171 $this->showEditCount($ec);
72 -
 72+
7373 wfProfileOut(__METHOD__);
7474 }
7575
@@ -81,12 +81,12 @@
8282 function showEditCount($ec)
8383 {
8484 global $wgOut, $wgContLang;
85 -
86 - wfProfileIn(__METHOD__);
8785
 86+ wfProfileIn(__METHOD__);
 87+
8888 if ($ec->getTotal() == 0) {
8989 $wgOut->addHTML(wfMsg("editcount-noedits", $ec->getName()));
90 - wfProfileOut(__METHOD__);
 90+ wfProfileOut(__METHOD__);
9191 return;
9292 }
9393
@@ -118,8 +118,8 @@
119119
120120 $table .= wfCloseElement("table");
121121 $wgOut->addHtml($table);
122 -
123 - wfProfileOut(__METHOD__);
 122+
 123+ wfProfileOut(__METHOD__);
124124 }
125125
126126 /**
@@ -131,7 +131,7 @@
132132 */
133133 function doRow($cells)
134134 {
135 - wfProfileIn(__METHOD__);
 135+ wfProfileIn(__METHOD__);
136136 $ret = wfElement("tr", null, null);
137137 if (count($cells) == 2) {
138138 $ret .= wfElement("td", array("style" => $this->border), $cells[0]);
@@ -143,8 +143,8 @@
144144 }
145145 }
146146 $ret .= wfCloseElement("tr");
147 -
148 - wfProfileOut(__METHOD__);
 147+
 148+ wfProfileOut(__METHOD__);
149149 return $ret;
150150 }
151151
@@ -156,14 +156,14 @@
157157 */
158158 function showInputForm($user = "") {
159159 global $wgOut, $wgScriptPath;
160 -
161 - wfProfileIn(__METHOD__);
162 -
 160+
 161+ wfProfileIn(__METHOD__);
 162+
163163 $ct = Title::makeTitle(NS_SPECIAL, $this->getName());
164164 $form = "";
165165 $form .= wfElement("p", null, wfMsg("editcount-des"));
166166 $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"), "") . " ";
168168 $form .= wfElement("label", array("for" => "target"), wfMsg("editcount-username")). " ";
169169 $form .= wfElement("input", array("type" => "textbox", "name" => "target", "size" => "24", "value" => $user), "") . " ";
170170 $form .= wfElement("input", array("type" => "submit", "name" => "doeditcount", "value" => wfMsg("editcount-show")));
@@ -171,8 +171,8 @@
172172
173173 $this->setHeaders();
174174 $wgOut->addHtml($form);
175 -
176 - wfProfileOut(__METHOD__);
 175+
 176+ wfProfileOut(__METHOD__);
177177 }
178178 }
179179
@@ -241,7 +241,7 @@
242242 WHERE $cond AND p.page_namespace = $ns
243243 GROUP BY p.page_namespace");
244244 $row = $this->db->fetchRow($result);
245 -
 245+
246246 wfProfileOut(__METHOD__);
247247 return ($row["count"]) ? $row["count"] : 0;
248248 }
@@ -273,7 +273,7 @@
274274 }
275275 }
276276 ksort($nsResults, SORT_NUMERIC);
277 -
 277+
278278 wfProfileOut(__METHOD__);
279279 return $nsResults;
280280 }
@@ -289,11 +289,11 @@
290290 wfProfileIn(__METHOD__);
291291 global $wgDBprefix;
292292 if ($this->id == 0) {
293 - wfProfileOut(__METHOD__);
 293+ wfProfileOut(__METHOD__);
294294 return $this->db->selectField("{$wgDBprefix}revision", "COUNT(*)", array("rev_user_text" => $this->user->getName()), __METHOD__);
295295 }
296 -
297 - wfProfileOut(__METHOD__);
 296+
 297+ wfProfileOut(__METHOD__);
298298 return $this->user->edits($this->id);
299299 }
300300
@@ -308,4 +308,4 @@
309309 return $this->user->getName();
310310 }
311311 }
312 -?>
\ No newline at end of file
 312+
Index: trunk/extensions/mw-editcount/EditCount.i18n.php
@@ -117,4 +117,4 @@
118118 "editcount-total" => "Totaal",
119119 "editcount-username" => "Gebruikersnaam:"
120120 );
121 -?>
\ No newline at end of file
 121+
Index: trunk/extensions/mw-editcount/EditCount.php
@@ -64,38 +64,21 @@
6565 function efEditCount() {
6666 global $wgAutoloadClasses, $wgSpecialPages, $wgParser,
6767 $egECParserFunction, $egECEnableSpecialPage, $egECParserFunctionNames, $wgVersion;
68 -
69 - //for cross version compatibility
70 - $before17 = version_compare($wgVersion, "1.7", "<");
71 -
72 - //Autoload
 68+
 69+ //Autoload
7370 $wgAutoloadClasses["EditCountPage"] = dirname(__FILE__) . "/EditCountPage.php";
7471 $wgAutoloadClasses["EditCount"] = dirname(__FILE__) . "/EditCountPage.php";
7572 if ($before17) {
7673 //autoloading not supported
7774 require_once "EditCountPage.php";
7875 }
79 -
 76+
8077 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";
8879 }
8980
9081 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");
10083 }
10184
10285 efEditCountMsgs();
@@ -124,32 +107,22 @@
125108 function efEditCountMsgs() {
126109 global $wgMessageCache, $wgContLang, $wgVersion;
127110 static $msgsLoaded = false;
128 -
129 - wfProfileIn(__FUNCTION__);
 111+
 112+ wfProfileIn(__FUNCTION__);
130113
131114 $before17 = version_compare($wgVersion, "1.7", "<");
132115
133116 if (!$msgsLoaded) {
134117 $weECMessages = array();
135118 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) {
142121 $wgMessageCache->addMessages($weECMessages[$code], $code);
143122 }
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 - }
150123 $msgsLoaded = true;
151124 }
152 -
153 - wfProfileOut(__FUNCTION__);
 125+
 126+ wfProfileOut(__FUNCTION__);
154127 }
155128
156129 /**
@@ -187,38 +160,38 @@
188161 */
189162 function efEditCountParserFunction($parser, $param1 = "", $param2 = "") {
190163 global $wgContLang;
191 -
192 - wfProfileIn(__FUNCTION__);
193164
 165+ wfProfileIn(__FUNCTION__);
 166+
194167 if ($param1 == "" || !Title::newFromText($param1)) {
195 - wfProfileOut(__FUNCTION__);
 168+ wfProfileOut(__FUNCTION__);
196169 return array("found" => false);
197170 }
198171
199172 $ec = new EditCount($param1);
200173
201174 if ($param2 === "") {
202 - wfProfileOut(__FUNCTION__);
 175+ wfProfileOut(__FUNCTION__);
203176 return $ec->getTotal();
204177 }
205178
206179 if (!is_numeric($param2)) {
207180 $index = Namespace::getCanonicalIndex(strtolower($param2));
208181 if ($index === null) {
209 - wfProfileOut(__FUNCTION__);
 182+ wfProfileOut(__FUNCTION__);
210183 return array("found" => false);
211184 }
212185 }
213186 else {
214187 $namespaces = $wgContLang->getNamespaces();
215188 if (!array_key_exists($param2, $namespaces)) {
216 - wfProfileOut(__FUNCTION__);
 189+ wfProfileOut(__FUNCTION__);
217190 return array("found" => false);
218191 }
219192 $index = $param2;
220193 }
221 -
222 - wfProfileOut(__FUNCTION__);
 194+
 195+ wfProfileOut(__FUNCTION__);
223196 return $ec->getByNamespace($index);
224197 }
225198
@@ -239,4 +212,3 @@
240213 return true;
241214 }
242215
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+
3030 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
3131 + native

Status & tagging log