function ctools_file_download

Implementation of hook_file_download()

When using the private file system, we have to let Drupal know it's ok to download CSS and image files from our temporary directory.

File

./ctools.module, line 712

Code

function ctools_file_download($filepath) {
    if (strpos($filepath, 'ctools') === 0) {
        $mime = file_get_mimetype($filepath);
        // For safety's sake, we allow only text and images.
        if (strpos($mime, 'text') === 0 || strpos($mime, 'image') === 0) {
            return array(
                'Content-type:' . $mime,
            );
        }
    }
}