~tempo-openerp/+junk/osclass-axima-dev

« back to all changes in this revision

Viewing changes to oc-includes/htmlpurifier/HTMLPurifier/URIFilter/HostBlacklist.php

  • Committer: vg at tempo-consulting
  • Date: 2013-08-20 07:59:29 UTC
  • Revision ID: vg@tempo-consulting.fr-20130820075929-m57t59qytwvctmuu
osclass axima site annonces

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
class HTMLPurifier_URIFilter_HostBlacklist extends HTMLPurifier_URIFilter
 
4
{
 
5
    public $name = 'HostBlacklist';
 
6
    protected $blacklist = array();
 
7
    public function prepare($config) {
 
8
        $this->blacklist = $config->get('URI.HostBlacklist');
 
9
        return true;
 
10
    }
 
11
    public function filter(&$uri, $config, $context) {
 
12
        foreach($this->blacklist as $blacklisted_host_fragment) {
 
13
            if (strpos($uri->host, $blacklisted_host_fragment) !== false) {
 
14
                return false;
 
15
            }
 
16
        }
 
17
        return true;
 
18
    }
 
19
}
 
20
 
 
21
// vim: et sw=4 sts=4