@@ -12,7 +12,7 @@ |
||
| 12 | 12 | // Feel free to remove this, extend it, or make something more sophisticated. |
| 13 | 13 | if (isset($_SERVER['HTTP_CLIENT_IP']) |
| 14 | 14 | || isset($_SERVER['HTTP_X_FORWARDED_FOR']) |
| 15 | - || !( in_array(@$_SERVER['REMOTE_ADDR'], [ '127.0.0.1', 'fe80::1', '::1' ]) || php_sapi_name() === 'cli-server' ) |
|
| 15 | + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') |
|
| 16 | 16 | ) { |
| 17 | 17 | header('HTTP/1.0 403 Forbidden'); |
| 18 | 18 | exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $final = []; // initialize the final array |
|
| 122 | + $final = []; // initialize the final array |
|
| 123 | 123 | $finalRaw = []; // Initialize the raw data array |
| 124 | 124 | |
| 125 | 125 | foreach ($this->data as $key => $value) { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $final = array_count_values($final); // find repetition and its count |
| 134 | 134 | |
| 135 | - $final = array_diff($final, [1]); // remove single occurrences |
|
| 135 | + $final = array_diff($final, [1]); // remove single occurrences |
|
| 136 | 136 | |
| 137 | 137 | $this->duplicates = array_keys($final); |
| 138 | 138 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $username = $request->query->get('username'); |
| 49 | 49 | |
| 50 | 50 | if ($projectQuery != '' && $username != '') { |
| 51 | - $routeParams = [ 'project' => $projectQuery, 'username' => $username ]; |
|
| 51 | + $routeParams = ['project' => $projectQuery, 'username' => $username]; |
|
| 52 | 52 | return $this->redirectToRoute( |
| 53 | 53 | 'rfxvoteResult', |
| 54 | 54 | $routeParams |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | $titles = []; |
| 168 | 168 | |
| 169 | 169 | while ($row = $sth->fetch()) { |
| 170 | - $titles[] = $namespaces[$row['page_namespace']] . |
|
| 171 | - ':' .$row['page_title']; |
|
| 170 | + $titles[] = $namespaces[$row['page_namespace']]. |
|
| 171 | + ':'.$row['page_title']; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Chunking... it's possible to make a URI too long |
@@ -166,7 +166,7 @@ |
||
| 166 | 166 | $neutral = $rfx->getSection('neutral'); |
| 167 | 167 | $dup = $rfx->getDuplicates(); |
| 168 | 168 | |
| 169 | - $total = count($support) + count($oppose) + count($neutral); |
|
| 169 | + $total = count($support)+count($oppose)+count($neutral); |
|
| 170 | 170 | |
| 171 | 171 | if ($total === 0) { |
| 172 | 172 | $this->addFlash('notice', ['no-result', $pagename]); |
@@ -191,7 +191,7 @@ |
||
| 191 | 191 | // Send all to the template. |
| 192 | 192 | return $this->render('topedits/result_article.html.twig', [ |
| 193 | 193 | 'xtPage' => 'topedits', |
| 194 | - 'xtTitle' => $user->getUsername() . ' - ' . $page->getTitle(), |
|
| 194 | + 'xtTitle' => $user->getUsername().' - '.$page->getTitle(), |
|
| 195 | 195 | 'project' => $project, |
| 196 | 196 | 'user' => $user, |
| 197 | 197 | 'page' => $page, |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | || $projMetadata['url'] == "https://$project" |
| 150 | 150 | || $projMetadata['url'] == "https://$project.org" |
| 151 | 151 | || $projMetadata['url'] == "https://www.$project") { |
| 152 | - $this->log->debug(__METHOD__ . " Using cached data for $project"); |
|
| 152 | + $this->log->debug(__METHOD__." Using cached data for $project"); |
|
| 153 | 153 | return $projMetadata; |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $optedIn = $this->container->getParameter('opted_in'); |
| 293 | 293 | // In case there's just one given. |
| 294 | 294 | if (!is_array($optedIn)) { |
| 295 | - $optedIn = [ $optedIn ]; |
|
| 295 | + $optedIn = [$optedIn]; |
|
| 296 | 296 | } |
| 297 | 297 | return $optedIn; |
| 298 | 298 | } |
@@ -330,9 +330,9 @@ |
||
| 330 | 330 | { |
| 331 | 331 | $pageTable = $this->getTableName($project->getDatabaseName(), 'page'); |
| 332 | 332 | $query = "SELECT page_id " |
| 333 | - . " FROM $pageTable " |
|
| 334 | - . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 " |
|
| 335 | - . " LIMIT 1"; |
|
| 333 | + . " FROM $pageTable " |
|
| 334 | + . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 " |
|
| 335 | + . " LIMIT 1"; |
|
| 336 | 336 | $params = [ |
| 337 | 337 | 'ns' => $namespaceId, |
| 338 | 338 | 'title' => str_replace(' ', '_', $pageTitle), |
@@ -117,8 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if ($this->container->hasParameter("database_meta_table")) { |
| 119 | 119 | $table = $this->container->getParameter("database_meta_table"); |
| 120 | - } |
|
| 121 | - else { |
|
| 120 | + } else { |
|
| 122 | 121 | $table = "wiki"; |
| 123 | 122 | } |
| 124 | 123 | |
@@ -175,8 +174,7 @@ discard block |
||
| 175 | 174 | |
| 176 | 175 | if ($this->container->hasParameter("database_meta_table")) { |
| 177 | 176 | $table = $this->container->getParameter("database_meta_table"); |
| 178 | - } |
|
| 179 | - else { |
|
| 177 | + } else { |
|
| 180 | 178 | $table = "wiki"; |
| 181 | 179 | } |
| 182 | 180 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public function loginAction() |
| 90 | 90 | { |
| 91 | 91 | try { |
| 92 | - list( $next, $token ) = $this->getOauthClient()->initiate(); |
|
| 92 | + list($next, $token) = $this->getOauthClient()->initiate(); |
|
| 93 | 93 | } catch (Exception $oauthException) { |
| 94 | 94 | throw $oauthException; |
| 95 | 95 | // @TODO Make this work. |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | . '?title=Special:OAuth'; |
| 157 | 157 | $conf = new ClientConfig($endpoint); |
| 158 | 158 | $consumerKey = $this->getParameter('oauth_key'); |
| 159 | - $consumerSecret = $this->getParameter('oauth_secret'); |
|
| 159 | + $consumerSecret = $this->getParameter('oauth_secret'); |
|
| 160 | 160 | $conf->setConsumer(new Consumer($consumerKey, $consumerSecret)); |
| 161 | 161 | $this->oauthClient = new Client($conf); |
| 162 | 162 | // Callback URL is hardcoded in the consumer registration. |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return $this->editCounts[$domain]; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $this->editCounts[$domain] = (int) $this->getRepository()->getEditCount( |
|
| 96 | + $this->editCounts[$domain] = (int)$this->getRepository()->getEditCount( |
|
| 97 | 97 | $project->getDatabaseName(), |
| 98 | 98 | $this->getUsername() |
| 99 | 99 | ); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function isAnon() |
| 161 | 161 | { |
| 162 | - return (bool) filter_var($this->username, FILTER_VALIDATE_IP); |
|
| 162 | + return (bool)filter_var($this->username, FILTER_VALIDATE_IP); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function countEdits(Project $project, $namespace = 'all', $start = '', $end = '') |
| 223 | 223 | { |
| 224 | - return (int) $this->getRepository()->countEdits($project, $this, $namespace, $start, $end); |
|
| 224 | + return (int)$this->getRepository()->countEdits($project, $this, $namespace, $start, $end); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -232,7 +232,7 @@ |
||
| 232 | 232 | ]; |
| 233 | 233 | |
| 234 | 234 | if ($pages->getNumResults() === $pages->resultsPerPage()) { |
| 235 | - $ret['continue'] = $offset + 1; |
|
| 235 | + $ret['continue'] = $offset+1; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | $ret['pages'] = $pagesList; |