From 4f5b44bd3bd490309eb2ba7b44df4769816ba729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 3 Aug 2013 19:26:54 +0200 Subject: twig implementation --- inc/3rdparty/Twig/Extensions/Extension/Intl.php | 66 ------------------------- 1 file changed, 66 deletions(-) delete mode 100644 inc/3rdparty/Twig/Extensions/Extension/Intl.php (limited to 'inc/3rdparty/Twig/Extensions/Extension/Intl.php') diff --git a/inc/3rdparty/Twig/Extensions/Extension/Intl.php b/inc/3rdparty/Twig/Extensions/Extension/Intl.php deleted file mode 100644 index 40f7fc20..00000000 --- a/inc/3rdparty/Twig/Extensions/Extension/Intl.php +++ /dev/null @@ -1,66 +0,0 @@ - new Twig_Filter_Function('twig_localized_date_filter', array('needs_environment' => true)), - ); - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'intl'; - } -} - -function twig_localized_date_filter(Twig_Environment $env, $date, $dateFormat = 'medium', $timeFormat = 'medium', $locale = null, $timezone = null, $format = null) -{ - $date = twig_date_converter($env, $date, $timezone); - - $formatValues = array( - 'none' => IntlDateFormatter::NONE, - 'short' => IntlDateFormatter::SHORT, - 'medium' => IntlDateFormatter::MEDIUM, - 'long' => IntlDateFormatter::LONG, - 'full' => IntlDateFormatter::FULL, - ); - - $formatter = IntlDateFormatter::create( - $locale !== null ? $locale : Locale::getDefault(), - $formatValues[$dateFormat], - $formatValues[$timeFormat], - $date->getTimezone()->getName(), - IntlDateFormatter::GREGORIAN, - $format - ); - - return $formatter->format($date->getTimestamp()); -} -- cgit v1.2.3