]> git.wh0rd.org - tt-rss.git/blame - lib/htmlpurifier/library/HTMLPurifier/URIFilter.php
remove Archived articles from Uncategorized view
[tt-rss.git] / lib / htmlpurifier / library / HTMLPurifier / URIFilter.php
CommitLineData
f45a286b
AD
1<?php
2
3/**
4 * Chainable filters for custom URI processing.
5 *
6 * These filters can perform custom actions on a URI filter object,
dd205fba
MK
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.
10 *
11 * The following contexts may be available while URIFilters are being
12 * processed:
13 *
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)
f45a286b
AD
22 *
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.
27 */
28abstract class HTMLPurifier_URIFilter
29{
30
31 /**
32 * Unique identifier of filter
33 */
34 public $name;
35
36 /**
37 * True if this filter should be run after scheme validation.
38 */
39 public $post = false;
40
41 /**
dd205fba
MK
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.)
45 */
46 public $always_load = false;
47
48 /**
49 * Performs initialization for the filter. If the filter returns
50 * false, this means that it shouldn't be considered active.
f45a286b
AD
51 */
52 public function prepare($config) {return true;}
53
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
62 */
63 abstract public function filter(&$uri, $config, $context);
64
65}
66
67// vim: et sw=4 sts=4