mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #3395 from ADmad/2.4-autolinkurl
Fix auto linking urls with subdomain with underscore. Fixes #3392
This commit is contained in:
commit
4a24d6ea31
2 changed files with 5 additions and 1 deletions
|
@ -265,6 +265,10 @@ class TextHelperTest extends CakeTestCase {
|
|||
'Text with a url http://www.not--work.com and more',
|
||||
'Text with a url <a href="http://www.not--work.com">http://www.not--work.com</a> and more',
|
||||
),
|
||||
array(
|
||||
'Text with a url http://www.sub_domain.domain.pl and more',
|
||||
'Text with a url <a href="http://www.sub_domain.domain.pl">http://www.sub_domain.domain.pl</a> and more',
|
||||
),
|
||||
array(
|
||||
'Text with a partial www.küchenschöhn-not-working.de URL',
|
||||
'Text with a partial <a href="http://www.küchenschöhn-not-working.de">www.küchenschöhn-not-working.de</a> URL'
|
||||
|
|
|
@ -104,7 +104,7 @@ class TextHelper extends AppHelper {
|
|||
$this->_placeholders = array();
|
||||
$options += array('escape' => true);
|
||||
|
||||
$pattern = '#(?<!href="|src="|">)((?:https?|ftp|nntp)://[\p{L}0-9.\-:]+(?:[/?][^\s<]*)?)#ui';
|
||||
$pattern = '#(?<!href="|src="|">)((?:https?|ftp|nntp)://[\p{L}0-9.\-_:]+(?:[/?][^\s<]*)?)#ui';
|
||||
$text = preg_replace_callback(
|
||||
$pattern,
|
||||
array(&$this, '_insertPlaceHolder'),
|
||||
|
|
Loading…
Reference in a new issue