HTMLPurifier 4.4.0
|
00001 <?php 00002 00003 // It's not clear to me whether or not Punycode means that hostnames 00004 // do not have canonical forms anymore. As far as I can tell, it's 00005 // not a problem (punycoding should be identity when no Unicode 00006 // points are involved), but I'm not 100% sure 00007 class HTMLPurifier_URIFilter_HostBlacklist extends HTMLPurifier_URIFilter 00008 { 00009 public $name = 'HostBlacklist'; 00010 protected $blacklist = array(); 00011 public function prepare($config) { 00012 $this->blacklist = $config->get('URI.HostBlacklist'); 00013 return true; 00014 } 00015 public function filter(&$uri, $config, $context) { 00016 foreach($this->blacklist as $blacklisted_host_fragment) { 00017 if (strpos($uri->host, $blacklisted_host_fragment) !== false) { 00018 return false; 00019 } 00020 } 00021 return true; 00022 } 00023 } 00024 00025 // vim: et sw=4 sts=4