|
|
(36 intermediate revisions not shown) |
Line 1: |
Line 1: |
- | <?php | + | <html> |
- | /**
| + | <body> |
- | * MediaWiki Flash SWF extension
| + | <p> |
- | * set up MediaWiki to react to the "<swf>" tag
| + | <object type="application/x-shockwave-flash" height="1000" width="960" data="https://static.igem.org/mediawiki/2009/b/b3/IGEM.swf"> |
- | *
| + | <param name="movie" value="https://static.igem.org/mediawiki/2009/b/b3/IGEM.swf" /> |
- | * @version 0.2
| + | |
- | * @author Brigitte Jellinek
| + | |
- | */
| + | |
- |
| + | |
- | /**
| + | |
- | * Protect against register_globals vulnerabilities.
| + | |
- | * This line must be present before any global variable is referenced.
| + | |
- | */
| + | |
- | if (!defined('MEDIAWIKI')) die();
| + | |
- |
| + | |
- | //Avoid unstubbing $wgParser too early on modern (1.12+) MW versions, as per r35980
| + | |
- | if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
| + | |
- | $wgHooks['ParserFirstCallInit'][] = 'wfSwf';
| + | |
- | } else {
| + | |
- | $wgExtensionFunctions[] = 'wfSwf';
| + | |
- | }
| + | |
- |
| + | |
- | $wgExtensionCredits['parserhook'][] = array(
| + | |
- | 'name' => 'Flash SWF',
| + | |
- | 'version' => '0.2',
| + | |
- | 'author' => 'Brigitte Jellinek',
| + | |
- | 'description' => 'Allows the display of flash movies within a wiki with the <tt><swf></tt> tag',
| + | |
- | 'url' => 'http://www.mediawiki.org/wiki/Extension:Flash_swf',
| + | |
- | );
| + | |
- |
| + | |
- | function wfSwf() {
| + | |
- | global $wgParser;
| + | |
- | $wgParser->setHook( 'swf', 'renderSwf' );
| + | |
- | return true;
| + | |
- | }
| + | |
- |
| + | |
- | function renderSwf( $input, $argv ) {
| + | |
- | global $wgScriptPath;
| + | |
- | $output = "";
| + | |
- |
| + | |
- | #parse fields in flashow-section
| + | |
- | $fields = explode("|",$input);
| + | |
- | $input = $fields[0];
| + | |
- |
| + | |
- | //added functionality for parameters passed within the tag's body
| + | |
- | //<swf>movie.swf|width=200|height=300|loop=false</swf>
| + | |
- | for ($i=1; $i < sizeof($fields); $i++) {
| + | |
- | $newArg = explode("=", $fields[$i]);
| + | |
- | $argv[$newArg[0]] = $newArg[1];
| + | |
- | }
| + | |
- |
| + | |
- | // external URL
| + | |
- | if ( (strpos($input , "http") === 0) &&
| + | |
- | (strpos($input, ".swf") == strlen($input)-4)
| + | |
- | ) {
| + | |
- | $url = $input;
| + | |
- | }
| + | |
- |
| + | |
- | // internal media:
| + | |
- | else {
| + | |
- | $img = Image::newFromTitle( $input );
| + | |
- | if ( $img == null ) return "Not an internal Media/swf: $input";
| + | |
- | $img->load();
| + | |
- | $path = $img->getPath();
| + | |
- | if ( ! $path ) return "No path for internal Media:$input";
| + | |
- | $dir = dirname($_SERVER['SCRIPT_FILENAME']);
| + | |
- | $url = str_replace($dir, $wgScriptPath, $path );
| + | |
- | }
| + | |
- |
| + | |
- | $width = isset($argv['width']) ? $argv['width'] : 550;
| + | |
- | $height = isset($argv['height'])? $argv['height'] : 400;
| + | |
- |
| + | |
- | if (strpos($width,"%") == (strlen($width) - 1)) {
| + | |
- | $divWidth = "width:$width";
| + | |
- | } else {
| + | |
- | $divWidth = "width:$width"."px";
| + | |
- | }
| + | |
- | if (strpos($height,"%") == (strlen($height) - 1)) {
| + | |
- | $divHeight= "height:$height";
| + | |
- | } else {
| + | |
- | $divHeight= "height:$height"."px";
| + | |
- | }
| + | |
- |
| + | |
- | $id = basename($input, ".swf");
| + | |
- | $output .=<<<EOM
| + | |
- | <!-- display a swf -->
| + | |
- | <div class="swf" style="$divWidth;$divHeight"> | + | |
- | <object
| + | |
- | classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
| + | |
- | codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
| + | |
- | width="$width" height="$height" id="$id" align="middle">
| + | |
- | <param name="allowScriptAccess" value="sameDomain" />
| + | |
- | <param name="menu" value="true" />
| + | |
- | <param name="movie" value="$url" />
| + | |
| <param name="quality" value="high" /> | | <param name="quality" value="high" /> |
- | <param name="bgcolor" value="#ffffff" />
| |
- | <embed src="$url" quality="high" bgcolor="#ffffff"
| |
- | width="$width" height="$height"
| |
- | name="$id" align="middle" allowScriptAccess="sameDomain"
| |
- | type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
| |
| </object> | | </object> |
- | </div> | + | </p> |
- | <!-- end of swf display --> | + | </body> |
- | EOM;
| + | </html> |
- | $output = str_replace("\n", "", $output);
| + | |
- |
| + | |
- |
| + | |
- | return $output;
| + | |
- | }
| + | |
- | | + | |
- | [[Flash:title.swf]]
| + | |
- | | + | |
- | | + | |
- | | + | |
- | {|align="justify"
| + | |
- | |You can write a background of your team here. Give us a background of your team, the members, etc. Or tell us more about something of your choosing.
| + | |
- | |[[Image:Example_logo.png|200px|right|frame]]
| + | |
- | |-
| + | |
- | |
| + | |
- | ''Tell us more about your project. Give us background. Use this is the abstract of your project. Be descriptive but concise (1-2 paragraphs)''
| + | |
- | |[[Image:Team.png|right|frame|Your team picture]]
| + | |
- | |-
| + | |
- | |
| + | |
- | |align="center"|[[Team:TzuChiU_Formosa | Team Example]]
| + | |
- | |}
| + | |
- | | + | |
- | <!--- The Mission, Experiments ---> | + | |
- | | + | |
- | {| style="color:#1b2c8a;background-color:#0c6;" cellpadding="3" cellspacing="1" border="1" bordercolor="#fff" width="62%" align="center"
| + | |
- | !align="center"|[[Team:TzuChiU_Formosa|Home]]
| + | |
- | !align="center"|[[Team:TzuChiU_Formosa/Team|The Team]]
| + | |
- | !align="center"|[[Team:TzuChiU_Formosa/Project|The Project]]
| + | |
- | !align="center"|[[Team:TzuChiU_Formosa/Parts|Parts Submitted to the Registry]]
| + | |
- | !align="center"|[[Team:TzuChiU_Formosa/Modeling|Modeling]]
| + | |
- | !align="center"|[[Team:TzuChiU_Formosa/Notebook|Notebook]]
| + | |
- | |}
| + | |
- | (''Or you can choose different headings. But you must have a team page, a project page, and a notebook page.'')
| + | |