示例#1
0
 static function checked_read($filename)
 {
     if ($content = fs::read($filename)) {
         return $content;
     } else {
         runtime_error('File not found: ' . $filename);
     }
 }
示例#2
0
文件: www.php 项目: nyan-cat/easyweb
 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);
     }
 }
示例#3
0
文件: www.php 项目: nyan-cat/easyweb
 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;
     }
 }
示例#4
0
文件: www.php 项目: nyan-cat/easyweb
 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;
     }
 }