@@ -46,31 +46,31 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $options = ['is_safe' => ['html']]; |
| 48 | 48 | return [ |
| 49 | - new \Twig_SimpleFunction('request_time', [ $this, 'requestTime' ], $options), |
|
| 50 | - new \Twig_SimpleFunction('memory_usage', [ $this, 'requestMemory' ], $options), |
|
| 51 | - new \Twig_SimpleFunction('year', [ $this, 'generateYear' ], $options), |
|
| 52 | - new \Twig_SimpleFunction('msgPrintExists', [ $this, 'intuitionMessagePrintExists' ], $options), |
|
| 53 | - new \Twig_SimpleFunction('msgExists', [ $this, 'intuitionMessageExists' ], $options), |
|
| 54 | - new \Twig_SimpleFunction('msg', [ $this, 'intuitionMessage' ], $options), |
|
| 55 | - new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options), |
|
| 56 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
| 57 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
| 58 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
| 59 | - new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
| 60 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
| 61 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
| 62 | - new \Twig_SimpleFunction('releaseDate', [ $this, 'gitDate' ]), |
|
| 63 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
| 64 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
| 65 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
| 66 | - new \Twig_SimpleFunction('chartColor', [ $this, 'chartColor' ]), |
|
| 67 | - new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]), |
|
| 68 | - new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]), |
|
| 69 | - new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]), |
|
| 70 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
| 71 | - new \Twig_SimpleFunction('replag', [ $this, 'replag' ]), |
|
| 72 | - new \Twig_SimpleFunction('quote', [ $this, 'quote' ]), |
|
| 73 | - new \Twig_SimpleFunction('bugReportURL', [ $this, 'bugReportURL' ]), |
|
| 49 | + new \Twig_SimpleFunction('request_time', [$this, 'requestTime'], $options), |
|
| 50 | + new \Twig_SimpleFunction('memory_usage', [$this, 'requestMemory'], $options), |
|
| 51 | + new \Twig_SimpleFunction('year', [$this, 'generateYear'], $options), |
|
| 52 | + new \Twig_SimpleFunction('msgPrintExists', [$this, 'intuitionMessagePrintExists'], $options), |
|
| 53 | + new \Twig_SimpleFunction('msgExists', [$this, 'intuitionMessageExists'], $options), |
|
| 54 | + new \Twig_SimpleFunction('msg', [$this, 'intuitionMessage'], $options), |
|
| 55 | + new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options), |
|
| 56 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
| 57 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
| 58 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
| 59 | + new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
| 60 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
| 61 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
| 62 | + new \Twig_SimpleFunction('releaseDate', [$this, 'gitDate']), |
|
| 63 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
| 64 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
| 65 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
| 66 | + new \Twig_SimpleFunction('chartColor', [$this, 'chartColor']), |
|
| 67 | + new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']), |
|
| 68 | + new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']), |
|
| 69 | + new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']), |
|
| 70 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
| 71 | + new \Twig_SimpleFunction('replag', [$this, 'replag']), |
|
| 72 | + new \Twig_SimpleFunction('quote', [$this, 'quote']), |
|
| 73 | + new \Twig_SimpleFunction('bugReportURL', [$this, 'bugReportURL']), |
|
| 74 | 74 | new \Twig_SimpleFunction('logged_in_user', [$this, 'functionLoggedInUser']), |
| 75 | 75 | new \Twig_SimpleFunction('isUserAnon', [$this, 'isUserAnon']), |
| 76 | 76 | new \Twig_SimpleFunction('nsName', [$this, 'nsName']), |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public function requestTime() |
| 90 | 90 | { |
| 91 | 91 | if (!isset($this->requestTime)) { |
| 92 | - $this->requestTime = microtime(true) - $this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 92 | + $this->requestTime = microtime(true)-$this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | return $this->requestTime; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | public function intuitionMessage($message = "", $vars = []) |
| 164 | 164 | { |
| 165 | 165 | $vars = is_array($vars) ? $vars : []; |
| 166 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
| 166 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -192,10 +192,10 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function getAllLangs() |
| 194 | 194 | { |
| 195 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
| 195 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
| 196 | 196 | |
| 197 | 197 | $languages = array_values(array_unique(array_map( |
| 198 | - function ($filename) { |
|
| 198 | + function($filename) { |
|
| 199 | 199 | return basename($filename, '.json'); |
| 200 | 200 | }, |
| 201 | 201 | $messageFiles |
@@ -543,9 +543,9 @@ discard block |
||
| 543 | 543 | public function getFilters() |
| 544 | 544 | { |
| 545 | 545 | return [ |
| 546 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
| 547 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
| 548 | - new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]), |
|
| 546 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
| 547 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
| 548 | + new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]), |
|
| 549 | 549 | new \Twig_SimpleFilter('num_format', [$this, 'numberFormat']), |
| 550 | 550 | new \Twig_SimpleFilter('date_format', [$this, 'dateFormatStd']), |
| 551 | 551 | new \Twig_SimpleFilter('date_localize', [$this, 'dateFormat']), |
@@ -646,10 +646,10 @@ discard block |
||
| 646 | 646 | if (!$denominator) { |
| 647 | 647 | $quotient = $numerator; |
| 648 | 648 | } else { |
| 649 | - $quotient = ( $numerator / $denominator ) * 100; |
|
| 649 | + $quotient = ($numerator / $denominator) * 100; |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - return $this->numberFormat($quotient, $precision) . '%'; |
|
| 652 | + return $this->numberFormat($quotient, $precision).'%'; |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | /** |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | list($val, $key) = $this->getDurationMessageKey($seconds); |
| 720 | 720 | |
| 721 | 721 | if ($translate) { |
| 722 | - return $this->numberFormat($val) . ' ' . $this->intuitionMessage("num-$key", [$val]); |
|
| 722 | + return $this->numberFormat($val).' '.$this->intuitionMessage("num-$key", [$val]); |
|
| 723 | 723 | } else { |
| 724 | 724 | return [$this->numberFormat($val), "num-$key"]; |
| 725 | 725 | } |
@@ -740,15 +740,15 @@ discard block |
||
| 740 | 740 | |
| 741 | 741 | if ($seconds >= 86400) { |
| 742 | 742 | // Over a day |
| 743 | - $val = (int) floor($seconds / 86400); |
|
| 743 | + $val = (int)floor($seconds / 86400); |
|
| 744 | 744 | $key = 'days'; |
| 745 | 745 | } elseif ($seconds >= 3600) { |
| 746 | 746 | // Over an hour, less than a day |
| 747 | - $val = (int) floor($seconds / 3600); |
|
| 747 | + $val = (int)floor($seconds / 3600); |
|
| 748 | 748 | $key = 'hours'; |
| 749 | 749 | } elseif ($seconds >= 60) { |
| 750 | 750 | // Over a minute, less than an hour |
| 751 | - $val = (int) floor($seconds / 60); |
|
| 751 | + $val = (int)floor($seconds / 60); |
|
| 752 | 752 | $key = 'minutes'; |
| 753 | 753 | } |
| 754 | 754 | |