You are here

function adstxt_callback in AdsTxt 7

Show the ads.txt file.

1 string reference to 'adstxt_callback'
adstxt_menu in ./adstxt.module
Implements hook_menu().

File

./adstxt.module, line 55

Code

function adstxt_callback() {
  $content = array();
  $content[] = variable_get('adstxt', '');

  // Hook other modules for adding additional lines.
  if ($additions = module_invoke_all('adstxt')) {
    $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(PHP_EOL, $content);
  drupal_page_footer();
  exit;
}