1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-06 14:16:32 +02:00

Don't add nofollow for matching hosts, generalize this code.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Edward Z. Yang
2011-06-12 10:59:27 +01:00
parent 856a5e5b89
commit 32c0ffde0c
4 changed files with 22 additions and 6 deletions

View File

@@ -199,6 +199,21 @@ class HTMLPurifier_URI
return $result;
}
/**
* Returns true if this URL might be considered a 'local' URL given
* the current context. This is true when the host is null, or
* when it matches the host supplied to the configuration.
*
* Note that this does not do any scheme checking (URI.Munge, I'm
* looking at you).
*/
public function isLocal($config, $context) {
if ($this->host === null) return true;
$uri_def = $config->getDefinition('URI');
if ($uri_def->host === $this->host) return true;
return false;
}
}
// vim: et sw=4 sts=4