function display_formatted_citation($id, $style) { global $config; global $couch; $reference = null; // grab JSON from CouchDB $couch_id = $id; $resp = $couch->send("GET", "/" . $config['couchdb_options']['database'] . "/" . urlencode($couch_id)); $reference = json_decode($resp); if (isset($reference->error)) { $html = "Oops"; } else { if ($style == 'ris') { $html = '<pre>' . reference_to_ris($reference) . '</pre>'; } else { $citeproc_obj = reference_to_citeprocjs($reference); $json = json_encode($citeproc_obj); $citeproc_obj = json_decode($json); //echo $json; $cslfilename = dirname(__FILE__) . '/style/'; switch ($style) { case 'apa': case 'bibtex': case 'wikipedia': case 'zookeys': case 'zootaxa': $cslfilename .= $style . '.csl'; break; default: $cslfilename .= 'apa.csl'; break; } $csl = file_get_contents($cslfilename); $citeproc = new citeproc($csl); $html = $citeproc->render($citeproc_obj, 'bibliography'); } } echo $html; }
function DisplayRis() { $ris = ''; $articles = db_retrieve_articles_from_journal($this->issn, $this->oclc); foreach ($articles as $k => $v) { foreach ($v as $ref) { $reference = db_retrieve_reference($ref->id); $ris .= reference_to_ris($reference); } } header("Content-type: text/plain; charset=utf-8\n\n"); echo $ris; }
function DisplayRis() { log_access($this->id, 'ris'); header("Content-type: text/plain; charset=utf-8\n\n"); echo reference_to_ris($this->object); }