1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-03 20:58:11 +02:00

Do not duplicate nofollow attribute in transform.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Edward Z. Yang
2011-06-11 15:52:02 +01:00
parent 35b1fbce01
commit 820d6e9097
3 changed files with 13 additions and 1 deletions

View File

@@ -26,7 +26,11 @@ class HTMLPurifier_AttrTransform_Nofollow extends HTMLPurifier_AttrTransform
if (!is_null($url->host) && $scheme !== false && $scheme->browsable) {
if (isset($attr['rel'])) {
$attr['rel'] .= ' nofollow';
$rels = explode(' ', $attr);
if (!in_array('nofollow', $rels)) {
$rels[] = 'nofollow';
}
$attr['rel'] = implode(' ', $rels);
} else {
$attr['rel'] = 'nofollow';
}