|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 class HTMLPurifier_URIFilter_HostBlacklist extends HTMLPurifier_URIFilter 00004 { 00005 public $name = 'HostBlacklist'; 00006 protected $blacklist = array(); 00007 public function prepare($config) { 00008 $this->blacklist = $config->get('URI.HostBlacklist'); 00009 return true; 00010 } 00011 public function filter(&$uri, $config, $context) { 00012 foreach($this->blacklist as $blacklisted_host_fragment) { 00013 if (strpos($uri->host, $blacklisted_host_fragment) !== false) { 00014 return false; 00015 } 00016 } 00017 return true; 00018 } 00019 } 00020 00021 // vim: et sw=4 sts=4