Gracefully deal with null injectors.
[htmlpurifier.git] / library / HTMLPurifier / URIScheme.php
blob039710fd1586bf525394d06b8d2b4fe1863ac191
1 <?php
3 /**
4 * Validator for the components of a URI for a specific scheme
5 */
6 class HTMLPurifier_URIScheme
9 /**
10 * Scheme's default port (integer)
12 public $default_port = null;
14 /**
15 * Whether or not URIs of this schem are locatable by a browser
16 * http and ftp are accessible, while mailto and news are not.
18 public $browsable = false;
20 /**
21 * Whether or not the URI always uses <hier_part>, resolves edge cases
22 * with making relative URIs absolute
24 public $hierarchical = false;
26 /**
27 * Validates the components of a URI
28 * @note This implementation should be called by children if they define
29 * a default port, as it does port processing.
30 * @param $uri Instance of HTMLPurifier_URI
31 * @param $config HTMLPurifier_Config object
32 * @param $context HTMLPurifier_Context object
33 * @return Bool success or failure
35 public function validate(&$uri, $config, $context) {
36 if ($this->default_port == $uri->port) $uri->port = null;
37 return true;
42 // vim: et sw=4 sts=4