ILIAS
Release_4_0_x_branch Revision 61816
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
YouTube.php
Go to the documentation of this file.
1
<?php
2
3
class
HTMLPurifier_Filter_YouTube
extends
HTMLPurifier_Filter
4
{
5
6
public
$name
=
'YouTube'
;
7
8
public
function
preFilter
($html,
$config
, $context) {
9
$pre_regex =
'#<object[^>]+>.+?'
.
10
'http://www.youtube.com/v/([A-Za-z0-9\-_]+).+?</object>#s'
;
11
$pre_replace =
'<span class="youtube-embed">\1</span>'
;
12
return
preg_replace($pre_regex, $pre_replace, $html);
13
}
14
15
public
function
postFilter
($html,
$config
, $context) {
16
$post_regex =
'#<span class="youtube-embed">([A-Za-z0-9\-_]+)</span>#'
;
17
return
preg_replace_callback($post_regex, array($this,
'postFilterCallback'
), $html);
18
}
19
20
protected
function
armorUrl
($url) {
21
return
str_replace(
'--'
,
'--'
, $url);
22
}
23
24
protected
function
postFilterCallback
($matches) {
25
$url = $this->
armorUrl
($matches[1]);
26
return
'<object width="425" height="350" type="application/x-shockwave-flash" '
.
27
'data="http://www.youtube.com/v/'
.$url.
'">'
.
28
'<param name="movie" value="http://www.youtube.com/v/'
.$url.
'"></param>'
.
29
'<!--[if IE]>'
.
30
'<embed src="http://www.youtube.com/v/'
.$url.
'"'
.
31
'type="application/x-shockwave-flash"'
.
32
'wmode="transparent" width="425" height="350" />'
.
33
'<![endif]-->'
.
34
'</object>'
;
35
36
}
37
}
38
39
// vim: et sw=4 sts=4
Services
Html
HtmlPurifier
library
HTMLPurifier
Filter
YouTube.php
Generated on Wed Apr 27 2016 19:01:42 for ILIAS by
1.8.1.2 (using
Doxyfile
)