Implement Iframe module, and provide %HTML.SafeIframe and %URI.SafeIframeRegexp for...
[htmlpurifier.git] / library / HTMLPurifier / URIFilter.php
blob6a1b0b08e4b260cd4e3a85732d2064bacbdeee0c
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
34 public $name;
36 /**
37 * True if this filter should be run after scheme validation.
39 public $post = false;
41 /**
42 * True if this filter should always be loaded (this permits
43 * a filter to be named Foo without the corresponding %URI.Foo
44 * directive existing.)
46 public $always_load = false;
48 /**
49 * Performs initialization for the filter. If the filter returns
50 * false, this means that it shouldn't be considered active.
52 public function prepare($config) {return true;}
54 /**
55 * Filter a URI object
56 * @param $uri Reference to URI object variable
57 * @param $config Instance of HTMLPurifier_Config
58 * @param $context Instance of HTMLPurifier_Context
59 * @return bool Whether or not to continue processing: false indicates
60 * URL is no good, true indicates continue processing. Note that
61 * all changes are committed directly on the URI object
63 abstract public function filter(&$uri, $config, $context);
67 // vim: et sw=4 sts=4