aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/htmlpurifier/HTMLPurifier/URIFilter/HostBlacklist.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2014-02-21 15:57:10 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2014-02-21 15:57:10 +0100
commit99679d06884120c57f43b44e55e03595f1f87bed (patch)
treea3f2a1aa1afdaeca1386d0c6e8a75344fd2241fb /inc/3rdparty/htmlpurifier/HTMLPurifier/URIFilter/HostBlacklist.php
parent655214ab30ee84884dc408488b85586f36263fcb (diff)
parentd3b47e94705e17b3ba3529cbb1dc6efe69c5d2b7 (diff)
downloadwallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.gz
wallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.zst
wallabag-99679d06884120c57f43b44e55e03595f1f87bed.zip
Merge pull request #481 from wallabag/dev1.5.2
1.5.2
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/URIFilter/HostBlacklist.php')
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/URIFilter/HostBlacklist.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/URIFilter/HostBlacklist.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/URIFilter/HostBlacklist.php
new file mode 100644
index 00000000..54980b6e
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/URIFilter/HostBlacklist.php
@@ -0,0 +1,46 @@
1<?php
2
3// It's not clear to me whether or not Punycode means that hostnames
4// do not have canonical forms anymore. As far as I can tell, it's
5// not a problem (punycoding should be identity when no Unicode
6// points are involved), but I'm not 100% sure
7class HTMLPurifier_URIFilter_HostBlacklist extends HTMLPurifier_URIFilter
8{
9 /**
10 * @type string
11 */
12 public $name = 'HostBlacklist';
13
14 /**
15 * @type array
16 */
17 protected $blacklist = array();
18
19 /**
20 * @param HTMLPurifier_Config $config
21 * @return bool
22 */
23 public function prepare($config)
24 {
25 $this->blacklist = $config->get('URI.HostBlacklist');
26 return true;
27 }
28
29 /**
30 * @param HTMLPurifier_URI $uri
31 * @param HTMLPurifier_Config $config
32 * @param HTMLPurifier_Context $context
33 * @return bool
34 */
35 public function filter(&$uri, $config, $context)
36 {
37 foreach ($this->blacklist as $blacklisted_host_fragment) {
38 if (strpos($uri->host, $blacklisted_host_fragment) !== false) {
39 return false;
40 }
41 }
42 return true;
43 }
44}
45
46// vim: et sw=4 sts=4