Example #1
0
 protected static function _getLocalizedToken($token, $locale)
 {
     switch ($token) {
         case self::ISO_8601:
             return "yyyy-MM-ddThh:mm:ss";
             break;
         case self::RFC_2822:
             return "EEE, dd MMM yyyy HH:mm:ss";
             break;
         case self::DATES:
             return Locale\Data::getContent($locale, 'date');
             break;
         case self::DATE_FULL:
             return Locale\Data::getContent($locale, 'date', array('gregorian', 'full'));
             break;
         case self::DATE_LONG:
             return Locale\Data::getContent($locale, 'date', array('gregorian', 'long'));
             break;
         case self::DATE_MEDIUM:
             return Locale\Data::getContent($locale, 'date', array('gregorian', 'medium'));
             break;
         case self::DATE_SHORT:
             return Locale\Data::getContent($locale, 'date', array('gregorian', 'short'));
             break;
         case self::TIMES:
             return Locale\Data::getContent($locale, 'time');
             break;
         case self::TIME_FULL:
             return Locale\Data::getContent($locale, 'time', array('gregorian', 'full'));
             break;
         case self::TIME_LONG:
             return Locale\Data::getContent($locale, 'time', array('gregorian', 'long'));
             break;
         case self::TIME_MEDIUM:
             return Locale\Data::getContent($locale, 'time', array('gregorian', 'medium'));
             break;
         case self::TIME_SHORT:
             return Locale\Data::getContent($locale, 'time', array('gregorian', 'short'));
             break;
         case self::DATETIME:
             return Locale\Data::getContent($locale, 'datetime');
             break;
         case self::DATETIME_FULL:
             return Locale\Data::getContent($locale, 'datetime', array('gregorian', 'full'));
             break;
         case self::DATETIME_LONG:
             return Locale\Data::getContent($locale, 'datetime', array('gregorian', 'long'));
             break;
         case self::DATETIME_MEDIUM:
             return Locale\Data::getContent($locale, 'datetime', array('gregorian', 'medium'));
             break;
         case self::DATETIME_SHORT:
             return Locale\Data::getContent($locale, 'datetime', array('gregorian', 'short'));
             break;
         case self::ATOM:
         case self::RFC_3339:
         case self::W3C:
             return "yyyy-MM-DD HH:mm:ss";
             break;
         case self::COOKIE:
         case self::RFC_850:
             return "EEEE, dd-MM-yyyy HH:mm:ss";
             break;
         case self::RFC_822:
         case self::RFC_1036:
         case self::RFC_1123:
         case self::RSS:
             return "EEE, dd MM yyyy HH:mm:ss";
             break;
     }
     return $token;
 }
Example #2
0
 /**
  * Disables the set cache
  *
  * @param  boolean $flag True disables any set cache, default is false
  * @return void
  */
 public static function disableCache($flag)
 {
     Data::disableCache($flag);
 }
Example #3
0
 public static function getDateTimeFormat($locale = null)
 {
     $format = Data::getContent($locale, 'datetime');
     if (empty($format)) {
         throw new Exception("failed to receive data from locale {$locale}");
     }
     return $format;
 }