You are here

function print_controller_html in Printer, email and PDF versions 7.2

Same name and namespace in other branches
  1. 5.4 print.pages.inc \print_controller_html()
  2. 5.3 print.pages.inc \print_controller_html()
  3. 6 print.pages.inc \print_controller_html()
  4. 7 print.pages.inc \print_controller_html()
  5. 5.x print.pages.inc \print_controller_html()

Generate an HTML version of the printer-friendly page.

See also

print_controller()

1 string reference to 'print_controller_html'
print_menu in ./print.module
Implements hook_menu().

File

./print.pages.inc, line 21

Code

function print_controller_html() {
  $args = func_get_args();
  $path = filter_xss(implode('/', $args));
  $cid = isset($_GET['comment']) ? (int) $_GET['comment'] : NULL;
  $link = print_print_link();
  $node = print_controller($path, $link['format'], $cid);
  if ($node) {

    // Handle the query.
    $query = $_GET;
    unset($query['q']);
    $html = theme('print', array(
      'node' => $node,
      'query' => $query,
      'format' => $link['format'],
    ));
    drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
    drupal_send_headers();
    print $html;
    $nodepath = isset($node->nid) ? 'node/' . $node->nid : drupal_get_normal_path($path);
    db_merge('print_page_counter')
      ->key(array(
      'path' => substr($nodepath, 0, 255),
    ))
      ->fields(array(
      'totalcount' => 1,
      'timestamp' => REQUEST_TIME,
    ))
      ->expression('totalcount', 'totalcount + 1')
      ->execute();
  }
  else {
    drupal_exit();
  }
}