<?php
$wgExtensionFunctions[] = 'wfSlideShare';
$wgExtensionCredits['parserhook'][] = array(
'name' => 'SlideShare',
'description' => 'Display SlideShare presentation'
);
function wfSlideShare() {
global $wgParser;
$wgParser->setHook( 'slideshare', 'renderSlideShare' );
}
function renderSlideShare( $input, $params ) {
$id = $params['id'];
$width = !empty( $params['width'] ) ? $params['width'] : 425;
$height = !empty( $params['height'] ) ? $params['height'] : 355;
if ( preg_match('%[^A-Za-z0-9_\\-]%', $id ) ) {
return 'SlideShare : bad presentation ID !';
}
$url = 'http://static.slideshare.net/swf/ssplayer2.swf?doc=' . $id;
$output =
Xml::openElement( 'object',
array(
'width' => $width,
'height' => $height ) ) .
Xml::openElement( 'param',
array(
'name' => 'movie',
'value' => $url ) ) .
'</param>' .
Xml::openElement( 'embed',
array(
'src' => $url,
'type' => 'application/x-shockwave-flash',
'width' => $width,
'height' => $height ) ) .
'</embed>' .
'</object>';
/*
<object style="margin:0px" width="425" height="355">
<param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=google14qfr-dernire-version-1228241219943844-8" />
<param name="allowFullScreen" value="true"/>
<param name="allowScriptAccess" value="always"/>
<embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=google14qfr-dernire-version-1228241219943844-8" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355">
</embed>
</object>
*/
return $output;
}