@@ -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']), |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | public function requestTime() |
| 89 | 89 | { |
| 90 | 90 | if (!isset($this->requestTime)) { |
| 91 | - $this->requestTime = microtime(true) - $this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 91 | + $this->requestTime = microtime(true)-$this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | return $this->requestTime; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | public function intuitionMessage($message = "", $vars = []) |
| 163 | 163 | { |
| 164 | 164 | $vars = is_array($vars) ? $vars : []; |
| 165 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
| 165 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -191,10 +191,10 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function getAllLangs() |
| 193 | 193 | { |
| 194 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
| 194 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
| 195 | 195 | |
| 196 | 196 | $languages = array_values(array_unique(array_map( |
| 197 | - function ($filename) { |
|
| 197 | + function($filename) { |
|
| 198 | 198 | return basename($filename, '.json'); |
| 199 | 199 | }, |
| 200 | 200 | $messageFiles |
@@ -542,9 +542,9 @@ discard block |
||
| 542 | 542 | public function getFilters() |
| 543 | 543 | { |
| 544 | 544 | return [ |
| 545 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
| 546 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
| 547 | - new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]), |
|
| 545 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
| 546 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
| 547 | + new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]), |
|
| 548 | 548 | new \Twig_SimpleFilter('num_format', [$this, 'numberFormat']), |
| 549 | 549 | new \Twig_SimpleFilter('date_format', [$this, 'dateFormatStd']), |
| 550 | 550 | new \Twig_SimpleFilter('date_localize', [$this, 'dateFormat']), |
@@ -633,10 +633,10 @@ discard block |
||
| 633 | 633 | if (!$denominator) { |
| 634 | 634 | $quotient = $numerator; |
| 635 | 635 | } else { |
| 636 | - $quotient = ( $numerator / $denominator ) * 100; |
|
| 636 | + $quotient = ($numerator / $denominator) * 100; |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - return $this->numberFormat($quotient, $precision) . '%'; |
|
| 639 | + return $this->numberFormat($quotient, $precision).'%'; |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | /** |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | list($val, $key) = $this->getDurationMessageKey($seconds); |
| 707 | 707 | |
| 708 | 708 | if ($translate) { |
| 709 | - return $this->numberFormat($val) . ' ' . $this->intuitionMessage("num-$key", [$val]); |
|
| 709 | + return $this->numberFormat($val).' '.$this->intuitionMessage("num-$key", [$val]); |
|
| 710 | 710 | } else { |
| 711 | 711 | return [$this->numberFormat($val), "num-$key"]; |
| 712 | 712 | } |
@@ -727,15 +727,15 @@ discard block |
||
| 727 | 727 | |
| 728 | 728 | if ($seconds >= 86400) { |
| 729 | 729 | // Over a day |
| 730 | - $val = (int) floor($seconds / 86400); |
|
| 730 | + $val = (int)floor($seconds / 86400); |
|
| 731 | 731 | $key = 'days'; |
| 732 | 732 | } elseif ($seconds >= 3600) { |
| 733 | 733 | // Over an hour, less than a day |
| 734 | - $val = (int) floor($seconds / 3600); |
|
| 734 | + $val = (int)floor($seconds / 3600); |
|
| 735 | 735 | $key = 'hours'; |
| 736 | 736 | } elseif ($seconds >= 60) { |
| 737 | 737 | // Over a minute, less than an hour |
| 738 | - $val = (int) floor($seconds / 60); |
|
| 738 | + $val = (int)floor($seconds / 60); |
|
| 739 | 739 | $key = 'minutes'; |
| 740 | 740 | } |
| 741 | 741 | |