Extension:SlideShare
From MediaWiki.org
|
Release status: beta |
|
|---|---|
| Implementation | Parser function |
| Description | Parser function for embedding SlideShare presentations |
| Author(s) | Sergey ChernyshevTalk |
| Last Version | 0.1 (November 2007) |
| License | No license specified |
| Download | SVN |
| Example | Behind the Scenes at LiveJournal: Scaling Storytime presentation |
|
check usage (experimental) |
|
WARNING: [DEPRECATED] This extension was replaced with SlideShare Widget which is using Widgets extension to render the player.
Parser function for embedding SlideShare presentations into wiki pages. Originally developed for TechPresentations.org project.
Contents |
[edit] Usage
{{#slideshare:<slideshare_document_id>|<width>|<height}}
@slideshare_document_id - slideshare document id
(doc parameter in the URL)
@width - (optional) width parameter, default is 425 pixels
@height - (optional) height parameter, default is 348 pixels
[edit] Prerequisites
This extension uses filter PECL package. To install it on your server, type the following (with superuser permissions).
pecl install filter
or
pear install pecl/filter
[edit] Getting files from Subversion
Change to extension directory under your MediaWiki installation and type:
svn checkout http://slideshare-mediawiki-extension.googlecode.com/svn/trunk/ SlideShare
[edit] Configuration
Add the following line at the bottom of your LocalSettings.php
require_once( "$IP/extensions/SlideShare/SlideShare.php" );
[edit] Code
<?php /******************************************************************************* * $Id$ * * This extension allow adding SlideShare slideshows to wiki pages * * {{#slideshare:<slideshare_document_id>|<width>|<height}} * * @slideshare_document_id - slideshare document id * (doc parameter in the URL) * @width - (optional) width parameter, default is 425 pixels * @height - (optional) height parameter, default is 348 pixels * * ******************************************************************************** * Copyright (C) 2007 Sergey Chernyshev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ********************************************************************************/ $wgExtensionFunctions[] = 'wfSlideShare'; $wgHooks['LanguageGetMagic'][] = 'wfSlideShare_Magic'; $wgExtensionCredits['parserhook'][] = array( 'name' => 'SlideShare', 'description' => 'Extension to add SlideShare slideshows to wiki pages.', 'author' => '[http://www.mediawiki.org/wiki/User:Sergey_Chernyshev Sergey Chernyshev]', 'url' => 'http://www.mediawiki.org/wiki/Extension:SlideShare', 'version' => '0.1', 'type' => 'parserhook' ); function wfSlideShare() { global $wgParser; $wgParser->setFunctionHook('slideshare', 'renderSlideShare'); } function wfSlideShare_Magic( &$magicWords, $langCode ) { # Add the magic word # The first array element is case sensitive, in this case it is not case sensitive # All remaining elements are synonyms for our parser function $magicWords['slideshare'] = array( 0, 'slideshare' ); # unless we return true, other parser functions extensions won't get loaded. return true; } # The callback function for converting the input text to HTML output function renderSlideShare(&$parser, $id, $width=425, $height=348) { // id must be a URL encoded string $id = filter_var($id, FILTER_SANITIZE_ENCODED); // width must be more then 0 $width = filter_var($width, FILTER_VALIDATE_INT, array("options" => array("min_range"=>1)) ); // height must be more then 0 $height = filter_var($height, FILTER_VALIDATE_INT, array("options" => array("min_range"=>1)) ); $output = ''; if ($id) { $output = '<object style="margin:0px" width="'.$width.'" height="'.$height.'"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc='.$id.'"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc='.$id.'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'.$width.'" height="'.$height.'"></embed></object>'; } return array($output, 'noparse' => true, 'isHTML' => true, 'noargs' => true); }