3 * Template Lite template_destroy_dir template internal module
6 * Name: template_destroy_dir
9 function template_destroy_dir($file, $id, $dir, &$object)
11 if ($file == null && $id == null)
15 if($d = opendir($dir))
17 while(($f = readdir($d)) !== false)
19 if ($f != '.' && $f != '..')
21 template_rm_dir($dir.$f.DIRECTORY_SEPARATOR
);
31 $object->template_dir
= $object->_get_dir($object->template_dir
);
33 $name = ($object->encode_file_name
) ?
md5($object->template_dir
.$file).'.php' : str_replace(".", "_", str_replace("/", "_", $file)).'.php';
39 foreach(explode('|', $id) as $value)
41 $_args .= $value.DIRECTORY_SEPARATOR
;
43 template_rm_dir($dir.DIRECTORY_SEPARATOR
.$_args);
48 function template_rm_dir($dir)
50 if (is_file(substr($dir, 0, -1)))
52 @unlink
(substr($dir, 0, -1));
56 if (!file_exists($dir))
59 if ($d = opendir($dir))
61 while(($f = readdir($d)) !== false)
63 if ($f != '.' && $f != '..')
65 template_rm_dir($dir.$f.DIRECTORY_SEPARATOR
);