You are here

xmlsitemap.module in XML sitemap 5.2

Creates a sitemap compatible with the sitemaps.org schema.

File

xmlsitemap/xmlsitemap.module
View source
<?php

/**
 * @file
 * Creates a sitemap compatible with the sitemaps.org schema.
 */

/**
 * @addtogroup xmlsitemap
 * @{
 */

/*****************************************************************************
 * Public constants.
 ****************************************************************************/

/**
 * The timestamp of server request to avoid repeatedly generating value.
 */
if (!defined('REQUEST_TIME')) {
  if (isset($_SERVER['REQUEST_TIME'])) {
    define('REQUEST_TIME', $_SERVER['REQUEST_TIME']);
  }
  else {
    define('REQUEST_TIME', time());
  }
}

/*****************************************************************************
 * Drupal hooks.
 ****************************************************************************/

/**
 * Implementation of hook_cron().
 */
function xmlsitemap_cron() {
  if (variable_get('xmlsitemap_cron_submit', FALSE) && variable_get('xmlsitemap_changed', FALSE)) {
    if (variable_get('xmlsitemap_update', FALSE)) {
      _xmlsitemap_update();
    }
    _xmlsitemap_ping();
  }
}

/**
 * Implementation of hook_exit().
 */
function xmlsitemap_exit() {
  if (variable_get('xmlsitemap_log_access', FALSE)) {
    $items = array();
    $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["sitemap{$chunk}.xml"] = $chunk;
      }
    }
    drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
    if (in_array(arg(0), $items) && is_null(arg(1))) {
      $chunk = $items[arg(0)];
      if ($chunk < $link_count / $chunk_size) {
        $write_log = TRUE;
      }
    }
    elseif (arg(0) == 'sitemap.xml' && is_null(arg(1))) {
      $write_log = TRUE;
    }
    if (isset($write_log)) {
      drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
      $message = array_shift(module_invoke_all('xmlsitemap_engines', 'access'));
      if (!isset($message)) {
        $message = 'Sitemap downloaded by @user-agent at @address.';
      }
      watchdog('xmlsitemap', t($message, array(
        '@user-agent' => $_SERVER['HTTP_USER_AGENT'],
        '@address' => $_SERVER['REMOTE_ADDR'],
      )));
    }
  }
  if (!isset($write_log)) {
    if (_xmlsitemap_submit_on_exit()) {
      drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
      _xmlsitemap_update();
      _xmlsitemap_ping();
    }
  }
}

/**
 * Implementation of hook_help().
 */
function xmlsitemap_help($section) {
  switch ($section) {
    case 'admin/settings/xmlsitemap':
    case 'admin/settings/xmlsitemap/settings':
      $output = t('Configure the sitemap.');
      break;
    case 'admin/settings/xmlsitemap/engines':
      $output = t('Configure the behavior for search engines.');
      break;
    case 'admin/help#xmlsitemap':
      $output = '<p>' . t('XML sitemap automatically creates a sitemap that conforms to the <a href="@sitemaps.org">sitemaps.org specification</a>. This helps search engines keep their search results up to date.', array(
        '@sitemaps.org' => 'http://www.sitemaps.org',
      )) . '</p>';
      $output .= '<h3>' . t('Supporting modules') . '</h3>';
      $output .= '<p>' . t('By itself, the XML sitemap module adds only the front page of your site to the sitemap. Other types of links are handled by supporting modules.') . '</p>';
      $optional = '';
      foreach (module_implements('xmlsitemap_description', TRUE) as $module) {
        $function = $module . '_xmlsitemap_description';
        $optional .= $function();
      }
      if (!empty($optional)) {
        $output .= "<dl>{$optional}</dl>";
      }
      $output .= '<p>' . t('Links may be assigned a priority between 0.0 and 1.0. The default priority is 0.5. A priority of <em>Not in sitemap</em> excludes a link from the sitemap.') . '</p>';
      $output .= '<p>' . t('More information is available in the <a href="@module_docs">XML sitemap documentation</a>.', array(
        '@module_docs' => 'http://drupal.org/handbook/modules/gsitemap',
      )) . '</p>';
      break;
    default:
      $output = '';
      break;
  }
  return $output;
}

