You are here

function _xmlsitemap_engines_ask in XML sitemap 5

Define actions for Ask.com.

Related topics

1 call to _xmlsitemap_engines_ask()
xmlsitemap_engines_xmlsitemap_engines in xmlsitemap_engines/xmlsitemap_engines.module
Implementation of hook_xmlsitemap_engines().

File

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

Code

function _xmlsitemap_engines_ask($op) {
  switch ($op) {
    case 'form':
      $form['ask'] = array(
        '#type' => 'fieldset',
        '#title' => t('Ask.com'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['ask']['xmlsitemap_engines_ask_submit'] = array(
        '#type' => 'checkbox',
        '#title' => t('Submit site map to Ask.com.'),
        '#default_value' => variable_get('xmlsitemap_engines_ask_submit', FALSE),
      );
      $form['ask']['xmlsitemap_engines_ask_url'] = array(
        '#type' => 'textfield',
        '#title' => t('Submission URL'),
        '#default_value' => variable_get('xmlsitemap_engines_ask_url', 'http://submissions.ask.com/ping?sitemap=' . xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE)),
        '#description' => t('The URL to submit the site map to.'),
      );
      return $form;
    case 'ping':
      if (variable_get('xmlsitemap_engines_ask_submit', FALSE)) {
        $result = drupal_http_request(variable_get('xmlsitemap_engines_ask_url', 'http://submissions.ask.com/ping?sitemap=' . xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE)));
        if ($result->code == 200) {
          watchdog('xmlsitemap', t('Site map successfully submitted to Ask.com.'));
        }
        else {
          watchdog('xmlsitemap', t('Error occurred submitting site map to Ask.com: @code', array(
            '@code' => $result->code,
          )), WATCHDOG_ERROR);
        }
      }
      break;
  }
}