You are here

function cdn_check_file in CDN 6.2

Same name and namespace in other branches
  1. 7.2 cdn.module \cdn_check_file()

Check if a file should be served from the CDN.

Parameters

$path: Path to a file; relative to the Drupal root directory.

1 call to cdn_check_file()
cdn_file_url_alter in ./cdn.module
Implementation of hook_file_url_alter().

File

./cdn.module, line 751

Code

function cdn_check_file($path) {
  $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($path, $file_path_blacklist) || drupal_match_path($path, $module_blacklist)) && !drupal_match_path($path, $file_path_whitelist)) {
    return FALSE;
  }
  return TRUE;
}