/**
 * Implementation of hook_menu().
 */
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;
}

/**
 * Implementation of hook_perm().
 */
function xmlsitemap_perm() {
  return array(
    'override node settings',
    'override profile settings',
  );
}

/**
 * Implementation of hook_robotstxt().
 */
function xmlsitemap_robotstxt() {
  return array(
    "Sitemap: " . xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE),
  );
}

/*****************************************************************************
 * Menu callbacks / form builders, submit/validate functions.
 ****************************************************************************/

/**
 * Menu callback; display the sitemap.
 * @param $chunk:
 * An integer specifying which chunk of the sitemap is being requested. If not
 * set and there is more than one chunk, display the sitemap index.
 * @return None
 */
function xmlsitemap_output($chunk = NULL) {
  global $user;
  if (!$user->uid && variable_get('xmlsitemap_update', FALSE)) {
    _xmlsitemap_update();
  }
  drupal_set_header('Content-type: text/xml; charset=utf-8');
  $chunk_size = variable_get('xmlsitemap_chunk_size', 50000);
  $link_count = xmlsitemap_link_count();
  if ($link_count / $chunk_size > 1000) {
    $chunk_size = (int) $link_count / 1000;
    if ($chunk_size != variable_get('xmlsitemap_chunk_size', 50000)) {
      variable_set('xmlsitemap_chunk_size', $chunk_size);
    }
  }
  if (isset($chunk)) {
    if ($chunk < $link_count / $chunk_size) {
      _xmlsitemap_output_chunk($chunk);
    }
    else {
      drupal_not_found();
    }
  }
  else {
    if ($link_count > $chunk_size) {
      _xmlsitemap_output_index();
    }
    else {
      _xmlsitemap_output_chunk();
    }
  }
  drupal_page_footer();
  exit;
}

/**
 * Menu callback; return sitemap settings form.
 */
function xmlsitemap_settings_sitemap() {
  $form['general'] = array(
    '#type' => 'fieldset',
    '#title' => t('General settings'),
    '#collapsible' => TRUE,
  );
  $form['general']['priority'] = array(
    '#type' => 'fieldset',
    '#title' => t('Priority'),
    '#collapsible' => TRUE,
  );
  $form['general']['priority']['xmlsitemap_front_page_priority'] = array(
    '#type' => 'select',
    '#title' => t('Front page priority'),
    '#description' => t('This is the absolute priority for the front page.'),
    '#default_value' => variable_get('xmlsitemap_front_page_priority', 1),
    '#options' => xmlsitemap_priority_options(),
  );
  return system_settings_form($form);
}

/**
 * Submit sitemap settings form.
 */
function xmlsitemap_settings_sitemap_submit($form_id, $form_values) {
  system_settings_form_submit($form_id, $form_values);
  xmlsitemap_flag_sitemap();
}

/**
 * Menu callback; return search engine settings form.
 */
function xmlsitemap_settings_engines() {
  $form['submission'] = array(
    '#type' => 'fieldset',
    '#title' => t('Submission settings'),
  );
  $form['submission']['xmlsitemap_submit'] = array(
    '#type' => 'checkbox',
    '#title' => t('Submit the sitemap in content updates'),
    '#default_value' => variable_get('xmlsitemap_submit', FALSE),
    '#description' => t('If enabled, search engines will be notified of changes to the site map each time the site content is updated..'),
  );
  $form['submission']['xmlsitemap_cron_submit'] = array(
    '#type' => 'checkbox',
    '#title' => t('Submit the sitemap on cron run'),
    '#default_value' => variable_get('xmlsitemap_cron_submit', FALSE),
    '#description' => t('If enabled, the search engines will be notified of changes to the sitemap each time cron is run.'),
  );
  $form['submission']['xmlsitemap_log_access'] = array(
    '#type' => 'checkbox',
    '#title' => t('Log access'),
    '#default_value' => variable_get('xmlsitemap_log_access', FALSE),
    '#description' => t('If enabled, a watchdog entry will be made each time the sitemap is accessed, containing information about the requestor.'),
  );
  $form = array_merge($form, module_invoke_all('xmlsitemap_engines', 'form'));
  return system_settings_form($form);
}

