@@ -41,32 +41,32 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $options = ['is_safe' => ['html']]; |
| 43 | 43 | return [ |
| 44 | - new \Twig_SimpleFunction('request_time', [ $this, 'requestTime' ], $options), |
|
| 45 | - new \Twig_SimpleFunction('memory_usage', [ $this, 'requestMemory' ], $options), |
|
| 46 | - new \Twig_SimpleFunction('year', [ $this, 'generateYear' ], $options), |
|
| 47 | - new \Twig_SimpleFunction('msgPrintExists', [ $this, 'intuitionMessagePrintExists' ], $options), |
|
| 48 | - new \Twig_SimpleFunction('msgExists', [ $this, 'intuitionMessageExists' ], $options), |
|
| 49 | - new \Twig_SimpleFunction('msg', [ $this, 'intuitionMessage' ], $options), |
|
| 50 | - new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options), |
|
| 51 | - new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options), |
|
| 52 | - new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]), |
|
| 53 | - new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]), |
|
| 54 | - new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]), |
|
| 55 | - new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]), |
|
| 56 | - new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]), |
|
| 57 | - new \Twig_SimpleFunction('releaseDate', [ $this, 'gitDate' ]), |
|
| 58 | - new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]), |
|
| 59 | - new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]), |
|
| 60 | - new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]), |
|
| 61 | - new \Twig_SimpleFunction('chartColor', [ $this, 'chartColor' ]), |
|
| 62 | - new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]), |
|
| 63 | - new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]), |
|
| 64 | - new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]), |
|
| 65 | - new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]), |
|
| 66 | - new \Twig_SimpleFunction('replag', [ $this, 'replag' ]), |
|
| 67 | - new \Twig_SimpleFunction('link', [ $this, 'link' ]), |
|
| 68 | - new \Twig_SimpleFunction('quote', [ $this, 'quote' ]), |
|
| 69 | - new \Twig_SimpleFunction('bugReportURL', [ $this, 'bugReportURL' ]), |
|
| 44 | + new \Twig_SimpleFunction('request_time', [$this, 'requestTime'], $options), |
|
| 45 | + new \Twig_SimpleFunction('memory_usage', [$this, 'requestMemory'], $options), |
|
| 46 | + new \Twig_SimpleFunction('year', [$this, 'generateYear'], $options), |
|
| 47 | + new \Twig_SimpleFunction('msgPrintExists', [$this, 'intuitionMessagePrintExists'], $options), |
|
| 48 | + new \Twig_SimpleFunction('msgExists', [$this, 'intuitionMessageExists'], $options), |
|
| 49 | + new \Twig_SimpleFunction('msg', [$this, 'intuitionMessage'], $options), |
|
| 50 | + new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options), |
|
| 51 | + new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options), |
|
| 52 | + new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']), |
|
| 53 | + new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']), |
|
| 54 | + new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']), |
|
| 55 | + new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']), |
|
| 56 | + new \Twig_SimpleFunction('hash', [$this, 'gitHash']), |
|
| 57 | + new \Twig_SimpleFunction('releaseDate', [$this, 'gitDate']), |
|
| 58 | + new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']), |
|
| 59 | + new \Twig_SimpleFunction('tools', [$this, 'allTools']), |
|
| 60 | + new \Twig_SimpleFunction('color', [$this, 'getColorList']), |
|
| 61 | + new \Twig_SimpleFunction('chartColor', [$this, 'chartColor']), |
|
| 62 | + new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']), |
|
| 63 | + new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']), |
|
| 64 | + new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']), |
|
| 65 | + new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']), |
|
| 66 | + new \Twig_SimpleFunction('replag', [$this, 'replag']), |
|
| 67 | + new \Twig_SimpleFunction('link', [$this, 'link']), |
|
| 68 | + new \Twig_SimpleFunction('quote', [$this, 'quote']), |
|
| 69 | + new \Twig_SimpleFunction('bugReportURL', [$this, 'bugReportURL']), |
|
| 70 | 70 | new \Twig_SimpleFunction('logged_in_user', [$this, 'functionLoggedInUser']), |
| 71 | 71 | new \Twig_SimpleFunction('isUserAnon', [$this, 'isUserAnon']), |
| 72 | 72 | new \Twig_SimpleFunction('nsName', [$this, 'nsName']), |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | public function requestTime() |
| 83 | 83 | { |
| 84 | 84 | if (!isset($this->requestTime)) { |
| 85 | - $this->requestTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; |
|
| 85 | + $this->requestTime = microtime(true)-$_SERVER['REQUEST_TIME_FLOAT']; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return $this->requestTime; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function intuitionMessage($message = "", $vars = []) |
| 157 | 157 | { |
| 158 | - return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]); |
|
| 158 | + return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -184,10 +184,10 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function getAllLangs() |
| 186 | 186 | { |
| 187 | - $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json'); |
|
| 187 | + $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json'); |
|
| 188 | 188 | |
| 189 | 189 | $languages = array_values(array_unique(array_map( |
| 190 | - function ($filename) { |
|
| 190 | + function($filename) { |
|
| 191 | 191 | return basename($filename, '.json'); |
| 192 | 192 | }, |
| 193 | 193 | $messageFiles |
@@ -534,9 +534,9 @@ discard block |
||
| 534 | 534 | public function getFilters() |
| 535 | 535 | { |
| 536 | 536 | return [ |
| 537 | - new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]), |
|
| 538 | - new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]), |
|
| 539 | - new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]), |
|
| 537 | + new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']), |
|
| 538 | + new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']), |
|
| 539 | + new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]), |
|
| 540 | 540 | new \Twig_SimpleFilter('num_format', [$this, 'numberFormat']), |
| 541 | 541 | new \Twig_SimpleFilter('date_format', [$this, 'dateFormat']), |
| 542 | 542 | ]; |
@@ -605,10 +605,10 @@ discard block |
||
| 605 | 605 | if (!$denominator) { |
| 606 | 606 | $quotient = $numerator; |
| 607 | 607 | } else { |
| 608 | - $quotient = ( $numerator / $denominator ) * 100; |
|
| 608 | + $quotient = ($numerator / $denominator) * 100; |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - return $this->numberFormat($quotient, $precision) . '%'; |
|
| 611 | + return $this->numberFormat($quotient, $precision).'%'; |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | /** |
@@ -683,20 +683,20 @@ discard block |
||
| 683 | 683 | |
| 684 | 684 | if ($seconds >= 86400) { |
| 685 | 685 | // Over a day |
| 686 | - $val = (int) floor($seconds / 86400); |
|
| 686 | + $val = (int)floor($seconds / 86400); |
|
| 687 | 687 | $key = 'days'; |
| 688 | 688 | } elseif ($seconds >= 3600) { |
| 689 | 689 | // Over an hour, less than a day |
| 690 | - $val = (int) floor($seconds / 3600); |
|
| 690 | + $val = (int)floor($seconds / 3600); |
|
| 691 | 691 | $key = 'hours'; |
| 692 | 692 | } elseif ($seconds >= 60) { |
| 693 | 693 | // Over a minute, less than an hour |
| 694 | - $val = (int) floor($seconds / 60); |
|
| 694 | + $val = (int)floor($seconds / 60); |
|
| 695 | 695 | $key = 'minutes'; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | if ($translate) { |
| 699 | - return $this->numberFormat($val) . ' ' . $this->intuitionMessage("num-$key", [$val]); |
|
| 699 | + return $this->numberFormat($val).' '.$this->intuitionMessage("num-$key", [$val]); |
|
| 700 | 700 | } else { |
| 701 | 701 | return [$this->numberFormat($val), "num-$key"]; |
| 702 | 702 | } |
@@ -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 | } |