From 5945edd983597dc0bf44f6162101e7b3c3a5353f 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 | 2 +- cake/tests/cases/libs/view/helpers/text.test.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cake/libs/view/helpers/text.php b/cake/libs/view/helpers/text.php index 046ce7080..04e80a812 100644 --- a/cake/libs/view/helpers/text.php +++ b/cake/libs/view/helpers/text.php @@ -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('#(?)(?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); } /** diff --git a/cake/tests/cases/libs/view/helpers/text.test.php b/cake/tests/cases/libs/view/helpers/text.test.php index eb674d3e5..7a5470c01 100644 --- a/cake/tests/cases/libs/view/helpers/text.test.php +++ b/cake/tests/cases/libs/view/helpers/text.test.php @@ -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 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); } /**