diff --git a/wysiwyg_filter.pages.inc b/wysiwyg_filter.pages.inc index ce2a02e..06c34a8 100644 --- a/wysiwyg_filter.pages.inc +++ b/wysiwyg_filter.pages.inc @@ -447,7 +447,12 @@ function _wysiwyg_filter_xss_attributes($attr, $element = '') { break; } } - if (($nofollow_policy == 'blacklist' && $domain_found) || ($nofollow_policy == 'whitelist' && !$domain_found)) { + // If we are doing a blacklist and found the domain, add a nofollow. + // If we are doing a whitelist and didn't find the domain AND it is + // not a relative link, add nofollow. Links are checked by + // http://php.net/parse_url. + $link_is_relative = empty(parse_url($attrinfo['value'], PHP_URL_HOST)); + if (($nofollow_policy == 'blacklist' && $domain_found) || ($nofollow_policy == 'whitelist' && !$domain_found && !$link_is_relative)) { $add_nofollow = TRUE; } }