Fixes #3419, $text->autoLink does not preserve existing links

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5836 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-10-21 22:21:28 +00:00
parent acdeadde01
commit 1704efa50a

View file

@ -106,10 +106,10 @@ class TextHelper extends AppHelper {
}
$options .= ')';
$text=preg_replace_callback('#((?:http|https|ftp|nntp)://[^ <]+)#', create_function('$matches',
$text = preg_replace_callback('#(?<!href="|">)((?:http|https|ftp|nntp)://[^ <]+)#i', create_function('$matches',
'$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], $matches[0],' . $options . ');'), $text);
return preg_replace_callback('#(?<!http://|https://|ftp://|nntp://)(www\.[^\n\%\ <]+[^<\n\%\,\.\ <])#i',
return preg_replace_callback('#(?<!href="|">)(?<!http://|https://|ftp://|nntp://)(www\.[^\n\%\ <]+[^<\n\%\,\.\ <])#i',
create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . low($matches[0]),' . $options . ');'), $text);
}
/**