mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix autoLinkEmail() not working when emails are adjacent to HTML.
When an email address is adjacent to HTML it should be autolinked correctly. Refs #3656
This commit is contained in:
parent
74d8e9ea40
commit
9136f63874
2 changed files with 12 additions and 1 deletions
|
@ -415,6 +415,17 @@ class TextHelperTest extends CakeTestCase {
|
|||
array('class' => 'link'),
|
||||
),
|
||||
|
||||
array(
|
||||
'<p>mark@example.com</p>',
|
||||
'<p><a href="mailto:mark@example.com">mark@example.com</a></p>',
|
||||
array('escape' => false)
|
||||
),
|
||||
|
||||
array(
|
||||
'Some mark@example.com Text',
|
||||
'Some <a href="mailto:mark@example.com">mark@example.com</a> Text',
|
||||
array('escape' => false)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ class TextHelper extends AppHelper {
|
|||
|
||||
$atom = '[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]';
|
||||
$text = preg_replace_callback(
|
||||
'/(?<=\s|^|\()(' . $atom . '*(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[\p{L}0-9-]+)+)/ui',
|
||||
'/(?<=\s|^|\(|\>|\;)(' . $atom . '*(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[\p{L}0-9-]+)+)/ui',
|
||||
array(&$this, '_insertPlaceholder'),
|
||||
$text
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue