Changeset 1851 for trunk


Ignore:
Timestamp:
10/11/2010 03:13:22 PM (20 months ago)
Author:
Xiping.Wang
Message:

[trunk] update Flash extension

Location:
trunk/w
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/w/LocalSettings.php

    r1847 r1851  
    198198$wgEnableUploads     = true; 
    199199$wgUploadBaseUrl     = $wgServer; 
    200 $wgFileExtensions    = array( 'png', 'gif', 'jpg', 'jpeg', 'doc', 'pdf', 'xls', 'ppt', 'docx','xlsx','pptx','zip','svg','mpp'); 
     200$wgFileExtensions    = array( 'png', 'gif', 'jpg', 'jpeg', 'doc', 'pdf', 'xls', 'ppt', 'docx','xlsx','pptx','zip','svg','mpp','swf'); 
    201201 
    202202# Workaround for file upload corruption issue.   
  • trunk/w/extensions/Flash.php

    r103 r1851  
    11<?php 
    2  
     2  
    33/* 
    44 *  This program is free software; you can redistribute it and/or modify 
     
    1414 *  You should have received a copy of the GNU General Public License 
    1515 *  along with this program; if not, write to the Free Software 
    16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USAw 
     16 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1717 *   
    18  * Parts of the program use the file 'Image.php' from the MediaWiki project. The respective source can be acquired from http://wikipedia.sourceforge.net/. 
     18 * Parts of the program use the file 'Image.php' from the MediaWiki project. The respective source can be acquired from http://svn.wikimedia.org/. 
    1919 *  
    2020 * @author <marius.treitz@i-u.de> 
     
    2222 * A small patch by an unknown author has been applied to fix the flashvars attribute input. 
    2323 */ 
    24  
     24  
     25//Extension credits that show up on Special:Version 
     26$wgExtensionCredits['parserhook'][] = array( 
     27        'name' => 'Flash', 
     28        'author' => 'Marius Treitz', 
     29        'description' => 'Allows the display of flash movies within a wiki with the <tt>&lt;flash&gt;</tt> tag', 
     30        'url' => 'http://www.mediawiki.org/wiki/Extension:Flash', 
     31        'version' => '1.0', 
     32); 
     33  
    2534$wgExtensionFunctions[] = "wfFlashExtension"; 
    26  
    27  
     35  
    2836/* 
    2937 * The Flash class generates code in order to implement a flash object. 
     
    3543                Flash::genCode(); // Generate the final code 
    3644        } 
    37  
     45  
    3846        /* Parser */ 
    3947        function parseInput( $input ) { 
    4048                for($pos=0; $pos<strlen($input); $pos++) { // go through all arguments 
    41                         if($input{$pos}=='=') { // separator between command 
    42                                 //ignore '=' if the attribute is flashvars 
    43                                 //this will enable to pass query string to flash files 
    44                                 if($gotflashvars) { 
    45                                         $this->tmp .= $input{$pos}; 
    46                                         continue; 
    47                                 } 
     49                        if($input{$pos}=='=') { // separator between command 
     50                                //ignore '=' if the attribute is flashvars 
     51                                //this will enable to pass query string to flash files 
     52                                if($gotflashvars) { 
     53                                        $this->tmp .= $input{$pos}; 
     54                                        continue; 
     55                                } 
    4856                                $this->instr = $this->tmp; 
    49                                 $this->tmp = ''; 
    50                                 //set the flag for flashvars 
    51                                 if($this->instr == 'flashvars') $gotflashvars = 1; 
     57                                $this->tmp = ''; 
     58                                //set the flag for flashvars 
     59                                if($this->instr == 'flashvars') $gotflashvars = 1; 
    5260                        } 
    53                         else if($input{$pos}=='|') { // separator between arguments 
    54                                 //reset the flags for other attributes 
    55                                 if($gotflashvars) $gotflashvars = 0; 
     61                        else if($input{$pos}=='|') { // separator between arguments 
     62                                //reset the flags for other attributes 
     63                                if($gotflashvars) $gotflashvars = 0; 
    5664                                Flash::setValue(); 
    5765                                $this->tmp=''; 
     
    6270                if($this->tmp!='') Flash::setValue(); // Deal with the rest of the input string 
    6371        } 
    64  
     72  
    6573        /* Coordinate commands with values */ 
    6674        function setValue() { 
     
    8795                } 
    8896        } 
    89  
     97  
    9098        /* Generate big, final chunk of code */ 
    9199        function genCode() { 
     
    93101                $allowscriptaccess = 'false'; // allow / disallow scripts 
    94102                $swliveconnect = 'false'; // start / do not start up java 
    95  
     103  
    96104                // Default version Setting: 
    97105                $this->version='7,0,0,0'; // Version settings for <object> 
    98                 $this->url = $this->getTitle($this->file);//Flash::imageUrl( $this->file, $this->fromSharedDirectory ); // get Wiki internal url 
    99  
    100                 // if flashvars is set append to the url 
    101                 if($this->flashvars) $this->url .= $this->flashvars; 
    102  
     106                $this->url = $this->getTitle($this->file);//Flash::imageUrl( $this->file, $this->fromSharedDirectory ); // get Wiki internal url 
     107  
     108                // if flashvars is set append to the url 
     109                if($this->flashvars) $this->url .= $this->flashvars; 
     110  
    103111                /* Final Code */ 
    104                 $this->code = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="' . $this->width . '" height="' . $this->height . '" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' . $this->version . '"><param name="movie" value="' . $this->url . '">' . $this->codeObject . '<embed src="' . $this->url . '" width="' . $this->width . '" height="' . $this->height . '"' . $this->codeEmbed . ' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>'; 
     112                $this->code = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="' . $this->width . '" height="' . $this->height . '" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' . $this->version . '"><param name="movie" value="' . $this->url . '">' . $this->codeObject . '<embed src="' . $this->url . '" width="' . $this->width . '" height="' . $this->height . '"' . $this->codeEmbed . ' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>'; 
    105113                return $this->code; 
    106114        } 
     
    118126function renderFlash( $input ) { 
    119127        global $code; 
    120  
     128  
    121129        // Constructor 
    122130        $flashFile = new Flash( $input ); 
    123131        $code = $flashFile->code; 
    124  
     132  
    125133        return $code; // send the final code to the wiki 
    126134} 
    127135 
    128 ?> 
Note: See TracChangeset for help on using the changeset viewer.