diff options
author | Andrew Dolgov <[email protected]> | 2012-10-28 12:21:21 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-10-28 12:21:21 +0400 |
commit | acccafe3daee1c94064202d38fa244bd5a15c2e7 (patch) | |
tree | 11407af73571632e239e1de01c4a7dfb7664503d /lib/htmlpurifier/library/HTMLPurifier/AttrTransform/Nofollow.php | |
parent | 17525d012750697283a3758b0fe00c0a6945947f (diff) |
replace htmlpurifier with htmlawed
Diffstat (limited to 'lib/htmlpurifier/library/HTMLPurifier/AttrTransform/Nofollow.php')
-rw-r--r-- | lib/htmlpurifier/library/HTMLPurifier/AttrTransform/Nofollow.php | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/Nofollow.php b/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/Nofollow.php deleted file mode 100644 index 573b42c9c..000000000 --- a/lib/htmlpurifier/library/HTMLPurifier/AttrTransform/Nofollow.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -// must be called POST validation - -/** - * Adds rel="nofollow" to all outbound links. This transform is - * only attached if Attr.Nofollow is TRUE. - */ -class HTMLPurifier_AttrTransform_Nofollow extends HTMLPurifier_AttrTransform -{ - private $parser; - - public function __construct() { - $this->parser = new HTMLPurifier_URIParser(); - } - - public function transform($attr, $config, $context) { - - if (!isset($attr['href'])) { - return $attr; - } - - // XXX Kind of inefficient - $url = $this->parser->parse($attr['href']); - $scheme = $url->getSchemeObj($config, $context); - - if (!is_null($url->host) && $scheme !== false && $scheme->browsable) { - if (isset($attr['rel'])) { - $attr['rel'] .= ' nofollow'; - } else { - $attr['rel'] = 'nofollow'; - } - } - - return $attr; - - } - -} - -// vim: et sw=4 sts=4 |