You are here

function cdn_basic_get_mapping in CDN 7.2

Same name and namespace in other branches
  1. 6.2 cdn.basic.inc \cdn_basic_get_mapping()

Returns the CDN mapping for HTTP or HTTPS.

Return value

array

6 calls to cdn_basic_get_mapping()
CDNOriginPullTestCase::assertMapping in tests/cdn.test
Assert a CDN mapping (and optionally set a mapping).
CDNOriginPullTestCase::testMapping in tests/cdn.test
cdn_basic_get_servers in ./cdn.basic.inc
Gets the servers on which a file is available when basic mode is enabled.
cdn_cacheaudit in ./cdn.module
Implements hook_cacheaudit().
cdn_get_domains in ./cdn.module
Get all domains from which files might be served. This information is necessary for some modules, e.g. Boost.

... See full list

File

./cdn.basic.inc, line 62
Logic for basic mode ("Origin Pull mode" in the UI).

Code

function cdn_basic_get_mapping() {
  $https_mapping = variable_get(CDN_BASIC_MAPPING_HTTPS_VARIABLE, '');
  if (!empty($https_mapping) && cdn_serve_from_https()) {

    // if we have https mapping enabled and we are on a HTTPS page
    $mapping = $https_mapping;
  }
  else {

    // otherwise use the non-https mapping
    $mapping = variable_get(CDN_BASIC_MAPPING_VARIABLE, '');
  }
  return $mapping;
}