?'; }
return '' . $a . '' ;
}
// Create citations from bibtex entries. One argument per bibtex entry.
/* Example: As shown in , one can use bibtex within HTML/PHP.
*/
function cite() {
global $citations;
global $DB;
$entries = func_get_args(); // list of bibtex entries
$refs = array(); // corresponding references
foreach ($entries as $entry) {
$bib = $DB->getEntryByKey($entry);
if ( empty($bib) ) {
$ref = array(); // empty ref for detection by linkify, while getting last with sort()
$txt = "Unknown key «$entry»";
$refs[$txt] = $ref;
continue;
}
if (ABBRV_TYPE != 'index') {
$ref = $bib->getAbbrv();
$citations[$entry] = $ref;
} else {
if ( array_key_exists ( $entry , $citations ) ) {
$ref = $citations[$entry] ;
} else {
$ref = count( $citations ) + 1 ;
$citations[$entry] = $ref ;
}
}
$txt = $bib->getVeryCompactedAuthors() . ", «" . $bib->getTitle() . "», " . $bib->getYear() ;
$refs[$txt] = $ref;
}
asort( $refs );
$links = array();
foreach ( $refs as $txt => $ref ) {
$links[] = linkify($txt,$ref);
}
echo "[" . implode(",",$links) . "]" ;
}
// Function to print out the table/list of references
function make_bibliography() {
global $citations;
$bibfile = $_GET[Q_FILE]; // save bibfilename before resetting $_GET
$_GET = array();
$_GET['bib'] = $bibfile;
$_GET['bibliography'] = 1; // also sets $_GET['assoc_keys']=1
$_GET['keys'] = json_encode(array_flip($citations));
//print_r($_GET);
include( 'bibtexbrowser.php' );
?>