You are here

function xmlsitemap_menu in XML sitemap 5

Same name and namespace in other branches
  1. 5.2 xmlsitemap/xmlsitemap.module \xmlsitemap_menu()
  2. 6.2 xmlsitemap.module \xmlsitemap_menu()
  3. 6 xmlsitemap.module \xmlsitemap_menu()
  4. 7.2 xmlsitemap.module \xmlsitemap_menu()

Implementation of hook_menu().

Related topics

File

./xmlsitemap.module, line 30
Creates a site map compatible with the sitemaps.org schema.

Code

function xmlsitemap_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/xmlsitemap',
      'title' => t('XML Sitemap'),
      'description' => t('Configure site map.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'xmlsitemap_settings_sitemap',
      ),
      'access' => user_access('administer site configuration'),
    );
    $items[] = array(
      'path' => 'admin/settings/xmlsitemap/settings',
      'title' => t('Site map'),
      'description' => t('Configure site map.'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -1,
    );
    $items[] = array(
      'path' => 'admin/settings/xmlsitemap/engines',
      'title' => t('Search engines'),
      'description' => t('Configure search engines.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'xmlsitemap_settings_engines',
      ),
      'type' => MENU_LOCAL_TASK,
      'access' => user_access('administer site configuration'),
    );
    $items[] = array(
      'path' => 'admin/settings/xmlsitemap/additional',
      'title' => t('Additional'),
      'description' => t('Configure additional links.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'xmlsitemap_settings_additional',
      ),
      'type' => MENU_LOCAL_TASK,
      'access' => user_access('administer site configuration'),
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'sitemap.xml',
      'title' => t('Site map index'),
      'callback' => '_xmlsitemap_output',
      'type' => MENU_CALLBACK,
      'access' => user_access('access content'),
    );
  }
  else {
    $chunk_count = variable_get('xmlsitemap_chunk_count', 0);
    for ($chunk = 0; $chunk < $chunk_count; ++$chunk) {
      $items[] = array(
        'path' => "sitemap{$chunk}.xml",
        'title' => t('Site map !number', array(
          '!number' => $chunk,
        )),
        'callback' => '_xmlsitemap_output',
        'callback arguments' => array(
          $chunk,
        ),
        'type' => MENU_CALLBACK,
        'access' => user_access('access content'),
      );
    }
  }
  return $items;
}