You are here

function xmlsitemap_file_create_url in XML sitemap 5.2

Modified version of file_create_url(). Allows us to remove language prefixes.

Parameters

$path: the path to the file:

Return value

A URL to the file

File

xmlsitemap/xmlsitemap.module, line 325
Creates a sitemap compatible with the sitemaps.org schema.

Code

function xmlsitemap_file_create_url($path, $alias = NULL) {
  $path = trim(substr($path, strlen(file_directory_path())), '\\/');
  if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
    return xmlsitemap_url('system/files/' . $path, $alias, NULL, NULL, TRUE);
  }
  else {
    return "{$GLOBALS['base_url']}/" . file_directory_path() . '/' . str_replace('\\', '/', $path);
  }
}