mirror of
https://github.com/flarum/framework.git
synced 2025-01-22 21:48:46 +08:00
Add target="_blank" and rel="nofollow" to all formatted links
closes #247
This commit is contained in:
parent
283abb88c2
commit
bcc16a3329
|
@ -42,6 +42,15 @@ class Formatter
|
||||||
|
|
||||||
event(new FormatterConfigurator($configurator));
|
event(new FormatterConfigurator($configurator));
|
||||||
|
|
||||||
|
$dom = $configurator->tags['URL']->template->asDOM();
|
||||||
|
|
||||||
|
foreach ($dom->getElementsByTagName('a') as $a) {
|
||||||
|
$a->setAttribute('target', '_blank');
|
||||||
|
$a->setAttribute('rel', 'nofollow');
|
||||||
|
}
|
||||||
|
|
||||||
|
$dom->saveChanges();
|
||||||
|
|
||||||
return $configurator;
|
return $configurator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user