Add a little bit of documentation about contexts for URIFilters.
[htmlpurifier/rdancer.git] / library / HTMLPurifier / URIFilter.php
blob5d54c15802f9fa9cd02531f1d5ea5478664e0eea
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.
9 * The following contexts may be available while URIFilters are being
10 * processed:
12 * - EmbeddedURI: true if URI is an embedded resource that will
13 * be loaded automatically on page load
14 * - CurrentToken: a reference to the token that is currently
15 * being processed
16 * - CurrentAttr: the name of the attribute that is currently being
17 * processed
18 * - CurrentCSSProperty: the name of the CSS property that is
19 * currently being processed (if applicable)
21 * @warning This filter is called before scheme object validation occurs.
22 * Make sure, if you require a specific scheme object, you
23 * you check that it exists. This allows filters to convert
24 * proprietary URI schemes into regular ones.
26 abstract class HTMLPurifier_URIFilter
29 /**
30 * Unique identifier of filter
32 public $name;
34 /**
35 * True if this filter should be run after scheme validation.
37 public $post = false;
39 /**
40 * Performs initialization for the filter
42 public function prepare($config) {return true;}
44 /**
45 * Filter a URI object
46 * @param $uri Reference to URI object variable
47 * @param $config Instance of HTMLPurifier_Config
48 * @param $context Instance of HTMLPurifier_Context
49 * @return bool Whether or not to continue processing: false indicates
50 * URL is no good, true indicates continue processing. Note that
51 * all changes are committed directly on the URI object
53 abstract public function filter(&$uri, $config, $context);
57 // vim: et sw=4 sts=4