]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
bitcoin schema for HTMLPurifier
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 8 Feb 2016 19:20:31 +0000 (20:20 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 8 Feb 2016 19:20:31 +0000 (20:20 +0100)
plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/bitcoin.php [new file with mode: 0644]

diff --git a/plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/bitcoin.php b/plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/bitcoin.php
new file mode 100644 (file)
index 0000000..26174ac
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Validates bitcoin (Bitcoin addresses)
+ * @todo validate address length and stuff
+ */
+
+class HTMLPurifier_URIScheme_bitcoin extends HTMLPurifier_URIScheme
+{
+    /**
+     * @type bool
+     */
+    public $browsable = false;
+
+    /**
+     * @type bool
+     */
+    public $may_omit_host = true;
+
+    /**
+     * @param HTMLPurifier_URI $uri
+     * @param HTMLPurifier_Config $config
+     * @param HTMLPurifier_Context $context
+     * @return bool
+     */
+    public function doValidate(&$uri, $config, $context)
+    {
+        $uri->userinfo = null;
+        $uri->host     = null;
+        $uri->port     = null;
+        return true;
+    }
+}
+
+// vim: et sw=4 sts=4