You are here

function xmlsitemap_node_frequency in XML sitemap 5

Same name and namespace in other branches
  1. 5.2 xmlsitemap_node/xmlsitemap_node.module \xmlsitemap_node_frequency()

Related topics

3 calls to xmlsitemap_node_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_node_links in xmlsitemap_node/xmlsitemap_node.module
Get node links.

File

xmlsitemap_node/xmlsitemap_node.module, line 87
Adds nodes to the site map.

Code

function xmlsitemap_node_frequency($node) {
  $age = time() - $node->changed;
  if (variable_get('xmlsitemap_node_count_comments', TRUE)) {
    $age = time() - max($node->changed, $node->last_comment_timestamp);
    if (!empty($node->previously_changed) && isset($node->previous_comment)) {
      $interval = min($node->changed, $node->last_comment_timestamp) - max($node->previously_changed, $node->previous_comment);
    }
    elseif (!empty($node->previously_changed)) {
      $interval = min($node->changed, $node->last_comment_timestamp) - $node->previously_changed;
    }
    elseif (isset($node->previous_comment)) {
      $interval = min($node->changed, $node->last_comment_timestamp) - $node->previous_comment;
    }
    else {
      $interval = 0;
    }
  }
  else {
    $interval = empty($node->previously_changed) ? 0 : $node->changed - $node->previously_changed;
  }
  return max($age, $interval);
}