diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-18 20:07:46 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-18 20:07:46 +0100 |
commit | adf17b677edeb2387671f6a0f12123e7497b5938 (patch) | |
tree | 8fd87d7bf5699488ffc12afa991011e80ac1011b /inc/3rdparty/htmlpurifier/HTMLPurifier/AttrTransform/Nofollow.php | |
parent | 894cd087f41d605f2f093aaad1300825f705e009 (diff) | |
download | wallabag-adf17b677edeb2387671f6a0f12123e7497b5938.tar.gz wallabag-adf17b677edeb2387671f6a0f12123e7497b5938.tar.zst wallabag-adf17b677edeb2387671f6a0f12123e7497b5938.zip |
remove 3rd libraries
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/AttrTransform/Nofollow.php')
-rw-r--r-- | inc/3rdparty/htmlpurifier/HTMLPurifier/AttrTransform/Nofollow.php | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrTransform/Nofollow.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrTransform/Nofollow.php deleted file mode 100644 index 25173c21..00000000 --- a/inc/3rdparty/htmlpurifier/HTMLPurifier/AttrTransform/Nofollow.php +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | // must be called POST validation | ||
4 | |||
5 | /** | ||
6 | * Adds rel="nofollow" to all outbound links. This transform is | ||
7 | * only attached if Attr.Nofollow is TRUE. | ||
8 | */ | ||
9 | class HTMLPurifier_AttrTransform_Nofollow extends HTMLPurifier_AttrTransform | ||
10 | { | ||
11 | /** | ||
12 | * @type HTMLPurifier_URIParser | ||
13 | */ | ||
14 | private $parser; | ||
15 | |||
16 | public function __construct() | ||
17 | { | ||
18 | $this->parser = new HTMLPurifier_URIParser(); | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * @param array $attr | ||
23 | * @param HTMLPurifier_Config $config | ||
24 | * @param HTMLPurifier_Context $context | ||
25 | * @return array | ||
26 | */ | ||
27 | public function transform($attr, $config, $context) | ||
28 | { | ||
29 | if (!isset($attr['href'])) { | ||
30 | return $attr; | ||
31 | } | ||
32 | |||
33 | // XXX Kind of inefficient | ||
34 | $url = $this->parser->parse($attr['href']); | ||
35 | $scheme = $url->getSchemeObj($config, $context); | ||
36 | |||
37 | if ($scheme->browsable && !$url->isLocal($config, $context)) { | ||
38 | if (isset($attr['rel'])) { | ||
39 | $rels = explode(' ', $attr['rel']); | ||
40 | if (!in_array('nofollow', $rels)) { | ||
41 | $rels[] = 'nofollow'; | ||
42 | } | ||
43 | $attr['rel'] = implode(' ', $rels); | ||
44 | } else { | ||
45 | $attr['rel'] = 'nofollow'; | ||
46 | } | ||
47 | } | ||
48 | return $attr; | ||
49 | } | ||
50 | } | ||
51 | |||
52 | // vim: et sw=4 sts=4 | ||