\HTMLPurifier_URI

HTML Purifier's internal representation of a URI.

Summary

Methods
Properties
Constants
__construct()
getSchemeObj()
validate()
toString()
isLocal()
isBenign()
$scheme
$userinfo
$host
$port
$path
$query
$fragment
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$scheme

$scheme : 

Type

$userinfo

$userinfo : 

Type

$host

$host : 

Type

$port

$port : 

Type

$path

$path : 

Type

$query

$query : 

Type

$fragment

$fragment : 

Type

Methods

__construct()

__construct(string  $scheme, string  $userinfo, string  $host, integer  $port, string  $path, string  $query, string  $fragment) 

Parameters

string $scheme
string $userinfo
string $host
integer $port
string $path
string $query
string $fragment

getSchemeObj()

getSchemeObj(\HTMLPurifier_Config  $config, \HTMLPurifier_Context  $context) : \HTMLPurifier_URIScheme

Retrieves a scheme object corresponding to the URI's scheme/default

Parameters

\HTMLPurifier_Config $config
\HTMLPurifier_Context $context

Returns

\HTMLPurifier_URIScheme

Scheme object appropriate for validating this URI

validate()

validate(\HTMLPurifier_Config  $config, \HTMLPurifier_Context  $context) : boolean

Generic validation method applicable for all schemes. May modify this URI in order to get it into a compliant form.

Parameters

\HTMLPurifier_Config $config
\HTMLPurifier_Context $context

Returns

boolean —

True if validation/filtering succeeds, false if failure

toString()

toString() : string

Convert URI back to string

Returns

string —

URI appropriate for output

isLocal()

isLocal(\HTMLPurifier_Config  $config, \HTMLPurifier_Context  $context) : boolean

Returns true if this URL might be considered a 'local' URL given the current context. This is true when the host is null, or when it matches the host supplied to the configuration.

Note that this does not do any scheme checking, so it is mostly only appropriate for metadata that doesn't care about protocol security. isBenign is probably what you actually want.

Parameters

\HTMLPurifier_Config $config
\HTMLPurifier_Context $context

Returns

boolean

isBenign()

isBenign(\HTMLPurifier_Config  $config, \HTMLPurifier_Context  $context) : boolean

Returns true if this URL should be considered a 'benign' URL, that is:

  • It is a local URL (isLocal), and
    • It has a equal or better level of security

Parameters

\HTMLPurifier_Config $config
\HTMLPurifier_Context $context

Returns

boolean