function _robotstxt_get_content in RobotsTxt 6
Same name and namespace in other branches
- 5 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.admin.inc - Administration settings form.
- robotstxt_robots in ./
robotstxt.module - Show the robots.txt file.
File
- ./
robotstxt.module, line 75
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;
}