Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-03-05 03:53:31 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-03-05 03:53:31 +0400
commitc25f396c2452760b9c40c95b6889a3abdfcb317e (patch)
tree046e92caa124ab6a8f531d2e4232be296caa7764 /core/Twig.php
parent8601c094bd1b0e4dbf80877ea7d00ad831a1b7ba (diff)
refs #57 started to work on movers and shakers and lots of minor improvements
Diffstat (limited to 'core/Twig.php')
-rw-r--r--core/Twig.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/Twig.php b/core/Twig.php
index fd266d0b7b..4da7a364f8 100644
--- a/core/Twig.php
+++ b/core/Twig.php
@@ -9,6 +9,7 @@
namespace Piwik;
use Exception;
+use Piwik\Period\Range;
use Piwik\Translate;
use Piwik\Visualization\Sparkline;
use Piwik\View\RenderTokenParser;
@@ -63,6 +64,7 @@ class Twig
$this->addFilter_truncate();
$this->addFilter_notificiation();
$this->addFilter_percentage();
+ $this->addFilter_prettyDate();
$this->twig->addFilter(new Twig_SimpleFilter('implode', 'implode'));
$this->twig->addFilter(new Twig_SimpleFilter('ucwords', 'ucwords'));
@@ -187,6 +189,14 @@ class Twig
$this->twig->addFilter($notificationFunction);
}
+ protected function addFilter_prettyDate()
+ {
+ $prettyDate = new Twig_SimpleFilter('prettyDate', function ($dateString, $period) {
+ return Range::factory($period, $dateString)->getLocalizedShortString();
+ });
+ $this->twig->addFilter($prettyDate);
+ }
+
protected function addFilter_percentage()
{
$percentage = new Twig_SimpleFilter('percentage', function ($string, $totalValue, $precision = 1) {