@@ -111,7 +111,7 @@ |
||
111 | 111 | * List top edits by this user for all pages in a particular namespace. |
112 | 112 | * @param User $user The User. |
113 | 113 | * @param Project $project The project. |
114 | - * @param integer|string $namespace The namespace ID or 'all' |
|
114 | + * @param integer $namespace The namespace ID or 'all' |
|
115 | 115 | * @return \Symfony\Component\HttpFoundation\Response |
116 | 116 | */ |
117 | 117 | protected function namespaceTopEdits(User $user, Project $project, $namespace) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | 'username' => $username, |
69 | 69 | ]); |
70 | 70 | } elseif ($project != "") { |
71 | - return $this->redirectToRoute("TopEditsResults", [ 'project'=>$project ]); |
|
71 | + return $this->redirectToRoute("TopEditsResults", ['project'=>$project]); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // set default wiki so we can populate the namespace selector |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | // Get page info about these 100 pages, so we can use their display title. |
146 | - $titles = array_map(function ($e) { |
|
146 | + $titles = array_map(function($e) { |
|
147 | 147 | return $e['page_title']; |
148 | 148 | }, $editData); |
149 | 149 | /** @var ApiHelper $apiHelper */ |
@@ -14,6 +14,9 @@ |
||
14 | 14 | /** @var string[] Basic metadata about the project */ |
15 | 15 | protected $metadata; |
16 | 16 | |
17 | + /** |
|
18 | + * @param string $nameOrUrl |
|
19 | + */ |
|
17 | 20 | public function __construct($nameOrUrl) |
18 | 21 | { |
19 | 22 | $this->nameUnnormalized = $nameOrUrl; |
@@ -55,7 +55,7 @@ |
||
55 | 55 | */ |
56 | 56 | public function getUrl() |
57 | 57 | { |
58 | - return rtrim($this->getMetadata()['url'], '/') . '/'; |
|
58 | + return rtrim($this->getMetadata()['url'], '/').'/'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -16,38 +16,38 @@ 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('msg_footer', [ $this, 'intuitionMessageFooter' ], $options), |
|
26 | - new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options), |
|
27 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
28 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
29 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
30 | - new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
31 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
32 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
33 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
34 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
35 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
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' ]), |
|
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('msg_footer', [$this, 'intuitionMessageFooter'], $options), |
|
26 | + new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options), |
|
27 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
28 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
29 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
30 | + new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
31 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
32 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
33 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
34 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
35 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
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 | 44 | ]; |
45 | 45 | } |
46 | 46 | |
47 | 47 | public function requestTime($decimals = 3) |
48 | 48 | { |
49 | 49 | |
50 | - return number_format(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
50 | + return number_format(microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'], $decimals); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function requestMemory() |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function linkToWiki($url, $page, $secondary = "") |
75 | 75 | { |
76 | - $link = $url . "/"; |
|
76 | + $link = $url."/"; |
|
77 | 77 | |
78 | 78 | if ($this->isWMFLabs()) { |
79 | 79 | $link .= "wiki/"; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | public function linkToWikiScript($url, $secondary) |
92 | 92 | { |
93 | - $link = $url . "/"; |
|
93 | + $link = $url."/"; |
|
94 | 94 | |
95 | 95 | if ($this->isWMFLabs()) { |
96 | 96 | $link .= "w/"; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | // TODO: refactor all intuition stuff so it can be used anywhere |
107 | 107 | public function intuitionMessageExists($message = "") |
108 | 108 | { |
109 | - return $this->getIntuition()->msgExists($message, [ "domain" => "xtools" ]); |
|
109 | + return $this->getIntuition()->msgExists($message, ["domain" => "xtools"]); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | public function intuitionMessagePrintExists($message = "", $vars = []) |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | public function intuitionMessage($message = "", $vars = []) |
127 | 127 | { |
128 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
128 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | public function intuitionMessageFooter() |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function getAllLangs() |
155 | 155 | { |
156 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
156 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
157 | 157 | |
158 | 158 | $languages = array_values(array_unique(array_map( |
159 | - function ($filename) { |
|
159 | + function($filename) { |
|
160 | 160 | return basename($filename, '.json'); |
161 | 161 | }, |
162 | 162 | $messageFiles |
@@ -213,41 +213,41 @@ discard block |
||
213 | 213 | public static function getColorList($num = false) |
214 | 214 | { |
215 | 215 | $colors = [ |
216 | - 0 => '#Cc0000',# '#FF005A', #red '#FF5555', |
|
216 | + 0 => '#Cc0000', # '#FF005A', #red '#FF5555', |
|
217 | 217 | 1 => '#F7b7b7', |
218 | - 2 => '#5c8d20',# '#008800', #green'#55FF55', |
|
218 | + 2 => '#5c8d20', # '#008800', #green'#55FF55', |
|
219 | 219 | 3 => '#85eD82', |
220 | 220 | 4 => '#2E97E0', # blue |
221 | 221 | 5 => '#B9E3F9', |
222 | - 6 => '#e1711d', # orange |
|
222 | + 6 => '#e1711d', # orange |
|
223 | 223 | 7 => '#ffc04c', |
224 | 224 | 8 => '#FDFF98', # yellow |
225 | 225 | 9 => '#5555FF', |
226 | 226 | 10 => '#55FFFF', |
227 | - 11 => '#0000C0', # |
|
228 | - 12 => '#008800', # green |
|
227 | + 11 => '#0000C0', # |
|
228 | + 12 => '#008800', # green |
|
229 | 229 | 13 => '#00C0C0', |
230 | - 14 => '#FFAFAF', # rosé |
|
231 | - 15 => '#808080', # gray |
|
230 | + 14 => '#FFAFAF', # rosé |
|
231 | + 15 => '#808080', # gray |
|
232 | 232 | 16 => '#00C000', |
233 | 233 | 17 => '#404040', |
234 | - 18 => '#C0C000', # green |
|
234 | + 18 => '#C0C000', # green |
|
235 | 235 | 19 => '#C000C0', |
236 | - 100 => '#75A3D1', # blue |
|
237 | - 101 => '#A679D2', # purple |
|
236 | + 100 => '#75A3D1', # blue |
|
237 | + 101 => '#A679D2', # purple |
|
238 | 238 | 102 => '#660000', |
239 | 239 | 103 => '#000066', |
240 | - 104 => '#FAFFAF', # caramel |
|
240 | + 104 => '#FAFFAF', # caramel |
|
241 | 241 | 105 => '#408345', |
242 | 242 | 106 => '#5c8d20', |
243 | - 107 => '#e1711d', # red |
|
244 | - 108 => '#94ef2b', # light green |
|
245 | - 109 => '#756a4a', # brown |
|
243 | + 107 => '#e1711d', # red |
|
244 | + 108 => '#94ef2b', # light green |
|
245 | + 109 => '#756a4a', # brown |
|
246 | 246 | 110 => '#6f1dab', |
247 | 247 | 111 => '#301e30', |
248 | 248 | 112 => '#5c9d96', |
249 | - 113 => '#a8cd8c', # earth green |
|
250 | - 114 => '#f2b3f1', # light purple |
|
249 | + 113 => '#a8cd8c', # earth green |
|
250 | + 114 => '#f2b3f1', # light purple |
|
251 | 251 | 115 => '#9b5828', |
252 | 252 | 118 => '#99FFFF', |
253 | 253 | 119 => '#99BBFF', |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | 446 => '#06DCFB', |
269 | 269 | 447 => '#892EE4', |
270 | 270 | 460 => '#99FF66', |
271 | - 461 => '#99CC66', # green |
|
272 | - 470 => '#CCCC33', # ocker |
|
271 | + 461 => '#99CC66', # green |
|
272 | + 470 => '#CCCC33', # ocker |
|
273 | 273 | 471 => '#CCFF33', |
274 | 274 | 480 => '#6699FF', |
275 | 275 | 481 => '#66FFFF', |
@@ -284,18 +284,18 @@ discard block |
||
284 | 284 | 1198 => '#FF34B3', |
285 | 285 | 1199 => '#8B1C62', |
286 | 286 | |
287 | - '#61a9f3',# blue |
|
288 | - '#f381b9',# pink |
|
287 | + '#61a9f3', # blue |
|
288 | + '#f381b9', # pink |
|
289 | 289 | '#61E3A9', |
290 | 290 | '#D56DE2', |
291 | 291 | '#85eD82', |
292 | 292 | '#F7b7b7', |
293 | 293 | '#CFDF49', |
294 | 294 | '#88d8f2', |
295 | - '#07AF7B',# green |
|
295 | + '#07AF7B', # green |
|
296 | 296 | '#B9E3F9', |
297 | 297 | '#FFF3AD', |
298 | - '#EF606A',# red |
|
298 | + '#EF606A', # red |
|
299 | 299 | '#EC8833', |
300 | 300 | '#FFF100', |
301 | 301 | '#87C9A5', |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | public function getFilters() |
423 | 423 | { |
424 | 424 | return [ |
425 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
425 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
426 | 426 | ]; |
427 | 427 | } |
428 | 428 |