]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/3rdparty/htmlpurifier/HTMLPurifier/PropertyListIterator.php
[add] HTML Purifier added to clean code
[github/wallabag/wallabag.git] / inc / 3rdparty / htmlpurifier / HTMLPurifier / PropertyListIterator.php
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/PropertyListIterator.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/PropertyListIterator.php
new file mode 100644 (file)
index 0000000..1e707e2
--- /dev/null
@@ -0,0 +1,42 @@
+<?php\r
+\r
+/**\r
+ * Property list iterator. Do not instantiate this class directly.\r
+ */\r
+class HTMLPurifier_PropertyListIterator extends FilterIterator\r
+{\r
+\r
+    /**\r
+     * @type int\r
+     */\r
+    protected $l;\r
+    /**\r
+     * @type string\r
+     */\r
+    protected $filter;\r
+\r
+    /**\r
+     * @param Iterator $iterator Array of data to iterate over\r
+     * @param string $filter Optional prefix to only allow values of\r
+     */\r
+    public function __construct(Iterator $iterator, $filter = null)\r
+    {\r
+        parent::__construct($iterator);\r
+        $this->l = strlen($filter);\r
+        $this->filter = $filter;\r
+    }\r
+\r
+    /**\r
+     * @return bool\r
+     */\r
+    public function accept()\r
+    {\r
+        $key = $this->getInnerIterator()->key();\r
+        if (strncmp($key, $this->filter, $this->l) !== 0) {\r
+            return false;\r
+        }\r
+        return true;\r
+    }\r
+}\r
+\r
+// vim: et sw=4 sts=4\r