mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 02:26:17 +00:00
Fixed small bug in TextHelper::autoLinkUrls, closes #4357
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6832 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
170fe3d9d1
commit
93ad951a8c
2 changed files with 6 additions and 1 deletions
|
@ -109,7 +109,7 @@ class TextHelper extends AppHelper {
|
|||
$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('#(?<!href="|">)(?<!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://" . strtolower($matches[0]),' . $options . ');'), $text);
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -133,6 +133,11 @@ class TextTest extends UnitTestCase {
|
|||
$result = $this->Text->autoLinkUrls($text);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$text = 'This is a test that includes (www.cakephp.org)';
|
||||
$expected = 'This is a test that includes (<a href="http://www.cakephp.org">www.cakephp.org</a>)';
|
||||
$result = $this->Text->autoLinkUrls($text);
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$text = 'Text with a partial www.cakephp.org URL';
|
||||
$expected = 'Text with a partial <a href="http://www.cakephp.org"\s*>www.cakephp.org</a> URL';
|
||||
$result = $this->Text->autoLinkUrls($text);
|
||||
|
|
Loading…
Add table
Reference in a new issue