You are here

function _cdn_get_absolute_path in CDN 7.2

Maps a file URI (or shipped file path) to an absolute path.

Parameters

string $uri: A file URI or shipped file path.

Return value

string The absolute path.

2 calls to _cdn_get_absolute_path()
cdn_touch_file_form_submit in ./cdn.stats.inc
_cdn_devel_page_stats in ./cdn.stats.inc
Collects per-page CDN integration statistics.

File

./cdn.stats.inc, line 143
Per-page CDN integration statistics functionality.

Code

function _cdn_get_absolute_path($uri) {
  static $drupal_root_path;
  if (!isset($drupal_root_path)) {
    $drupal_root_path = dirname('.');
  }
  $absolute_path = '';
  if (file_uri_scheme($uri)) {
    if ($wrapper = file_stream_wrapper_get_instance_by_uri($uri)) {
      $absolute_path = $wrapper
        ->realpath();
    }
  }
  else {
    $absolute_path = realpath($drupal_root_path . '/' . $uri);
  }
  return $absolute_path;
}