@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | $article = $request->query->get('article'); |
82 | 82 | |
83 | 83 | if ($projectQuery != '' && $article != '') { |
84 | - return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]); |
|
84 | + return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]); |
|
85 | 85 | } elseif ($article != '') { |
86 | - return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]); |
|
86 | + return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | if ($projectQuery == '') { |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | $rendered = str_replace('"', '\"', trim($rendered)); |
122 | 122 | |
123 | 123 | // Uglify temporary file. |
124 | - $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js'; |
|
124 | + $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js'; |
|
125 | 125 | $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && "; |
126 | - $script .= $this->get('kernel')->getRootDir() . |
|
127 | - "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " . |
|
126 | + $script .= $this->get('kernel')->getRootDir(). |
|
127 | + "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ". |
|
128 | 128 | "&& rm $tmpFile >/dev/null"; |
129 | 129 | $process = new Process($script); |
130 | 130 | $process->run(); |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | $rendered = str_replace('\"', '"', trim($rendered)); |
144 | 144 | |
145 | 145 | // Add comment after uglifying since it removes comments. |
146 | - $rendered = "/**\n * This code was automatically generated and should not " . |
|
147 | - "be manually edited.\n * For updates, please copy and paste from " . |
|
148 | - $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) . |
|
149 | - "\n * Released under GPL v3 license.\n */\n" . $rendered; |
|
146 | + $rendered = "/**\n * This code was automatically generated and should not ". |
|
147 | + "be manually edited.\n * For updates, please copy and paste from ". |
|
148 | + $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL). |
|
149 | + "\n * Released under GPL v3 license.\n */\n".$rendered; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | $response = new \Symfony\Component\HttpFoundation\Response($rendered); |
@@ -8,7 +8,6 @@ |
||
8 | 8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
9 | 9 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
10 | 10 | use Symfony\Component\HttpFoundation\Request; |
11 | -use Symfony\Component\DependencyInjection\ContainerInterface; |
|
12 | 11 | use Symfony\Component\HttpFoundation\Response; |
13 | 12 | use Symfony\Component\Process\Process; |
14 | 13 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
@@ -57,7 +57,7 @@ |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // Find the path, and complain if English doesn't exist. |
60 | - $path = $this->container->getParameter('kernel.root_dir') . '/../i18n'; |
|
60 | + $path = $this->container->getParameter('kernel.root_dir').'/../i18n'; |
|
61 | 61 | if (!file_exists("$path/en.json")) { |
62 | 62 | throw new Exception("Language directory doesn't exist: $path"); |
63 | 63 | } |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | { |
45 | 45 | $options = ['is_safe' => ['html']]; |
46 | 46 | return [ |
47 | - new \Twig_SimpleFunction('request_time', [ $this, 'requestTime' ], $options), |
|
48 | - new \Twig_SimpleFunction('memory_usage', [ $this, 'requestMemory' ], $options), |
|
49 | - new \Twig_SimpleFunction('year', [ $this, 'generateYear' ], $options), |
|
50 | - new \Twig_SimpleFunction('msgPrintExists', [ $this, 'intuitionMessagePrintExists' ], $options), |
|
51 | - new \Twig_SimpleFunction('msgExists', [ $this, 'intuitionMessageExists' ], $options), |
|
52 | - new \Twig_SimpleFunction('msg', [ $this, 'intuitionMessage' ], $options), |
|
53 | - new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options), |
|
54 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
55 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
56 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
57 | - new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
58 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
59 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
60 | - new \Twig_SimpleFunction('releaseDate', [ $this, 'gitDate' ]), |
|
61 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
62 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
63 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
64 | - new \Twig_SimpleFunction('chartColor', [ $this, 'chartColor' ]), |
|
65 | - new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]), |
|
66 | - new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]), |
|
67 | - new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]), |
|
68 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
69 | - new \Twig_SimpleFunction('replag', [ $this, 'replag' ]), |
|
70 | - new \Twig_SimpleFunction('link', [ $this, 'link' ]), |
|
71 | - new \Twig_SimpleFunction('quote', [ $this, 'quote' ]), |
|
72 | - new \Twig_SimpleFunction('bugReportURL', [ $this, 'bugReportURL' ]), |
|
47 | + new \Twig_SimpleFunction('request_time', [$this, 'requestTime'], $options), |
|
48 | + new \Twig_SimpleFunction('memory_usage', [$this, 'requestMemory'], $options), |
|
49 | + new \Twig_SimpleFunction('year', [$this, 'generateYear'], $options), |
|
50 | + new \Twig_SimpleFunction('msgPrintExists', [$this, 'intuitionMessagePrintExists'], $options), |
|
51 | + new \Twig_SimpleFunction('msgExists', [$this, 'intuitionMessageExists'], $options), |
|
52 | + new \Twig_SimpleFunction('msg', [$this, 'intuitionMessage'], $options), |
|
53 | + new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options), |
|
54 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
55 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
56 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
57 | + new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
58 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
59 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
60 | + new \Twig_SimpleFunction('releaseDate', [$this, 'gitDate']), |
|
61 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
62 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
63 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
64 | + new \Twig_SimpleFunction('chartColor', [$this, 'chartColor']), |
|
65 | + new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']), |
|
66 | + new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']), |
|
67 | + new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']), |
|
68 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
69 | + new \Twig_SimpleFunction('replag', [$this, 'replag']), |
|
70 | + new \Twig_SimpleFunction('link', [$this, 'link']), |
|
71 | + new \Twig_SimpleFunction('quote', [$this, 'quote']), |
|
72 | + new \Twig_SimpleFunction('bugReportURL', [$this, 'bugReportURL']), |
|
73 | 73 | new \Twig_SimpleFunction('logged_in_user', [$this, 'functionLoggedInUser']), |
74 | 74 | new \Twig_SimpleFunction('isUserAnon', [$this, 'isUserAnon']), |
75 | 75 | new \Twig_SimpleFunction('nsName', [$this, 'nsName']), |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function requestTime() |
86 | 86 | { |
87 | 87 | if (!isset($this->requestTime)) { |
88 | - $this->requestTime = microtime(true) - $this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
88 | + $this->requestTime = microtime(true)-$this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $this->requestTime; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function intuitionMessage($message = "", $vars = []) |
160 | 160 | { |
161 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
161 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function getAllLangs() |
189 | 189 | { |
190 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
190 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
191 | 191 | |
192 | 192 | $languages = array_values(array_unique(array_map( |
193 | - function ($filename) { |
|
193 | + function($filename) { |
|
194 | 194 | return basename($filename, '.json'); |
195 | 195 | }, |
196 | 196 | $messageFiles |
@@ -537,9 +537,9 @@ discard block |
||
537 | 537 | public function getFilters() |
538 | 538 | { |
539 | 539 | return [ |
540 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
541 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
542 | - new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]), |
|
540 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
541 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
542 | + new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]), |
|
543 | 543 | new \Twig_SimpleFilter('num_format', [$this, 'numberFormat']), |
544 | 544 | new \Twig_SimpleFilter('date_format', [$this, 'dateFormat']), |
545 | 545 | ]; |
@@ -613,10 +613,10 @@ discard block |
||
613 | 613 | if (!$denominator) { |
614 | 614 | $quotient = $numerator; |
615 | 615 | } else { |
616 | - $quotient = ( $numerator / $denominator ) * 100; |
|
616 | + $quotient = ($numerator / $denominator) * 100; |
|
617 | 617 | } |
618 | 618 | |
619 | - return $this->numberFormat($quotient, $precision) . '%'; |
|
619 | + return $this->numberFormat($quotient, $precision).'%'; |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | /** |
@@ -691,20 +691,20 @@ discard block |
||
691 | 691 | |
692 | 692 | if ($seconds >= 86400) { |
693 | 693 | // Over a day |
694 | - $val = (int) floor($seconds / 86400); |
|
694 | + $val = (int)floor($seconds / 86400); |
|
695 | 695 | $key = 'days'; |
696 | 696 | } elseif ($seconds >= 3600) { |
697 | 697 | // Over an hour, less than a day |
698 | - $val = (int) floor($seconds / 3600); |
|
698 | + $val = (int)floor($seconds / 3600); |
|
699 | 699 | $key = 'hours'; |
700 | 700 | } elseif ($seconds >= 60) { |
701 | 701 | // Over a minute, less than an hour |
702 | - $val = (int) floor($seconds / 60); |
|
702 | + $val = (int)floor($seconds / 60); |
|
703 | 703 | $key = 'minutes'; |
704 | 704 | } |
705 | 705 | |
706 | 706 | if ($translate) { |
707 | - return $this->numberFormat($val) . ' ' . $this->intuitionMessage("num-$key", [$val]); |
|
707 | + return $this->numberFormat($val).' '.$this->intuitionMessage("num-$key", [$val]); |
|
708 | 708 | } else { |
709 | 709 | return [$this->numberFormat($val), "num-$key"]; |
710 | 710 | } |