function cdn_check_file in CDN 7.2
Same name and namespace in other branches
- 6.2 cdn.module \cdn_check_file()
Check if a file should be served from the CDN.
Parameters
$uri: A file URI.
3 calls to cdn_check_file()
- cdn_css_alter in ./
cdn.module - Implements hook_css_alter().
- cdn_file_url_alter in ./
cdn.module - Implements hook_file_url_alter().
- cdn_js_alter in ./
cdn.module - Implements hook_js_alter().
File
- ./
cdn.module, line 922
Code
function cdn_check_file($uri) {
$file_path_blacklist = variable_get(CDN_EXCEPTION_FILE_PATH_BLACKLIST_VARIABLE, CDN_EXCEPTION_FILE_PATH_BLACKLIST_DEFAULT);
$file_path_whitelist = variable_get(CDN_EXCEPTION_FILE_PATH_WHITELIST_VARIABLE, CDN_EXCEPTION_FILE_PATH_WHITELIST_DEFAULT);
$module_blacklist = cdn_get_blacklist();
// A file should not be served from a CDN when it matches one of the
// blacklists, except when it matches the whitelist.
if ((drupal_match_path($uri, $file_path_blacklist) || drupal_match_path($uri, $module_blacklist)) && !drupal_match_path($uri, $file_path_whitelist)) {
return FALSE;
}
return TRUE;
}