function xmlsitemap_menu in XML sitemap 5.2
Same name and namespace in other branches
- 5 xmlsitemap.module \xmlsitemap_menu()
- 6.2 xmlsitemap.module \xmlsitemap_menu()
- 6 xmlsitemap.module \xmlsitemap_menu()
- 7.2 xmlsitemap.module \xmlsitemap_menu()
Implementation of hook_menu().
File
- xmlsitemap/
xmlsitemap.module, line 128 - Creates a sitemap compatible with the sitemaps.org schema.
Code
function xmlsitemap_menu($may_cache) {
global $user;
$items = array();
$access_config = user_access('administer site configuration');
$access_content = user_access('access content');
if ($may_cache) {
$items[] = array(
'path' => 'admin/settings/xmlsitemap',
'title' => t('XML sitemap'),
'description' => t('Configure the XML sitemap.'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'xmlsitemap_settings_sitemap',
),
'access' => $access_config,
);
$items[] = array(
'path' => 'admin/settings/xmlsitemap/sitemap',
'title' => t('sitemap'),
'description' => t('Configure the sitemap.'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -1,
);
$items[] = array(
'path' => 'admin/settings/xmlsitemap/engines',
'title' => t('Search engines'),
'description' => t('Configure the submission settings for the XML sitemap to the search engines.'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'xmlsitemap_settings_engines',
),
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'sitemap.xml',
'title' => t('sitemap index'),
'callback' => 'xmlsitemap_output',
'type' => MENU_CALLBACK,
'access' => $access_content,
);
}
else {
$chunk_size = variable_get('xmlsitemap_chunk_size', 50000);
$link_count = xmlsitemap_link_count();
if ($link_count / $chunk_size > 1) {
for ($chunk = 0; $chunk < $link_count / $chunk_size; ++$chunk) {
$items[] = array(
'path' => "sitemap{$chunk}.xml",
'title' => t('sitemap !number', array(
'!number' => $chunk,
)),
'callback' => 'xmlsitemap_output',
'callback arguments' => array(
$chunk,
),
'type' => MENU_CALLBACK,
'access' => $access_content,
);
}
}
}
return $items;
}