Tema: Mediawiki
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/12/2007, 06:01
clinisbut
 
Fecha de Ingreso: diciembre-2004
Mensajes: 278
Antigüedad: 21 años, 9 meses
Puntos: 0
Re: Mediawiki

Este es el código que estoy utilizando:
Código PHP:
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="'
.$this->url.'" 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
}