Skip to content

Commit

Permalink
complete autoLinkEmail()
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Sep 27, 2013
1 parent 205f7a5 commit bd87ef4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/Cake/Test/Case/View/Helper/TextHelperTest.php
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper/TextHelper.php
Expand Up @@ -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
);
Expand Down

0 comments on commit bd87ef4

Please sign in to comment.