You are here

function xmlsitemap_engines_submit_engines in XML sitemap 8

Same name and namespace in other branches
  1. 6.2 xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_submit_engines()
  2. 7.2 xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_submit_engines()
  3. 2.x xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_submit_engines()

Submit the sitemaps to all the specified search engines.

Parameters

array $smids: An optional array of XML sitemap IDs. If not provided, it will load all existing XML sitemaps.

1 call to xmlsitemap_engines_submit_engines()
xmlsitemap_engines_cron in xmlsitemap_engines/xmlsitemap_engines.module
Implements hook_cron().
1 string reference to 'xmlsitemap_engines_submit_engines'
xmlsitemap_engines_xmlsitemap_sitemap_operations in xmlsitemap_engines/xmlsitemap_engines.module
Implements hook_xmlsitemap_sitemap_operations().

File

xmlsitemap_engines/xmlsitemap_engines.module, line 99
Main file for the XML sitemap engines.

Code

function xmlsitemap_engines_submit_engines(array $smids = []) {
  if (empty($smids)) {
    $smids = FALSE;
  }
  $sitemaps = xmlsitemap_sitemap_load_multiple($smids);
  $engines = \Drupal::config('xmlsitemap_engines.settings')
    ->get('engines');
  $engine_info = xmlsitemap_engines_get_engine_info();
  foreach ($engines as $engine) {
    if (isset($engine_info[$engine]['url'])) {
      xmlsitemap_engines_submit_sitemaps($engine_info[$engine]['url'], $sitemaps);
    }
  }
  $custom_urls = \Drupal::config('xmlsitemap_engines.settings')
    ->get('custom_urls');
  $custom_urls = preg_split('/[\\r\\n]+/', $custom_urls, -1, PREG_SPLIT_NO_EMPTY);
  foreach ($custom_urls as $custom_url) {
    xmlsitemap_engines_submit_sitemaps($custom_url, $sitemaps);
  }
  \Drupal::state()
    ->set('xmlsitemap_engines_submit_last', \Drupal::time()
    ->getRequestTime());
}