'Ahmet Sacan', 'email' => 'ahmet@ceng.metu.edu.tr', 'date' => '2007-02-07', 'name' => 'Distribute plugin', 'desc' => 'helps distribute your plugins', 'url' => 'http://www.ceng.metu.edu.tr/~ahmet', ); } function getType(){ return 'substition'; } function getSort(){ return 158; } function connectTo($mode) { $this->Lexer->addSpecialPattern('\x5cdistribute\x7b[^\x7d]*\x7d',$mode,'plugin_distribute_syntax'); } function handle($match, $state, $pos, &$handler){ $ret = (object) array('match'=>$match); switch ($state) { case DOKU_LEXER_SPECIAL: if(preg_match('/^\x5cdistribute\x7b([^\x7d]+)\x7d$/', $match, $ms)){ $ret->command = 'distribute'; $ret->arg = $ms[1]; } } return array($state,$ret); } /////////////////////////////////////////////////////////////// function render($mode, &$renderer, $data) { global $ID; require_once dirname(__FILE__).'/../helper.funcs.util.php'; if($mode == 'xhtml'){ list($state, $match) = $data; $this->options['match'] .= $match->match; switch ($state) { case DOKU_LEXER_SPECIAL: if(!in_array($match->arg, explode(',',$this->getConf('plugins')))) $renderer->doc .= "[[distribution of $match->arg plugin not allowed in configuration]]"; else{ $lastupdate = my_filemtime(DOKU_PLUGIN.$match->arg, true); $renderer->doc .= "$match->arg".'_'.date('Ymd',$lastupdate).".zip"; } } return true; }//xhtml return false; }//render() }