Skip to content
Permalink
Browse files

Fix words with WWW in them being autolinked.

Don't autolink words that don't have `www.` in them.

Fixes #5968
  • Loading branch information...
markstory committed Feb 26, 2015
1 parent ef82096 commit ea79cf5d137fb3c78bdc3009256764c2849caea5
Showing with 5 additions and 1 deletion.
  1. +4 −0 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
  2. +1 −1 lib/Cake/View/Helper/TextHelper.php
@@ -117,6 +117,10 @@ public function testEngineOverride() {
* @return void
*/
public function testAutoLink() {
$text = 'The AWWWARD show happened today';
$result = $this->Text->autoLink($text);
$this->assertEquals($text, $result);
$text = 'This is a test text';
$expected = 'This is a test text';
$result = $this->Text->autoLink($text);
@@ -114,7 +114,7 @@ public function autoLinkUrls($text, $options = array()) {
$text
);
$text = preg_replace_callback(
'#(?<!href="|">)(?<!\b[[:punct:]])(?<!http://|https://|ftp://|nntp://|//)www.[^\n\%\ <]+[^<\n\%\,\.\ <](?<!\))#i',
'#(?<!href="|">)(?<!\b[[:punct:]])(?<!http://|https://|ftp://|nntp://|//)www\.[^\n\%\ <]+[^<\n\%\,\.\ <](?<!\))#i',
array(&$this, '_insertPlaceHolder'),
$text
);

0 comments on commit ea79cf5

Please sign in to comment.
You can’t perform that action at this time.