--- C:\Documents and Settings\Aldo\Local Settings\Temp\TCVe529.tmp\common.1.537.inc Mon Oct 09 10:50:23 2006 +++ D:\drupal cvs\drupal\includes\common.inc Mon Oct 09 09:52:59 2006 @@ -695,6 +695,24 @@ } /** + * Convert relative URLs in a block of HTML to absolute URLs + * + */ + function filter_absolute_urls($data, $base_url) { + $base_url_root = (preg_match('%(.*://.*?)/%',$base_url, $matches)>0)?$matches[1]:$base_url; + + $src = '%( href| src)="(?!\w+://)([^/][^"]*)"%'; + $dst = '$1="'. $base_url .'/$2"'; + $data = preg_replace($src, $dst, $data); + + $src = '%( href| src)="(?!\w+://)/?([^"]*)"%'; + $dst = '$1="'. trim($base_url_root, '/') .'/$2"'; + return preg_replace($src, $dst, $data); + + return $data; + } + +/** * @defgroup format Formatting * @{ * Functions to format numbers, strings, dates, etc. @@ -735,7 +753,7 @@ $output = "\n"; $output .= ' '. check_plain($title) ."\n"; $output .= ' '. check_url($link) ."\n"; - $output .= ' '. check_plain($description) ."\n"; + $output .= ' '. check_plain(filter_absolute_urls($description, $link)) ."\n"; foreach ($args as $key => $value) { if (is_array($value)) { if ($value['key']) {