+
+ function flush_dir($path) {
+ $dir = opendir($path);
+ while(false !== ($fname = readdir($dir))) {
+ if($fname=='.' || $fname=='..') continue;
+ if(is_dir($path.'/'.$fname)) {
+ flush_dir($path.'/'.$fname);
+ rmdir($path.'/'.$fname);
+ } else
+ unlink($path.'/'.$fname);
+ }
+ }
+
+ function cache_js_file($fpath, $text)
+ {
+
+ // FIX compress text ...
+
+ $file = fopen($fpath, 'w');
+ if (!$file) return false;
+ if (!fwrite($file, $text)) return false;
+ return fclose($file);
+
+ }
+
+ function add_js_file($filename)
+ {