]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/3rdparty/htmlpurifier/HTMLPurifier/Filter.php
[add] HTML Purifier added to clean code
[github/wallabag/wallabag.git] / inc / 3rdparty / htmlpurifier / HTMLPurifier / Filter.php
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/Filter.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/Filter.php
new file mode 100644 (file)
index 0000000..2f85b93
--- /dev/null
@@ -0,0 +1,56 @@
+<?php\r
+\r
+/**\r
+ * Represents a pre or post processing filter on HTML Purifier's output\r
+ *\r
+ * Sometimes, a little ad-hoc fixing of HTML has to be done before\r
+ * it gets sent through HTML Purifier: you can use filters to acheive\r
+ * this effect. For instance, YouTube videos can be preserved using\r
+ * this manner. You could have used a decorator for this task, but\r
+ * PHP's support for them is not terribly robust, so we're going\r
+ * to just loop through the filters.\r
+ *\r
+ * Filters should be exited first in, last out. If there are three filters,\r
+ * named 1, 2 and 3, the order of execution should go 1->preFilter,\r
+ * 2->preFilter, 3->preFilter, purify, 3->postFilter, 2->postFilter,\r
+ * 1->postFilter.\r
+ *\r
+ * @note Methods are not declared abstract as it is perfectly legitimate\r
+ *       for an implementation not to want anything to happen on a step\r
+ */\r
+\r
+class HTMLPurifier_Filter\r
+{\r
+\r
+    /**\r
+     * Name of the filter for identification purposes.\r
+     * @type string\r
+     */\r
+    public $name;\r
+\r
+    /**\r
+     * Pre-processor function, handles HTML before HTML Purifier\r
+     * @param string $html\r
+     * @param HTMLPurifier_Config $config\r
+     * @param HTMLPurifier_Context $context\r
+     * @return string\r
+     */\r
+    public function preFilter($html, $config, $context)\r
+    {\r
+        return $html;\r
+    }\r
+\r
+    /**\r
+     * Post-processor function, handles HTML after HTML Purifier\r
+     * @param string $html\r
+     * @param HTMLPurifier_Config $config\r
+     * @param HTMLPurifier_Context $context\r
+     * @return string\r
+     */\r
+    public function postFilter($html, $config, $context)\r
+    {\r
+        return $html;\r
+    }\r
+}\r
+\r
+// vim: et sw=4 sts=4\r