monperrus/bibtexbrowser — pull request #13 by mguillau (2014-03-19 17:11:57+00:00)
Title: User-defined bib2links

in this commit, bib2links has be refactored a bit.
- it is now a function and not a method, like bib2html
- it encapsulates the function name defined in BIBTEXBROWSER_LINK_STYLE (same as BIBLIOGRAPHYSTYLE for bib2html)
- so it's easy to redefine it in bibtexbrowser.local.php (same idea as BIBLIOGRAPHYSTYLE for bib2html)
- I also added a few methods to the BibEntry class to make it easier to define a bib2links function with new links, and icons if needed ;-), for instance:
```php
function bib2links_with_icons(&$bibentry) {
// bib is a special type of link. without the url argument or with an invalid image, it prints '[bibtex]'
$result = $bibentry->getBibLink('http://www.vision.ee.ethz.ch/%7emguillau/icons/bib.png');
// returns an empty string if no pdf field present
$result .= $bibentry->getLink('pdf','http://www.vision.ee.ethz.ch/%7emguillau/icons/pdf.png');
// returns an empty string if no url field present
$result .= $bibentry->getLink('url','http://www.vision.ee.ethz.ch/%7emguillau/icons/url.png');
// returns an empty string if no slides field present
$result .= $bibentry->getLink('slides','http://www.vision.ee.ethz.ch/%7emguillau/icons/slides.png');
// returns an empty string if no poster field present
$result .= $bibentry->getLink('poster','http://www.vision.ee.ethz.ch/%7emguillau/icons/slides.png');
// Google Scholar ID. empty string if no gsid field present
$result .= $bibentry->getGSLink('http://www.vision.ee.ethz.ch/%7emguillau/icons/google_scholar.png');
// returns an empty string if no doi field present
$result .= $bibentry->getDoiLink('http://www.vision.ee.ethz.ch/%7emguillau/icons/doi.png');
return $result;
}
```