]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Edit.php
[add] HTML Purifier added to clean code
[github/wallabag/wallabag.git] / inc / 3rdparty / htmlpurifier / HTMLPurifier / HTMLModule / Edit.php
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Edit.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/HTMLModule/Edit.php
new file mode 100644 (file)
index 0000000..b828836
--- /dev/null
@@ -0,0 +1,55 @@
+<?php\r
+\r
+/**\r
+ * XHTML 1.1 Edit Module, defines editing-related elements. Text Extension\r
+ * Module.\r
+ */\r
+class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule\r
+{\r
+\r
+    /**\r
+     * @type string\r
+     */\r
+    public $name = 'Edit';\r
+\r
+    /**\r
+     * @param HTMLPurifier_Config $config\r
+     */\r
+    public function setup($config)\r
+    {\r
+        $contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow';\r
+        $attr = array(\r
+            'cite' => 'URI',\r
+            // 'datetime' => 'Datetime', // not implemented\r
+        );\r
+        $this->addElement('del', 'Inline', $contents, 'Common', $attr);\r
+        $this->addElement('ins', 'Inline', $contents, 'Common', $attr);\r
+    }\r
+\r
+    // HTML 4.01 specifies that ins/del must not contain block\r
+    // elements when used in an inline context, chameleon is\r
+    // a complicated workaround to acheive this effect\r
+\r
+    // Inline context ! Block context (exclamation mark is\r
+    // separator, see getChildDef for parsing)\r
+\r
+    /**\r
+     * @type bool\r
+     */\r
+    public $defines_child_def = true;\r
+\r
+    /**\r
+     * @param HTMLPurifier_ElementDef $def\r
+     * @return HTMLPurifier_ChildDef_Chameleon\r
+     */\r
+    public function getChildDef($def)\r
+    {\r
+        if ($def->content_model_type != 'chameleon') {\r
+            return false;\r
+        }\r
+        $value = explode('!', $def->content_model);\r
+        return new HTMLPurifier_ChildDef_Chameleon($value[0], $value[1]);\r
+    }\r
+}\r
+\r
+// vim: et sw=4 sts=4\r