mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-18 11:41:52 +00:00
Remove PHP4 cruft from URISchemeRegistry.
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
parent
41c9226f3d
commit
24f761d84a
@ -36,21 +36,20 @@ class HTMLPurifier_URISchemeRegistry
|
|||||||
*/
|
*/
|
||||||
public function getScheme($scheme, $config, $context) {
|
public function getScheme($scheme, $config, $context) {
|
||||||
if (!$config) $config = HTMLPurifier_Config::createDefault();
|
if (!$config) $config = HTMLPurifier_Config::createDefault();
|
||||||
$null = null; // for the sake of passing by reference
|
|
||||||
|
|
||||||
// important, otherwise attacker could include arbitrary file
|
// important, otherwise attacker could include arbitrary file
|
||||||
$allowed_schemes = $config->get('URI.AllowedSchemes');
|
$allowed_schemes = $config->get('URI.AllowedSchemes');
|
||||||
if (!$config->get('URI.OverrideAllowedSchemes') &&
|
if (!$config->get('URI.OverrideAllowedSchemes') &&
|
||||||
!isset($allowed_schemes[$scheme])
|
!isset($allowed_schemes[$scheme])
|
||||||
) {
|
) {
|
||||||
return $null;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->schemes[$scheme])) return $this->schemes[$scheme];
|
if (isset($this->schemes[$scheme])) return $this->schemes[$scheme];
|
||||||
if (!isset($allowed_schemes[$scheme])) return $null;
|
if (!isset($allowed_schemes[$scheme])) return;
|
||||||
|
|
||||||
$class = 'HTMLPurifier_URIScheme_' . $scheme;
|
$class = 'HTMLPurifier_URIScheme_' . $scheme;
|
||||||
if (!class_exists($class)) return $null;
|
if (!class_exists($class)) return;
|
||||||
$this->schemes[$scheme] = new $class();
|
$this->schemes[$scheme] = new $class();
|
||||||
return $this->schemes[$scheme];
|
return $this->schemes[$scheme];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user