static function checked_read($filename) { if ($content = fs::read($filename)) { return $content; } else { runtime_error('File not found: ' . $filename); } }
static function create($options) { if (isset($options->cache)) { $cache = $options->cache . 'cache.tmp'; if ($www = fs::read($cache)) { $www = unserialize($www); $www->locale->setup($options->language, $options->country); return $www; } else { $www = new www($options); fs::write($cache, serialize($www)); return $www; } } else { return new www($options); } }
static function create($language, $country, $types = array()) { foreach ($types as $name => $pattern) { validate::register($name, $pattern); } $cache = cache_location . 'cache.tmp'; if ($www = fs::read($cache)) { $www = unserialize($www); $www->locale->setup($language, $country); return $www; } else { $www = new www($language, $country); fs::write($cache, serialize($www)); $www->vars->initialize(); return $www; } }
static function create($options) { if (isset($options->cache)) { $cache = $options->cache . 'cache.tmp'; if ($www = fs::read($cache)) { $www = unserialize($www); $www->bind(); return $www; } else { $www = new www($options); fs::write($cache, serialize($www)); $www->bind(); return $www; } } else { $www = new www($options); $www->bind(); return $www; } }