@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function intuitionMessage($message = "", $vars = []) |
32 | 32 | { |
33 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
33 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /*********************************** FUNCTIONS ***********************************/ |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function getFunctions() |
43 | 43 | { |
44 | - $options = [ 'is_safe' => [ 'html']]; |
|
44 | + $options = ['is_safe' => ['html']]; |
|
45 | 45 | return [ |
46 | - new Twig_SimpleFunction('wiki_link', [ $this, 'wikiLink' ], $options), |
|
47 | - new Twig_SimpleFunction('user_link', [ $this, 'userLink' ], $options), |
|
48 | - new Twig_SimpleFunction('user_log_link', [ $this, 'userLogLink' ], $options), |
|
49 | - new Twig_SimpleFunction('group_link', [ $this, 'groupLink' ], $options), |
|
50 | - new Twig_SimpleFunction('wiki_history_link', [ $this, 'wikiHistoryLink' ], $options), |
|
51 | - new Twig_SimpleFunction('wiki_log_link', [ $this, 'wikiLogLink' ], $options), |
|
52 | - new Twig_SimpleFunction('pageviews_links', [ $this, 'pageviewsLinks' ], $options), |
|
53 | - new Twig_SimpleFunction('diff_link', [ $this, 'diffLink' ], $options), |
|
54 | - new Twig_SimpleFunction('perma_link', [ $this, 'permaLink' ], $options), |
|
55 | - new Twig_SimpleFunction('edit_link', [ $this, 'editLink' ], $options), |
|
46 | + new Twig_SimpleFunction('wiki_link', [$this, 'wikiLink'], $options), |
|
47 | + new Twig_SimpleFunction('user_link', [$this, 'userLink'], $options), |
|
48 | + new Twig_SimpleFunction('user_log_link', [$this, 'userLogLink'], $options), |
|
49 | + new Twig_SimpleFunction('group_link', [$this, 'groupLink'], $options), |
|
50 | + new Twig_SimpleFunction('wiki_history_link', [$this, 'wikiHistoryLink'], $options), |
|
51 | + new Twig_SimpleFunction('wiki_log_link', [$this, 'wikiLogLink'], $options), |
|
52 | + new Twig_SimpleFunction('pageviews_links', [$this, 'pageviewsLinks'], $options), |
|
53 | + new Twig_SimpleFunction('diff_link', [$this, 'diffLink'], $options), |
|
54 | + new Twig_SimpleFunction('perma_link', [$this, 'permaLink'], $options), |
|
55 | + new Twig_SimpleFunction('edit_link', [$this, 'editLink'], $options), |
|
56 | 56 | ]; |
57 | 57 | } |
58 | 58 | |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | public function getFilters() |
278 | 278 | { |
279 | 279 | return [ |
280 | - new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]), |
|
281 | - new \Twig_SimpleFilter('wikify_comment', [ $this, 'wikifyComment' ], [ 'is_safe' => [ 'html' ] ]), |
|
280 | + new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]), |
|
281 | + new \Twig_SimpleFilter('wikify_comment', [$this, 'wikifyComment'], ['is_safe' => ['html']]), |
|
282 | 282 | ]; |
283 | 283 | } |
284 | 284 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | if ($isSection) { |
318 | 318 | $sectionTitle = $sectionMatch[1][0]; |
319 | 319 | $sectionTitleLink = str_replace(' ', '_', $sectionTitle); |
320 | - $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>→</a>" . |
|
320 | + $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>→</a>". |
|
321 | 321 | "<em class='text-muted'>$sectionTitle:</em> "; |
322 | 322 | $wikitext = str_replace($sectionMatch[0][0], $sectionWikitext, $wikitext); |
323 | 323 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | // If we've got a project and user, redirect to results. |
43 | 43 | if ($projectName != '' && $username != '') { |
44 | - $routeParams = [ 'project' => $projectName, 'username' => $username ]; |
|
44 | + $routeParams = ['project' => $projectName, 'username' => $username]; |
|
45 | 45 | return $this->redirectToRoute('SimpleEditCounterResult', $routeParams); |
46 | 46 | } |
47 | 47 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | $resultQuery->execute(); |
109 | 109 | |
110 | 110 | if ($resultQuery->errorCode() > 0) { |
111 | - $this->addFlash('notice', [ 'no-result', $username ]); |
|
112 | - return $this->redirectToRoute('SimpleEditCounterProject', [ 'project' => $project->getDomain() ]); |
|
111 | + $this->addFlash('notice', ['no-result', $username]); |
|
112 | + return $this->redirectToRoute('SimpleEditCounterProject', ['project' => $project->getDomain()]); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // Fetch the result data |
@@ -133,16 +133,16 @@ discard block |
||
133 | 133 | $rev = $row['value']; |
134 | 134 | } |
135 | 135 | if ($row['source'] == 'groups') { |
136 | - $groups .= $row['value']. ', '; |
|
136 | + $groups .= $row['value'].', '; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | 140 | // Unknown user - If the user is created the $results variable will have 3 entries. |
141 | 141 | // This is a workaround to detect non-existent IPs. |
142 | 142 | if (count($results) < 3 && $arch == 0 && $rev == 0) { |
143 | - $this->addFlash('notice', [ 'no-result', $username ]); |
|
143 | + $this->addFlash('notice', ['no-result', $username]); |
|
144 | 144 | |
145 | - return $this->redirectToRoute('SimpleEditCounterProject', [ 'project' => $project->getDomain() ]); |
|
145 | + return $this->redirectToRoute('SimpleEditCounterProject', ['project' => $project->getDomain()]); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | // Remove the last comma and space |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | 'project_url' => $url, |
173 | 173 | 'id' => $id, |
174 | 174 | 'arch' => $arch, |
175 | - 'rev' => $rev + $arch, |
|
175 | + 'rev' => $rev+$arch, |
|
176 | 176 | 'live' => $rev, |
177 | 177 | 'groups' => $groups, |
178 | 178 | 'globalGroups' => $globalGroups, |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | $username = $request->query->get('username', $request->query->get('user')); |
77 | 77 | |
78 | 78 | if (($project || $queryProject) && $username) { |
79 | - $routeParams = [ 'project'=>($project ?: $queryProject), 'username' => $username ]; |
|
79 | + $routeParams = ['project'=>($project ?: $queryProject), 'username' => $username]; |
|
80 | 80 | return $this->redirectToRoute("EditCounterResult", $routeParams); |
81 | 81 | } elseif (!$project && $queryProject) { |
82 | - return $this->redirectToRoute("EditCounterProject", [ 'project'=>$queryProject ]); |
|
82 | + return $this->redirectToRoute("EditCounterProject", ['project'=>$queryProject]); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $project = ProjectRepository::getProject($queryProject, $this->container); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $this->setUpEditCounter($project, $username); |
110 | 110 | $isSubRequest = $this->container->get('request_stack')->getParentRequest() !== null; |
111 | 111 | return $this->render('editCounter/result.html.twig', [ |
112 | - 'xtTitle' => $this->user->getUsername() . ' - ' . $this->project->getTitle(), |
|
112 | + 'xtTitle' => $this->user->getUsername().' - '.$this->project->getTitle(), |
|
113 | 113 | 'xtPage' => 'ec', |
114 | 114 | 'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'), |
115 | 115 | 'is_labs' => $this->project->getRepository()->isLabs(), |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if ($projMetadata['dbname'] == "$project" |
140 | 140 | || $projMetadata['url'] == "$project" |
141 | 141 | || $projMetadata['url'] == "https://$project") { |
142 | - $this->log->debug(__METHOD__ . " Using cached data for $project"); |
|
142 | + $this->log->debug(__METHOD__." Using cached data for $project"); |
|
143 | 143 | return $projMetadata; |
144 | 144 | } |
145 | 145 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $optedIn = $this->container->getParameter('opted_in'); |
260 | 260 | // In case there's just one given. |
261 | 261 | if (!is_array($optedIn)) { |
262 | - $optedIn = [ $optedIn ]; |
|
262 | + $optedIn = [$optedIn]; |
|
263 | 263 | } |
264 | 264 | return $optedIn; |
265 | 265 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | // as required by Labs. We combine $table with |
75 | 75 | // $table_extension in order to generate the new table name |
76 | 76 | if ($this->isLabs() && $table_extension !== null) { |
77 | - $table = $table . "_" . $table_extension; |
|
77 | + $table = $table."_".$table_extension; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Use the table specified in the table mapping configuration, if present. |
@@ -139,7 +139,7 @@ |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | $conn = $this->getDoctrine()->getManager('default')->getConnection(); |
142 | - $date = date('Y-m-d'); |
|
142 | + $date = date('Y-m-d'); |
|
143 | 143 | |
144 | 144 | // Increment count in timeline |
145 | 145 | $existsSql = "SELECT 1 FROM usage_timeline |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $end = $request->query->get('end'); |
32 | 32 | |
33 | 33 | if ($start != '' && $end != '') { |
34 | - return $this->redirectToRoute('MetaResult', [ 'start' => $start, 'end' => $end ]); |
|
34 | + return $this->redirectToRoute('MetaResult', ['start' => $start, 'end' => $end]); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return $this->render('meta/index.html.twig', [ |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $timeline = []; |
74 | 74 | $startObj = new DateTime($start); |
75 | 75 | $endObj = new DateTime($end); |
76 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
76 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
77 | 77 | $grandSum = 0; |
78 | 78 | |
79 | 79 | // Generate array of date labels |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | |
86 | 86 | foreach ($data as $entry) { |
87 | 87 | if (!isset($totals[$entry['tool']])) { |
88 | - $totals[$entry['tool']] = (int) $entry['count']; |
|
88 | + $totals[$entry['tool']] = (int)$entry['count']; |
|
89 | 89 | |
90 | 90 | // Create arrays for each tool, filled with zeros for each date in the timeline |
91 | 91 | $timeline[$entry['tool']] = array_fill(0, $numDays, 0); |
92 | 92 | } else { |
93 | - $totals[$entry['tool']] += (int) $entry['count']; |
|
93 | + $totals[$entry['tool']] += (int)$entry['count']; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $date = new DateTime($entry['date']); |
97 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
98 | - $timeline[$entry['tool']][$dateIndex] = (int) $entry['count']; |
|
97 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
98 | + $timeline[$entry['tool']][$dateIndex] = (int)$entry['count']; |
|
99 | 99 | |
100 | 100 | $grandSum += $entry['count']; |
101 | 101 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | 'username' => $username, |
79 | 79 | ]); |
80 | 80 | } elseif ($projectQuery != "") { |
81 | - return $this->redirectToRoute("PagesProject", [ 'project'=>$projectQuery ]); |
|
81 | + return $this->redirectToRoute("PagesProject", ['project'=>$projectQuery]); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // set default wiki so we can populate the namespace selector |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | JOIN $revisionTable ON page_id = rev_page |
197 | 197 | $paJoin |
198 | 198 | WHERE $whereRev AND rev_parent_id = '0' $namespaceConditionRev $redirectCondition |
199 | - " . ($hasPageAssessments ? 'GROUP BY rev_page' : '') . " |
|
199 | + ".($hasPageAssessments ? 'GROUP BY rev_page' : '')." |
|
200 | 200 | ) |
201 | 201 | |
202 | 202 | UNION |
@@ -280,8 +280,8 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | if ($total < 1) { |
283 | - $this->addFlash('notice', [ 'no-result', $username ]); |
|
284 | - return $this->redirectToRoute('PagesProject', [ 'project' => $project ]); |
|
283 | + $this->addFlash('notice', ['no-result', $username]); |
|
284 | + return $this->redirectToRoute('PagesProject', ['project' => $project]); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | ksort($pagesByNamespaceByDate); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'username' => $username, |
76 | 76 | ]); |
77 | 77 | } elseif ($projectName != "") { |
78 | - return $this->redirectToRoute("TopEditsResults", [ 'project'=>$projectName ]); |
|
78 | + return $this->redirectToRoute("TopEditsResults", ['project'=>$projectName]); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // Set default project so we can populate the namespace selector. |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | // Get page info about these 100 pages, so we can use their display title. |
182 | - $titles = array_map(function ($e) use ($namespaces) { |
|
182 | + $titles = array_map(function($e) use ($namespaces) { |
|
183 | 183 | // If non-mainspace, prepend namespace to the titles. |
184 | 184 | $ns = $e['page_namespace']; |
185 | - $nsTitle = $ns > 0 ? $namespaces[$e['page_namespace']] . ':' : ''; |
|
186 | - return $nsTitle . $e['page_title']; |
|
185 | + $nsTitle = $ns > 0 ? $namespaces[$e['page_namespace']].':' : ''; |
|
186 | + return $nsTitle.$e['page_title']; |
|
187 | 187 | }, $editData); |
188 | 188 | /** @var ApiHelper $apiHelper */ |
189 | 189 | $apiHelper = $this->get('app.api_helper'); |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | foreach ($editData as $editDatum) { |
199 | 199 | // If non-mainspace, prepend namespace to the titles. |
200 | 200 | $ns = $editDatum['page_namespace']; |
201 | - $nsTitle = $ns > 0 ? $namespaces[$editDatum['page_namespace']] . ':' : ''; |
|
202 | - $pageTitle = $nsTitle . $editDatum['page_title']; |
|
201 | + $nsTitle = $ns > 0 ? $namespaces[$editDatum['page_namespace']].':' : ''; |
|
202 | + $pageTitle = $nsTitle.$editDatum['page_title']; |
|
203 | 203 | $editDatum['displaytitle'] = $displayTitles[$pageTitle]; |
204 | 204 | // $editDatum['page_title'] is retained without the namespace |
205 | 205 | // so we can link to TopEdits for that page |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | // Send all to the template. |
261 | 261 | return $this->render('topedits/result_article.html.twig', [ |
262 | 262 | 'xtPage' => 'topedits', |
263 | - 'xtTitle' => $user->getUsername() . ' - ' . $page->getTitle(), |
|
263 | + 'xtTitle' => $user->getUsername().' - '.$page->getTitle(), |
|
264 | 264 | 'project' => $project, |
265 | 265 | 'user' => $user, |
266 | 266 | 'page' => $page, |