mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Removing strtolower call that was breaking autolinks for URL shorteners. Tests added. Fixes #838
This commit is contained in:
parent
26d20b6d62
commit
5945edd983
2 changed files with 7 additions and 3 deletions
|
@ -123,7 +123,7 @@ class TextHelper extends AppHelper {
|
|||
'$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',
|
||||
create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . strtolower($matches[0]),' . $options . ');'), $text);
|
||||
create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . $matches[0],' . $options . ');'), $text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -267,15 +267,19 @@ class TextHelperTest extends CakeTestCase {
|
|||
$this->assertPattern('#^' . $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';
|
||||
$expected = 'Text with a partial <a href="http://WWW.cakephp.org"\s*>WWW.cakephp.org</a> URL';
|
||||
$result = $this->Text->autoLinkUrls($text);
|
||||
$this->assertPattern('#^' . $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';
|
||||
$expected = 'Text with a partial <a href="http://WWW.cakephp.org"\s*>WWW.cakephp.org</a> © URL';
|
||||
$result = $this->Text->autoLinkUrls($text, array('escape' => false));
|
||||
$this->assertPattern('#^' . $expected . '$#', $result);
|
||||
|
||||
$text = 'Text with a url www.cot.ag/cuIb2Q and more';
|
||||
$expected = 'Text with a url <a href="http://www.cot.ag/cuIb2Q">www.cot.ag/cuIb2Q</a> and more';
|
||||
$result = $this->Text->autoLinkUrls($text);
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue