Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
HTMLPurifier_URI Class Reference

Public Member Functions

 __construct ($scheme, $userinfo, $host, $port, $path, $query, $fragment)
 
 getSchemeObj ($config, $context)
 Retrieves a scheme object corresponding to the URI's scheme/default.
 
 isBenign ($config, $context)
 Returns true if this URL should be considered a 'benign' URL, that is:
 
 isLocal ($config, $context)
 Returns true if this URL might be considered a 'local' URL given the current context.
 
 toString ()
 Convert URI back to string.
 
 validate ($config, $context)
 Generic validation method applicable for all schemes.
 

Public Attributes

 $fragment
 @type string
 
 $host
 @type string
 
 $path
 @type string
 
 $port
 @type int
 
 $query
 @type string
 
 $scheme
 @type string
 
 $userinfo
 @type string
 

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_URI::__construct ( $scheme,
$userinfo,
$host,
$port,
$path,
$query,
$fragment )
Parameters
string$scheme
string$userinfo
string$host
int$port
string$path
string$query
string$fragment
Note
Automatically normalizes scheme and port

Member Function Documentation

◆ getSchemeObj()

HTMLPurifier_URI::getSchemeObj ( $config,
$context )

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

Parameters
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Return values
HTMLPurifier_URISchemeScheme object appropriate for validating this URI

◆ isBenign()

HTMLPurifier_URI::isBenign ( $config,
$context )

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
Return values
bool

◆ isLocal()

HTMLPurifier_URI::isLocal ( $config,
$context )

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
Return values
bool

◆ toString()

HTMLPurifier_URI::toString ( )

Convert URI back to string.

Return values
stringURI appropriate for output

◆ validate()

HTMLPurifier_URI::validate ( $config,
$context )

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
Return values
boolTrue if validation/filtering succeeds, false if failure

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