ncbi = new ncbi(); $this->xmlCache = new plugin_cache("ncbi_esummary","pubmed","xml.gz"); if($this->ncbi == Null) print("NCBI is null !"); if($this->xmlCache == Null) print("this->xmlCache is null !"); } function getType(){ return 'substition'; } function getSort(){ return 158; } function connectTo($mode){$this->Lexer->addSpecialPattern('\{\{pubmed>[^}]*\}\}',$mode,'plugin_pubmed');} /** * Handle the match */ function handle($match, $state, $pos, Doku_Handler $handler){ $match = substr($match,9,-2); if(str_contains($match,':')){ list($cmd,$pmid) = explode(':',$match); }else{ $cmd = $match; $pmid = ''; } return array($state,array($cmd,$pmid)); } /** * Create output */ function render($mode, Doku_Renderer $renderer, $data) { if ($mode!='xhtml') return false; list($state, $query) = $data; list($cmd, $pmid) = $query; $cmd = strtolower($cmd); if ($cmd=='long' || $cmd=='short'){ if (!is_numeric($pmid)){ $renderer->doc.=sprintf($this->getLang('pubmed_wrong_format')); return false; } $xml = $this->getSummaryXML($pmid); if(empty($xml)){ $renderer->doc.=sprintf($this->getLang('pubmed_not_found'),$pmid); return false; } $href_url = sprintf($this->ncbi->pubmedURL,$pmid); $journal = $this->ncbi->GetSummaryItem ("Source",$xml); $date = $this->ncbi->GetSummaryItem ("PubDate",$xml); $volume = $this->ncbi->GetSummaryItem ("Volume",$xml); $pages = $this->ncbi->GetSummaryItem ("Pages",$xml); $authors = $this->ncbi->GetSummaryItems("Author",$xml); $title = $this->ncbi->GetSummaryItem ("Title",$xml); if ($cmd=='long'||$cmd=='short'){ $renderer->doc.='
".htmlspecialchars($xml).""; return true; case 'clear_summary': $this->xmlCache->ClearCache(); $renderer->doc .= 'Cleared.'; return true; case 'remove_dir': $this->xmlCache->RemoveDir(); $renderer->doc .= 'Directory cleared.'; return true; default: // Command was not found.. $renderer->doc.='