You are here

function _xmlsitemap_frequency in XML sitemap 5

Determine the frequency of updates to a link.

Parameters

$interval: The number of seconds since last change:

Return value

A string representing the update frequency according to the sitemaps.org protocol

Related topics

3 calls to _xmlsitemap_frequency()
theme_xmlsitemap_node_view_news in xmlsitemap_node/xmlsitemap_node.module
Display the nodes of a view as a Google News site map.
theme_xmlsitemap_node_view_sitemap in xmlsitemap_node/xmlsitemap_node.module
Display the nodes of a view as an XML site map.
_xmlsitemap_format in ./xmlsitemap.module
Process an array of links.

File

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

Code

function _xmlsitemap_frequency($interval) {
  $frequencies = array(
    'always' => 3600,
    'hourly' => 86400,
    'daily' => 604800,
    'weekly' => 2419200,
    'monthly' => 29030400,
    'yearly' => 100000000,
    'never' => 0,
  );
  $frequency = 'never';
  if (!is_numeric($interval)) {
    if (isset($frequencies[$interval])) {
      $frequency = $interval;
    }
  }
  else {
    foreach ($frequencies as $frequency => $value) {
      if ($interval < $value) {
        break;
      }
    }
  }
  return $frequency;
}