@@ -45,7 +45,7 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | // Find the path, and complain if English doesn't exist. |
48 | - $path = $this->container->getParameter("kernel.root_dir") . '/../i18n'; |
|
48 | + $path = $this->container->getParameter("kernel.root_dir").'/../i18n'; |
|
49 | 49 | if (!file_exists("$path/en.json")) { |
50 | 50 | throw new Exception("Language directory doesn't exist: $path"); |
51 | 51 | } |
@@ -14,22 +14,22 @@ discard block |
||
14 | 14 | |
15 | 15 | public function intuitionMessage($message = "", $vars = []) |
16 | 16 | { |
17 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
17 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /*********************************** FUNCTIONS ***********************************/ |
21 | 21 | |
22 | 22 | public function getFunctions() |
23 | 23 | { |
24 | - $options = [ 'is_safe' => [ 'html']]; |
|
24 | + $options = ['is_safe' => ['html']]; |
|
25 | 25 | return [ |
26 | - new Twig_SimpleFunction('wiki_link', [ $this, 'wikiLink' ], $options), |
|
27 | - new Twig_SimpleFunction('user_link', [ $this, 'userLink' ], $options), |
|
28 | - new Twig_SimpleFunction('wiki_history_link', [ $this, 'wikiHistoryLink' ], $options), |
|
29 | - new Twig_SimpleFunction('wiki_log_link', [ $this, 'wikiLogLink' ], $options), |
|
30 | - new Twig_SimpleFunction('pageviews_links', [ $this, 'pageviewsLinks' ], $options), |
|
31 | - new Twig_SimpleFunction('diff_link', [ $this, 'diffLink' ], $options), |
|
32 | - new Twig_SimpleFunction('perma_link', [ $this, 'permaLink' ], $options), |
|
26 | + new Twig_SimpleFunction('wiki_link', [$this, 'wikiLink'], $options), |
|
27 | + new Twig_SimpleFunction('user_link', [$this, 'userLink'], $options), |
|
28 | + new Twig_SimpleFunction('wiki_history_link', [$this, 'wikiHistoryLink'], $options), |
|
29 | + new Twig_SimpleFunction('wiki_log_link', [$this, 'wikiLogLink'], $options), |
|
30 | + new Twig_SimpleFunction('pageviews_links', [$this, 'pageviewsLinks'], $options), |
|
31 | + new Twig_SimpleFunction('diff_link', [$this, 'diffLink'], $options), |
|
32 | + new Twig_SimpleFunction('perma_link', [$this, 'permaLink'], $options), |
|
33 | 33 | ]; |
34 | 34 | } |
35 | 35 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | public function getFilters() |
181 | 181 | { |
182 | 182 | return [ |
183 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
184 | - new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]), |
|
185 | - new \Twig_SimpleFilter('wikify_comment', [ $this, 'wikifyComment' ], [ 'is_safe' => [ 'html' ] ]), |
|
183 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
184 | + new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]), |
|
185 | + new \Twig_SimpleFilter('wikify_comment', [$this, 'wikifyComment'], ['is_safe' => ['html']]), |
|
186 | 186 | ]; |
187 | 187 | } |
188 | 188 | |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | if (!$denominator) { |
219 | 219 | $quotient = 0; |
220 | 220 | } else { |
221 | - $quotient = ( $numerator / $denominator ) * 100; |
|
221 | + $quotient = ($numerator / $denominator) * 100; |
|
222 | 222 | } |
223 | 223 | |
224 | - return round($quotient, $precision) . '%'; |
|
224 | + return round($quotient, $precision).'%'; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | if ($isSection) { |
240 | 240 | $sectionTitle = $sectionMatch[1][0]; |
241 | 241 | $sectionTitleLink = str_replace(' ', '_', $sectionTitle); |
242 | - $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>→</a>" . |
|
242 | + $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>→</a>". |
|
243 | 243 | "<em class='text-muted'>$sectionTitle:</em> "; |
244 | 244 | $wikitext = str_replace($sectionMatch[0][0], $sectionWikitext, $wikitext); |
245 | 245 | } |
@@ -16,38 +16,38 @@ discard block |
||
16 | 16 | { |
17 | 17 | $options = ['is_safe' => ['html']]; |
18 | 18 | return [ |
19 | - new \Twig_SimpleFunction('request_time', [ $this, 'requestTime' ], $options), |
|
20 | - new \Twig_SimpleFunction('memory_usage', [ $this, 'requestMemory' ], $options), |
|
21 | - new \Twig_SimpleFunction('year', [ $this, 'generateYear' ], $options), |
|
22 | - new \Twig_SimpleFunction('linkWiki', [ $this, 'linkToWiki' ], $options), |
|
23 | - new \Twig_SimpleFunction('linkWikiScript', [ $this, 'linkToWikiScript' ], $options), |
|
24 | - new \Twig_SimpleFunction('msgPrintExists', [ $this, 'intuitionMessagePrintExists' ], $options), |
|
25 | - new \Twig_SimpleFunction('msgExists', [ $this, 'intuitionMessageExists' ], $options), |
|
26 | - new \Twig_SimpleFunction('msg', [ $this, 'intuitionMessage' ], $options), |
|
27 | - new \Twig_SimpleFunction('msg_footer', [ $this, 'intuitionMessageFooter' ], $options), |
|
28 | - new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options), |
|
29 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
30 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
31 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
32 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
33 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
34 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
35 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
36 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
37 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
38 | - new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]), |
|
39 | - new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]), |
|
40 | - new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]), |
|
41 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
42 | - new \Twig_SimpleFunction('replag', [ $this, 'replag' ]), |
|
43 | - new \Twig_SimpleFunction('link', [ $this, 'link' ]), |
|
19 | + new \Twig_SimpleFunction('request_time', [$this, 'requestTime'], $options), |
|
20 | + new \Twig_SimpleFunction('memory_usage', [$this, 'requestMemory'], $options), |
|
21 | + new \Twig_SimpleFunction('year', [$this, 'generateYear'], $options), |
|
22 | + new \Twig_SimpleFunction('linkWiki', [$this, 'linkToWiki'], $options), |
|
23 | + new \Twig_SimpleFunction('linkWikiScript', [$this, 'linkToWikiScript'], $options), |
|
24 | + new \Twig_SimpleFunction('msgPrintExists', [$this, 'intuitionMessagePrintExists'], $options), |
|
25 | + new \Twig_SimpleFunction('msgExists', [$this, 'intuitionMessageExists'], $options), |
|
26 | + new \Twig_SimpleFunction('msg', [$this, 'intuitionMessage'], $options), |
|
27 | + new \Twig_SimpleFunction('msg_footer', [$this, 'intuitionMessageFooter'], $options), |
|
28 | + new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options), |
|
29 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
30 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
31 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
32 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
33 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
34 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
35 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
36 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
37 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
38 | + new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']), |
|
39 | + new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']), |
|
40 | + new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']), |
|
41 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
42 | + new \Twig_SimpleFunction('replag', [$this, 'replag']), |
|
43 | + new \Twig_SimpleFunction('link', [$this, 'link']), |
|
44 | 44 | ]; |
45 | 45 | } |
46 | 46 | |
47 | 47 | public function requestTime($decimals = 3) |
48 | 48 | { |
49 | 49 | |
50 | - return number_format(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
50 | + return number_format(microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function requestMemory() |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function linkToWiki($url, $page, $secondary = "") |
75 | 75 | { |
76 | - $link = $url . "/"; |
|
76 | + $link = $url."/"; |
|
77 | 77 | |
78 | 78 | if ($this->isWMFLabs()) { |
79 | 79 | $link .= "wiki/"; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | public function linkToWikiScript($url, $secondary) |
92 | 92 | { |
93 | - $link = $url . "/"; |
|
93 | + $link = $url."/"; |
|
94 | 94 | |
95 | 95 | if ($this->isWMFLabs()) { |
96 | 96 | $link .= "w/"; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | // TODO: refactor all intuition stuff so it can be used anywhere |
107 | 107 | public function intuitionMessageExists($message = "") |
108 | 108 | { |
109 | - return $this->getIntuition()->msgExists($message, [ "domain" => "xtools" ]); |
|
109 | + return $this->getIntuition()->msgExists($message, ["domain" => "xtools"]); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | public function intuitionMessagePrintExists($message = "", $vars = []) |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | public function intuitionMessage($message = "", $vars = []) |
127 | 127 | { |
128 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
128 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | public function intuitionMessageFooter() |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function getAllLangs() |
155 | 155 | { |
156 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
156 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
157 | 157 | |
158 | 158 | $languages = array_values(array_unique(array_map( |
159 | - function ($filename) { |
|
159 | + function($filename) { |
|
160 | 160 | return basename($filename, '.json'); |
161 | 161 | }, |
162 | 162 | $messageFiles |
@@ -208,41 +208,41 @@ discard block |
||
208 | 208 | public function getColorList($num = false) |
209 | 209 | { |
210 | 210 | $colors = [ |
211 | - 0 => '#Cc0000',# '#FF005A', #red '#FF5555', |
|
211 | + 0 => '#Cc0000', # '#FF005A', #red '#FF5555', |
|
212 | 212 | 1 => '#F7b7b7', |
213 | - 2 => '#5c8d20',# '#008800', #green'#55FF55', |
|
213 | + 2 => '#5c8d20', # '#008800', #green'#55FF55', |
|
214 | 214 | 3 => '#85eD82', |
215 | 215 | 4 => '#2E97E0', # blue |
216 | 216 | 5 => '#B9E3F9', |
217 | - 6 => '#e1711d', # orange |
|
217 | + 6 => '#e1711d', # orange |
|
218 | 218 | 7 => '#ffc04c', |
219 | 219 | 8 => '#FDFF98', # yellow |
220 | 220 | 9 => '#5555FF', |
221 | 221 | 10 => '#55FFFF', |
222 | - 11 => '#0000C0', # |
|
223 | - 12 => '#008800', # green |
|
222 | + 11 => '#0000C0', # |
|
223 | + 12 => '#008800', # green |
|
224 | 224 | 13 => '#00C0C0', |
225 | - 14 => '#FFAFAF', # rosé |
|
226 | - 15 => '#808080', # gray |
|
225 | + 14 => '#FFAFAF', # rosé |
|
226 | + 15 => '#808080', # gray |
|
227 | 227 | 16 => '#00C000', |
228 | 228 | 17 => '#404040', |
229 | - 18 => '#C0C000', # green |
|
229 | + 18 => '#C0C000', # green |
|
230 | 230 | 19 => '#C000C0', |
231 | - 100 => '#75A3D1', # blue |
|
232 | - 101 => '#A679D2', # purple |
|
231 | + 100 => '#75A3D1', # blue |
|
232 | + 101 => '#A679D2', # purple |
|
233 | 233 | 102 => '#660000', |
234 | 234 | 103 => '#000066', |
235 | - 104 => '#FAFFAF', # caramel |
|
235 | + 104 => '#FAFFAF', # caramel |
|
236 | 236 | 105 => '#408345', |
237 | 237 | 106 => '#5c8d20', |
238 | - 107 => '#e1711d', # red |
|
239 | - 108 => '#94ef2b', # light green |
|
240 | - 109 => '#756a4a', # brown |
|
238 | + 107 => '#e1711d', # red |
|
239 | + 108 => '#94ef2b', # light green |
|
240 | + 109 => '#756a4a', # brown |
|
241 | 241 | 110 => '#6f1dab', |
242 | 242 | 111 => '#301e30', |
243 | 243 | 112 => '#5c9d96', |
244 | - 113 => '#a8cd8c', # earth green |
|
245 | - 114 => '#f2b3f1', # light purple |
|
244 | + 113 => '#a8cd8c', # earth green |
|
245 | + 114 => '#f2b3f1', # light purple |
|
246 | 246 | 115 => '#9b5828', |
247 | 247 | 118 => '#99FFFF', |
248 | 248 | 119 => '#99BBFF', |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | 446 => '#06DCFB', |
264 | 264 | 447 => '#892EE4', |
265 | 265 | 460 => '#99FF66', |
266 | - 461 => '#99CC66', # green |
|
267 | - 470 => '#CCCC33', # ocker |
|
266 | + 461 => '#99CC66', # green |
|
267 | + 470 => '#CCCC33', # ocker |
|
268 | 268 | 471 => '#CCFF33', |
269 | 269 | 480 => '#6699FF', |
270 | 270 | 481 => '#66FFFF', |
@@ -279,18 +279,18 @@ discard block |
||
279 | 279 | 1198 => '#FF34B3', |
280 | 280 | 1199 => '#8B1C62', |
281 | 281 | |
282 | - '#61a9f3',# blue |
|
283 | - '#f381b9',# pink |
|
282 | + '#61a9f3', # blue |
|
283 | + '#f381b9', # pink |
|
284 | 284 | '#61E3A9', |
285 | 285 | '#D56DE2', |
286 | 286 | '#85eD82', |
287 | 287 | '#F7b7b7', |
288 | 288 | '#CFDF49', |
289 | 289 | '#88d8f2', |
290 | - '#07AF7B',# green |
|
290 | + '#07AF7B', # green |
|
291 | 291 | '#B9E3F9', |
292 | 292 | '#FFF3AD', |
293 | - '#EF606A',# red |
|
293 | + '#EF606A', # red |
|
294 | 294 | '#EC8833', |
295 | 295 | '#FFF100', |
296 | 296 | '#87C9A5', |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | public function getFilters() |
405 | 405 | { |
406 | 406 | return [ |
407 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
407 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
408 | 408 | ]; |
409 | 409 | } |
410 | 410 |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false) |
51 | 51 | { |
52 | - $this->fulfilled = (bool) $fulfilled; |
|
53 | - $this->testMessage = (string) $testMessage; |
|
54 | - $this->helpHtml = (string) $helpHtml; |
|
55 | - $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText; |
|
56 | - $this->optional = (bool) $optional; |
|
52 | + $this->fulfilled = (bool)$fulfilled; |
|
53 | + $this->testMessage = (string)$testMessage; |
|
54 | + $this->helpHtml = (string)$helpHtml; |
|
55 | + $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string)$helpText; |
|
56 | + $this->optional = (bool)$optional; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | ); |
545 | 545 | } |
546 | 546 | |
547 | - $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null; |
|
547 | + $pcreVersion = defined('PCRE_VERSION') ? (float)PCRE_VERSION : null; |
|
548 | 548 | |
549 | 549 | $this->addRequirement( |
550 | 550 | null !== $pcreVersion, |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | $unit = ''; |
784 | 784 | if (!ctype_digit($size)) { |
785 | 785 | $unit = strtolower(substr($size, -1, 1)); |
786 | - $size = (int) substr($size, 0, -1); |
|
786 | + $size = (int)substr($size, 0, -1); |
|
787 | 787 | } |
788 | 788 | switch ($unit) { |
789 | 789 | case 'g': |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | case 'k': |
794 | 794 | return $size * 1024; |
795 | 795 | default: |
796 | - return (int) $size; |
|
796 | + return (int)$size; |
|
797 | 797 | } |
798 | 798 | } |
799 | 799 | |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | continue; |
816 | 816 | } |
817 | 817 | |
818 | - return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION; |
|
818 | + return (int)$package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION; |
|
819 | 819 | } |
820 | 820 | |
821 | 821 | return false; |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | $username = $request->query->get('user'); |
28 | 28 | |
29 | 29 | if (($project || $queryProject) && $username) { |
30 | - $routeParams = [ 'project'=>($project ?: $queryProject), 'username' => $username ]; |
|
30 | + $routeParams = ['project'=>($project ?: $queryProject), 'username' => $username]; |
|
31 | 31 | return $this->redirectToRoute("EditCounterResult", $routeParams); |
32 | 32 | } elseif (!$project && $queryProject) { |
33 | - return $this->redirectToRoute("EditCounterProject", [ 'project'=>$queryProject ]); |
|
33 | + return $this->redirectToRoute("EditCounterProject", ['project'=>$queryProject]); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // Otherwise fall through. |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | 'rev_small' => $revisionCounts['small'], |
106 | 106 | 'rev_large' => $revisionCounts['large'], |
107 | 107 | 'with_comments' => $revisionCounts['with_comments'], |
108 | - 'without_comments' => $revisionCounts['live'] - $revisionCounts['with_comments'], |
|
108 | + 'without_comments' => $revisionCounts['live']-$revisionCounts['with_comments'], |
|
109 | 109 | 'minor_edits' => $revisionCounts['minor_edits'], |
110 | - 'nonminor_edits' => $revisionCounts['live'] - $revisionCounts['minor_edits'], |
|
110 | + 'nonminor_edits' => $revisionCounts['live']-$revisionCounts['minor_edits'], |
|
111 | 111 | |
112 | 112 | // Page counts. |
113 | 113 | 'uniquePages' => $pageCounts['unique'], |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | $this->setUp($project); |
45 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
45 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
46 | 46 | $query = new SimpleRequest('query', $params); |
47 | 47 | $result = []; |
48 | 48 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | $this->setUp($project); |
70 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
70 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
71 | 71 | $query = new SimpleRequest('query', $params); |
72 | 72 | $result = []; |
73 | 73 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | $this->setUp($project); |
101 | - $query = new SimpleRequest('query', [ "meta"=>"siteinfo", "siprop"=>"namespaces" ]); |
|
101 | + $query = new SimpleRequest('query', ["meta"=>"siteinfo", "siprop"=>"namespaces"]); |
|
102 | 102 | $result = []; |
103 | 103 | |
104 | 104 | try { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $normalized = []; |
212 | 212 | if (isset($result['query']['normalized'])) { |
213 | 213 | array_map( |
214 | - function ($e) use (&$normalized) { |
|
214 | + function($e) use (&$normalized) { |
|
215 | 215 | $normalized[$e['to']] = $e['from']; |
216 | 216 | }, |
217 | 217 | $result['query']['normalized'] |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | ]; |
256 | 256 | |
257 | 257 | // get assessments for this page from the API |
258 | - $assessments = $this->massApi($params, $project, function ($data) { |
|
258 | + $assessments = $this->massApi($params, $project, function($data) { |
|
259 | 259 | return isset($data['pages'][0]['pageassessments']) ? $data['pages'][0]['pageassessments'] : []; |
260 | 260 | }, 'pacontinue')['pages']; |
261 | 261 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $assessment['class']['value'] = '???'; |
284 | 284 | // $1 is used to substitute the WikiProject name, e.g. Category:FA-Class Wikipedia 1.0 articles |
285 | 285 | $assessment['class']['category'] = str_replace('$1', $wikiproject, $classAttrs['category']); |
286 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". $classAttrs['badge']; |
|
286 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".$classAttrs['badge']; |
|
287 | 287 | } else { |
288 | 288 | $classAttrs = $config['class'][$classValue]; |
289 | 289 | $assessment['class'] = [ |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | // add full URL to badge icon |
296 | 296 | if ($classAttrs['badge'] !== '') { |
297 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/" . |
|
297 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". |
|
298 | 298 | $classAttrs['badge']; |
299 | 299 | } |
300 | 300 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $query = FluentRequest::factory()->setAction('query')->setParams($requestData); |
421 | 421 | $innerPromise = $this->api->getRequestAsync($query); |
422 | 422 | |
423 | - $innerPromise->then(function ($result) use (&$data) { |
|
423 | + $innerPromise->then(function($result) use (&$data) { |
|
424 | 424 | // some failures come back as 200s, so we still resolve and let the outer function handle it |
425 | 425 | if (isset($result['error']) || !isset($result['query'])) { |
426 | 426 | return $data['promise']->resolve($data); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function getUserId($usernameOrIp) |
35 | 35 | { |
36 | 36 | // Use cache if possible. |
37 | - $cacheKey = 'usernameOrIp.' . $usernameOrIp; |
|
37 | + $cacheKey = 'usernameOrIp.'.$usernameOrIp; |
|
38 | 38 | if ($this->cacheHas($cacheKey)) { |
39 | 39 | return $this->cacheGet($cacheKey); |
40 | 40 | } |
@@ -115,24 +115,24 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | $revisionCounts = array_combine( |
118 | - array_map(function ($e) { |
|
118 | + array_map(function($e) { |
|
119 | 119 | return $e['source']; |
120 | 120 | }, $results), |
121 | - array_map(function ($e) { |
|
121 | + array_map(function($e) { |
|
122 | 122 | return $e['value']; |
123 | 123 | }, $results) |
124 | 124 | ); |
125 | 125 | |
126 | 126 | // Count the number of days, accounting for when there's only one edit. |
127 | - $editingTimeInSeconds = ceil($revisionCounts['last'] - $revisionCounts['first']); |
|
128 | - $revisionCounts['days'] = $editingTimeInSeconds ? $editingTimeInSeconds/(60*60*24) : 1; |
|
127 | + $editingTimeInSeconds = ceil($revisionCounts['last']-$revisionCounts['first']); |
|
128 | + $revisionCounts['days'] = $editingTimeInSeconds ? $editingTimeInSeconds / (60 * 60 * 24) : 1; |
|
129 | 129 | |
130 | 130 | // Format the first and last dates. |
131 | 131 | $revisionCounts['first'] = date('Y-m-d H:i', strtotime($revisionCounts['first'])); |
132 | 132 | $revisionCounts['last'] = date('Y-m-d H:i', strtotime($revisionCounts['last'])); |
133 | 133 | |
134 | 134 | // Sum deleted and live to make the total. |
135 | - $revisionCounts['total'] = $revisionCounts['deleted'] + $revisionCounts['live']; |
|
135 | + $revisionCounts['total'] = $revisionCounts['deleted']+$revisionCounts['live']; |
|
136 | 136 | |
137 | 137 | // Calculate the average number of live edits per day. |
138 | 138 | $revisionCounts['avg_per_day'] = round( |
@@ -176,16 +176,16 @@ discard block |
||
176 | 176 | $results = $resultQuery->fetchAll(); |
177 | 177 | |
178 | 178 | $pageCounts = array_combine( |
179 | - array_map(function ($e) { |
|
179 | + array_map(function($e) { |
|
180 | 180 | return $e['source']; |
181 | 181 | }, $results), |
182 | - array_map(function ($e) { |
|
182 | + array_map(function($e) { |
|
183 | 183 | return $e['value']; |
184 | 184 | }, $results) |
185 | 185 | ); |
186 | 186 | |
187 | 187 | // Total created. |
188 | - $pageCounts['created'] = $pageCounts['created-live'] + $pageCounts['created-deleted']; |
|
188 | + $pageCounts['created'] = $pageCounts['created-live']+$pageCounts['created-deleted']; |
|
189 | 189 | |
190 | 190 | // Calculate the average number of edits per page. |
191 | 191 | $pageCounts['edits_per_page'] = 0; |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | $resultQuery->execute(); |
220 | 220 | $results = $resultQuery->fetchAll(); |
221 | 221 | $logCounts = array_combine( |
222 | - array_map(function ($e) { |
|
222 | + array_map(function($e) { |
|
223 | 223 | return $e['source']; |
224 | 224 | }, $results), |
225 | - array_map(function ($e) { |
|
225 | + array_map(function($e) { |
|
226 | 226 | return $e['value']; |
227 | 227 | }, $results) |
228 | 228 | ); |
229 | 229 | |
230 | 230 | // Make sure there is some value for each of the wanted counts. |
231 | 231 | $requiredCounts = [ |
232 | - 'thanks-thank', 'review-approve', 'patrol-patrol','block-block', 'block-unblock', |
|
232 | + 'thanks-thank', 'review-approve', 'patrol-patrol', 'block-block', 'block-unblock', |
|
233 | 233 | 'protect-protect', 'protect-unprotect', 'delete-delete', 'delete-revision', |
234 | 234 | 'delete-restore', 'import-import', 'upload-upload', 'upload-overwrite', |
235 | 235 | ]; |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // Merge approvals together. |
243 | - $logCounts['review-approve'] = $logCounts['review-approve'] + |
|
244 | - (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) + |
|
245 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
243 | + $logCounts['review-approve'] = $logCounts['review-approve']+ |
|
244 | + (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+ |
|
245 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
246 | 246 | (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0); |
247 | 247 | |
248 | 248 | // Add Commons upload count, if applicable. |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | $sql = "SELECT page_namespace, count(rev_id) AS total |
277 | - FROM ".$this->labsHelper->getTable('revision') ." r |
|
277 | + FROM ".$this->labsHelper->getTable('revision')." r |
|
278 | 278 | JOIN ".$this->labsHelper->getTable('page')." p on r.rev_page = p.page_id |
279 | 279 | WHERE r.rev_user = :id GROUP BY page_namespace"; |
280 | 280 | $resultQuery = $this->replicas->prepare($sql); |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | $resultQuery->execute(); |
283 | 283 | $results = $resultQuery->fetchAll(); |
284 | 284 | $namespaceTotals = array_combine( |
285 | - array_map(function ($e) { |
|
285 | + array_map(function($e) { |
|
286 | 286 | return $e['page_namespace']; |
287 | 287 | }, $results), |
288 | - array_map(function ($e) { |
|
288 | + array_map(function($e) { |
|
289 | 289 | return $e['total']; |
290 | 290 | }, $results) |
291 | 291 | ); |