/**
 * Plugin smarty type modifier
 * Purpose:  format a date given by its timestamp (YYYMMDD) to a date according
 *   to the current languages settings
 * if an incorrect date is given, returns the string without any modification
 * Input: YYYYMMDD
 * Output: (french) DD/MM/YYYY, (english) MM/DD/YYYY
 * Example:  {$date|datei18n}
 * @return string
 */
function smarty_modifier_datei18n($string)
{
    return ($date = CopixI18N::timestampToDate($string)) !== false ? $date : $string;
}