xmlsitemap_frequency

Definition

xmlsitemap_frequency($interval)
contributions/modules/xmlsitemap/xmlsitemap.module, line 370

Description

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

Namesort iconDescription
XML SitemapNotify search engines of site updates.

Code

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