/** * Return the IntlDateFormatter for the given locale and date type. * @param string $locale * @param integer $date_type * @return IntlDateFormatter */ public function getIntlFormatter($locale, $date_type) { if (!class_exists("IntlDateFormatter")) { return null; } if (!is_array(self::$formatters)) { self::$formatters = array(); } if (!array_key_exists($locale, self::$formatters) || !is_array(self::$formatters[$locale])) { self::$formatters[$locale] = array(); } if (!array_key_exists($date_type, self::$formatters[$locale]) || !self::$formatters[$locale][$date_type] instanceof IntlDateFormatter) { $format = self::$intl_formats[$date_type]; I2CE::getConfig()->setIfIsSet($format, "/I2CE/date/intl_format/" . $date_type); self::$formatters[$locale][$date_type] = new IntlDateFormatter($locale, null, null, null, null, $format); } if (self::$formatters[$locale][$date_type] instanceof IntlDateFormatter) { return self::$formatters[$locale][$date_type]; } else { return null; } }