|
Revision 21, 1.1 kB
(checked in by admin, 18 years ago)
|
|
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | /** |
|---|
| 4 | * Validator for the components of a URI for a specific scheme |
|---|
| 5 | */ |
|---|
| 6 | class HTMLPurifier_URIScheme |
|---|
| 7 | { |
|---|
| 8 | |
|---|
| 9 | /** |
|---|
| 10 | * Scheme's default port (integer) |
|---|
| 11 | */ |
|---|
| 12 | public $default_port = null; |
|---|
| 13 | |
|---|
| 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. |
|---|
| 17 | */ |
|---|
| 18 | public $browsable = false; |
|---|
| 19 | |
|---|
| 20 | /** |
|---|
| 21 | * Whether or not the URI always uses <hier_part>, resolves edge cases |
|---|
| 22 | * with making relative URIs absolute |
|---|
| 23 | */ |
|---|
| 24 | public $hierarchical = false; |
|---|
| 25 | |
|---|
| 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 |
|---|
| 34 | */ |
|---|
| 35 | public function validate(&$uri, $config, $context) { |
|---|
| 36 | if ($this->default_port == $uri->port) $uri->port = null; |
|---|
| 37 | return true; |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | } |
|---|
| 41 | |
|---|