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

Comments

deekayen’s picture

Version: » 7.x-1.x-dev
Status: Active » Needs review
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;
}
deekayen’s picture

Status: Needs review » Fixed

committed to cvs

peterjohnhartman’s picture

Assigned: Unassigned » peterjohnhartman

commited to DRUPAL-4-7.

Anonymous’s picture

Status: Fixed » Closed (fixed)