You are here

function xmlsitemap_engines_xmlsitemap_engines in XML sitemap 5.2

Same name and namespace in other branches
  1. 5 xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_xmlsitemap_engines()

Implementation of hook_xmlsitemap_engines().

File

xmlsitemap_engines/xmlsitemap_engines.module, line 57
Defines actions for Google, Yahoo!, Ask, and Windows Live.

Code

function xmlsitemap_engines_xmlsitemap_engines($op) {
  switch ($op) {
    case 'form':
      $form = array();

      // Ask.com 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 the sitemap 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=[sitemap]'),
        '#description' => t('The URL to submit the sitemap to. Use %placeholder like placeholder for the sitemap URL.', array(
          '%placeholder' => '[sitemap]',
        )),
      );

      // Google form.
      $form['google'] = array(
        '#type' => 'fieldset',
        '#title' => t('Google'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['google']['xmlsitemap_engines_google_submit'] = array(
        '#type' => 'checkbox',
        '#title' => t('Submit the sitemap to Google'),
        '#default_value' => variable_get('xmlsitemap_engines_google_submit', FALSE),
      );
      $form['google']['xmlsitemap_engines_google_url'] = array(
        '#type' => 'textfield',
        '#title' => t('Submission URL'),
        '#default_value' => variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap=[sitemap]'),
        '#description' => t('The URL to submit the sitemap to. Use %placeholder like placeholder for the sitemap URL.', array(
          '%placeholder' => '[sitemap]',
        )),
      );
      $form['google']['xmlsitemap_engines_google_verify'] = array(
        '#type' => 'textfield',
        '#title' => t('Verification link'),
        '#default_value' => variable_get('xmlsitemap_engines_google_verify', ''),
        '#description' => t('In order to show statistics, Google will ask you to verify that you control this site by creating a file with a certain name. Enter that name here and the XML sitemap module will create a path to that file name. This will only work if you have clean URLs enabled.'),
      );

      // Moreover.com form.
      $form['moreover'] = array(
        '#type' => 'fieldset',
        '#title' => t('Moreover.com'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['moreover']['xmlsitemap_engines_moreover_submit'] = array(
        '#type' => 'checkbox',
        '#title' => t('Submit the sitemap to Moreover.com'),
        '#default_value' => variable_get('xmlsitemap_engines_moreover_submit', FALSE),
      );
      $form['moreover']['xmlsitemap_engines_moreover_url'] = array(
        '#type' => 'textfield',
        '#title' => t('Submission URL'),
        '#default_value' => variable_get('xmlsitemap_engines_moreover_url', 'http://api.moreover.com/ping?u=[sitemap]'),
        '#description' => t('The URL to submit the sitemap to. Use %placeholder like placeholder for the sitemap URL.', array(
          '%placeholder' => '[sitemap]',
        )),
      );

      // Windows Live form.
      $form['live'] = array(
        '#type' => 'fieldset',
        '#title' => t('Windows Live'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['live']['xmlsitemap_engines_live_submit'] = array(
        '#type' => 'checkbox',
        '#title' => t('Submit the sitemap to Windows Live'),
        '#default_value' => variable_get('xmlsitemap_engines_live_submit', FALSE),
      );
      $form['live']['xmlsitemap_engines_live_url'] = array(
        '#type' => 'textfield',
        '#title' => t('Submission URL'),
        '#default_value' => variable_get('xmlsitemap_engines_live_url', 'http://webmaster.live.com/ping.aspx?siteMap=[sitemap]'),
        '#description' => t('The URL to submit the sitemap to. Use %placeholder like placeholder for the sitemap URL.', array(
          '%placeholder' => '[sitemap]',
        )),
      );
      $form['live']['xmlsitemap_engines_live_verify'] = array(
        '#type' => 'textfield',
        '#title' => t('Authentication file'),
        '#default_value' => variable_get('xmlsitemap_engines_live_verify', 'LiveSearchSiteAuth.xml'),
        '#description' => t('Before allowing you to view additional information, Windows Live will ask you to verify that you control this site by creating a file with a certain name. Enter that name here, and XML sitemap will create a path to that file name. This will only work if you have clean URLs enabled.'),
      );
      $form['live']['xmlsitemap_engines_live_verify_string'] = array(
        '#type' => 'textfield',
        '#title' => t('Authentication tag'),
        '#default_value' => variable_get('xmlsitemap_engines_live_verify_string', ''),
        '#description' => t('Windows Live will give you an authentication tag.'),
      );

      // Yahoo! form.
      $form['yahoo'] = array(
        '#type' => 'fieldset',
        '#title' => t('Yahoo!'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form['yahoo']['xmlsitemap_engines_yahoo_submit'] = array(
        '#type' => 'checkbox',
        '#title' => t('Submit the sitemap to Yahoo!'),
        '#default_value' => variable_get('xmlsitemap_engines_yahoo_submit', FALSE),
      );
      $form['yahoo']['xmlsitemap_engines_yahoo_url'] = array(
        '#type' => 'textfield',
        '#title' => t('Submission URL'),
        '#default_value' => variable_get('xmlsitemap_engines_yahoo_url', 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=[sitemap]'),
        '#description' => t('The URL to submit the sitemap to. Use %placeholder like placeholder for the sitemap URL.', array(
          '%placeholder' => '[sitemap]',
        )),
      );
      $form['yahoo']['xmlsitemap_engines_yahoo_verify'] = array(
        '#type' => 'textfield',
        '#title' => t('Verification link'),
        '#default_value' => variable_get('xmlsitemap_engines_yahoo_verify', ''),
        '#description' => t('Before allowing you to view additional information, Yahoo! will ask you to verify that you control this site by creating a file with a certain name. Enter that name here, and XML sitemap will create a path to that file name. This will only work if you have clean URLs enabled.'),
      );
      $form['yahoo']['xmlsitemap_engines_yahoo_verify_string'] = array(
        '#type' => 'textfield',
        '#title' => t('Authentication key'),
        '#default_value' => variable_get('xmlsitemap_engines_yahoo_verify_string', ''),
        '#description' => t('Yahoo! will ask you to put an authentication key in the verification file.'),
      );
      return $form;
    case 'ping':

      // Ask.com.
      if (variable_get('xmlsitemap_engines_ask_submit', FALSE)) {
        xmlsitemap_engines_submit_sitemap('Ask.com', 'xmlsitemap_engines_ask_url', 'http://submissions.ask.com/ping?sitemap=[sitemap]');
      }

      // Google.
      if (variable_get('xmlsitemap_engines_google_submit', FALSE)) {
        xmlsitemap_engines_submit_sitemap('Google', 'xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap=[sitemap]');
      }

      // Moreover.com.
      if (variable_get('xmlsitemap_engines_moreover_submit', FALSE)) {
        xmlsitemap_engines_submit_sitemap('Moreover.com', 'xmlsitemap_engines_moreover_url', 'http://api.moreover.com/ping?u=[sitemap]');
      }

      // Windows Live.
      if (variable_get('xmlsitemap_engines_ask_submit', FALSE)) {
        xmlsitemap_engines_submit_sitemap('Windows Live', 'xmlsitemap_engines_live_url', 'http://webmaster.live.com/ping.aspx?siteMap=[sitemap]');
      }

      // Yahoo!.
      if (variable_get('xmlsitemap_engines_yahoo_submit', FALSE)) {
        xmlsitemap_engines_submit_sitemap('Yahoo!', 'xmlsitemap_engines_yahoo_url', 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=[sitemap]');
      }
      break;
    case 'access':
      if (strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') !== FALSE) {
        return 'Sitemap downloaded by Google.';
      }
  }
}