html = @file_get_contents(DOKU_PLUGIN.'youtube/object.htm');
$this->pattern = '/\{\{(\s?)youtube>(small|large|link):([^} |]+)\|?(.*?)(\s?)\}\}/';
}
function getInfo(){
return array(
'author' => 'Ikuo Obataya',
'email' => 'I.Obataya@gmail.com',
'date' => '2008-04-05',
'name' => 'YouTube Plugin',
'desc' => 'YouTube link and object{{youtube>[small|large|link]:ID}}',
'url' => 'http://wiki.symplus.co.jp/computer/en/youtube_plugin',
);
}
function getType(){ return 'substition'; }
function getSort(){ return 159; }
function connectTo($mode) { $this->Lexer->addSpecialPattern('\{\{\s?youtube>[^}]*\s?\}\}',$mode,'plugin_youtube'); }
function handle($match, $state, $pos, &$handler){
$pm = preg_match_all($this->pattern,$match,$result);
$left = ($result[1][0]==" ");
$right = ($result[5][0]==" ");
$cmd = $result[2][0];
$id = $result[3][0];
$title = $result[4][0];
if ($left==true && $right==true){
$align = 'center';
}else if($left==true){
$align = 'right';
}else if($right==true){
$align = 'left';
}
return array($state, array($cmd,$id,$align,$title));
}
function render($mode, &$renderer, $data){
if($mode != 'xhtml'){return false;}
list($state, $match) = $data;
list($cmd,$id,$align,$title) = $match;
$id = urlencode($id);
$title = urlencode($title);
$title = str_replace("+"," ",$title);
switch($cmd){
case 'link':
$lnkFormat='';
$href_start=sprintf($lnkFormat,$id,empty($title)?$id:$title.' ('.$id.')');
$renderer->doc.=$href_start.'