You are here

function ResourcePublicStreamWrapper::interpolateUrl in D7 Media 6

Interpolate the url path, adding the public files path.

Overrides ResourceStreamWrapper::interpolateUrl

File

resource/ResourcePublicStreamWrapper.inc, line 27

Class

ResourcePublicStreamWrapper
public:// stream wrapper class.

Code

function interpolateUrl($url) {
  $basepath = variable_get($this->pathKey, $this->pathDefault);

  // just in case stream_public_path is s3://, ftp://, etc. Don't call PHP's
  // realpath().
  if (parse_url($basepath, PHP_URL_SCHEME)) {
    $path = $basepath . parse_url($url, PHP_URL_PATH);
  }
  else {

    // interpolate relative paths for basepath, and strip relative paths from
    // url path.
    $path = realpath($basepath) . str_replace('/..', '', parse_url($url, PHP_URL_PATH));
  }
  return $path;
}