From 7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 12 May 2012 17:57:41 -0700 Subject: some important stuff we'll need --- .../library/HTMLPurifier/URISchemeRegistry.php | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 lib/htmlpurifier/library/HTMLPurifier/URISchemeRegistry.php (limited to 'lib/htmlpurifier/library/HTMLPurifier/URISchemeRegistry.php') diff --git a/lib/htmlpurifier/library/HTMLPurifier/URISchemeRegistry.php b/lib/htmlpurifier/library/HTMLPurifier/URISchemeRegistry.php new file mode 100644 index 000000000..576bf7b6d --- /dev/null +++ b/lib/htmlpurifier/library/HTMLPurifier/URISchemeRegistry.php @@ -0,0 +1,68 @@ +get('URI.AllowedSchemes'); + if (!$config->get('URI.OverrideAllowedSchemes') && + !isset($allowed_schemes[$scheme]) + ) { + return; + } + + if (isset($this->schemes[$scheme])) return $this->schemes[$scheme]; + if (!isset($allowed_schemes[$scheme])) return; + + $class = 'HTMLPurifier_URIScheme_' . $scheme; + if (!class_exists($class)) return; + $this->schemes[$scheme] = new $class(); + return $this->schemes[$scheme]; + } + + /** + * Registers a custom scheme to the cache, bypassing reflection. + * @param $scheme Scheme name + * @param $scheme_obj HTMLPurifier_URIScheme object + */ + public function register($scheme, $scheme_obj) { + $this->schemes[$scheme] = $scheme_obj; + } + +} + +// vim: et sw=4 sts=4 -- cgit v1.2.3