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(); } }
/** Load cached data */ private static function load_cache() { self::$conf = \System\Json::read(self::get_cache_filename()); ksort(self::$conf); }
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; }
/** 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; }
private function import_json($file) { $json = \System\Json::read($file); $this->seed_data($file, $json); return $this; }