You are here

function cdn_check_drupal_path in CDN 6.2

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

Check if a Drupal path should serve files from the CDN (i.e.: is the Drupal path blacklisted?).

Parameters

$path: A Drupal path.

2 calls to cdn_check_drupal_path()
cdn_file_url_alter in ./cdn.module
Implementation of hook_file_url_alter().
_cdn_css_aggregate in ./cdn.basic.css.inc
Mostly based on drupal_get_css().

File

./cdn.module, line 727

Code

function cdn_check_drupal_path($path) {
  global $user;
  $blacklist = variable_get(CDN_EXCEPTION_DRUPAL_PATH_BLACKLIST_VARIABLE, CDN_EXCEPTION_DRUPAL_PATH_BLACKLIST_DEFAULT);
  $auth_blacklist = variable_get(CDN_EXCEPTION_AUTH_USERS_BLACKLIST_VARIABLE, CDN_EXCEPTION_AUTH_USERS_BLACKLIST_DEFAULT);

  // Check if the Drupal path matches one of the blacklisted Drupal paths.
  if (drupal_match_path($path, $blacklist)) {
    return FALSE;
  }

  // If logged in user, apply a secondary blacklist.
  if ($user->uid > 0 && drupal_match_path($path, $auth_blacklist)) {
    return FALSE;
  }
  return TRUE;
}