示例#1
0
 public static function load_config()
 {
     if (self::check_cache()) {
         $data = \System\Json::read(BASE_DIR . self::FILE_ROUTES_CACHE);
         self::$routes = $data['routes'];
         self::$menu = $data['menu'];
         self::$cfg = $data['cfg'];
     } else {
         self::build_config();
     }
 }
示例#2
0
 /** Load cached data
  */
 private static function load_cache()
 {
     self::$conf = \System\Json::read(self::get_cache_filename());
     ksort(self::$conf);
 }
示例#3
0
文件: text.php 项目: just-paja/fudjan
 public static function get_meta($path, $file)
 {
     $json = null;
     $meta = null;
     if (file_exists($p = $path . '/' . $file)) {
         $json = \System\Json::read($p);
     }
     if ($json) {
         if (isset($json['include'])) {
             $meta = $json['include'];
         } else {
             if (isset($json['main'])) {
                 $meta = $json['main'];
                 if (!is_array($meta)) {
                     $meta = array($meta);
                 }
             }
         }
     }
     return $meta;
 }
示例#4
0
 /** Load all messages by language
  * @param string $lang
  * @return void
  */
 public function load_messages($locale = null)
 {
     if (is_null($locale)) {
         $locale = $this->locale;
     }
     if (!isset($this->messages[$locale])) {
         $list = $this::get_available();
         if (in_array($locale, $list)) {
             $file = BASE_DIR . self::DIR_CACHE . '/' . $locale . '.json';
             if (file_exists($file)) {
                 $this->messages[$locale] = \System\Json::read($file);
             } else {
                 $this->messages[$locale] = \System\Settings::read(self::DIR . '/' . $locale, false, $this->files);
             }
         } else {
             throw new \System\Error\Locales(sprintf('Unknown language %s', $locale));
         }
     }
     return $this;
 }
示例#5
0
文件: db.php 项目: just-paja/fudjan
 private function import_json($file)
 {
     $json = \System\Json::read($file);
     $this->seed_data($file, $json);
     return $this;
 }