]>
Commit | Line | Data |
---|---|---|
d4949327 NL |
1 | <?php\r |
2 | \r | |
3 | /**\r | |
4 | * Represents a pre or post processing filter on HTML Purifier's output\r | |
5 | *\r | |
6 | * Sometimes, a little ad-hoc fixing of HTML has to be done before\r | |
7 | * it gets sent through HTML Purifier: you can use filters to acheive\r | |
8 | * this effect. For instance, YouTube videos can be preserved using\r | |
9 | * this manner. You could have used a decorator for this task, but\r | |
10 | * PHP's support for them is not terribly robust, so we're going\r | |
11 | * to just loop through the filters.\r | |
12 | *\r | |
13 | * Filters should be exited first in, last out. If there are three filters,\r | |
14 | * named 1, 2 and 3, the order of execution should go 1->preFilter,\r | |
15 | * 2->preFilter, 3->preFilter, purify, 3->postFilter, 2->postFilter,\r | |
16 | * 1->postFilter.\r | |
17 | *\r | |
18 | * @note Methods are not declared abstract as it is perfectly legitimate\r | |
19 | * for an implementation not to want anything to happen on a step\r | |
20 | */\r | |
21 | \r | |
22 | class HTMLPurifier_Filter\r | |
23 | {\r | |
24 | \r | |
25 | /**\r | |
26 | * Name of the filter for identification purposes.\r | |
27 | * @type string\r | |
28 | */\r | |
29 | public $name;\r | |
30 | \r | |
31 | /**\r | |
32 | * Pre-processor function, handles HTML before HTML Purifier\r | |
33 | * @param string $html\r | |
34 | * @param HTMLPurifier_Config $config\r | |
35 | * @param HTMLPurifier_Context $context\r | |
36 | * @return string\r | |
37 | */\r | |
38 | public function preFilter($html, $config, $context)\r | |
39 | {\r | |
40 | return $html;\r | |
41 | }\r | |
42 | \r | |
43 | /**\r | |
44 | * Post-processor function, handles HTML after HTML Purifier\r | |
45 | * @param string $html\r | |
46 | * @param HTMLPurifier_Config $config\r | |
47 | * @param HTMLPurifier_Context $context\r | |
48 | * @return string\r | |
49 | */\r | |
50 | public function postFilter($html, $config, $context)\r | |
51 | {\r | |
52 | return $html;\r | |
53 | }\r | |
54 | }\r | |
55 | \r | |
56 | // vim: et sw=4 sts=4\r |