mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Fix words with WWW in them being autolinked.
Don't autolink words that don't have `www.` in them. Fixes #5968
This commit is contained in:
parent
ef820964e5
commit
ea79cf5d13
2 changed files with 5 additions and 1 deletions
|
@ -117,6 +117,10 @@ class TextHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testAutoLink() {
|
||||
$text = 'The AWWWARD show happened today';
|
||||
$result = $this->Text->autoLink($text);
|
||||
$this->assertEquals($text, $result);
|
||||
|
||||
$text = 'This is a test text';
|
||||
$expected = 'This is a test text';
|
||||
$result = $this->Text->autoLink($text);
|
||||
|
|
|
@ -114,7 +114,7 @@ class TextHelper extends AppHelper {
|
|||
$text
|
||||
);
|
||||
$text = preg_replace_callback(
|
||||
'#(?<!href="|">)(?<!\b[[:punct:]])(?<!http://|https://|ftp://|nntp://|//)www.[^\n\%\ <]+[^<\n\%\,\.\ <](?<!\))#i',
|
||||
'#(?<!href="|">)(?<!\b[[:punct:]])(?<!http://|https://|ftp://|nntp://|//)www\.[^\n\%\ <]+[^<\n\%\,\.\ <](?<!\))#i',
|
||||
array(&$this, '_insertPlaceHolder'),
|
||||
$text
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue