示例#1
0
文件: css.php 项目: pihizi/qf
 static function cache_content($f)
 {
     $files = array_unique(explode(' ', $f));
     $content = '';
     foreach ($files as $file) {
         $file = trim($file);
         list($category, $file) = explode(':', $file, 2);
         if (!$file) {
             $file = $category;
             $category = NULL;
         }
         if (!$file) {
             continue;
         }
         $path = Core::file_exists(PRIVATE_BASE . 'css/' . $file . '.css', $category);
         if ($path) {
             $content .= CSS::format(@file_get_contents($path));
         }
     }
     $url_base = preg_replace('/[^\\/]*$/', '', $_SERVER['SCRIPT_NAME']);
     $content = preg_replace('/\\burl\\s*\\(\\s*(["\'])?\\s*([^:]+?)\\s*\\1?\\s*\\)/', 'url(' . $url_base . '\\2)', $content);
     $css_file = Misc::key('css', $f) . '.css';
     Cache::cache_content($css_file, $content);
     return $content;
 }