示例#1
0
function wptouch_remove_file($dir_name, $f)
{
    if ($f == '__MACOSX') {
        wptouch_remove_directory($dir_name . '/' . $f);
    }
    @unlink($dir_name . '/' . $f);
}
function wptouch_remove_directory($dir_name)
{
    // Check permissions
    if (current_user_can('manage_options')) {
        $dir = @opendir($dir_name);
        if ($dir) {
            while ($f = readdir($dir)) {
                if ($f == '.' || $f == '..') {
                    continue;
                }
                if ($f == '__MACOSX') {
                    wptouch_remove_directory($dir_name . '/' . $f);
                }
                @unlink($dir_name . '/' . $f);
            }
            closedir($dir);
            rmdir($dir_name);
        }
    }
}
 function remove_directory($dir_name)
 {
     require_once WPTOUCH_DIR . '/core/file-operations.php';
     wptouch_remove_directory($dir_name);
 }