yourvideo.flv [width,height]}} * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @version 0.2 * @author Dave Kliczbor * @author Jason Byrne * @author Chris Smith */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); define('PLUGIN_FLOW', DOKU_BASE.'lib/plugins/flowplay/flowplayer/'); require_once(DOKU_PLUGIN.'syntax.php'); if (!function_exists('hsc')) { function hsc($string){ return htmlspecialchars($string, ENT_QUOTES, 'UTF-8'); } } class syntax_plugin_flowplay extends DokuWiki_Syntax_Plugin { function getInfo(){ return array( 'author' => 'Dave Kliczbor', 'email' => 'maligree@gmx.de', 'date' => '2007-02-22', 'version'=> '0.2', 'name' => 'flowplay', 'desc' => 'Embeds a video stream player flash applet into your page', 'url' => 'http://wiki.splitbrain.org/plugin:flowplay', 'ack' => 'Parts of this plugin were copied from the video plugin by Jason Byrne and Chris Smith', ); } function getType() { return 'substition'; } function getSort(){ return 305; } function connectTo($mode) { $this->Lexer->addSpecialPattern('{{flowplay>.*?}}',$mode,'plugin_flowplay'); } function handle($match, $state, $pos, &$handler){ list($type, $data) = explode('>',substr($match, 2,-2),2); $data = html_entity_decode($data); list($url, $alt) = explode('|',$data,2); if (preg_match('/(.*)\[(.*)\]$/',trim($url),$matches=array())) { $url = $matches[1]; if (strpos($matches[2],',') !== false) { list($w, $h) = explode(',',$matches[2],2); } else { $h = $matches[2]; $w = '320'; } } else { $w = '320'; $h = '240'; } $h += 23; //add the height of the control bar if (!isset($alt)) $alt = $type.' file: '.$url; return array(hsc(trim($url)), hsc(trim($alt)), hsc(trim($w)), hsc(trim($h))); } function render($mode, &$renderer, $data) { list($url, $alt, $param['width'], $param['height']) = $data; if($mode == 'xhtml'){ if( strlen($this->getConf('player_base_url')) > 0 ) { $prefix = $this->getConf('player_base_url'); } else { $prefix = PLUGIN_FLOW; } if( $prefix{strlen($prefix)-1} !== '/' ) $prefix .= '/'; $renderer->doc .= ' '."\n"; $renderer->doc .= ' '."\n"; $renderer->doc .= ' '."\n"; $renderer->doc .= ' '."\n"; $renderer->doc .= ' '."\n"; $renderer->doc .= ' '."\n"; $renderer->doc .= ' '."\n"; $renderer->doc .= ''."\n"; return true; } return false; } } ?>