. if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); require_once('cUrlHelper.php'); require_once('BzBug.php'); class syntax_plugin_bugzillaHTTP extends DokuWiki_Syntax_Plugin { private $starttime; private $endtime; function getInfo(){ return array( 'author' => 'andreas parschalk', 'email' => 'dprskavec@gmail.com', 'date' => '2012-08-17', 'name' => 'bugzilla http plugin', 'desc' => 'Gets information about bugs via HTTP (xml-view).', 'url' => 'http://www.dokuwiki.org/plugin:bugzillaHTTP', ); } function getType() { return 'substition'; } function getPType() { return 'normal'; } function getSort() { return 777; } function connectTo($mode) { $this->Lexer->addSpecialPattern('^\[buglist\s*\|\s*\d+\s*(?:\s*,\s*\d+)*\s*\]', $mode, 'plugin_bugzillaHTTP'); } function fetchBugs($idString) { // $this->starttime = microtime(true); $url = $this->getConf('bug_xml_url'); $url .= $idString; $curl = new cUrlHelper(); $content = $curl->fetchContent($url); $bug = new BzBug(); $buglist = $bug->unmarshall($content); // $this->endtime = microtime(true); return $buglist; } function handle($match, $state, $pos, &$handler) { preg_match('/^\[buglist\s*\|([\s(\d),]+)\]/', $match, $submatch); $idString = preg_replace('/\s/', '', $submatch[1]); return $idString; } function uncachedHandle($idString) { return $this->fetchBugs($idString); } function render($mode, &$renderer, $idString) { $bugData = $this->uncachedHandle($idString); //var_dump($bugData); $url = $this->getConf('bug_url'); if($mode == 'xhtml'){ // render tableheader $bugtable = '
ID | PRI | SEV | ASSIGNEE | STATUS | SHORT DESCRIPTION |
---|---|---|---|---|---|
'.$bug->getId().' | '.$bug->getPriority().' | '.$bug->getSeverity().' | '. $bug->getAssignedTo().' | '.$bug->getStatus().' | '.$bug->getShortDesc().' | '; $bugtable .= '