/**
 * Submit search engine settings form.
 */
function xmlsitemap_settings_engines_submit($form_id, $form_values) {
  if ($form_values['xmlsitemap_root']) {
    $form_values['xmlsitemap_submit'] = FALSE;
    $form_values['xmlsitemap_log_access'] = FALSE;
  }
  system_settings_form_submit($form_id, $form_values);
}

/*****************************************************************************
 * Public functions.
 ****************************************************************************/

/**
 * Modified version of file_create_url(). Allows us to remove language prefixes.
 * @param $path: the path to the file
 * @return A URL to the file
 */
function xmlsitemap_file_create_url($path, $alias = NULL) {
  $path = trim(substr($path, strlen(file_directory_path())), '\\/');
  if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
    return xmlsitemap_url('system/files/' . $path, $alias, NULL, NULL, TRUE);
  }
  else {
    return "{$GLOBALS['base_url']}/" . file_directory_path() . '/' . str_replace('\\', '/', $path);
  }
}

/**
 * Return the number of links in the sitemap.
 */
function xmlsitemap_link_count() {
  static $link_count;
  if (!isset($link_count)) {
    $link_count = db_result(db_query("SELECT COUNT(*) FROM {xmlsitemap}"));
  }
  return $link_count;
}

/**
 * Given a database field type, return the correct %-placeholder.
 * Embed the placeholder in a query to be passed to db_query and and pass as an
 * argument to db_query a value of the specified type.
 * This is the backport of the function present in Drupal 6.
 *
 * @param $type
 *   The type of a database field.
 * @return
 *   The placeholder string to embed in a query for that type.
 */
function xmlsitemap_placeholder($type) {
  switch ($type) {
    case 'varchar':
    case 'char':
    case 'text':
    case 'datetime':
      return "'%s'";
    case 'numeric':
      return '%n';
    case 'serial':
    case 'int':
      return '%d';
    case 'float':
      return '%f';
    case 'blob':
      return '%b';
  }
  return 'unsupported type ' . $type . 'for xmlsitemap_placeholder';
}

/**
 * Generate placeholders for an array of query arguments of a single type.
 * Given a database field type, return correct %-placeholders to
 * embed in a query.
 * This is the backport of a function present in Drupal 6.
 *
 * @param $arguments
 *  An array with at least one element.
 * @param $type
 *   The database type of a field (e.g. 'int', 'text', or 'varchar').
 * @return
 *   An array of placeholders for the passed database type.
 */
function xmlsitemap_placeholders($arguments, $type = 'int') {
  $placeholder = xmlsitemap_placeholder($type);
  return implode(',', array_fill(0, count($arguments), $placeholder));
}

/**
 * Get an array of sitemap priority options.
 * @param $option:
 * If not given, the array will include priority values from 0.0 to 1.0.
 * - exclude: Add option to exclude item from sitemap.
 * - default: Add option to use default priority. Only for cases where a default
 *   priority exists.
 * - both: Add both the default and exclude options.
 * @return An array of priority options.
 */
function xmlsitemap_priority_options($option = '') {
  $options = array(
    '1' => t('1.0'),
    '0.9' => t('0.9'),
    '0.8' => t('0.8'),
    '0.7' => t('0.7'),
    '0.6' => t('0.6'),
    '0.5' => t('0.5'),
    '0.4' => t('0.4'),
    '0.3' => t('0.3'),
    '0.2' => t('0.2'),
    '0.1' => t('0.1'),
    '0' => t('0.0'),
  );
  if ($option == 'exclude' || $option == 'both') {
    $options['-1'] = t('Not in sitemap');
  }
  if ($option == 'default' || $option == 'both') {
    $options['-2'] = t('Default');
  }
  return $options;
}

