xmlsitemap_menu

Definition

xmlsitemap_menu($may_cache)
contributions/modules/xmlsitemap/xmlsitemap.module, line 61

Description

Implementation of hook_menu().

Related topics

Namesort iconDescription
XML SitemapNotify search engines of site updates.

Code

function xmlsitemap_menu($may_cache) {
  $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 site map.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array('xmlsitemap_settings_sitemap'),
      'access' => $access_config,
    );
    $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,
    );
    $items[] = array(
      'path' => drupal_get_path('module', 'xmlsitemap') .'/gss/gss.xsl',
      'title' => 'gss.xsl',
      'callback' => '_xmlsitemap_xsl',
      'type' => MENU_CALLBACK,
      'access' => $access_content,
    );
    $items[] = array(
      'path' => 'sitemap.xml',
      'title' => t('Site map index'),
      'callback' => '_xmlsitemap_output',
      'type' => MENU_CALLBACK,
      'access' => $access_content,
    );
  }
  else {
    $chunk_size = variable_get('xmlsitemap_chunk_size', 50000);
    if (_xmlsitemap_link_count() / $chunk_size > 1 || !empty($xml)) {
      for ($chunk = 0; $chunk < _xmlsitemap_link_count() / $chunk_size + count(_xmlsitemap_xml()); ++$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' => $access_content,
        );
      }
    }
  }
  return $items;
}