Add vim modelines to all files.
[htmlpurifier/bfroehle.git] / library / HTMLPurifier / Filter / YouTube.php
blobdf20d09f2769277f8754f2c284d855ac71dd1dd2
1 <?php
3 class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter
6 public $name = 'YouTube';
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);
15 public function postFilter($html, $config, $context) {
16 $post_regex = '#<span class="youtube-embed">([A-Za-z0-9\-_]+)</span>#';
17 $post_replace = '<object width="425" height="350" '.
18 'data="http://www.youtube.com/v/\1">'.
19 '<param name="movie" value="http://www.youtube.com/v/\1"></param>'.
20 '<param name="wmode" value="transparent"></param>'.
21 '<!--[if IE]>'.
22 '<embed src="http://www.youtube.com/v/\1"'.
23 'type="application/x-shockwave-flash"'.
24 'wmode="transparent" width="425" height="350" />'.
25 '<![endif]-->'.
26 '</object>';
27 return preg_replace($post_regex, $post_replace, $html);
32 // vim: et sw=4 sts=4