.*?<\/div>/sim", "", $comments);
if ($cid != NULL) {
// Single comment requested, output only the comment
unset($node->body);
}
$node->body .= $comments;
}
node_invoke_nodeapi($node, 'alter', false, true);
// Convert the a href elements
$pattern = "@<(a\s[^>]*?)>(.*?)()@is";
$node->body = preg_replace_callback($pattern, "_print_rewrite_urls", $node->body);
init_theme();
$print = _print_var_generator($node, $cid);
return $print;
}
/**
* Outputs a printer-friendly page. Used for drupal core pages.
*/
function _print_generate_path($path) {
global $base_url;
$path = drupal_get_normal_path($path);
menu_set_active_item($path);
// Adapted from index.php.
$node = new stdClass();
$node->body = menu_execute_active_handler($path);
$node->title = menu_get_active_title();
$node->path = $path;
// It may happen that a drupal_not_found is called in the above call
if (preg_match('/404 Not Found/', drupal_get_headers()) == 1) {
return;
}
switch ($node->body) {
case MENU_NOT_FOUND:
return drupal_not_found();
break;
case MENU_ACCESS_DENIED:
return drupal_access_denied();
break;
}
// Delete any links area
$node->body = preg_replace("/\s*
.*?<\/div>/sim", "", $node->body);
// Convert the a href elements
$pattern = "@<(a\s[^>]*?)>(.*?)()@is";
$node->body = preg_replace_callback($pattern, "_print_rewrite_urls", $node->body);
init_theme();
$print = _print_var_generator($node);
return $print;
}
/**
* Outputs a printer-friendly page. Used for book pages
*/
function _print_generate_book($nid) {
global $base_url;
$node = node_load(array('nid' => $nid));
if (!node_access('view', $node) || (!user_access('access printer-friendly version'))) {
// Access is denied
return drupal_access_denied();
}
$tree = book_menu_subtree_data($node->book);
$node->body = book_export_traverse($tree, 'book_node_export');
// Convert the a href elements
$pattern = "@<(a\s[^>]*?)>(.*?)()@is";
$node->body = preg_replace_callback($pattern, "_print_rewrite_urls", $node->body);
init_theme();
$print = _print_var_generator($node);
// The title is already displayed by the book_recurse, so avoid duplication
$print["title"] = "";
return $print;
}