From 90045d66ea8dd098cb57b5844f05050a528bf037 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 3 Feb 2016 14:36:51 +0100 Subject: [PATCH] HTMLPurifierSchemes plugin to allow geo and magnet URIs --- lib/default.php | 1 + .../HTMLPurifierSchemesPlugin.php | 43 +++++++++++++++++++ .../lib/htmlpurifier/urischeme/geo.php | 35 +++++++++++++++ .../lib/htmlpurifier/urischeme/magnet.php | 35 +++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 plugins/HTMLPurifierSchemes/HTMLPurifierSchemesPlugin.php create mode 100644 plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/geo.php create mode 100644 plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/magnet.php diff --git a/lib/default.php b/lib/default.php index 947875fa58..b59d249f2f 100644 --- a/lib/default.php +++ b/lib/default.php @@ -304,6 +304,7 @@ $default = 'AuthCrypt' => array(), 'Cronish' => array(), 'Favorite' => array(), + 'HTMLPurifierSchemes' => array(), 'Share' => array(), 'LRDD' => array(), ), diff --git a/plugins/HTMLPurifierSchemes/HTMLPurifierSchemesPlugin.php b/plugins/HTMLPurifierSchemes/HTMLPurifierSchemesPlugin.php new file mode 100644 index 0000000000..d8ca619dec --- /dev/null +++ b/plugins/HTMLPurifierSchemes/HTMLPurifierSchemesPlugin.php @@ -0,0 +1,43 @@ +. + */ + +if (!defined('GNUSOCIAL')) { exit(1); } + +// because autoloading classes won't work otherwise +require_once INSTALLDIR.'/extlib/HTMLPurifier/HTMLPurifier.auto.php'; + +/** + * @package Activity + * @maintainer Mikael Nordfeldth + */ +class HTMLPurifierSchemesPlugin extends Plugin +{ + public function onPluginVersion(array &$versions) + { + $versions[] = array('name' => 'HTMLPurifier Schemes', + 'version' => GNUSOCIAL_VERSION, + 'author' => 'Mikael Nordfeldth', + 'homepage' => 'https://gnu.io/social', + 'rawdescription' => + // TRANS: Plugin description. + _m('Additional URI schemes for HTMLPurifier.')); + + return true; + } +} diff --git a/plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/geo.php b/plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/geo.php new file mode 100644 index 0000000000..5a6119967e --- /dev/null +++ b/plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/geo.php @@ -0,0 +1,35 @@ +userinfo = null; + $uri->host = null; + $uri->port = null; + return true; + } +} + +// vim: et sw=4 sts=4 diff --git a/plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/magnet.php b/plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/magnet.php new file mode 100644 index 0000000000..5cb72ca845 --- /dev/null +++ b/plugins/HTMLPurifierSchemes/lib/htmlpurifier/urischeme/magnet.php @@ -0,0 +1,35 @@ +userinfo = null; + $uri->host = null; + $uri->port = null; + return true; + } +} + +// vim: et sw=4 sts=4 -- 2.39.5