You are here

function xmlsitemap_sitemap_frequency in XML sitemap 6

Same name and namespace in other branches
  1. 5.2 xmlsitemap/xmlsitemap.module \xmlsitemap_sitemap_frequency()

Determine the frequency of updates to a link.

Parameters

$interval: The number of seconds since the last change, or the number of seconds between the last change, and the previous change.

Return value

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

1 call to xmlsitemap_sitemap_frequency()
_xmlsitemap_create_cache_chunk in ./xmlsitemap.pages.inc
Create a sitemap chunk cache file.

File

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

Code

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