You are here

function _print_robots_meta_generator in Printer, email and PDF versions 5.2

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.3 print.pages.inc \_print_robots_meta_generator()
  4. 6 print.pages.inc \_print_robots_meta_generator()
  5. 7.2 print.pages.inc \_print_robots_meta_generator()
  6. 7 print.pages.inc \_print_robots_meta_generator()
  7. 5.x print.pages.inc \_print_robots_meta_generator()

Generates a meta tag to tell robots what they may index based on module settings

Return value

string

1 call to _print_robots_meta_generator()
_print_var_generator in ./print.module
Generates the HTML to insert in the template file

File

./print.module, line 374
Display printer-friendly versions of Drupal pages

Code

function _print_robots_meta_generator() {
  $robots_settings = variable_get('print_robot_settings', print_robot_settings_default());
  $robots_meta = array();
  if (!empty($robots_settings['noindex'])) {
    $robots_meta[] = 'noindex';
  }
  if (!empty($robots_settings['nofollow'])) {
    $robots_meta[] = 'nofollow';
  }
  if (!empty($robots_settings['noarchive'])) {
    $robots_meta[] = 'noarchive';
  }
  if (!empty($robots_settings['nocache'])) {
    $robots_meta[] = 'nocache';
  }
  if (sizeof($robots_meta) > 0) {
    $robots_meta = isset($robots_meta[1]) ? implode(', ', $robots_meta) : $robots_meta[0];
    $robots_meta = '<meta name="robots" content="' . $robots_meta . "\" />\n";
  }
  else {
    $robots_meta = '';
  }
  return $robots_meta;
}