ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
HTMLPurifier_URIScheme Class Reference

Validator for the components of a URI for a specific scheme. More...

+ Inheritance diagram for HTMLPurifier_URIScheme:
+ Collaboration diagram for HTMLPurifier_URIScheme:

Public Member Functions

 doValidate (&$uri, $config, $context)
 Validates the components of a URI for a specific scheme. More...
 
 validate (&$uri, $config, $context)
 Public interface for validating components of a URI. More...
 

Data Fields

 $default_port = null
 Scheme's default port (integer). More...
 
 $browsable = false
 Whether or not URIs of this scheme are locatable by a browser http and ftp are accessible, while mailto and news are not. More...
 
 $secure = false
 Whether or not data transmitted over this scheme is encrypted. More...
 
 $hierarchical = false
 Whether or not the URI always uses <hier_part>, resolves edge cases with making relative URIs absolute @type bool. More...
 
 $may_omit_host = false
 Whether or not the URI may omit a hostname when the scheme is explicitly specified, ala file:///path/to/file. More...
 

Detailed Description

Validator for the components of a URI for a specific scheme.

Definition at line 6 of file URIScheme.php.

Member Function Documentation

◆ doValidate()

HTMLPurifier_URIScheme::doValidate ( $uri,
  $config,
  $context 
)
abstract

Validates the components of a URI for a specific scheme.

Parameters
HTMLPurifier_URI$uriReference to a HTMLPurifier_URI object
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
bool success or failure

Reimplemented in HTMLPurifier_URIScheme_data, HTMLPurifier_URIScheme_file, HTMLPurifier_URIScheme_ftp, HTMLPurifier_URIScheme_http, HTMLPurifier_URIScheme_mailto, HTMLPurifier_URIScheme_news, and HTMLPurifier_URIScheme_nntp.

Referenced by validate().

+ Here is the caller graph for this function:

◆ validate()

HTMLPurifier_URIScheme::validate ( $uri,
  $config,
  $context 
)

Public interface for validating components of a URI.

Performs a bunch of default actions. Don't overload this method.

Parameters
HTMLPurifier_URI$uriReference to a HTMLPurifier_URI object
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
bool success or failure

Definition at line 63 of file URIScheme.php.

64 {
65 if ($this->default_port == $uri->port) {
66 $uri->port = null;
67 }
68 // kludge: browsers do funny things when the scheme but not the
69 // authority is set
70 if (!$this->may_omit_host &&
71 // if the scheme is present, a missing host is always in error
72 (!is_null($uri->scheme) && ($uri->host === '' || is_null($uri->host))) ||
73 // if the scheme is not present, a *blank* host is in error,
74 // since this translates into '///path' which most browsers
75 // interpret as being 'http://path'.
76 (is_null($uri->scheme) && $uri->host === '')
77 ) {
78 do {
79 if (is_null($uri->scheme)) {
80 if (substr($uri->path, 0, 2) != '//') {
81 $uri->host = null;
82 break;
83 }
84 // URI is '////path', so we cannot nullify the
85 // host to preserve semantics. Try expanding the
86 // hostname instead (fall through)
87 }
88 // first see if we can manually insert a hostname
89 $host = $config->get('URI.Host');
90 if (!is_null($host)) {
91 $uri->host = $host;
92 } else {
93 // we can't do anything sensible, reject the URL.
94 return false;
95 }
96 } while (false);
97 }
98 return $this->doValidate($uri, $config, $context);
99 }
doValidate(&$uri, $config, $context)
Validates the components of a URI for a specific scheme.

References doValidate().

+ Here is the call graph for this function:

Field Documentation

◆ $browsable

HTMLPurifier_URIScheme::$browsable = false

Whether or not URIs of this scheme are locatable by a browser http and ftp are accessible, while mailto and news are not.

@type bool

Definition at line 22 of file URIScheme.php.

◆ $default_port

HTMLPurifier_URIScheme::$default_port = null

Scheme's default port (integer).

If an explicit port number is specified that coincides with the default port, it will be elided. @type int

Definition at line 15 of file URIScheme.php.

◆ $hierarchical

HTMLPurifier_URIScheme::$hierarchical = false

Whether or not the URI always uses <hier_part>, resolves edge cases with making relative URIs absolute @type bool.

Definition at line 36 of file URIScheme.php.

◆ $may_omit_host

HTMLPurifier_URIScheme::$may_omit_host = false

Whether or not the URI may omit a hostname when the scheme is explicitly specified, ala file:///path/to/file.

As of writing, 'file' is the only scheme that browsers support his properly. @type bool

Definition at line 44 of file URIScheme.php.

◆ $secure

HTMLPurifier_URIScheme::$secure = false

Whether or not data transmitted over this scheme is encrypted.

https is secure, http is not. @type bool

Definition at line 29 of file URIScheme.php.


The documentation for this class was generated from the following file: