function robotstxt_robots in RobotsTxt 7
Same name and namespace in other branches
- 5 robotstxt.module \robotstxt_robots()
- 6 robotstxt.module \robotstxt_robots()
Show the robots.txt file.
2 string references to 'robotstxt_robots'
- robotstxt_menu in ./
robotstxt.module - Implements hook_menu().
- robotstxt_test_menu in tests/
robotstxt_test.module - Implements hook_menu().
File
- ./
robotstxt.module, line 57
Code
function robotstxt_robots() {
$content = array();
$content[] = variable_get('robotstxt', '');
// Hook other modules for adding additional lines.
if ($additions = module_invoke_all('robotstxt')) {
$content = array_merge($content, $additions);
}
// Trim any extra whitespace and filter out empty strings.
$content = array_map('trim', $content);
$content = array_filter($content);
drupal_add_http_header('Content-type', 'text/plain');
echo implode("\n", $content);
drupal_page_footer();
exit;
}