@@ -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 |
@@ -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 | } |
@@ -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', [ |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | 'url' => $basicInfo['fullurl'] |
102 | 102 | ]; |
103 | 103 | |
104 | - $this->pageInfo['watchers'] = ( isset($basicInfo['watchers']) ) ? $basicInfo['watchers'] : "< 30"; |
|
104 | + $this->pageInfo['watchers'] = (isset($basicInfo['watchers'])) ? $basicInfo['watchers'] : "< 30"; |
|
105 | 105 | |
106 | 106 | $pageProps = isset($basicInfo['pageprops']) ? $basicInfo['pageprops'] : []; |
107 | 107 | |
@@ -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; |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | |
262 | 262 | if ($info['all'] > 1) { |
263 | 263 | // Number of seconds between first and last edit |
264 | - $secs = intval(strtotime($info['last']) - strtotime($info['first']) / $info['all']); |
|
264 | + $secs = intval(strtotime($info['last'])-strtotime($info['first']) / $info['all']); |
|
265 | 265 | |
266 | 266 | // Average time between edits (in days) |
267 | - $this->pageInfo['editors'][$editor]['atbe'] = $secs / ( 60 * 60 * 24 ); |
|
267 | + $this->pageInfo['editors'][$editor]['atbe'] = $secs / (60 * 60 * 24); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | if (count($info['sizes'])) { |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | // First sort editors array by the amount of text they added |
281 | 281 | $topTenEditorsByAdded = $this->pageInfo['editors']; |
282 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
282 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
283 | 283 | if ($a['added'] === $b['added']) { |
284 | 284 | return 0; |
285 | 285 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | // Then build a new array of top 10 editors by added text, |
290 | 290 | // in the data structure needed for the chart |
291 | - $this->pageInfo['topTenEditorsByAdded'] = array_map(function ($editor) { |
|
291 | + $this->pageInfo['topTenEditorsByAdded'] = array_map(function($editor) { |
|
292 | 292 | $added = $this->pageInfo['editors'][$editor]['added']; |
293 | 293 | return [ |
294 | 294 | 'label' => $editor, |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | |
335 | 335 | // Transform to associative array by 'type' |
336 | 336 | foreach ($res as $row) { |
337 | - $data[$row['type'] . '_count'] = $row['value']; |
|
337 | + $data[$row['type'].'_count'] = $row['value']; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | return $data; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $title = str_replace(' ', '_', $this->pageInfo['title']); |
351 | 351 | $query = "SELECT log_action, log_type, log_timestamp AS timestamp |
352 | 352 | FROM $loggingTable |
353 | - WHERE log_namespace = '" . $this->pageInfo['namespace'] . "' |
|
353 | + WHERE log_namespace = '".$this->pageInfo['namespace']."' |
|
354 | 354 | AND log_title = '$title' AND log_timestamp > 1 |
355 | 355 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
356 | 356 | $events = $this->conn->query($query)->fetchAll(); |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $conn = $this->container->get('doctrine')->getManager('replicas')->getConnection(); |
436 | 436 | $res = $conn->query($query)->fetchAll(); |
437 | 437 | |
438 | - $terms = array_map(function ($entry) { |
|
438 | + $terms = array_map(function($entry) { |
|
439 | 439 | return $entry['term']; |
440 | 440 | }, $res); |
441 | 441 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | 'prio' => 2, |
447 | 447 | 'name' => 'Wikidata', |
448 | 448 | 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n |
449 | - 'explanation' => "See: <a target='_blank' " . |
|
449 | + 'explanation' => "See: <a target='_blank' ". |
|
450 | 450 | "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>", |
451 | 451 | ]; |
452 | 452 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | 'prio' => 3, |
456 | 456 | 'name' => 'Wikidata', |
457 | 457 | 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n |
458 | - 'explanation' => "See: <a target='_blank' " . |
|
458 | + 'explanation' => "See: <a target='_blank' ". |
|
459 | 459 | "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>", |
460 | 460 | ]; |
461 | 461 | } |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $query = "SELECT rev_id, rev_parent_id, rev_user_text, rev_user, rev_timestamp, |
473 | 473 | rev_minor_edit, rev_len, rev_comment |
474 | 474 | FROM $this->revisionTable |
475 | - WHERE rev_page = '" . $this->pageInfo['id'] . "' AND rev_timestamp > 1 |
|
475 | + WHERE rev_page = '".$this->pageInfo['id']."' AND rev_timestamp > 1 |
|
476 | 476 | ORDER BY rev_timestamp"; |
477 | 477 | |
478 | 478 | $res = $this->conn->query($query)->fetchAll(); |
@@ -492,14 +492,14 @@ discard block |
||
492 | 492 | return $rev['rev_len']; |
493 | 493 | } |
494 | 494 | |
495 | - $lastRev = $this->pageHistory[$revIndex - 1]; |
|
495 | + $lastRev = $this->pageHistory[$revIndex-1]; |
|
496 | 496 | |
497 | 497 | // TODO: Remove once T101631 is resolved |
498 | 498 | // Treat as zero change in size if rev_len of previous edit is missing |
499 | 499 | if ($lastRev['rev_len'] === null) { |
500 | 500 | return 0; |
501 | 501 | } else { |
502 | - return $rev['rev_len'] - $lastRev['rev_len']; |
|
502 | + return $rev['rev_len']-$lastRev['rev_len']; |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
@@ -520,12 +520,12 @@ discard block |
||
520 | 520 | // The month of the first edit. Used as a comparison when building the per-month data |
521 | 521 | $firstEditMonth = strtotime(date('Y-m-01, 00:00', strtotime($firstEdit['rev_timestamp']))); |
522 | 522 | |
523 | - $lastEdit = $this->pageHistory[ $revisionCount - 1 ]; |
|
524 | - $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[ $revisionCount - 2 ]; |
|
523 | + $lastEdit = $this->pageHistory[$revisionCount-1]; |
|
524 | + $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[$revisionCount-2]; |
|
525 | 525 | |
526 | 526 | // Now we can start our master array. This one will be HUGE! |
527 | 527 | $lastEditSize = ($revisionCount > 1) |
528 | - ? $lastEdit['rev_len'] - $secondLastEdit['rev_len'] |
|
528 | + ? $lastEdit['rev_len']-$secondLastEdit['rev_len'] |
|
529 | 529 | : $lastEdit['rev_len']; |
530 | 530 | $data = [ |
531 | 531 | 'general' => [ |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | // Increment year and month counts for all edits |
623 | 623 | $data['year_count'][$timestamp['year']]['all']++; |
624 | 624 | $data['year_count'][$timestamp['year']]['months'][$timestamp['month']]['all']++; |
625 | - $data['year_count'][$timestamp['year']]['size'] = (int) $rev['rev_len']; |
|
625 | + $data['year_count'][$timestamp['year']]['size'] = (int)$rev['rev_len']; |
|
626 | 626 | |
627 | 627 | $editsThisMonth = $data['year_count'][$timestamp['year']]['months'][$timestamp['month']]['all']; |
628 | 628 | if ($editsThisMonth > $data['max_edits_per_month']) { |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | } |
667 | 667 | |
668 | 668 | // determine if the next revision was a revert |
669 | - $nextRevision = isset($this->pageHistory[$i + 1]) ? $this->pageHistory[$i + 1] : null; |
|
669 | + $nextRevision = isset($this->pageHistory[$i+1]) ? $this->pageHistory[$i+1] : null; |
|
670 | 670 | $nextRevisionIsRevert = $nextRevision && |
671 | - $this->getDiffSize($i + 1) === -$diffSize && |
|
671 | + $this->getDiffSize($i+1) === -$diffSize && |
|
672 | 672 | $this->aeh->isRevert($nextRevision['rev_comment']); |
673 | 673 | |
674 | 674 | // don't count this edit as content removal if the next edit reverted it |
@@ -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('msgPrintExists', [ $this, 'intuitionMessagePrintExists' ], $options), |
|
23 | - new \Twig_SimpleFunction('msgExists', [ $this, 'intuitionMessageExists' ], $options), |
|
24 | - new \Twig_SimpleFunction('msg', [ $this, 'intuitionMessage' ], $options), |
|
25 | - new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options), |
|
26 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
27 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
28 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
29 | - new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
30 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
31 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
32 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
33 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
34 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
35 | - new \Twig_SimpleFunction('chartColor', [ $this, 'chartColor' ]), |
|
36 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
37 | - new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]), |
|
38 | - new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]), |
|
39 | - new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]), |
|
40 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
41 | - new \Twig_SimpleFunction('replag', [ $this, 'replag' ]), |
|
42 | - new \Twig_SimpleFunction('link', [ $this, 'link' ]), |
|
43 | - new \Twig_SimpleFunction('quote', [ $this, 'quote' ]), |
|
44 | - new \Twig_SimpleFunction('bugReportURL', [ $this, 'bugReportURL' ]), |
|
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('msgPrintExists', [$this, 'intuitionMessagePrintExists'], $options), |
|
23 | + new \Twig_SimpleFunction('msgExists', [$this, 'intuitionMessageExists'], $options), |
|
24 | + new \Twig_SimpleFunction('msg', [$this, 'intuitionMessage'], $options), |
|
25 | + new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options), |
|
26 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
27 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
28 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
29 | + new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
30 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
31 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
32 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
33 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
34 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
35 | + new \Twig_SimpleFunction('chartColor', [$this, 'chartColor']), |
|
36 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
37 | + new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']), |
|
38 | + new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']), |
|
39 | + new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']), |
|
40 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
41 | + new \Twig_SimpleFunction('replag', [$this, 'replag']), |
|
42 | + new \Twig_SimpleFunction('link', [$this, 'link']), |
|
43 | + new \Twig_SimpleFunction('quote', [$this, 'quote']), |
|
44 | + new \Twig_SimpleFunction('bugReportURL', [$this, 'bugReportURL']), |
|
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() |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | // TODO: refactor all intuition stuff so it can be used anywhere |
69 | 69 | public function intuitionMessageExists($message = "") |
70 | 70 | { |
71 | - return $this->getIntuition()->msgExists($message, [ "domain" => "xtools" ]); |
|
71 | + return $this->getIntuition()->msgExists($message, ["domain" => "xtools"]); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function intuitionMessagePrintExists($message = "", $vars = []) |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function intuitionMessage($message = "", $vars = []) |
89 | 89 | { |
90 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
90 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | public function getLang() |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getAllLangs() |
110 | 110 | { |
111 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
111 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
112 | 112 | |
113 | 113 | $languages = array_values(array_unique(array_map( |
114 | - function ($filename) { |
|
114 | + function($filename) { |
|
115 | 115 | return basename($filename, '.json'); |
116 | 116 | }, |
117 | 117 | $messageFiles |
@@ -168,41 +168,41 @@ discard block |
||
168 | 168 | public static function getColorList($num = false) |
169 | 169 | { |
170 | 170 | $colors = [ |
171 | - 0 => '#Cc0000',# '#FF005A', #red '#FF5555', |
|
171 | + 0 => '#Cc0000', # '#FF005A', #red '#FF5555', |
|
172 | 172 | 1 => '#F7b7b7', |
173 | - 2 => '#5c8d20',# '#008800', #green'#55FF55', |
|
173 | + 2 => '#5c8d20', # '#008800', #green'#55FF55', |
|
174 | 174 | 3 => '#85eD82', |
175 | 175 | 4 => '#2E97E0', # blue |
176 | 176 | 5 => '#B9E3F9', |
177 | - 6 => '#e1711d', # orange |
|
177 | + 6 => '#e1711d', # orange |
|
178 | 178 | 7 => '#ffc04c', |
179 | 179 | 8 => '#FDFF98', # yellow |
180 | 180 | 9 => '#5555FF', |
181 | 181 | 10 => '#55FFFF', |
182 | - 11 => '#0000C0', # |
|
183 | - 12 => '#008800', # green |
|
182 | + 11 => '#0000C0', # |
|
183 | + 12 => '#008800', # green |
|
184 | 184 | 13 => '#00C0C0', |
185 | - 14 => '#FFAFAF', # rosé |
|
186 | - 15 => '#808080', # gray |
|
185 | + 14 => '#FFAFAF', # rosé |
|
186 | + 15 => '#808080', # gray |
|
187 | 187 | 16 => '#00C000', |
188 | 188 | 17 => '#404040', |
189 | - 18 => '#C0C000', # green |
|
189 | + 18 => '#C0C000', # green |
|
190 | 190 | 19 => '#C000C0', |
191 | - 100 => '#75A3D1', # blue |
|
192 | - 101 => '#A679D2', # purple |
|
191 | + 100 => '#75A3D1', # blue |
|
192 | + 101 => '#A679D2', # purple |
|
193 | 193 | 102 => '#660000', |
194 | 194 | 103 => '#000066', |
195 | - 104 => '#FAFFAF', # caramel |
|
195 | + 104 => '#FAFFAF', # caramel |
|
196 | 196 | 105 => '#408345', |
197 | 197 | 106 => '#5c8d20', |
198 | - 107 => '#e1711d', # red |
|
199 | - 108 => '#94ef2b', # light green |
|
200 | - 109 => '#756a4a', # brown |
|
198 | + 107 => '#e1711d', # red |
|
199 | + 108 => '#94ef2b', # light green |
|
200 | + 109 => '#756a4a', # brown |
|
201 | 201 | 110 => '#6f1dab', |
202 | 202 | 111 => '#301e30', |
203 | 203 | 112 => '#5c9d96', |
204 | - 113 => '#a8cd8c', # earth green |
|
205 | - 114 => '#f2b3f1', # light purple |
|
204 | + 113 => '#a8cd8c', # earth green |
|
205 | + 114 => '#f2b3f1', # light purple |
|
206 | 206 | 115 => '#9b5828', |
207 | 207 | 118 => '#99FFFF', |
208 | 208 | 119 => '#99BBFF', |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | 446 => '#06DCFB', |
224 | 224 | 447 => '#892EE4', |
225 | 225 | 460 => '#99FF66', |
226 | - 461 => '#99CC66', # green |
|
227 | - 470 => '#CCCC33', # ocker |
|
226 | + 461 => '#99CC66', # green |
|
227 | + 470 => '#CCCC33', # ocker |
|
228 | 228 | 471 => '#CCFF33', |
229 | 229 | 480 => '#6699FF', |
230 | 230 | 481 => '#66FFFF', |
@@ -239,18 +239,18 @@ discard block |
||
239 | 239 | 1198 => '#FF34B3', |
240 | 240 | 1199 => '#8B1C62', |
241 | 241 | |
242 | - '#61a9f3',# blue |
|
243 | - '#f381b9',# pink |
|
242 | + '#61a9f3', # blue |
|
243 | + '#f381b9', # pink |
|
244 | 244 | '#61E3A9', |
245 | 245 | '#D56DE2', |
246 | 246 | '#85eD82', |
247 | 247 | '#F7b7b7', |
248 | 248 | '#CFDF49', |
249 | 249 | '#88d8f2', |
250 | - '#07AF7B',# green |
|
250 | + '#07AF7B', # green |
|
251 | 251 | '#B9E3F9', |
252 | 252 | '#FFF3AD', |
253 | - '#EF606A',# red |
|
253 | + '#EF606A', # red |
|
254 | 254 | '#EC8833', |
255 | 255 | '#FFF100', |
256 | 256 | '#87C9A5', |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | public function getFilters() |
401 | 401 | { |
402 | 402 | return [ |
403 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
404 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
403 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
404 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
405 | 405 | ]; |
406 | 406 | } |
407 | 407 | |
@@ -428,9 +428,9 @@ discard block |
||
428 | 428 | if (!$denominator) { |
429 | 429 | $quotient = $numerator; |
430 | 430 | } else { |
431 | - $quotient = ( $numerator / $denominator ) * 100; |
|
431 | + $quotient = ($numerator / $denominator) * 100; |
|
432 | 432 | } |
433 | 433 | |
434 | - return round($quotient, $precision) . '%'; |
|
434 | + return round($quotient, $precision).'%'; |
|
435 | 435 | } |
436 | 436 | } |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | $editData = $conn->executeQuery($query, ['username' => $username])->fetchAll(); |
140 | 140 | |
141 | 141 | // Get diff sizes, based on length of each parent revision |
142 | - $parentRevIds = array_map(function ($edit) { |
|
142 | + $parentRevIds = array_map(function($edit) { |
|
143 | 143 | return $edit['rev_parent_id']; |
144 | 144 | }, $editData); |
145 | 145 | $query = "SELECT rev_len, rev_id |
146 | 146 | FROM revision |
147 | - WHERE rev_id IN (" . implode(',', $parentRevIds) . ")"; |
|
147 | + WHERE rev_id IN (" . implode(',', $parentRevIds).")"; |
|
148 | 148 | $diffSizeData = $conn->executeQuery($query)->fetchAll(); |
149 | 149 | |
150 | 150 | // reformat with rev_id as the key, rev_len as the value |
@@ -154,24 +154,24 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | // Build our array of nonautomated edits |
157 | - $editData = array_map(function ($edit) use ($namespaces, $diffSizes) { |
|
157 | + $editData = array_map(function($edit) use ($namespaces, $diffSizes) { |
|
158 | 158 | $pageTitle = $edit['page_title']; |
159 | 159 | |
160 | 160 | if ($edit['page_namespace'] !== '0') { |
161 | - $pageTitle = $namespaces[$edit['page_namespace']] . ":$pageTitle"; |
|
161 | + $pageTitle = $namespaces[$edit['page_namespace']].":$pageTitle"; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | $diffSize = $edit['rev_len']; |
165 | 165 | if ($edit['rev_parent_id'] > 0) { |
166 | - $diffSize = $edit['rev_len'] - $diffSizes[$edit['rev_parent_id']]; |
|
166 | + $diffSize = $edit['rev_len']-$diffSizes[$edit['rev_parent_id']]; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return [ |
170 | 170 | 'page_title' => $pageTitle, |
171 | - 'namespace' => (int) $edit['page_namespace'], |
|
172 | - 'rev_id' => (int) $edit['rev_id'], |
|
171 | + 'namespace' => (int)$edit['page_namespace'], |
|
172 | + 'rev_id' => (int)$edit['rev_id'], |
|
173 | 173 | 'timestamp' => DateTime::createFromFormat('YmdHis', $edit['rev_timestamp']), |
174 | - 'minor_edit' => (bool) $edit['rev_minor_edit'], |
|
174 | + 'minor_edit' => (bool)$edit['rev_minor_edit'], |
|
175 | 175 | 'summary' => $edit['rev_comment'], |
176 | 176 | 'size' => $diffSize |
177 | 177 | ]; |