示例#1
0
 public function load($group)
 {
     $config = array();
     if ($files = JsonApiApplication::find_file($this->_directory, $group, NULL, TRUE)) {
         foreach ($files as $file) {
             $config = Arr::merge($config, JsonApiApplication::load($file));
         }
     }
     return $config;
 }
示例#2
0
 public static function load($lang)
 {
     if (isset(I18n::$_cache[$lang])) {
         return I18n::$_cache[$lang];
     }
     $table = array();
     $parts = explode("-", $lang);
     do {
         $path = implode(DIRECTORY_SEPARATOR, $parts);
         if ($files = JsonApiApplication::find_file("i18n", $path, NULL, TRUE)) {
             $t = array();
             foreach ($files as $file) {
                 $t = array_merge($t, JsonApiApplication::load($file));
             }
             $table += $t;
         }
         array_pop($parts);
     } while ($parts);
     return I18n::$_cache[$lang] = $table;
 }
示例#3
0
 public static function message($file, $path = NULL, $default = NULL)
 {
     static $messages;
     if (!isset($messages[$file])) {
         $messages[$file] = array();
         if ($files = JsonApiApplication::find_file("messages", $file)) {
             foreach ($files as $f) {
                 $messages[$file] = Arr::merge($messages[$file], JsonApiApplication::load($f));
             }
         }
     }
     if ($path === NULL) {
         return $messages[$file];
     } else {
         return Arr::path($messages[$file], $path, $default);
     }
 }