mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06: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
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAutoLink() {
|
public function testAutoLink() {
|
||||||
|
$text = 'The AWWWARD show happened today';
|
||||||
|
$result = $this->Text->autoLink($text);
|
||||||
|
$this->assertEquals($text, $result);
|
||||||
|
|
||||||
$text = 'This is a test text';
|
$text = 'This is a test text';
|
||||||
$expected = 'This is a test text';
|
$expected = 'This is a test text';
|
||||||
$result = $this->Text->autoLink($text);
|
$result = $this->Text->autoLink($text);
|
||||||
|
|
|
@ -114,7 +114,7 @@ class TextHelper extends AppHelper {
|
||||||
$text
|
$text
|
||||||
);
|
);
|
||||||
$text = preg_replace_callback(
|
$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'),
|
array(&$this, '_insertPlaceHolder'),
|
||||||
$text
|
$text
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue