You are here

function _print_robots_meta_generator in Printer, email and PDF versions 5.x

Same name and namespace in other branches
  1. 5.4 print.pages.inc \_print_robots_meta_generator()
  2. 5 print.module \_print_robots_meta_generator()
  3. 5.2 print.module \_print_robots_meta_generator()
  4. 5.3 print.pages.inc \_print_robots_meta_generator()
  5. 6 print.pages.inc \_print_robots_meta_generator()
  6. 7.2 print.pages.inc \_print_robots_meta_generator()
  7. 7 print.pages.inc \_print_robots_meta_generator()

Generates a robots meta tag to tell them what they may index

Return value

string with the meta robots tag

1 call to _print_robots_meta_generator()
_print_var_generator in ./print.pages.inc
Post-processor that fills the array for the template with common details

File

./print.pages.inc, line 111

Code

function _print_robots_meta_generator() {
  $print_robots_noindex = variable_get('print_robots_noindex', PRINT_ROBOTS_NOINDEX_DEFAULT);
  $print_robots_nofollow = variable_get('print_robots_nofollow', PRINT_ROBOTS_NOFOLLOW_DEFAULT);
  $print_robots_noarchive = variable_get('print_robots_noarchive', PRINT_ROBOTS_NOARCHIVE_DEFAULT);
  $robots_meta = array();
  if (!empty($print_robots_noindex)) {
    $robots_meta[] = 'noindex';
  }
  if (!empty($print_robots_nofollow)) {
    $robots_meta[] = 'nofollow';
  }
  if (!empty($print_robots_noarchive)) {
    $robots_meta[] = 'noarchive';
  }
  if (count($robots_meta) > 0) {
    $robots_meta = implode(', ', $robots_meta);
    $robots_meta = "<meta name='robots' content='{$robots_meta}' />\n";
  }
  else {
    $robots_meta = '';
  }
  return $robots_meta;
}