ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
HTMLPurifier_Filter_YouTube Class Reference
+ Inheritance diagram for HTMLPurifier_Filter_YouTube:
+ Collaboration diagram for HTMLPurifier_Filter_YouTube:

Public Member Functions

 preFilter ($html, $config, $context)
 
 postFilter ($html, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_Filter
 preFilter ($html, $config, $context)
 Pre-processor function, handles HTML before HTML Purifier. More...
 
 postFilter ($html, $config, $context)
 Post-processor function, handles HTML after HTML Purifier. More...
 

Data Fields

 $name = 'YouTube'
 string More...
 
- Data Fields inherited from HTMLPurifier_Filter
 $name
 Name of the filter for identification purposes. More...
 

Protected Member Functions

 armorUrl ($url)
 
 postFilterCallback ($matches)
 

Detailed Description

Definition at line 3 of file YouTube.php.

Member Function Documentation

◆ armorUrl()

HTMLPurifier_Filter_YouTube::armorUrl (   $url)
protected
Parameters
$url
Returns
string

Definition at line 41 of file YouTube.php.

References $url.

Referenced by postFilterCallback().

42  {
43  return str_replace('--', '--', $url);
44  }
$url
Definition: shib_logout.php:72
+ Here is the caller graph for this function:

◆ postFilter()

HTMLPurifier_Filter_YouTube::postFilter (   $html,
  $config,
  $context 
)
Parameters
string$html
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
string

Definition at line 31 of file YouTube.php.

References $html, and array.

32  {
33  $post_regex = '#<span class="youtube-embed">((?:v|cp)/[A-Za-z0-9\-_=]+)</span>#';
34  return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html);
35  }
Create styles array
The data for the language used.
$html
Definition: example_001.php:87

◆ postFilterCallback()

HTMLPurifier_Filter_YouTube::postFilterCallback (   $matches)
protected
Parameters
array$matches
Returns
string

Definition at line 50 of file YouTube.php.

References $url, and armorUrl().

51  {
52  $url = $this->armorUrl($matches[1]);
53  return '<object width="425" height="350" type="application/x-shockwave-flash" ' .
54  'data="//www.youtube.com/' . $url . '">' .
55  '<param name="movie" value="//www.youtube.com/' . $url . '"></param>' .
56  '<!--[if IE]>' .
57  '<embed src="//www.youtube.com/' . $url . '"' .
58  'type="application/x-shockwave-flash"' .
59  'wmode="transparent" width="425" height="350" />' .
60  '<![endif]-->' .
61  '</object>';
62  }
$url
Definition: shib_logout.php:72
+ Here is the call graph for this function:

◆ preFilter()

HTMLPurifier_Filter_YouTube::preFilter (   $html,
  $config,
  $context 
)
Parameters
string$html
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
string

Definition at line 17 of file YouTube.php.

References $html.

18  {
19  $pre_regex = '#<object[^>]+>.+?' .
20  '(?:http:)?//www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s';
21  $pre_replace = '<span class="youtube-embed">\1</span>';
22  return preg_replace($pre_regex, $pre_replace, $html);
23  }
$html
Definition: example_001.php:87

Field Documentation

◆ $name

HTMLPurifier_Filter_YouTube::$name = 'YouTube'

string

Definition at line 9 of file YouTube.php.


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