Whoops, forgot to edit WHATSNEW
[htmlpurifier.git] / library / HTMLPurifier / URIFilter.php
blob09724e9f418800932350e62f87e55eb8e324cf08
1 <?php
3 /**
4 * Chainable filters for custom URI processing.
6 * These filters can perform custom actions on a URI filter object,
7 * including transformation or blacklisting. A filter named Foo
8 * must have a corresponding configuration directive %URI.Foo,
9 * unless always_load is specified to be true.
11 * The following contexts may be available while URIFilters are being
12 * processed:
14 * - EmbeddedURI: true if URI is an embedded resource that will
15 * be loaded automatically on page load
16 * - CurrentToken: a reference to the token that is currently
17 * being processed
18 * - CurrentAttr: the name of the attribute that is currently being
19 * processed
20 * - CurrentCSSProperty: the name of the CSS property that is
21 * currently being processed (if applicable)
23 * @warning This filter is called before scheme object validation occurs.
24 * Make sure, if you require a specific scheme object, you
25 * you check that it exists. This allows filters to convert
26 * proprietary URI schemes into regular ones.
28 abstract class HTMLPurifier_URIFilter
31 /**
32 * Unique identifier of filter.
33 * @type string
35 public $name;
37 /**
38 * True if this filter should be run after scheme validation.
39 * @type bool
41 public $post = false;
43 /**
44 * True if this filter should always be loaded.
45 * This permits a filter to be named Foo without the corresponding
46 * %URI.Foo directive existing.
47 * @type bool
49 public $always_load = false;
51 /**
52 * Performs initialization for the filter. If the filter returns
53 * false, this means that it shouldn't be considered active.
54 * @param HTMLPurifier_Config $config
55 * @return bool
57 public function prepare($config)
59 return true;
62 /**
63 * Filter a URI object
64 * @param HTMLPurifier_URI $uri Reference to URI object variable
65 * @param HTMLPurifier_Config $config
66 * @param HTMLPurifier_Context $context
67 * @return bool Whether or not to continue processing: false indicates
68 * URL is no good, true indicates continue processing. Note that
69 * all changes are committed directly on the URI object
71 abstract public function filter(&$uri, $config, $context);
74 // vim: et sw=4 sts=4