You are here

function _media_sitemap_format_title in Media Sitemap 7

Custom function for getting the formated title of the Image.

1 call to _media_sitemap_format_title()
_media_sitemap_generate in ./media_sitemap.module
Custom function for generating the sitemap.

File

./media_sitemap.module, line 133
This module is used for creating XML sitemap of Image/Video for Google.

Code

function _media_sitemap_format_title($filename = "") {
  $replacements = array(
    '/\\..*/' => '',
    '/[^a-zA-Z0-9]+/' => ' ',
    '/([a-z])([A-Z])/' => '\\1 \\2',
    '/([a-zA-Z])([0-9])/' => '\\1 \\2',
    '/([0-9])([a-zA-Z])/' => '\\1 \\2',
  );

  // In addition to above replacements, also capitalize the first letter of
  // each word, and remove leading and trailing spaces.
  $title = trim(ucwords(preg_replace(array_keys($replacements), array_values($replacements), $filename)));
  return $title;
}