diff options
author | zotlabs <mike@macgirvin.com> | 2017-03-27 14:11:25 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-03-27 14:11:25 -0700 |
commit | 8292553a2087a412e0b10f5593d461d371169adb (patch) | |
tree | 2648714d80a19154ec19defa92aaa3229cae23c6 /library/HTMLPurifier/URISchemeRegistry.php | |
parent | 5cbf60320355845e2abdec0422055d3fe321e84e (diff) | |
parent | 6375401e0af6c52d151dd2b944aa6a054b8ddc05 (diff) | |
download | volse-hubzilla-8292553a2087a412e0b10f5593d461d371169adb.tar.gz volse-hubzilla-8292553a2087a412e0b10f5593d461d371169adb.tar.bz2 volse-hubzilla-8292553a2087a412e0b10f5593d461d371169adb.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
Diffstat (limited to 'library/HTMLPurifier/URISchemeRegistry.php')
-rw-r--r-- | library/HTMLPurifier/URISchemeRegistry.php | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/library/HTMLPurifier/URISchemeRegistry.php b/library/HTMLPurifier/URISchemeRegistry.php deleted file mode 100644 index 4ac8a0b76..000000000 --- a/library/HTMLPurifier/URISchemeRegistry.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -/** - * Registry for retrieving specific URI scheme validator objects. - */ -class HTMLPurifier_URISchemeRegistry -{ - - /** - * Retrieve sole instance of the registry. - * @param HTMLPurifier_URISchemeRegistry $prototype Optional prototype to overload sole instance with, - * or bool true to reset to default registry. - * @return HTMLPurifier_URISchemeRegistry - * @note Pass a registry object $prototype with a compatible interface and - * the function will copy it and return it all further times. - */ - public static function instance($prototype = null) - { - static $instance = null; - if ($prototype !== null) { - $instance = $prototype; - } elseif ($instance === null || $prototype == true) { - $instance = new HTMLPurifier_URISchemeRegistry(); - } - return $instance; - } - - /** - * Cache of retrieved schemes. - * @type HTMLPurifier_URIScheme[] - */ - protected $schemes = array(); - - /** - * Retrieves a scheme validator object - * @param string $scheme String scheme name like http or mailto - * @param HTMLPurifier_Config $config - * @param HTMLPurifier_Context $context - * @return HTMLPurifier_URIScheme - */ - public function getScheme($scheme, $config, $context) - { - if (!$config) { - $config = HTMLPurifier_Config::createDefault(); - } - - // important, otherwise attacker could include arbitrary file - $allowed_schemes = $config->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 string $scheme Scheme name - * @param HTMLPurifier_URIScheme $scheme_obj - */ - public function register($scheme, $scheme_obj) - { - $this->schemes[$scheme] = $scheme_obj; - } -} - -// vim: et sw=4 sts=4 |