2006-08-12 01:12:35 +00:00
|
|
|
<?php
|
|
|
|
|
2006-08-20 20:59:13 +00:00
|
|
|
/**
|
|
|
|
* Validator for the components of a URI for a specific scheme
|
|
|
|
*/
|
2006-08-12 01:12:35 +00:00
|
|
|
class HTMLPurifier_URIScheme
|
|
|
|
{
|
|
|
|
|
2006-08-20 20:59:13 +00:00
|
|
|
/**
|
|
|
|
* Scheme's default port (integer)
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $default_port = null;
|
2006-08-12 18:58:54 +00:00
|
|
|
|
2006-11-17 23:09:10 +00:00
|
|
|
/**
|
|
|
|
* Whether or not URIs of this schem are locatable by a browser
|
|
|
|
* http and ftp are accessible, while mailto and news are not.
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $browsable = false;
|
2006-11-17 23:09:10 +00:00
|
|
|
|
2007-08-02 21:47:24 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the URI always uses <hier_part>, resolves edge cases
|
|
|
|
* with making relative URIs absolute
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $hierarchical = false;
|
2007-08-02 21:47:24 +00:00
|
|
|
|
2006-08-20 20:59:13 +00:00
|
|
|
/**
|
|
|
|
* Validates the components of a URI
|
|
|
|
* @note This implementation should be called by children if they define
|
|
|
|
* a default port, as it does port processing.
|
2007-08-01 18:34:46 +00:00
|
|
|
* @param $uri Instance of HTMLPurifier_URI
|
2006-08-20 20:59:13 +00:00
|
|
|
* @param $config HTMLPurifier_Config object
|
2006-10-27 01:20:10 +00:00
|
|
|
* @param $context HTMLPurifier_Context object
|
2007-08-01 18:34:46 +00:00
|
|
|
* @return Bool success or failure
|
2006-08-20 20:59:13 +00:00
|
|
|
*/
|
2008-01-05 00:10:43 +00:00
|
|
|
public function validate(&$uri, $config, $context) {
|
2007-08-01 18:34:46 +00:00
|
|
|
if ($this->default_port == $uri->port) $uri->port = null;
|
|
|
|
return true;
|
2006-08-12 01:12:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|