You are here

function print_controller_html in Printer, email and PDF versions 7

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.2 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;

  // Handle the query
  $query = $_GET;
  unset($query['q']);
  $print = print_controller($path, $query, $cid, PRINT_HTML_FORMAT);
  if ($print !== FALSE) {
    $node = $print['node'];
    $html = theme('print', array(
      'print' => $print,
      'type' => PRINT_HTML_FORMAT,
      'node' => $node,
    ));
    drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
    drupal_send_headers();
    print $html;
    $nodepath = isset($node->path) && is_string($node->path) ? drupal_get_normal_path($node->path) : 'node/' . $path;
    db_merge('print_page_counter')
      ->key(array(
      'path' => $nodepath,
    ))
      ->fields(array(
      'totalcount' => 1,
      'timestamp' => REQUEST_TIME,
    ))
      ->expression('totalcount', 'totalcount + 1')
      ->execute();
  }
}