function xmlsitemap_sitemap_load_multiple

7.x xmlsitemap.module xmlsitemap_sitemap_load_multiple($smids = array(), array $conditions = array())
6.x xmlsitemap.module xmlsitemap_sitemap_load_multiple($smids = array(), array $conditions = array())

Load multiple XML sitemaps from the database.

Parameters

$smids: An array of XML sitemap IDs, or FALSE to load all XML sitemaps.

$conditions: An array of conditions in the form 'field' => $value.

Return value

An array of XML sitemap objects.

Related topics

7 calls to xmlsitemap_sitemap_load_multiple()
xmlsitemap_check_all_directories in xmlsitemap/xmlsitemap.module
xmlsitemap_engines_submit_engines in xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module
Submit the sitemaps to all the specified search engines.
xmlsitemap_sitemap_delete_multiple in xmlsitemap/xmlsitemap.module
Delete multiple XML sitemaps.
xmlsitemap_sitemap_list_form in xmlsitemap/xmlsitemap.admin.inc
Render a tableselect list of XML sitemaps for the main admin page.
xmlsitemap_sitemap_load in xmlsitemap/xmlsitemap.module
Load an XML sitemap array from the database.

... See full list

File

xmlsitemap/xmlsitemap.module, line 354
Main file for the xmlsitemap module.

Code

function xmlsitemap_sitemap_load_multiple($smids = array(), array $conditions = array()) {
  if ($smids !== FALSE) {
    $conditions['smid'] = $smids;
  }

  $query = db_select('xmlsitemap_sitemap');
  $query->fields('xmlsitemap_sitemap');
  foreach ($conditions as $field => $value) {
    $query->condition($field, $value);
  }

  $sitemaps = $query->execute()->fetchAllAssoc('smid');
  foreach ($sitemaps as $smid => $sitemap) {
    $sitemaps[$smid]->context = unserialize($sitemap->context);
    $sitemaps[$smid]->uri = xmlsitemap_sitemap_uri($sitemaps[$smid]);
  }

  return $sitemaps;
}