/**
 * Determine the frequency of updates to a link.
 * @param $interval
 *  The number of seconds since the last change, or the number of seconds
 *  between the last change, and the previous change.
 * @return
 *  A string representing the update frequency according to the sitemaps.org
 *  protocol.
 */
function xmlsitemap_sitemap_frequency($interval) {
  $frequencies = array(
    'always' => 3600,
    'hourly' => 86400,
    'daily' => 604800,
    'weekly' => 2419200,
    'monthly' => 29030400,
    'yearly' => 100000000,
  );
  if (array_key_exists($interval, $frequencies)) {
    return $interval;
  }
  if ($interval < 0 || !is_numeric($interval)) {
    return 'never';
  }
  foreach ($frequencies as $frequency => $value) {
    if ($interval < $value) {
      break;
    }
  }
  return $frequency;
}

/**
 * Mark the sitemap as changed and the cache as needing update.
 * @return None
 */
function xmlsitemap_flag_sitemap() {
  if (!variable_get('xmlsitemap_changed', FALSE)) {
    variable_set('xmlsitemap_changed', TRUE);
  }
  if (!variable_get('xmlsitemap_update', FALSE)) {
    variable_set('xmlsitemap_update', TRUE);
  }
  if (variable_get('xmlsitemap_submit', FALSE)) {
    _xmlsitemap_submit_on_exit();
  }
}

/**
 * Modified version of url(). We don't want to do a separate database query for
 * each url, so we pass the alias as an extra parameter.
 * @param $alias: The URL alias. Default is NULL.
 * @return The fully formatted URL
 */
function xmlsitemap_url($path = NULL, $alias = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
  if (isset($fragment)) {
    $fragment = "#{$fragment}";
  }
  $colonpos = strpos($path, ':');
  if ($colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && filter_xss_bad_protocol($path, FALSE) == check_plain($path)) {
    if (strpos($path, '#') !== FALSE) {
      list($path, $old_fragment) = explode('#', $path, 2);
      if (isset($old_fragment) && !isset($fragment)) {
        $fragment = "#{$old_fragment}";
      }
    }
    if (isset($query)) {
      $path .= (strpos($path, '?') !== FALSE ? '&' : '?') . $query;
    }
    return $path . $fragment;
  }
  static $script;
  $script = isset($script) ? $script : strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === FALSE ? 'index.php' : '';
  $base = $absolute ? "{$GLOBALS['base_url']}/" : base_path();
  if (!empty($path) && $path != '<front>') {
    $path = _xmlsitemap_get_path_alias($path, $alias);
    $path = drupal_urlencode($path);
    if (!variable_get('clean_url', FALSE)) {
      if (isset($query)) {
        return $base . $script . '?q=' . $path . '&' . $query . $fragment;
      }
      else {
        return $base . $script . '?q=' . $path . $fragment;
      }
    }
    else {
      if (isset($query)) {
        return $base . $path . '?' . $query . $fragment;
      }
      else {
        return $base . $path . $fragment;
      }
    }
  }
  else {
    if (isset($query)) {
      return $base . $script . '?' . $query . $fragment;
    }
    else {
      return $base . $fragment;
    }
  }
}

/*****************************************************************************
 * Private functions.
 ****************************************************************************/

/**
 * Modified version of drupal_get_path_alias() for xmlsitemap_url().
 * @param $path: An internal Drupal path
 * @param $alias: The URL alias. Default is NULL.
 * @return A processed path
 */
function _xmlsitemap_get_path_alias($path, $alias = NULL) {
  $result = $path;
  if (!empty($alias)) {
    $result = $alias;
  }
  if (function_exists('custom_url_rewrite')) {
    $result = custom_url_rewrite('alias', $result, $path);
  }
  if (module_exists('i18n') && i18n_get_lang() == i18n_default_language()) {
    i18n_get_lang_prefix($result, TRUE);
  }
  return $result;
}

