diff options
author | mattab <matthieu.aubry@gmail.com> | 2015-10-12 01:37:26 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2015-10-12 01:37:26 +0300 |
commit | 95bea8a4008087c4fd6261fc06542bd3137a0312 (patch) | |
tree | 9ddfb2889eb45961eedc2cb33f7e3e24998d9c1c /core/Twig.php | |
parent | b4dc4af37f9667dff5e41d4e0b1ff9587a967157 (diff) |
SMS report: percentage evolution are prefixed by '+'
https://github.com/piwik/piwik/pull/8857
Diffstat (limited to 'core/Twig.php')
-rwxr-xr-x | core/Twig.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/Twig.php b/core/Twig.php index 6d5b91a24c..c806dcf9bb 100755 --- a/core/Twig.php +++ b/core/Twig.php @@ -86,6 +86,7 @@ class Twig $this->addFilter_notification(); $this->addFilter_percentage(); $this->addFilter_percent(); + $this->addFilter_percentEvolution(); $this->addFilter_prettyDate(); $this->addFilter_safeDecodeRaw(); $this->addFilter_number(); @@ -288,6 +289,14 @@ class Twig $this->twig->addFilter($percentage); } + protected function addFilter_percentEvolution() + { + $percentage = new Twig_SimpleFilter('percentEvolution', function ($string) { + return NumberFormatter::getInstance()->formatPercentEvolution($string); + }); + $this->twig->addFilter($percentage); + } + protected function addFilter_number() { $formatter = new Twig_SimpleFilter('number', function ($string, $minFractionDigits = 0, $maxFractionDigits = 0) { |