Commit 0a32d274 authored by Nigel McNie's avatar Nigel McNie
Browse files

Update slideshare filter as they moved their URLs to slidesharecdn.com.

parent cca14505
......@@ -6,20 +6,20 @@ class HTMLPurifier_Filter_SlideShare extends HTMLPurifier_Filter
public $name = 'SlideShare';
public function preFilter($html, $config, $context) {
$pre_regex = '#<embed\b[^>]+\bsrc="http://static.slideshare.net/swf/ssplayer2.swf\?(doc=[a-z0-9-]+)[^>]+>\s*</embed>#s';
$pre_replace = '<span class="slideshare-embed">\1</span>';
$pre_regex = '#<embed\b[^>]+\bsrc="http://static\.slideshare(\.net|cdn\.com)/swf/ssplayer2\.swf\?(doc=[a-z0-9-]+)[^>]+>\s*</embed>#s';
$pre_replace = '<span class="slideshare-embed">\2</span>';
return preg_replace($pre_regex, $pre_replace, $html);
}
public function postFilter($html, $config, $context) {
$post_regex = '#<span class="slideshare-embed">(doc=[a-z0-9-]+)</span>#';
$post_replace = '<object width="400" height="355" data="http://static.slideshare.net/swf/ssplayer2.swf?\1">'.
'<param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?\1" />'.
$post_replace = '<object width="400" height="355" data="http://static.slidesharecdn.com/swf/ssplayer2.swf?\1">'.
'<param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?\1" />'.
'<!--[if IE]>'.
'<embed style="width:400px; height:355px;" '.
'id="VideoPlayback" '.
'type="application/x-shockwave-flash" '.
'src="http://static.slideshare.net/swf/ssplayer2.swf?\1" '.
'src="http://static.slidesharecdn.com/swf/ssplayer2.swf?\1" '.
'flashvars="" '.
'</embed>'.
'<![endif]-->'.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment