@@ -16,39 +16,39 @@ 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('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
33 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
34 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
35 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
36 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
37 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
38 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
39 | - new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]), |
|
40 | - new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]), |
|
41 | - new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]), |
|
42 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
43 | - new \Twig_SimpleFunction('replag', [ $this, 'replag' ]), |
|
44 | - 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('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
33 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
34 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
35 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
36 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
37 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
38 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
39 | + new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']), |
|
40 | + new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']), |
|
41 | + new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']), |
|
42 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
43 | + new \Twig_SimpleFunction('replag', [$this, 'replag']), |
|
44 | + new \Twig_SimpleFunction('link', [$this, 'link']), |
|
45 | 45 | ]; |
46 | 46 | } |
47 | 47 | |
48 | 48 | public function requestTime($decimals = 3) |
49 | 49 | { |
50 | 50 | |
51 | - return number_format(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
51 | + return number_format(microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function requestMemory() |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function linkToWiki($url, $page, $secondary = "") |
76 | 76 | { |
77 | - $link = $url . "/"; |
|
77 | + $link = $url."/"; |
|
78 | 78 | |
79 | 79 | if ($this->isWMFLabs()) { |
80 | 80 | $link .= "wiki/"; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | public function linkToWikiScript($url, $secondary) |
93 | 93 | { |
94 | - $link = $url . "/"; |
|
94 | + $link = $url."/"; |
|
95 | 95 | |
96 | 96 | if ($this->isWMFLabs()) { |
97 | 97 | $link .= "w/"; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | // TODO: refactor all intuition stuff so it can be used anywhere |
108 | 108 | public function intuitionMessageExists($message = "") |
109 | 109 | { |
110 | - return $this->getIntuition()->msgExists($message, [ "domain" => "xtools" ]); |
|
110 | + return $this->getIntuition()->msgExists($message, ["domain" => "xtools"]); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | public function intuitionMessagePrintExists($message = "", $vars = []) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | public function intuitionMessage($message = "", $vars = []) |
128 | 128 | { |
129 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
129 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | public function intuitionMessageFooter() |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getAllLangs() |
156 | 156 | { |
157 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
157 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
158 | 158 | |
159 | 159 | $languages = array_values(array_unique(array_map( |
160 | - function ($filename) { |
|
160 | + function($filename) { |
|
161 | 161 | return basename($filename, '.json'); |
162 | 162 | }, |
163 | 163 | $messageFiles |
@@ -214,41 +214,41 @@ discard block |
||
214 | 214 | public static function getColorList($num = false) |
215 | 215 | { |
216 | 216 | $colors = [ |
217 | - 0 => '#Cc0000',# '#FF005A', #red '#FF5555', |
|
217 | + 0 => '#Cc0000', # '#FF005A', #red '#FF5555', |
|
218 | 218 | 1 => '#F7b7b7', |
219 | - 2 => '#5c8d20',# '#008800', #green'#55FF55', |
|
219 | + 2 => '#5c8d20', # '#008800', #green'#55FF55', |
|
220 | 220 | 3 => '#85eD82', |
221 | 221 | 4 => '#2E97E0', # blue |
222 | 222 | 5 => '#B9E3F9', |
223 | - 6 => '#e1711d', # orange |
|
223 | + 6 => '#e1711d', # orange |
|
224 | 224 | 7 => '#ffc04c', |
225 | 225 | 8 => '#FDFF98', # yellow |
226 | 226 | 9 => '#5555FF', |
227 | 227 | 10 => '#55FFFF', |
228 | - 11 => '#0000C0', # |
|
229 | - 12 => '#008800', # green |
|
228 | + 11 => '#0000C0', # |
|
229 | + 12 => '#008800', # green |
|
230 | 230 | 13 => '#00C0C0', |
231 | - 14 => '#FFAFAF', # rosé |
|
232 | - 15 => '#808080', # gray |
|
231 | + 14 => '#FFAFAF', # rosé |
|
232 | + 15 => '#808080', # gray |
|
233 | 233 | 16 => '#00C000', |
234 | 234 | 17 => '#404040', |
235 | - 18 => '#C0C000', # green |
|
235 | + 18 => '#C0C000', # green |
|
236 | 236 | 19 => '#C000C0', |
237 | - 100 => '#75A3D1', # blue |
|
238 | - 101 => '#A679D2', # purple |
|
237 | + 100 => '#75A3D1', # blue |
|
238 | + 101 => '#A679D2', # purple |
|
239 | 239 | 102 => '#660000', |
240 | 240 | 103 => '#000066', |
241 | - 104 => '#FAFFAF', # caramel |
|
241 | + 104 => '#FAFFAF', # caramel |
|
242 | 242 | 105 => '#408345', |
243 | 243 | 106 => '#5c8d20', |
244 | - 107 => '#e1711d', # red |
|
245 | - 108 => '#94ef2b', # light green |
|
246 | - 109 => '#756a4a', # brown |
|
244 | + 107 => '#e1711d', # red |
|
245 | + 108 => '#94ef2b', # light green |
|
246 | + 109 => '#756a4a', # brown |
|
247 | 247 | 110 => '#6f1dab', |
248 | 248 | 111 => '#301e30', |
249 | 249 | 112 => '#5c9d96', |
250 | - 113 => '#a8cd8c', # earth green |
|
251 | - 114 => '#f2b3f1', # light purple |
|
250 | + 113 => '#a8cd8c', # earth green |
|
251 | + 114 => '#f2b3f1', # light purple |
|
252 | 252 | 115 => '#9b5828', |
253 | 253 | 118 => '#99FFFF', |
254 | 254 | 119 => '#99BBFF', |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | 446 => '#06DCFB', |
270 | 270 | 447 => '#892EE4', |
271 | 271 | 460 => '#99FF66', |
272 | - 461 => '#99CC66', # green |
|
273 | - 470 => '#CCCC33', # ocker |
|
272 | + 461 => '#99CC66', # green |
|
273 | + 470 => '#CCCC33', # ocker |
|
274 | 274 | 471 => '#CCFF33', |
275 | 275 | 480 => '#6699FF', |
276 | 276 | 481 => '#66FFFF', |
@@ -285,18 +285,18 @@ discard block |
||
285 | 285 | 1198 => '#FF34B3', |
286 | 286 | 1199 => '#8B1C62', |
287 | 287 | |
288 | - '#61a9f3',# blue |
|
289 | - '#f381b9',# pink |
|
288 | + '#61a9f3', # blue |
|
289 | + '#f381b9', # pink |
|
290 | 290 | '#61E3A9', |
291 | 291 | '#D56DE2', |
292 | 292 | '#85eD82', |
293 | 293 | '#F7b7b7', |
294 | 294 | '#CFDF49', |
295 | 295 | '#88d8f2', |
296 | - '#07AF7B',# green |
|
296 | + '#07AF7B', # green |
|
297 | 297 | '#B9E3F9', |
298 | 298 | '#FFF3AD', |
299 | - '#EF606A',# red |
|
299 | + '#EF606A', # red |
|
300 | 300 | '#EC8833', |
301 | 301 | '#FFF100', |
302 | 302 | '#87C9A5', |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | public function getFilters() |
414 | 414 | { |
415 | 415 | return [ |
416 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
416 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
417 | 417 | ]; |
418 | 418 | } |
419 | 419 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'username' => $username, |
57 | 57 | ]); |
58 | 58 | } elseif ($projectQuery != "") { |
59 | - return $this->redirectToRoute("PagesProject", [ 'project'=>$projectQuery ]); |
|
59 | + return $this->redirectToRoute("PagesProject", ['project'=>$projectQuery]); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // set default wiki so we can populate the namespace selector |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | // show error message and redirect back to default project |
75 | 75 | $this->addFlash("notice", [$e->getMessage()]); |
76 | 76 | $project = $this->container->getParameter('default_project'); |
77 | - return $this->redirectToRoute("PagesProject", [ 'project'=>$project ]); |
|
77 | + return $this->redirectToRoute("PagesProject", ['project'=>$project]); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Otherwise fall through. |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | JOIN $revisionTable ON page_id = rev_page |
184 | 184 | $paJoin |
185 | 185 | WHERE $whereRev AND rev_parent_id = '0' $namespaceConditionRev $redirectCondition |
186 | - " . ($hasPageAssessments ? "GROUP BY rev_page" : "") . " |
|
186 | + ".($hasPageAssessments ? "GROUP BY rev_page" : "")." |
|
187 | 187 | ) |
188 | 188 | |
189 | 189 | UNION |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | if ($total < 1) { |
270 | - $this->addFlash("notice", [ "noresult", $username ]); |
|
271 | - return $this->redirectToRoute("PagesProject", [ "project"=>$project ]); |
|
270 | + $this->addFlash("notice", ["noresult", $username]); |
|
271 | + return $this->redirectToRoute("PagesProject", ["project"=>$project]); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | ksort($pagesByNamespaceByDate); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'username' => $username, |
49 | 49 | ]); |
50 | 50 | } elseif ($project != "") { |
51 | - return $this->redirectToRoute("TopEditsResults", [ 'project'=>$project ]); |
|
51 | + return $this->redirectToRoute("TopEditsResults", ['project'=>$project]); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | // set default wiki so we can populate the namespace selector |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // show error message and redirect back to default project |
67 | 67 | $this->addFlash("notice", [$e->getMessage()]); |
68 | 68 | $project = $this->container->getParameter('default_project'); |
69 | - return $this->redirectToRoute("PagesProject", [ 'project'=>$project ]); |
|
69 | + return $this->redirectToRoute("PagesProject", ['project'=>$project]); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | return $this->render('topedits/index.html.twig', [ |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $editData = $conn->executeQuery($query, $params)->fetchAll(); |
120 | 120 | |
121 | 121 | // Get page info about these 100 pages, so we can use their display title. |
122 | - $titles = array_map(function ($e) { |
|
122 | + $titles = array_map(function($e) { |
|
123 | 123 | return $e['page_title']; |
124 | 124 | }, $editData); |
125 | 125 | /** @var ApiHelper $apiHelper */ |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function groups($project, $username) |
56 | 56 | { |
57 | 57 | $this->setUp($project); |
58 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
58 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
59 | 59 | $query = new SimpleRequest('query', $params); |
60 | 60 | $result = []; |
61 | 61 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function globalGroups($project, $username) |
75 | 75 | { |
76 | 76 | $this->setUp($project); |
77 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
77 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
78 | 78 | $query = new SimpleRequest('query', $params); |
79 | 79 | $result = []; |
80 | 80 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | $this->setUp($project); |
107 | - $query = new SimpleRequest('query', [ "meta"=>"siteinfo", "siprop"=>"namespaces" ]); |
|
107 | + $query = new SimpleRequest('query', ["meta"=>"siteinfo", "siprop"=>"namespaces"]); |
|
108 | 108 | $namespaces = []; |
109 | 109 | |
110 | 110 | try { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $groups[] = "B"; |
161 | 161 | } |
162 | 162 | if (in_array("steward", $admin["groups"])) { |
163 | - $groups[] = "S" ; |
|
163 | + $groups[] = "S"; |
|
164 | 164 | } |
165 | 165 | if (in_array("checkuser", $admin["groups"])) { |
166 | 166 | $groups[] = "CU"; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | if (in_array("bot", $admin["groups"])) { |
172 | 172 | $groups[] = "Bot"; |
173 | 173 | } |
174 | - $result[ $admin["name"] ] = [ |
|
174 | + $result[$admin["name"]] = [ |
|
175 | 175 | "groups" => implode('/', $groups) |
176 | 176 | ]; |
177 | 177 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $normalized = []; |
247 | 247 | if (isset($result['query']['normalized'])) { |
248 | 248 | array_map( |
249 | - function ($e) use (&$normalized) { |
|
249 | + function($e) use (&$normalized) { |
|
250 | 250 | $normalized[$e['to']] = $e['from']; |
251 | 251 | }, |
252 | 252 | $result['query']['normalized'] |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | ]; |
293 | 293 | |
294 | 294 | // get assessments for this page from the API |
295 | - $assessments = $this->massApi($params, $project, function ($data) { |
|
295 | + $assessments = $this->massApi($params, $project, function($data) { |
|
296 | 296 | return isset($data['pages'][0]['pageassessments']) ? $data['pages'][0]['pageassessments'] : []; |
297 | 297 | }, 'pacontinue')['pages']; |
298 | 298 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $classAttrs = $config['class']['Unknown']; |
317 | 317 | $assessment['class']['value'] = '???'; |
318 | 318 | $assessment['class']['category'] = $classAttrs['category']; |
319 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". $classAttrs['badge']; |
|
319 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".$classAttrs['badge']; |
|
320 | 320 | } else { |
321 | 321 | $classAttrs = $config['class'][$classValue]; |
322 | 322 | $assessment['class'] = [ |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | // add full URL to badge icon |
329 | 329 | if ($classAttrs['badge'] !== '') { |
330 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/" . |
|
330 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". |
|
331 | 331 | $classAttrs['badge']; |
332 | 332 | } |
333 | 333 | |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | $config = $this->getAssessmentsConfig(); |
377 | 377 | |
378 | 378 | if (isset($config[$project]['class'][$class])) { |
379 | - return "https://upload.wikimedia.org/wikipedia/commons/" . $config[$project]['class'][$class]['badge']; |
|
379 | + return "https://upload.wikimedia.org/wikipedia/commons/".$config[$project]['class'][$class]['badge']; |
|
380 | 380 | } elseif (isset($config[$project]['class']['Unknown'])) { |
381 | - return "https://upload.wikimedia.org/wikipedia/commons/" . $config[$project]['class']['Unknown']['badge']; |
|
381 | + return "https://upload.wikimedia.org/wikipedia/commons/".$config[$project]['class']['Unknown']['badge']; |
|
382 | 382 | } else { |
383 | 383 | return ""; |
384 | 384 | } |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $query = FluentRequest::factory()->setAction('query')->setParams($requestData); |
472 | 472 | $innerPromise = $this->api->getRequestAsync($query); |
473 | 473 | |
474 | - $innerPromise->then(function ($result) use (&$data) { |
|
474 | + $innerPromise->then(function($result) use (&$data) { |
|
475 | 475 | // some failures come back as 200s, so we still resolve and let the outer function handle it |
476 | 476 | if (isset($result['error']) || !isset($result['query'])) { |
477 | 477 | return $data['promise']->resolve($data); |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | $username = $request->query->get('username'); |
31 | 31 | |
32 | 32 | if (($project || $queryProject) && $username) { |
33 | - $routeParams = [ 'project'=>($project ?: $queryProject), 'username' => $username ]; |
|
33 | + $routeParams = ['project'=>($project ?: $queryProject), 'username' => $username]; |
|
34 | 34 | return $this->redirectToRoute("EditCounterResult", $routeParams); |
35 | 35 | } elseif (!$project && $queryProject) { |
36 | - return $this->redirectToRoute("EditCounterProject", [ 'project'=>$queryProject ]); |
|
36 | + return $this->redirectToRoute("EditCounterProject", ['project'=>$queryProject]); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Otherwise fall through. |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | 'rev_small' => $revisionCounts['small'], |
115 | 115 | 'rev_large' => $revisionCounts['large'], |
116 | 116 | 'with_comments' => $revisionCounts['with_comments'], |
117 | - 'without_comments' => $revisionCounts['live'] - $revisionCounts['with_comments'], |
|
117 | + 'without_comments' => $revisionCounts['live']-$revisionCounts['with_comments'], |
|
118 | 118 | 'minor_edits' => $revisionCounts['minor_edits'], |
119 | - 'nonminor_edits' => $revisionCounts['live'] - $revisionCounts['minor_edits'], |
|
119 | + 'nonminor_edits' => $revisionCounts['live']-$revisionCounts['minor_edits'], |
|
120 | 120 | |
121 | 121 | // Page counts. |
122 | 122 | 'uniquePages' => $pageCounts['unique'], |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | $article = $request->query->get('article'); |
56 | 56 | |
57 | 57 | if ($projectQuery != '' && $article != '') { |
58 | - return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]); |
|
58 | + return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]); |
|
59 | 59 | } elseif ($article != '') { |
60 | - return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]); |
|
60 | + return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $this->render('articleInfo/index.html.twig', [ |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'url' => $basicInfo['fullurl'] |
103 | 103 | ]; |
104 | 104 | |
105 | - $this->pageInfo['watchers'] = ( isset($basicInfo['watchers']) ) ? $basicInfo['watchers'] : "< 30"; |
|
105 | + $this->pageInfo['watchers'] = (isset($basicInfo['watchers'])) ? $basicInfo['watchers'] : "< 30"; |
|
106 | 106 | |
107 | 107 | $pageProps = isset($basicInfo['pageprops']) ? $basicInfo['pageprops'] : []; |
108 | 108 | |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function getRevCount() |
166 | 166 | { |
167 | - $query = "SELECT COUNT(*) AS count FROM " . $this->revisionTable |
|
168 | - . " WHERE rev_page = '" . $this->pageInfo['id'] . "'"; |
|
167 | + $query = "SELECT COUNT(*) AS count FROM ".$this->revisionTable |
|
168 | + . " WHERE rev_page = '".$this->pageInfo['id']."'"; |
|
169 | 169 | $res = $this->conn->query($query)->fetchAll(); |
170 | 170 | return $res[0]['count']; |
171 | 171 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | FROM $this->revisionTable |
198 | 198 | LEFT JOIN $userGroupsTable ON rev_user = ug_user |
199 | 199 | LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user |
200 | - WHERE rev_page = " . $this->pageInfo['id'] . " AND (ug_group = 'bot' OR ufg_group = 'bot') |
|
200 | + WHERE rev_page = ".$this->pageInfo['id']." AND (ug_group = 'bot' OR ufg_group = 'bot') |
|
201 | 201 | GROUP BY rev_user_text"; |
202 | 202 | $res = $this->conn->query($query)->fetchAll(); |
203 | 203 | |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | $sum = 0; |
207 | 207 | foreach ($res as $bot) { |
208 | 208 | $bots[$bot['username']] = [ |
209 | - 'count' => (int) $bot['count'], |
|
209 | + 'count' => (int)$bot['count'], |
|
210 | 210 | 'current' => $bot['current'] === 'bot' |
211 | 211 | ]; |
212 | 212 | $sum += $bot['count']; |
213 | 213 | } |
214 | 214 | |
215 | - uasort($bots, function ($a, $b) { |
|
216 | - return $b['count'] - $a['count']; |
|
215 | + uasort($bots, function($a, $b) { |
|
216 | + return $b['count']-$a['count']; |
|
217 | 217 | }); |
218 | 218 | |
219 | 219 | $this->pageInfo['general']['bot_revision_count'] = $sum; |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | |
250 | 250 | if ($info['all'] > 1) { |
251 | 251 | // Number of seconds between first and last edit |
252 | - $secs = intval(strtotime($info['last']) - strtotime($info['first']) / $info['all']); |
|
252 | + $secs = intval(strtotime($info['last'])-strtotime($info['first']) / $info['all']); |
|
253 | 253 | |
254 | 254 | // Average time between edits (in days) |
255 | - $this->pageInfo['editors'][$editor]['atbe'] = $secs / ( 60 * 60 * 24 ); |
|
255 | + $this->pageInfo['editors'][$editor]['atbe'] = $secs / (60 * 60 * 24); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | if (count($info['sizes'])) { |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | |
299 | 299 | // Transform to associative array by 'type' |
300 | 300 | foreach ($res as $row) { |
301 | - $data[$row['type'] . '_count'] = $row['value']; |
|
301 | + $data[$row['type'].'_count'] = $row['value']; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | return $data; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $title = str_replace(' ', '_', $this->pageInfo['title']); |
315 | 315 | $query = "SELECT log_action, log_type, log_timestamp AS timestamp |
316 | 316 | FROM $loggingTable |
317 | - WHERE log_namespace = '" . $this->pageInfo['namespace'] . "' |
|
317 | + WHERE log_namespace = '".$this->pageInfo['namespace']."' |
|
318 | 318 | AND log_title = '$title' AND log_timestamp > 1 |
319 | 319 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
320 | 320 | $events = $this->conn->query($query)->fetchAll(); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $conn = $this->container->get('doctrine')->getManager('replicas')->getConnection(); |
396 | 396 | $res = $conn->query($query)->fetchAll(); |
397 | 397 | |
398 | - $terms = array_map(function ($entry) { |
|
398 | + $terms = array_map(function($entry) { |
|
399 | 399 | return $entry['term']; |
400 | 400 | }, $res); |
401 | 401 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | 'prio' => 2, |
407 | 407 | 'name' => 'Wikidata', |
408 | 408 | 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n |
409 | - 'explanation' => "See: <a target='_blank' " . |
|
409 | + 'explanation' => "See: <a target='_blank' ". |
|
410 | 410 | "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>", |
411 | 411 | ]; |
412 | 412 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | 'prio' => 3, |
416 | 416 | 'name' => 'Wikidata', |
417 | 417 | 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n |
418 | - 'explanation' => "See: <a target='_blank' " . |
|
418 | + 'explanation' => "See: <a target='_blank' ". |
|
419 | 419 | "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>", |
420 | 420 | ]; |
421 | 421 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $query = "SELECT rev_id, rev_parent_id, rev_user_text, rev_user, rev_timestamp, |
433 | 433 | rev_minor_edit, rev_len, rev_comment |
434 | 434 | FROM $this->revisionTable |
435 | - WHERE rev_page = '" . $this->pageInfo['id'] . "' AND rev_timestamp > 1 |
|
435 | + WHERE rev_page = '".$this->pageInfo['id']."' AND rev_timestamp > 1 |
|
436 | 436 | ORDER BY rev_timestamp"; |
437 | 437 | |
438 | 438 | $res = $this->conn->query($query)->fetchAll(); |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | return $rev['rev_len']; |
453 | 453 | } |
454 | 454 | |
455 | - $lastRev = $this->pageHistory[$revIndex - 1]; |
|
455 | + $lastRev = $this->pageHistory[$revIndex-1]; |
|
456 | 456 | |
457 | - return $rev['rev_len'] - $lastRev['rev_len']; |
|
457 | + return $rev['rev_len']-$lastRev['rev_len']; |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | // The month of the first edit. Used as a comparison when building the per-month data |
475 | 475 | $firstEditMonth = strtotime(date('Y-m-01, 00:00', strtotime($firstEdit['rev_timestamp']))); |
476 | 476 | |
477 | - $lastEdit = $this->pageHistory[ $revisionCount - 1 ]; |
|
478 | - $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[ $revisionCount - 2 ]; |
|
477 | + $lastEdit = $this->pageHistory[$revisionCount-1]; |
|
478 | + $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[$revisionCount-2]; |
|
479 | 479 | |
480 | 480 | // Now we can start our master array. This one will be HUGE! |
481 | 481 | $lastEditSize = ($revisionCount > 1) |
482 | - ? $lastEdit['rev_len'] - $secondLastEdit['rev_len'] |
|
482 | + ? $lastEdit['rev_len']-$secondLastEdit['rev_len'] |
|
483 | 483 | : $lastEdit['rev_len']; |
484 | 484 | $data = [ |
485 | 485 | 'general' => [ |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | // Increment year and month counts for all edits |
577 | 577 | $data['year_count'][$timestamp['year']]['all']++; |
578 | 578 | $data['year_count'][$timestamp['year']]['months'][$timestamp['month']]['all']++; |
579 | - $data['year_count'][$timestamp['year']]['size'] = (int) $rev['rev_len']; |
|
579 | + $data['year_count'][$timestamp['year']]['size'] = (int)$rev['rev_len']; |
|
580 | 580 | |
581 | 581 | $editsThisMonth = $data['year_count'][$timestamp['year']]['months'][$timestamp['month']]['all']; |
582 | 582 | if ($editsThisMonth > $data['max_edits_per_month']) { |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | } |
621 | 621 | |
622 | 622 | // determine if the next revision was a revert |
623 | - $nextRevision = isset($this->pageHistory[$i + 1]) ? $this->pageHistory[$i + 1] : null; |
|
623 | + $nextRevision = isset($this->pageHistory[$i+1]) ? $this->pageHistory[$i+1] : null; |
|
624 | 624 | $nextRevisionIsRevert = $nextRevision && |
625 | - $this->getDiffSize($i + 1) === -$diffSize && |
|
625 | + $this->getDiffSize($i+1) === -$diffSize && |
|
626 | 626 | $this->aeh->isRevert($nextRevision['rev_comment']); |
627 | 627 | |
628 | 628 | // don't count this edit as content removal if the next edit reverted it |
@@ -14,25 +14,25 @@ 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('user_log_link', [ $this, 'userLogLink' ], $options), |
|
29 | - new Twig_SimpleFunction('group_link', [ $this, 'groupLink' ], $options), |
|
30 | - new Twig_SimpleFunction('wiki_history_link', [ $this, 'wikiHistoryLink' ], $options), |
|
31 | - new Twig_SimpleFunction('wiki_log_link', [ $this, 'wikiLogLink' ], $options), |
|
32 | - new Twig_SimpleFunction('pageviews_links', [ $this, 'pageviewsLinks' ], $options), |
|
33 | - new Twig_SimpleFunction('diff_link', [ $this, 'diffLink' ], $options), |
|
34 | - new Twig_SimpleFunction('perma_link', [ $this, 'permaLink' ], $options), |
|
35 | - new Twig_SimpleFunction('edit_link', [ $this, 'editLink' ], $options), |
|
26 | + new Twig_SimpleFunction('wiki_link', [$this, 'wikiLink'], $options), |
|
27 | + new Twig_SimpleFunction('user_link', [$this, 'userLink'], $options), |
|
28 | + new Twig_SimpleFunction('user_log_link', [$this, 'userLogLink'], $options), |
|
29 | + new Twig_SimpleFunction('group_link', [$this, 'groupLink'], $options), |
|
30 | + new Twig_SimpleFunction('wiki_history_link', [$this, 'wikiHistoryLink'], $options), |
|
31 | + new Twig_SimpleFunction('wiki_log_link', [$this, 'wikiLogLink'], $options), |
|
32 | + new Twig_SimpleFunction('pageviews_links', [$this, 'pageviewsLinks'], $options), |
|
33 | + new Twig_SimpleFunction('diff_link', [$this, 'diffLink'], $options), |
|
34 | + new Twig_SimpleFunction('perma_link', [$this, 'permaLink'], $options), |
|
35 | + new Twig_SimpleFunction('edit_link', [$this, 'editLink'], $options), |
|
36 | 36 | ]; |
37 | 37 | } |
38 | 38 | |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | public function getFilters() |
245 | 245 | { |
246 | 246 | return [ |
247 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
248 | - new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]), |
|
249 | - new \Twig_SimpleFilter('wikify_comment', [ $this, 'wikifyComment' ], [ 'is_safe' => [ 'html' ] ]), |
|
247 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
248 | + new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]), |
|
249 | + new \Twig_SimpleFilter('wikify_comment', [$this, 'wikifyComment'], ['is_safe' => ['html']]), |
|
250 | 250 | ]; |
251 | 251 | } |
252 | 252 | |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | if (!$denominator) { |
283 | 283 | $quotient = $numerator; |
284 | 284 | } else { |
285 | - $quotient = ( $numerator / $denominator ) * 100; |
|
285 | + $quotient = ($numerator / $denominator) * 100; |
|
286 | 286 | } |
287 | 287 | |
288 | - return round($quotient, $precision) . '%'; |
|
288 | + return round($quotient, $precision).'%'; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | if ($isSection) { |
304 | 304 | $sectionTitle = $sectionMatch[1][0]; |
305 | 305 | $sectionTitleLink = str_replace(' ', '_', $sectionTitle); |
306 | - $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>→</a>" . |
|
306 | + $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>→</a>". |
|
307 | 307 | "<em class='text-muted'>$sectionTitle:</em> "; |
308 | 308 | $wikitext = str_replace($sectionMatch[0][0], $sectionWikitext, $wikitext); |
309 | 309 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | return $this->render( |
112 | 112 | 'quote/all.html.twig', [ |
113 | 113 | 'base_dir' => realpath( |
114 | - $this->getParameter('kernel.root_dir') . '/..' |
|
114 | + $this->getParameter('kernel.root_dir').'/..' |
|
115 | 115 | ), |
116 | 116 | "xtPage" => "bash", |
117 | 117 | "xtPageTitle" => "tool_bash", |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | return $this->render( |
162 | 162 | 'quote/view.html.twig', [ |
163 | 163 | 'base_dir' => realpath( |
164 | - $this->getParameter('kernel.root_dir') . '/..' |
|
164 | + $this->getParameter('kernel.root_dir').'/..' |
|
165 | 165 | ), |
166 | 166 | "xtPage" => "bash", |
167 | 167 | "xtPageTitle" => "tool_bash", |