Permalink
Browse files

complete autoLinkEmail()

  • Loading branch information...
1 parent 205f7a5 commit bd87ef45f2b36e35e806082623792d91b30ca639 @dereuromark dereuromark committed Sep 27, 2013
Showing with 6 additions and 1 deletion.
  1. +5 −0 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
  2. +1 −1 lib/Cake/View/Helper/TextHelper.php
View
5 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
@@ -364,6 +364,11 @@ public function testAutoLinkEmails() {
$expected = 'Text with <a href="mailto:düsentrieb@küchenschöhn-not-working.de">düsentrieb@küchenschöhn-not-working.de</a> address';
$result = $this->Text->autoLinkEmails($text);
$this->assertRegExp('#^' . $expected . '$#', $result);
+
+ $text = 'Text with me@subdomain.küchenschöhn.de address';
+ $expected = 'Text with <a href="mailto:me@subdomain.küchenschöhn.de">me@subdomain.küchenschöhn.de</a> address';
+ $result = $this->Text->autoLinkEmails($text);
+ $this->assertRegExp('#^' . $expected . '$#', $result);
}
/**
View
2 lib/Cake/View/Helper/TextHelper.php
@@ -188,7 +188,7 @@ public function autoLinkEmails($text, $options = array()) {
$atom = '[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]';
$text = preg_replace_callback(
- '/(' . $atom . '+(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[a-z0-9-]+)+)/ui',
+ '/(' . $atom . '+(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[\p{L}0-9-]+)+)/ui',
array(&$this, '_insertPlaceholder'),
$text
);

0 comments on commit bd87ef4

Please sign in to comment.