function _xmlsitemap_engines_bing in XML sitemap 5
Define actions for Bing.
Related topics
1 call to _xmlsitemap_engines_bing()
- xmlsitemap_engines_xmlsitemap_engines in xmlsitemap_engines/
xmlsitemap_engines.module - Implementation of hook_xmlsitemap_engines().
File
- xmlsitemap_engines/
xmlsitemap_engines.module, line 174 - Define actions for Google, Yahoo!, Ask, and Bing.
Code
function _xmlsitemap_engines_bing($op) {
switch ($op) {
case 'form':
$form['bing'] = array(
'#type' => 'fieldset',
'#title' => t('Bing (formerly Windows Live)'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['bing']['xmlsitemap_engines_bing_submit'] = array(
'#type' => 'checkbox',
'#title' => t('Submit site map to Bing.'),
'#default_value' => variable_get('xmlsitemap_engines_bing_submit', FALSE),
);
$form['bing']['xmlsitemap_engines_bing_url'] = array(
'#type' => 'textfield',
'#title' => t('Submission URL'),
'#default_value' => variable_get('xmlsitemap_engines_bing_url', 'http://www.bing.com/webmaster/ping.aspx?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.'),
);
$form['bing']['xmlsitemap_engines_bing_verify'] = array(
'#type' => 'textfield',
'#title' => t('Authentication file'),
'#default_value' => variable_get('xmlsitemap_engines_bing_verify', ''),
'#description' => t('Before allowing you to view additional information, Bing 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['bing']['xmlsitemap_engines_bing_verify_string'] = array(
'#type' => 'textfield',
'#title' => t('Authentication tag'),
'#default_value' => variable_get('xmlsitemap_engines_bing_verify_string', ''),
'#description' => t('Bing will give you an authentication tag.'),
);
return $form;
case 'ping':
if (variable_get('xmlsitemap_engines_bing_submit', FALSE)) {
$result = drupal_http_request(variable_get('xmlsitemap_engines_bing_url', 'http://www.bing.com/webmaster/ping.aspx?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 Bing.'));
}
else {
watchdog('xmlsitemap', t('Error occurred submitting site map to Bing: @code', array(
'@code' => $result->code,
)), WATCHDOG_ERROR);
}
}
break;
}
}