From 6fa4ce586ff03ecc14a1ac35f4042b306885c5ae Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 21 Jun 2010 21:17:37 -0400 Subject: [PATCH] Removing strtolower call that was breaking autolinks for URL shorteners. Tests added. Fixes #838 --- cake/libs/view/helpers/text.php | 4 ++-- cake/tests/cases/libs/view/helpers/text.test.php | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cake/libs/view/helpers/text.php b/cake/libs/view/helpers/text.php index 455c667ee8b..d38299c53ac 100644 --- a/cake/libs/view/helpers/text.php +++ b/cake/libs/view/helpers/text.php @@ -108,7 +108,7 @@ function autoLinkUrls($text, $htmlOptions = array()) { '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], $matches[0],' . $options . ');'), $text); return preg_replace_callback('#(?)(?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); } /** * Adds email links (WWW.cakephp.org URL'; + $expected = 'Text with a partial WWW.cakephp.org URL'; $result = $this->Text->autoLinkUrls($text); $this->assertPattern('#^' . $expected . '$#', $result); $text = 'Text with a partial WWW.cakephp.org © URL'; - $expected = 'Text with a partial WWW.cakephp.org © URL'; + $expected = 'Text with a partial WWW.cakephp.org © 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 www.cot.ag/cuIb2Q and more'; + $result = $this->Text->autoLinkUrls($text); + $this->assertEqual($expected, $result); } /** * testAutoLinkEmails method @@ -379,4 +383,4 @@ function testListGeneration() { $this->assertEqual($result, 'Dusty, Lucky y Ned'); } } -?> \ No newline at end of file +?>