/**
 * Display a chunk of the sitemap.
 * @param $chunk: An integer specifying which chunk of the sitemap to display
 * @return None
 */
function _xmlsitemap_output_chunk($chunk = 0) {
  print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
  print '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' . "\n";
  print '  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
  print '  xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n";
  print '  http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' . "\n";
  $chunk_size = variable_get('xmlsitemap_chunk_size', 50000);
  $start = $chunk * $chunk_size;
  $links = db_query_range("SELECT * FROM {xmlsitemap} ORDER BY priority DESC, lastmod DESC, changefreq, loc", $start, $chunk_size);
  while ($link = db_fetch_array($links)) {
    print '  <url>' . "\n";
    print '    <loc>' . check_url($link['loc']) . '</loc>' . "\n";
    if (isset($link['lastmod'])) {
      print '    <lastmod>' . gmdate('Y-m-d\\TH:i:s+00:00', $link['lastmod']) . '</lastmod>' . "\n";
    }
    if (isset($link['changefreq'])) {
      print '    <changefreq>' . xmlsitemap_sitemap_frequency($link['changefreq']) . '</changefreq>' . "\n";
    }
    if (isset($link['priority']) && $link['priority'] <= 1 && $link['priority'] >= 0) {
      print '    <priority>' . number_format($link['priority'], 1) . '</priority>' . "\n";
    }
    print '  </url>' . "\n";
  }
  print '</urlset>';
}

/**
 * Generate the sitemap index.
 * @return A string containing the sitemap index
 */
function _xmlsitemap_output_index() {
  print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
  print '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' . "\n";
  print '  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
  print '  xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n";
  print '  http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd">' . "\n";
  $chunk_size = variable_get('xmlsitemap_chunk_size', 50000);
  $link_count = xmlsitemap_link_count();
  for ($chunk = 0; $chunk < $link_count / $chunk_size; ++$chunk) {
    print '  <sitemap>' . "\n";
    print '    <loc>' . xmlsitemap_url("sitemap{$chunk}.xml", NULL, NULL, NULL, TRUE) . '</loc>' . "\n";
    if ($chunk < $link_count / $chunk_size) {
      $from = $chunk * $chunk_size;
      if (!empty($chunk_size)) {
        $lastmod = db_result(db_query_range("SELECT lastmod FROM {xmlsitemap} ORDER BY priority DESC, lastmod DESC, loc", $from, $chunk_size));
        if (isset($lastmod) && $lastmod !== FALSE) {
          print '    <lastmod>' . gmdate('Y-m-d\\TH:i:s+00:00', $lastmod) . '</lastmod>' . "\n";
        }
      }
    }
    print '  </sitemap>' . "\n";
  }
  print '</sitemapindex>';
}

/**
 * Submit the sitemap to search engines.
 * @return None
 */
function _xmlsitemap_ping() {
  module_invoke_all('xmlsitemap_engines', 'ping');
  variable_set('xmlsitemap_changed', FALSE);
}

/**
 * Schedule a call to _xmlsitemap_ping() to be run on exit. Use this function
 * instead of _xmlsitemap_ping() to avoid a delay in outputting the page to the
 * user.
 * @return TRUE if the function has been called previously, FALSE otherwise.
 */
function _xmlsitemap_submit_on_exit() {
  static $count = 0;
  return $count++ != 0;
}

/**
 * Update the sitemap if content has changed.
 */
