function xmlsitemap_sitemap_load_multiple in XML sitemap 6.2
Same name and namespace in other branches
- 8 xmlsitemap.module \xmlsitemap_sitemap_load_multiple()
- 7.2 xmlsitemap.module \xmlsitemap_sitemap_load_multiple()
- 2.x xmlsitemap.module \xmlsitemap_sitemap_load_multiple()
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.module - xmlsitemap_engines_submit_engines in xmlsitemap_engines/
xmlsitemap_engines.module - Submit the sitemaps to all the specified search engines.
- xmlsitemap_sitemap_delete_multiple in ./
xmlsitemap.module - Delete multiple XML sitemaps.
- xmlsitemap_sitemap_list_form in ./
xmlsitemap.admin.inc - Render a tableselect list of XML sitemaps for the main admin page.
- xmlsitemap_sitemap_load in ./
xmlsitemap.module - Load an XML sitemap array from the database.
File
- ./
xmlsitemap.module, line 335 - Main file for the xmlsitemap module.
Code
function xmlsitemap_sitemap_load_multiple($smids = array(), array $conditions = array()) {
module_load_include('inc', 'xmlsitemap');
if ($smids === array()) {
return array();
}
elseif ($smids !== FALSE) {
$conditions['smid'] = $smids;
}
$sql = "SELECT * FROM {xmlsitemap_sitemap}";
$args = _xmlsitemap_build_conditions($conditions, array(), array(
'table' => 'xmlsitemap_sitemap',
));
if (!empty($conditions)) {
$sql .= " WHERE " . implode(' AND ', $conditions);
}
$query = db_query($sql, $args);
$sitemaps = xmlsitemap_db_fetch_all_assoc($query, 'smid');
foreach ($sitemaps as $smid => $sitemap) {
$sitemaps[$smid]->context = unserialize($sitemap->context);
$sitemaps[$smid]->uri = xmlsitemap_sitemap_uri($sitemaps[$smid]);
}
return $sitemaps;
}