@@ -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']), |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function requestTime() |
| 88 | 88 | { |
| 89 | 89 | if (!isset($this->requestTime)) { |
| 90 | - $this->requestTime = microtime(true) - $this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 90 | + $this->requestTime = microtime(true)-$this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return $this->requestTime; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function intuitionMessage($message = "", $vars = []) |
| 162 | 162 | { |
| 163 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
| 163 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function getAllLangs() |
| 191 | 191 | { |
| 192 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
| 192 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
| 193 | 193 | |
| 194 | 194 | $languages = array_values(array_unique(array_map( |
| 195 | - function ($filename) { |
|
| 195 | + function($filename) { |
|
| 196 | 196 | return basename($filename, '.json'); |
| 197 | 197 | }, |
| 198 | 198 | $messageFiles |
@@ -540,9 +540,9 @@ discard block |
||
| 540 | 540 | public function getFilters() |
| 541 | 541 | { |
| 542 | 542 | return [ |
| 543 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
| 544 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
| 545 | - new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]), |
|
| 543 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
| 544 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
| 545 | + new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]), |
|
| 546 | 546 | new \Twig_SimpleFilter('num_format', [$this, 'numberFormat']), |
| 547 | 547 | new \Twig_SimpleFilter('date_format', [$this, 'dateFormat']), |
| 548 | 548 | ]; |
@@ -616,10 +616,10 @@ discard block |
||
| 616 | 616 | if (!$denominator) { |
| 617 | 617 | $quotient = $numerator; |
| 618 | 618 | } else { |
| 619 | - $quotient = ( $numerator / $denominator ) * 100; |
|
| 619 | + $quotient = ($numerator / $denominator) * 100; |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | - return $this->numberFormat($quotient, $precision) . '%'; |
|
| 622 | + return $this->numberFormat($quotient, $precision).'%'; |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | /** |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | list($val, $key) = $this->getDurationMessageKey($seconds); |
| 690 | 690 | |
| 691 | 691 | if ($translate) { |
| 692 | - return $this->numberFormat($val) . ' ' . $this->intuitionMessage("num-$key", [$val]); |
|
| 692 | + return $this->numberFormat($val).' '.$this->intuitionMessage("num-$key", [$val]); |
|
| 693 | 693 | } else { |
| 694 | 694 | return [$this->numberFormat($val), "num-$key"]; |
| 695 | 695 | } |
@@ -710,15 +710,15 @@ discard block |
||
| 710 | 710 | |
| 711 | 711 | if ($seconds >= 86400) { |
| 712 | 712 | // Over a day |
| 713 | - $val = (int) floor($seconds / 86400); |
|
| 713 | + $val = (int)floor($seconds / 86400); |
|
| 714 | 714 | $key = 'days'; |
| 715 | 715 | } elseif ($seconds >= 3600) { |
| 716 | 716 | // Over an hour, less than a day |
| 717 | - $val = (int) floor($seconds / 3600); |
|
| 717 | + $val = (int)floor($seconds / 3600); |
|
| 718 | 718 | $key = 'hours'; |
| 719 | 719 | } elseif ($seconds >= 60) { |
| 720 | 720 | // Over a minute, less than an hour |
| 721 | - $val = (int) floor($seconds / 60); |
|
| 721 | + $val = (int)floor($seconds / 60); |
|
| 722 | 722 | $key = 'minutes'; |
| 723 | 723 | } |
| 724 | 724 | |