[Mediawiki-l] Embeding a flash only works in preview mode

>Raul< clinisbut at gmail.com
Wed Dec 19 12:25:45 UTC 2007


I've edited the extension http://www.mediawiki.org/wiki/Extension:Flash to
allow post my own uploaded flashes animations.
It works great... but only in preview mode!!!
In the discussion page of this extension someone talks about "the solution
is to correct the current directory assumptions in the Flash code." but I've
tried with flash animations without any actionscript that could take any
current directory assumptions and does not work too.

This is my extension flash version:

class Flash
{
    var $tmp;
    var $file;

    /* Constructor */
    function Flash( $input )
    {
        $this->tmp = '';
        Flash::parseInput( $input ); // Parse the input
        Flash::genCode(); // Generate the final code
    }

    /*    Parser    */
    function parseInput( $input )
    {
        $this->file = $input;
    }


    /* Generate big, final chunk of code */
    function genCode()
    {
        // Possibly malicious settings:
        $allowscriptaccess = 'false'; // allow / disallow scripts
        $swliveconnect = 'false'; // start / do not start up java

        // Default version Setting:
        $this->version = '7,0,0,0'; // Version settings for <object>

        $this->url = $this->getTitle( $this->file );//Flash::imageUrl(
$this->file, $this->fromSharedDirectory ); // get Wiki internal url

        $this->code = '<div style="border:1px solid;">
        <embed src="extensions/flashMovie/quemecorro.swf" width="400"
height="400"
        type="application/x-shockwave-flash" pluginspage="
http://www.macromedia.com/go/getflashplayer" />
        </div>';

        return $this->code;
    }


    function getTitle( $file )
    {
        $title = Title::makeTitleSafe("Image",$file);
        $img = new Image( $title );
        $path = $img->getViewURL(false);
        return $path;
    }
}

function wfFlashExtension()
{
    global $wgParser;
    $wgParser->setHook( "flash", "renderFlash" );
}
function renderFlash( $input )
{
    global $code;

    // Constructor
    $flashFile = new Flash( $input );
    $code = $flashFile->code;

    return $code; // send the final code to the wiki
}


More information about the MediaWiki-l mailing list