]>
Commit | Line | Data |
---|---|---|
83c1e41e ER |
1 | --- eventum-20051227/include/class.misc.php 2005-12-27 15:35:26.000000000 +0200 |
2 | +++ /tmp/class.misc.php 2005-12-27 15:34:41.000000000 +0200 | |
3 | @@ -504,10 +497,15 @@ | |
4 | * @param string $class The CSS class to use on the actual links | |
5 | * @return string The parsed string | |
6 | */ | |
7 | - function activateLinks($text, $class = "link") | |
8 | + function activateLinks($text, $class = 'link') | |
9 | { | |
10 | - $text = preg_replace("'(\w+)://([\w\+\-\@\=\?\.\%\/\:\&\;~\|]+)(\.)?'", "<a title=\"open \\1://\\2 in a new window\" class=\"$class\" href=\"\\1://\\2\" target=\"_\\2\">\\1://\\2</a>", $text); | |
11 | - $text = preg_replace("'(\s+)www\.([\w\+\-\@\=\?\.\%\/\:\&\;~\|]+)(\.\s|\s)'", "\\1<a title=\"open http://www.\\2 in a new window\" class=\"$class\" href=\"http://www.\\2\" target=\"_\\2\">www.\\2</a>\\3" , $text); | |
12 | + $range = '[-\w+@=?.%/:&;~|,#]+'; | |
13 | + $text = preg_replace("'(\w+)://($range)(\.)?'", '<a title="open $1://$2 in a new window" class="' . $class . '" href="$1://$2" target="_$2">$1://$2</a>', $text); | |
14 | + $text = preg_replace("'(\s+)(www\.$range)(\.\s|\s)'", '$1<a title="open http://$2 in a new window" class="' . $class . '" href="http://$2" target="_$2">$2</a>$3' , $text); | |
15 | + | |
16 | + $mail_pat = '/([-+a-z0-9_.]+@(?:[-a-z0-9_.]{2,63}\.)+[a-z]{2,6})/i'; | |
17 | + $text = preg_replace($mail_pat, '<a title="open mailto:$1 in a new window" class="' . $class . '" href="mailto:$1" target="_$1">$1</a>' , $text); | |
18 | + | |
19 | return $text; | |
20 | } | |
21 |