Minor issues when in printing links at bottom of page
jdmquin - March 11, 2005 - 02:10
| Project: | Printer, e-mail and PDF versions |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | peterjohnhartman |
| Status: | closed |
Jump to:
Description
There a two minor issues when printing links at the bottom of the page.
1. mailto links get the base_url in front of them
2. If your not using clean urls then the ?q= is printed twice.
I'm no programmer, but I made the following changes to the print_friendly_urls function to fix these issues.
Original code
if ($url) {
$urls[] = strpos($url, '://') ? $url : $base_url. '/'. url($url);
return count($urls);
}New code
if ($url) {
/* $urls[] = strpos($url, '://') ? $url : $base_url. '/'. url($url); */
if (strpos($url, '://') | strpos($url, 'to:')) {
$urls[] = $url;
} else {
$urls[] = $base_url. '/'. $url;
}
return count($urls);
}
Thanks

#1
function print_friendly_urls($url = 0) {global $base_url;
static $urls = array();
if ($url) {
if(strpos($url, '://') || preg_match("/^mailto:.*?@.*?\..*?$/iu", $url)) {
$urls[] = $url;
} else {
$base_url. '/'. url($url);
}
return count($urls);
}
return $urls;
}
#2
committed to cvs
#3
commited to DRUPAL-4-7.
#4