ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
HTMLPurifier_URIScheme_tel Class Reference

Validates tel (for phone numbers). More...

+ Inheritance diagram for HTMLPurifier_URIScheme_tel:
+ Collaboration diagram for HTMLPurifier_URIScheme_tel:

Public Member Functions

 doValidate (&$uri, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_URIScheme
 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

 $browsable = false
 bool More...
 
 $may_omit_host = true
 bool More...
 
- Data Fields inherited from HTMLPurifier_URIScheme
 $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 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

Validates tel (for phone numbers).

The relevant specifications for this protocol are RFC 3966 and RFC 5341, but this class takes a much simpler approach: we normalize phone numbers so that they only include (possibly) a leading plus, and then any number of digits and x'es.

Definition at line 12 of file tel.php.

Member Function Documentation

◆ doValidate()

HTMLPurifier_URIScheme_tel::doValidate ( $uri,
  $config,
  $context 
)
Parameters
HTMLPurifier_URI$uri
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
bool

Definition at line 30 of file tel.php.

31  {
32  $uri->userinfo = null;
33  $uri->host = null;
34  $uri->port = null;
35 
36  // Delete all non-numeric characters, non-x characters
37  // from phone number, EXCEPT for a leading plus sign.
38  $uri->path = preg_replace('/(?!^\+)[^\dx]/', '',
39  // Normalize e(x)tension to lower-case
40  str_replace('X', 'x', $uri->path));
41 
42  return true;
43  }

Field Documentation

◆ $browsable

HTMLPurifier_URIScheme_tel::$browsable = false

bool

Definition at line 17 of file tel.php.

◆ $may_omit_host

HTMLPurifier_URIScheme_tel::$may_omit_host = true

bool

Definition at line 22 of file tel.php.


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