diff --git a/bibtexbrowser-documentation.wiki b/bibtexbrowser-documentation.wiki index f22480a..c56a7fa 100755 --- a/bibtexbrowser-documentation.wiki +++ b/bibtexbrowser-documentation.wiki @@ -26,7 +26,7 @@ This documentation is collaborative, you can improve it using a [[https://github * **(10/2009)** bibtexbrowser is able to generate a bibtex file containing only the selected entries (simply add &astext at the end of the link) * **(10/2009)** bibtexbrowser is now independent of the configuration of register_globals * **(01/2009)** bibtexbrowser allows multi criteria search, e.g. [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=monperrus.bib&type=inproceedings&year=20013|demo]] -* bibtexbrowser generates [[http://ocoins.info/|COinS]] for automatic import of bibliographic entries with [[http://www.zotero.org/|Zotero]] and [[http://www.mendeley.com/|Mendeley]]. +* bibtexbrowser generates [[http://ocoins.info/|COinS]] metadata for automatic import of bibliographic entries with [[http://www.zotero.org/|Zotero]] and [[http://www.mendeley.com/|Mendeley]]. * bibtexbrowser generates [[http://www.monperrus.net/martin/accurate+bibliographic+metadata+and+google+scholar|Google Scholar metadata]] so as to improve the visibility of your papers on Google Scholar. * bibtexbrowser replaces constants defined in @STRING * bibtexbrowser is very fast because it keeps a compiled version of the bibtex file (PHP object serialized) @@ -573,6 +573,18 @@ function bibtexbrowser_top_banner() { ?> +====How to configure the type of metadata that bibtexbrowser generates?==== + +Bibtexbrowser can generate [[https://en.wikipedia.org/wiki/COinS|Coins]], Google Scholar, Dublin Core (DC), Opengraph and Eprints metadata. This can be configured in ''bibtexbrowser.local.php'' as follows: +
+<?php
+@define('METADATA_COINS',true); // see https://en.wikipedia.org/wiki/COinS
+@define('METADATA_GS',false); // metadata google scholar, see http://www.monperrus.net/martin/accurate+bibliographic+metadata+and+google+scholar
+@define('METADATA_DC',true); // see http://dublincore.org/
+@define('METADATA_OPENGRAPH',true);  // see http://ogp.me/
+@define('METADATA_EPRINTS',false); // see https://wiki.eprints.org/w/Category:EPrints_Metadata_Fields
+?>
+
=====Related tools===== diff --git a/bibtexbrowser-test.php b/bibtexbrowser-test.php index e54fca5..f298d43 100755 --- a/bibtexbrowser-test.php +++ b/bibtexbrowser-test.php @@ -284,6 +284,7 @@ class BTBTest extends PHPUnit_Framework_TestCase { } function test_google_scholar_metadata() { + bibtexbrowser_configure('METADATA_GS', true); $test_data = fopen('php://memory','x+'); fwrite($test_data, "@article{aKey,title={A Book},author={Martin Monperrus},publisher={Springer},year=2009,pages={42--4242},number=1}\n". "@String{x=2008}\n" diff --git a/bibtexbrowser.php b/bibtexbrowser.php index e891e64..1e913a6 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -208,10 +208,11 @@ if (defined('ENCODING')) { @define('YEAR', 'year'); @define('BUFFERSIZE',100000); @define('MULTIPLE_BIB_SEPARATOR',';'); -@define('METADATA_GS',true); -@define('METADATA_DC',true); -@define('METADATA_OPENGRAPH',true); -@define('METADATA_EPRINTS',false); +@define('METADATA_COINS',true); // see https://en.wikipedia.org/wiki/COinS +@define('METADATA_GS',false); // metadata google scholar, see http://www.monperrus.net/martin/accurate+bibliographic+metadata+and+google+scholar +@define('METADATA_DC',true); // see http://dublincore.org/ +@define('METADATA_OPENGRAPH',true); // see http://ogp.me/ +@define('METADATA_EPRINTS',false); // see https://wiki.eprints.org/w/Category:EPrints_Metadata_Fields // define sort order for special values in 'year' field // highest number is sorted first @@ -1812,6 +1813,9 @@ class BibEntry { * Used by Zotero, mendeley, etc. */ function toCoins() { + if (c('METADATA_COINS') == false) { + return; + } $url_parts=array(); $url_parts[]='ctx_ver=Z39.88-2004'; @@ -1858,7 +1862,7 @@ class BibEntry { // referrer, the id of a collection of objects // see also http://www.openurl.info/registry/docs/pdf/info-sid.pdf - $url_parts[]='rfr_id='.s3988('info:sid/'.@$_SERVER['HTTP_HOST'].':'.@$_GET[Q_FILE]); + $url_parts[]='rfr_id='.s3988('info:sid/'.@$_SERVER['HTTP_HOST'].':'.basename(@$_GET[Q_FILE])); $url_parts[]='rft.date='.s3988($this->getYear()); @@ -3424,24 +3428,24 @@ class BibEntryDisplay { function metadata() { $result=array(); - if (BIBTEXBROWSER_ROBOTS_NOINDEX) { + if (c('BIBTEXBROWSER_ROBOTS_NOINDEX')) { $result[] = array('robots','noindex'); } - if (METADATA_GS) { + if (c('METADATA_GS')) { $result = $this->metadata_google_scholar($result); } // end Google Scholar // a fallback to essential dublin core - if (METADATA_DC) { + if (c('METADATA_DC')) { $result = $this->metadata_dublin_core($result); } - if (METADATA_OPENGRAPH) { + if (c('METADATA_OPENGRAPH')) { $result = $this->metadata_opengraph($result); } - if (METADATA_EPRINTS) { + if (c('METADATA_EPRINTS')) { $result = $this->metadata_eprints($result); }