function _xmlsitemap_menu_process_link in XML sitemap 5.2
Add links for a menu item and all its children to the sitemap.
Parameters
$mid: The ID of the menu to process:
$menu: The full menu structure for a user:
Return value
None
1 call to _xmlsitemap_menu_process_link()
- xmlsitemap_menu_xmlsitemap_links in xmlsitemap_menu/
xmlsitemap_menu.module - Implementation of hook_xmlsitmap_links().
File
- xmlsitemap_menu/
xmlsitemap_menu.module, line 88 - Adds menu items to the sitemap.
Code
function _xmlsitemap_menu_process_link($mid, $menu) {
$item = $menu['visible'][$mid];
if (!empty($item['path']) && strpos($item['path'], '://') === FALSE && $item['path'] != variable_get('site_frontpage', 'node')) {
$alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $item['path']));
$alias = $alias === FALSE ? NULL : $alias;
$priority = 1.0 - min(max(round(($menu['items'][$mid]['weight'] + 10) / 20, 1), 0.0), 1.0);
db_query("INSERT INTO {xmlsitemap} (loc, priority) VALUES ('%s', %f)", xmlsitemap_url($item['path'], $alias, NULL, NULL, TRUE), $priority);
}
if (isset($item['children'])) {
foreach ($item['children'] as $mid) {
_xmlsitemap_menu_process_link($mid, $menu);
}
}
}