You are here

function _xmlsitemap_file_create_url in XML sitemap 5

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

Related topics

3 calls to _xmlsitemap_file_create_url()
theme_xmlsitemap_node_view_sitemap in xmlsitemap_node/xmlsitemap_node.module
Display the nodes of a view as an XML site map.
_xmlsitemap_output_chunk in ./xmlsitemap.module
Generate a chunk of the site map.
_xmlsitemap_output_index in ./xmlsitemap.module
Generate the site map index.

File

./xmlsitemap.module, line 506
Creates a site map compatible with the sitemaps.org schema.

Code

function _xmlsitemap_file_create_url($path) {

  // Strip file_directory_path from $path. We only include relative paths in urls.
  if (strpos($path, file_directory_path() . '/') === 0) {
    $path = trim(substr($path, strlen(file_directory_path())), '\\/');
  }
  switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
    case FILE_DOWNLOADS_PUBLIC:
      return $GLOBALS['base_url'] . '/' . file_directory_path() . '/' . str_replace('\\', '/', $path);
    case FILE_DOWNLOADS_PRIVATE:
      return xmlsitemap_url('system/files/' . $path, NULL, NULL, NULL, TRUE);
  }
}