@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $apiPath = $this->container->getParameter('api_path'); |
40 | 40 | |
41 | 41 | try { |
42 | - $this->api = MediawikiApi::newFromApiEndpoint($normalizedProject . $apiPath); |
|
42 | + $this->api = MediawikiApi::newFromApiEndpoint($normalizedProject.$apiPath); |
|
43 | 43 | } catch (Exception $e) { |
44 | 44 | // Do nothing... |
45 | 45 | } catch (FatalErrorException $e) { |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | throw new Exception("Unable to find project '$project'"); |
69 | 69 | } |
70 | 70 | |
71 | - $cacheKey = "siteinfo." . str_replace('/', '_', $normalizedProject); |
|
71 | + $cacheKey = "siteinfo.".str_replace('/', '_', $normalizedProject); |
|
72 | 72 | if ($this->cacheHas($cacheKey)) { |
73 | 73 | return $this->cacheGet($cacheKey); |
74 | 74 | } |
75 | 75 | |
76 | 76 | $this->setUp($normalizedProject); |
77 | - $params = [ 'meta'=>'siteinfo', 'siprop'=>'general|namespaces' ]; |
|
77 | + $params = ['meta'=>'siteinfo', 'siprop'=>'general|namespaces']; |
|
78 | 78 | $query = new SimpleRequest('query', $params); |
79 | 79 | |
80 | 80 | $result = [ |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | public function groups($project, $username) |
139 | 139 | { |
140 | 140 | $this->setUp($project); |
141 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
141 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
142 | 142 | $query = new SimpleRequest('query', $params); |
143 | 143 | $result = []; |
144 | 144 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public function globalGroups($project, $username) |
158 | 158 | { |
159 | 159 | $this->setUp($project); |
160 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
160 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
161 | 161 | $query = new SimpleRequest('query', $params); |
162 | 162 | $result = []; |
163 | 163 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $groups[] = "B"; |
206 | 206 | } |
207 | 207 | if (in_array("steward", $admin["groups"])) { |
208 | - $groups[] = "S" ; |
|
208 | + $groups[] = "S"; |
|
209 | 209 | } |
210 | 210 | if (in_array("checkuser", $admin["groups"])) { |
211 | 211 | $groups[] = "CU"; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | if (in_array("bot", $admin["groups"])) { |
217 | 217 | $groups[] = "Bot"; |
218 | 218 | } |
219 | - $result[ $admin["name"] ] = [ |
|
219 | + $result[$admin["name"]] = [ |
|
220 | 220 | "groups" => implode('/', $groups) |
221 | 221 | ]; |
222 | 222 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $normalized = []; |
292 | 292 | if (isset($result['query']['normalized'])) { |
293 | 293 | array_map( |
294 | - function ($e) use (&$normalized) { |
|
294 | + function($e) use (&$normalized) { |
|
295 | 295 | $normalized[$e['to']] = $e['from']; |
296 | 296 | }, |
297 | 297 | $result['query']['normalized'] |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | ]; |
338 | 338 | |
339 | 339 | // get assessments for this page from the API |
340 | - $assessments = $this->massApi($params, $project, function ($data) { |
|
340 | + $assessments = $this->massApi($params, $project, function($data) { |
|
341 | 341 | return isset($data['pages'][0]['pageassessments']) ? $data['pages'][0]['pageassessments'] : []; |
342 | 342 | }, 'pacontinue')['pages']; |
343 | 343 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $classAttrs = $config['class']['Unknown']; |
362 | 362 | $assessment['class']['value'] = '???'; |
363 | 363 | $assessment['class']['category'] = $classAttrs['category']; |
364 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". $classAttrs['badge']; |
|
364 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".$classAttrs['badge']; |
|
365 | 365 | } else { |
366 | 366 | $classAttrs = $config['class'][$classValue]; |
367 | 367 | $assessment['class'] = [ |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | |
373 | 373 | // add full URL to badge icon |
374 | 374 | if ($classAttrs['badge'] !== '') { |
375 | - $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/" . |
|
375 | + $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". |
|
376 | 376 | $classAttrs['badge']; |
377 | 377 | } |
378 | 378 | |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | $config = $this->getAssessmentsConfig(); |
422 | 422 | |
423 | 423 | if (isset($config[$project]['class'][$class])) { |
424 | - return "https://upload.wikimedia.org/wikipedia/commons/" . $config[$project]['class'][$class]['badge']; |
|
424 | + return "https://upload.wikimedia.org/wikipedia/commons/".$config[$project]['class'][$class]['badge']; |
|
425 | 425 | } elseif (isset($config[$project]['class']['Unknown'])) { |
426 | - return "https://upload.wikimedia.org/wikipedia/commons/" . $config[$project]['class']['Unknown']['badge']; |
|
426 | + return "https://upload.wikimedia.org/wikipedia/commons/".$config[$project]['class']['Unknown']['badge']; |
|
427 | 427 | } else { |
428 | 428 | return ""; |
429 | 429 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | $query = FluentRequest::factory()->setAction('query')->setParams($requestData); |
517 | 517 | $innerPromise = $this->api->getRequestAsync($query); |
518 | 518 | |
519 | - $innerPromise->then(function ($result) use (&$data) { |
|
519 | + $innerPromise->then(function($result) use (&$data) { |
|
520 | 520 | // some failures come back as 200s, so we still resolve and let the outer function handle it |
521 | 521 | if (isset($result['error']) || !isset($result['query'])) { |
522 | 522 | return $data['promise']->resolve($data); |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | $username = $request->query->get('username'); |
28 | 28 | |
29 | 29 | if ($projectQuery != "" && $username != "") { |
30 | - return $this->redirectToRoute("AdminScoreResult", [ 'project'=>$projectQuery, 'username' => $username ]); |
|
30 | + return $this->redirectToRoute("AdminScoreResult", ['project'=>$projectQuery, 'username' => $username]); |
|
31 | 31 | } elseif ($projectQuery != "") { |
32 | - return $this->redirectToRoute("AdminScoreProject", [ 'project'=>$projectQuery ]); |
|
32 | + return $this->redirectToRoute("AdminScoreProject", ['project'=>$projectQuery]); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Otherwise fall through. |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | $archiveTable = $lh->getTable("archive", $dbName); |
68 | 68 | |
69 | 69 | // MULTIPLIERS (to review) |
70 | - $ACCT_AGE_MULT = 1.25; # 0 if = 365 jours |
|
71 | - $EDIT_COUNT_MULT = 1.25; # 0 if = 10 000 |
|
72 | - $USER_PAGE_MULT = 0.1; # 0 if = |
|
70 | + $ACCT_AGE_MULT = 1.25; # 0 if = 365 jours |
|
71 | + $EDIT_COUNT_MULT = 1.25; # 0 if = 10 000 |
|
72 | + $USER_PAGE_MULT = 0.1; # 0 if = |
|
73 | 73 | $PATROLS_MULT = 1; # 0 if = |
74 | - $BLOCKS_MULT = 1.4; # 0 if = 10 |
|
74 | + $BLOCKS_MULT = 1.4; # 0 if = 10 |
|
75 | 75 | $AFD_MULT = 1.15; |
76 | - $RECENT_ACTIVITY_MULT = 0.9; # 0 if = |
|
76 | + $RECENT_ACTIVITY_MULT = 0.9; # 0 if = |
|
77 | 77 | $AIV_MULT = 1.15; |
78 | - $EDIT_SUMMARIES_MULT = 0.8; # 0 if = |
|
79 | - $NAMESPACES_MULT = 1.0; # 0 if = |
|
78 | + $EDIT_SUMMARIES_MULT = 0.8; # 0 if = |
|
79 | + $NAMESPACES_MULT = 1.0; # 0 if = |
|
80 | 80 | $PAGES_CREATED_LIVE_MULT = 1.4; # 0 if = |
81 | 81 | $PAGES_CREATED_ARCHIVE_MULT = 1.4; # 0 if = |
82 | - $RPP_MULT = 1.15; # 0 if = |
|
83 | - $USERRIGHTS_MULT = 0.75; # 0 if = |
|
82 | + $RPP_MULT = 1.15; # 0 if = |
|
83 | + $USERRIGHTS_MULT = 0.75; # 0 if = |
|
84 | 84 | |
85 | 85 | // Grab the connection to the replica database (which is separate from the above) |
86 | 86 | $conn = $this->get('doctrine')->getManager("replicas")->getConnection(); |
@@ -156,15 +156,15 @@ discard block |
||
156 | 156 | $now = new DateTime(); |
157 | 157 | $date = new DateTime($value); |
158 | 158 | $diff = $date->diff($now); |
159 | - $formula = 365*$diff->format("%y")+30*$diff->format("%m")+$diff->format("%d"); |
|
159 | + $formula = 365 * $diff->format("%y")+30 * $diff->format("%m")+$diff->format("%d"); |
|
160 | 160 | $value = $formula-365; |
161 | 161 | } |
162 | 162 | |
163 | 163 | if ($key == "id") { |
164 | 164 | $id = $value; |
165 | 165 | } else { |
166 | - $multiplierKey = strtoupper($row["source"] . "_MULT"); |
|
167 | - $multiplier = ( isset($$multiplierKey) ? $$multiplierKey : 1 ); |
|
166 | + $multiplierKey = strtoupper($row["source"]."_MULT"); |
|
167 | + $multiplier = (isset($$multiplierKey) ? $$multiplierKey : 1); |
|
168 | 168 | $score = max(min($value * $multiplier, 100), -100); |
169 | 169 | $master[$key]["mult"] = $multiplier; |
170 | 170 | $master[$key]["value"] = $value; |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | if ($id == 0) { |
177 | - $this->addFlash("notice", [ "noresult", $username ]); |
|
178 | - return $this->redirectToRoute("AdminScore", [ "project"=>$project ]); |
|
177 | + $this->addFlash("notice", ["noresult", $username]); |
|
178 | + return $this->redirectToRoute("AdminScore", ["project"=>$project]); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $this->render('adminscore/result.html.twig', [ |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'quote/all.html.twig', |
112 | 112 | [ |
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 | 'quotes' => $quotes, |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 'quote/view.html.twig', |
161 | 161 | [ |
162 | 162 | 'base_dir' => realpath( |
163 | - $this->getParameter('kernel.root_dir') . '/..' |
|
163 | + $this->getParameter('kernel.root_dir').'/..' |
|
164 | 164 | ), |
165 | 165 | "xtPage" => "bash", |
166 | 166 | "text" => $text, |
@@ -155,7 +155,7 @@ |
||
155 | 155 | $archiveTable = $lh->getTable("archive", $dbName); |
156 | 156 | |
157 | 157 | $cond_begin = $start ? " AND rev_timestamp > :start " : null; |
158 | - $cond_end = $end ? " AND rev_timestamp < :end ": null; |
|
158 | + $cond_end = $end ? " AND rev_timestamp < :end " : null; |
|
159 | 159 | |
160 | 160 | foreach ($AEBTypes as $toolname => $check) { |
161 | 161 | $toolname = $dbh->quote($toolname, \PDO::PARAM_STR); |
@@ -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,8 +244,8 @@ discard block |
||
244 | 244 | public function getFilters() |
245 | 245 | { |
246 | 246 | return [ |
247 | - new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]), |
|
248 | - new \Twig_SimpleFilter('wikify_comment', [ $this, 'wikifyComment' ], [ 'is_safe' => [ 'html' ] ]), |
|
247 | + new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]), |
|
248 | + new \Twig_SimpleFilter('wikify_comment', [$this, 'wikifyComment'], ['is_safe' => ['html']]), |
|
249 | 249 | ]; |
250 | 250 | } |
251 | 251 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if ($isSection) { |
285 | 285 | $sectionTitle = $sectionMatch[1][0]; |
286 | 286 | $sectionTitleLink = str_replace(' ', '_', $sectionTitle); |
287 | - $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>→</a>" . |
|
287 | + $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>→</a>". |
|
288 | 288 | "<em class='text-muted'>$sectionTitle:</em> "; |
289 | 289 | $wikitext = str_replace($sectionMatch[0][0], $sectionWikitext, $wikitext); |
290 | 290 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | */ |
66 | 66 | public function userRightsUrl(Project $project) |
67 | 67 | { |
68 | - return $project->getUrl() . $project->getScriptPath() . "?title=Special:UserRights&user=" . |
|
68 | + return $project->getUrl().$project->getScriptPath()."?title=Special:UserRights&user=". |
|
69 | 69 | $this->getUsername(); |
70 | 70 | } |
71 | 71 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function getGroups(Project $project, $username) |
33 | 33 | { |
34 | 34 | $api = $this->getMediawikiApi($project); |
35 | - $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ]; |
|
35 | + $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"]; |
|
36 | 36 | $query = new SimpleRequest('query', $params); |
37 | 37 | $result = []; |
38 | 38 | $res = $api->getRequest($query); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | // Create the API query. |
59 | 59 | $api = $this->getMediawikiApi($project); |
60 | - $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ]; |
|
60 | + $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"]; |
|
61 | 61 | $query = new SimpleRequest('query', $params); |
62 | 62 | |
63 | 63 | // Get the result. |
@@ -53,10 +53,10 @@ |
||
53 | 53 | $username = $request->query->get('username'); |
54 | 54 | |
55 | 55 | if (($project || $queryProject) && $username) { |
56 | - $routeParams = [ 'project'=>($project ?: $queryProject), 'username' => $username ]; |
|
56 | + $routeParams = ['project'=>($project ?: $queryProject), 'username' => $username]; |
|
57 | 57 | return $this->redirectToRoute("EditCounterResult", $routeParams); |
58 | 58 | } elseif (!$project && $queryProject) { |
59 | - return $this->redirectToRoute("EditCounterProject", [ 'project'=>$queryProject ]); |
|
59 | + return $this->redirectToRoute("EditCounterProject", ['project'=>$queryProject]); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $this->init($project); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'username' => $username, |
56 | 56 | ]); |
57 | 57 | } elseif ($projectName != "") { |
58 | - return $this->redirectToRoute("TopEditsResults", [ 'project'=>$projectName ]); |
|
58 | + return $this->redirectToRoute("TopEditsResults", ['project'=>$projectName]); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Set default project so we can populate the namespace selector. |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | // Get page info about these 100 pages, so we can use their display title. |
133 | - $titles = array_map(function ($e) { |
|
133 | + $titles = array_map(function($e) { |
|
134 | 134 | return $e['page_title']; |
135 | 135 | }, $editData); |
136 | 136 | /** @var ApiHelper $apiHelper */ |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | foreach ($editData as $editDatum) { |
143 | 143 | $pageTitle = $editDatum['page_title']; |
144 | 144 | // If 'all' namespaces, prepend namespace to display title. |
145 | - $nsTitle = !is_numeric($namespaceId) ? $namespaces[$editDatum['page_namespace']] . ':' : ''; |
|
145 | + $nsTitle = !is_numeric($namespaceId) ? $namespaces[$editDatum['page_namespace']].':' : ''; |
|
146 | 146 | $editDatum['displaytitle'] = $nsTitle.$displayTitles[$pageTitle]; |
147 | 147 | $edits[] = $editDatum; |
148 | 148 | } |