ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
HTMLPurifier_URIFilter_SafeIframe Class Reference

Implements safety checks for safe iframes. More...

+ Inheritance diagram for HTMLPurifier_URIFilter_SafeIframe:
+ Collaboration diagram for HTMLPurifier_URIFilter_SafeIframe:

Public Member Functions

 prepare ($config)
 
 filter (&$uri, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_URIFilter
 prepare ($config)
 Performs initialization for the filter. More...
 
 filter (&$uri, $config, $context)
 Filter a URI object. More...
 

Data Fields

 $name = 'SafeIframe'
 string More...
 
 $always_load = true
 bool More...
 
- Data Fields inherited from HTMLPurifier_URIFilter
 $name
 Unique identifier of filter. More...
 
 $post = false
 True if this filter should be run after scheme validation. More...
 
 $always_load = false
 True if this filter should always be loaded. More...
 

Protected Attributes

 $regexp = null
 string More...
 

Detailed Description

Implements safety checks for safe iframes.

Warning
This filter is critical for ensuring that HTML.SafeIframe works safely.

Definition at line 9 of file SafeIframe.php.

Member Function Documentation

◆ filter()

HTMLPurifier_URIFilter_SafeIframe::filter ( $uri,
  $config,
  $context 
)
Parameters
HTMLPurifier_URI$uri
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
bool

Definition at line 45 of file SafeIframe.php.

References $config.

46  {
47  // check if filter not applicable
48  if (!$config->get('HTML.SafeIframe')) {
49  return true;
50  }
51  // check if the filter should actually trigger
52  if (!$context->get('EmbeddedURI', true)) {
53  return true;
54  }
55  $token = $context->get('CurrentToken', true);
56  if (!($token && $token->name == 'iframe')) {
57  return true;
58  }
59  // check if we actually have some whitelists enabled
60  if ($this->regexp === null) {
61  return false;
62  }
63  // actually check the whitelists
64  return preg_match($this->regexp, $uri->toString());
65  }

◆ prepare()

HTMLPurifier_URIFilter_SafeIframe::prepare (   $config)
Parameters
HTMLPurifier_Config$config
Returns
bool

Definition at line 33 of file SafeIframe.php.

References $config.

34  {
35  $this->regexp = $config->get('URI.SafeIframeRegexp');
36  return true;
37  }

Field Documentation

◆ $always_load

HTMLPurifier_URIFilter_SafeIframe::$always_load = true

bool

Definition at line 19 of file SafeIframe.php.

◆ $name

HTMLPurifier_URIFilter_SafeIframe::$name = 'SafeIframe'

string

Definition at line 14 of file SafeIframe.php.

◆ $regexp

HTMLPurifier_URIFilter_SafeIframe::$regexp = null
protected

string

Definition at line 24 of file SafeIframe.php.


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