helper =& plugin_load('helper', 'news'); } /** * return some info */ function getInfo(){ return array( 'author' => 'Myron Turner', 'email' => 'turnermm02@shaw.ca', 'date' => '2011-10-18', 'name' => 'news Plugin', 'desc' => 'creates newsfeed refresh button', 'url' => 'http://www.mturner.org', ); } function getType(){ return 'substition'; } function getSort(){ return 168; } function connectTo($mode) { $this->Lexer->addSpecialPattern('~~NEWS_REFRESH.*?~~',$mode,'plugin_news_button'); } /** * Handle the match */ function handle($match, $state, $pos, Doku_Handler $handler){ global $USERINFO; global $ID; global $INFO; if(!isset($USERINFO)) return false; if(isset($INFO['perm']) && $INFO['perm'] < 2) return; $match=substr($match,15,-2); // msg($match); $match = trim($match); if($match) { $title = $match; } $action = DOKU_URL . 'newsfeed.php'; $button_name = $this->getLang('btn_generate'); $button="
"; $button .= "
"; //msg($match); if($match) { $button .= ""; } $button .= "
"; switch ($state) { case DOKU_LEXER_SPECIAL : return array($state, $button); } return false; } /** * Create output */ function render($mode, Doku_Renderer $renderer, $data) { global $USERINFO; global $INFO; if(!isset($USERINFO)) return false; if(isset($INFO['perm']) && $INFO['perm'] < 2) return; if($mode == 'xhtml'){ list($state, $button) = $data; switch ($state) { case DOKU_LEXER_SPECIAL : $renderer->doc .= $button; return true; } } return false; } }