function _robotstxt_get_content in RobotsTxt 5
Same name and namespace in other branches
- 6 robotstxt.module \_robotstxt_get_content()
Retrieve contents of robots.txt from the database variable, site root, or module directory.
2 calls to _robotstxt_get_content()
- robotstxt_admin_settings in ./
robotstxt.module - You can edit the robots.txt for your site under admin/settings/robotstxt
- robotstxt_robots in ./
robotstxt.module - Show the robots.txt file.
File
- ./
robotstxt.module, line 88
Code
function _robotstxt_get_content() {
$content = variable_get('robotstxt', FALSE);
if ($content === FALSE) {
$files = array(
'./robots.txt',
drupal_get_path('module', 'robotstxt') . '/robots.txt',
);
foreach ($files as $file) {
if (file_exists($file) && is_readable($file)) {
$content = file_get_contents($file);
break;
}
}
}
return $content;
}