function _xmlsitemap_term_links in XML sitemap 5
Get term links.
Parameters
$excludes: An array of node types to exclude.:
Return value
An array of links. Each link is an array containing the XML values for a site map URL.
Related topics
1 call to _xmlsitemap_term_links()
- xmlsitemap_term_xmlsitemap_links in xmlsitemap_term/
xmlsitemap_term.module - Implementation of hook_xmlsitemap_links().
File
- xmlsitemap_term/
xmlsitemap_term.module, line 56 - Adds terms to the site map.
Code
function _xmlsitemap_term_links($excludes = array()) {
$links = array();
$result = db_query(db_rewrite_sql("\n SELECT t.*, v.module, xt.last_changed, xt.previously_changed, xt.priority_override, ua.dst AS alias\n FROM {term_data} t\n LEFT JOIN {vocabulary} v ON v.vid = t.vid\n LEFT JOIN {xmlsitemap_term} xt ON xt.tid = t.tid\n LEFT JOIN {url_alias} ua ON ua.pid = xt.pid\n WHERE (t.vid NOT IN (" . (empty($excludes) ? 0 : implode(', ', $excludes)) . ") AND xt.priority_override IS NULL OR xt.priority_override >= 0)\n AND t.tid <> %d\n ", 't', 'tid'), _xmlsitemap_term_frontpage());
while ($term = db_fetch_object($result)) {
if ($term->module == 'forum') {
$url = xmlsitemap_url("forum/{$term->tid}", $term->alias, NULL, NULL, TRUE);
}
elseif ($term->module != 'taxonomy' && ($path = module_invoke($term->module, 'term_path', $term))) {
$alias = drupal_lookup_path('alias', $path);
if ($alias !== FALSE) {
$term->alias = $alias;
}
$url = xmlsitemap_url($path, $term->alias, NULL, NULL, TRUE);
}
else {
$url = xmlsitemap_url("taxonomy/term/{$term->tid}", $term->alias, NULL, NULL, TRUE);
}
$age = time() - $term->last_changed;
$interval = empty($term->previously_changed) ? 0 : $term->last_changed - $term->previously_changed;
$links[] = array(
'tid' => $term->tid,
'#loc' => $url,
'#lastmod' => $term->last_changed,
'#changefreq' => max($age, $interval),
'#priority' => _xmlsitemap_term_priority($term),
);
}
return $links;
}