示例#1
0
 public static function init()
 {
     if (self::$lang === null) {
         self::$lang = conf_get('cms.lang', 'en');
     }
     if (self::$data === null) {
         self::$data = array();
         $dir = new DirectoryIterator(CMS . 'locales');
         foreach ($dir as $fileInfo) {
             if (!$fileInfo->isDot() && !$fileInfo->isDir() && preg_match('/^(?:[a-zA-Z0-9_\\-]+)\\.([a-z]+)\\.php$/', $fileInfo->getFileName(), $mt)) {
                 if (!array_key_exists($mt[1], self::$data)) {
                     self::$data[$mt[1]] = array();
                 }
                 self::$data[$mt[1]] += (require_once $fileInfo->getPathName());
             }
         }
     }
 }