function _xmlsitemap_update() {
  db_query("DELETE FROM {xmlsitemap}");
  $fp_priority = variable_get('xmlsitemap_front_page_priority', 1);
  global $user;
  $current_user = $user;
  $user = user_load(array(
    'uid' => 0,
  ));
  if (module_exists('i18n')) {
    $language = i18n_get_lang();
    i18n_selection_mode('strict');
    $languages = locale_supported_languages();
    unset($languages['name'][$language]);
    foreach ($languages['name'] as $key => $lang) {
      i18n_get_lang($key);
      $key = $key == i18n_default_language() ? NULL : $key;
      db_query("INSERT INTO {xmlsitemap} (loc, lastmod, changefreq, priority) VALUES ('%s', %d, %d, %f)", xmlsitemap_url($key, NULL, NULL, NULL, TRUE), REQUEST_TIME - 1, 1, $fp_priority);
      module_invoke_all('xmlsitemap_links');
    }
    i18n_get_lang($language);
    $language = $language == i18n_default_language() ? NULL : $language;
    db_query("INSERT INTO {xmlsitemap} (loc, lastmod, changefreq, priority) VALUES ('%s', %d, %d, %f)", xmlsitemap_url($language, NULL, NULL, NULL, TRUE), REQUEST_TIME - 1, 1, $fp_priority);
    i18n_selection_mode('simple');
    module_invoke_all('xmlsitemap_links');
    i18n_selection_mode('reset');
  }
  else {
    db_query("INSERT INTO {xmlsitemap} (loc, lastmod, changefreq, priority) VALUES ('%s', %d, %d, %f)", xmlsitemap_url(NULL, NULL, NULL, NULL, TRUE), REQUEST_TIME - 1, 1, $fp_priority);
    module_invoke_all('xmlsitemap_links');
  }
  $user = $current_user;
  cache_clear_all(xmlsitemap_url('sitemap.xml', NULL, NULL, NULL, TRUE), 'cache_page', TRUE);
  variable_set('xmlsitemap_update', FALSE);
}

/**
 * @} End of "addtogroup xmlsitemap".
 */

Functions

Namesort descending Description
xmlsitemap_cron Implementation of hook_cron().
xmlsitemap_exit Implementation of hook_exit().
xmlsitemap_file_create_url Modified version of file_create_url(). Allows us to remove language prefixes.
xmlsitemap_flag_sitemap Mark the sitemap as changed and the cache as needing update.
xmlsitemap_help Implementation of hook_help().
xmlsitemap_link_count Return the number of links in the sitemap.
xmlsitemap_menu Implementation of hook_menu().
xmlsitemap_output Menu callback; display the sitemap.
xmlsitemap_perm Implementation of hook_perm().
xmlsitemap_placeholder Given a database field type, return the correct %-placeholder. Embed the placeholder in a query to be passed to db_query and and pass as an argument to db_query a value of the specified type. This is the backport of the function present in Drupal 6.
xmlsitemap_placeholders Generate placeholders for an array of query arguments of a single type. Given a database field type, return correct %-placeholders to embed in a query. This is the backport of a function present in Drupal 6.
xmlsitemap_priority_options Get an array of sitemap priority options.
xmlsitemap_robotstxt Implementation of hook_robotstxt().
xmlsitemap_settings_engines Menu callback; return search engine settings form.
xmlsitemap_settings_engines_submit Submit search engine settings form.
xmlsitemap_settings_sitemap Menu callback; return sitemap settings form.
xmlsitemap_settings_sitemap_submit Submit sitemap settings form.
xmlsitemap_sitemap_frequency Determine the frequency of updates to a link.
xmlsitemap_url Modified version of url(). We don't want to do a separate database query for each url, so we pass the alias as an extra parameter.
_xmlsitemap_get_path_alias Modified version of drupal_get_path_alias() for xmlsitemap_url().
_xmlsitemap_output_chunk Display a chunk of the sitemap.
_xmlsitemap_output_index Generate the sitemap index.
_xmlsitemap_ping Submit the sitemap to search engines.
_xmlsitemap_submit_on_exit Schedule a call to _xmlsitemap_ping() to be run on exit. Use this function instead of _xmlsitemap_ping() to avoid a delay in outputting the page to the user.
_xmlsitemap_update Update the sitemap if content has changed.