mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
also fix autoLinkEmail()
This commit is contained in:
parent
2a954b6095
commit
205f7a504b
2 changed files with 7 additions and 2 deletions
|
@ -359,6 +359,11 @@ class TextHelperTest extends CakeTestCase {
|
|||
$expected = 'Text with <a href="mailto:email@example.com" \s*class="link">email@example.com</a> address';
|
||||
$result = $this->Text->autoLinkEmails($text, array('class' => 'link'));
|
||||
$this->assertRegExp('#^' . $expected . '$#', $result);
|
||||
|
||||
$text = 'Text with düsentrieb@küchenschöhn-not-working.de address';
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -186,9 +186,9 @@ class TextHelper extends AppHelper {
|
|||
$options += array('escape' => true);
|
||||
$this->_placeholders = array();
|
||||
|
||||
$atom = '[a-z0-9!#$%&\'*+\/=?^_`{|}~-]';
|
||||
$atom = '[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]';
|
||||
$text = preg_replace_callback(
|
||||
'/(' . $atom . '+(?:\.' . $atom . '+)*@[a-z0-9-]+(?:\.[a-z0-9-]+)+)/i',
|
||||
'/(' . $atom . '+(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[a-z0-9-]+)+)/ui',
|
||||
array(&$this, '_insertPlaceholder'),
|
||||
$text
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue