Commit 2d2c1854 authored by Nigel McNie's avatar Nigel McNie
Browse files

Added HTML filter for slideshare.net

Conflicts:

	htdocs/lib/version.php
parent 311e012e
......@@ -856,6 +856,10 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2009031000) {
reload_html_filters();
}
return $status;
}
......
<?php
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>';
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" />'.
'<!--[if IE]>'.
'<embed style="width:400px; height:355px;" '.
'id="VideoPlayback" '.
'type="application/x-shockwave-flash" '.
'src="http://static.slideshare.net/swf/ssplayer2.swf?\1" '.
'flashvars="" '.
'</embed>'.
'<![endif]-->'.
'</object>';
return preg_replace($post_regex, $post_replace, $html);
return $html;
}
}
......@@ -20,4 +20,8 @@
<filename>Twitter</filename>
<site>http://twitter.com</site>
</filter>
<filter>
<filename>SlideShare</filename>
<site>http://slideshare.net</site>
</filter>
</filters>
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2009022800;
$config->version = 2009031000;
$config->release = '1.2.0dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
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