Change grab file so that $resource_id is an option (only required for resources) 

I hope the logic in this pull request is identical to the current version. Using "switch" reduces code duplication.

You might also want to reinstate $options['timeout'] as a full-blown parameter, as it is applicable to all filetypes, so

grab_file($file, $type, $options = array(), $download_timeout)

seems a reasonable call.

The only 2 times it is used, it also has $options set, so you'll never need to pass in a dummy $options parameter.