You are here

function xmlsitemap_engines_ping_sitemap in XML sitemap 6

Submit the sitemap to the selected engines.

1 call to xmlsitemap_engines_ping_sitemap()
xmlsitemap_engines_cron in xmlsitemap_engines/xmlsitemap_engines.module
Implementation of hook_cron().
1 string reference to 'xmlsitemap_engines_ping_sitemap'
xmlsitemap_engines_xmlsitemap_operations in xmlsitemap_engines/xmlsitemap_engines.module
Implementation of hook_xmlsitemap_operations().

File

xmlsitemap_engines/xmlsitemap_engines.module, line 97
Define actions for Google, Yahoo!, Ask, and Bing.

Code

function xmlsitemap_engines_ping_sitemap($engine = NULL) {
  $engines = array(
    'ask' => array(
      'Ask.com',
      'http://submissions.ask.com/ping?sitemap=[sitemap]',
    ),
    'bing' => array(
      'Bing (formerly Live Search)',
      'http://www.bing.com/webmaster/ping.aspx?siteMap=[sitemap]',
    ),
    'google' => array(
      'Google',
      'http://www.google.com/webmasters/tools/ping?sitemap=[sitemap]',
    ),
    'moreover' => array(
      'Moreover.com',
      'http://api.moreover.com/ping?u=[sitemap]',
    ),
    'yahoo' => array(
      'Yahoo!',
      'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=[sitemap]',
    ),
  );
  if (variable_get('xmlsitemap_all_links_to_default_language', 0)) {

    // Only submit the default language sitemap since it contains every link.
    $languages = array(
      language_default(),
    );
  }
  else {

    // Get a list of enabled languages.
    $languages = language_list('enabled');
    $languages = $languages[1];
  }
  foreach ($languages as $language) {
    if (!isset($engine)) {
      foreach ($engines as $id => $info) {
        if (variable_get("xmlsitemap_engines_{$id}_submit", FALSE)) {
          xmlsitemap_engines_submit_sitemap($info[0], "xmlsitemap_engines_{$id}_url", $info[1], $language);
        }
      }
    }
    elseif (isset($engines[$engine])) {
      xmlsitemap_engines_submit_sitemap($engines[$engine][0], "xmlsitemap_engines_{$engine}_url", $engines[$engine][1], $language);
    }
  }
}