diff --git a/bibtexbrowser-test.php b/bibtexbrowser-test.php index 446fc8e..8ec90fb 100755 --- a/bibtexbrowser-test.php +++ b/bibtexbrowser-test.php @@ -81,6 +81,12 @@ class BTBTest extends PHPUnit_Framework_TestCase { // Vancouver style bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','VancouverBibliographyStyle'); $this->assertEquals("Foo Bar and Jane Doe. An Article. New Results. 2009;5:1-2.\n [bibtex]",strip_tags($first_entry->toHTML())); + + // changing the target + bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle'); + bibtexbrowser_configure('BIBTEXBROWSER_LINKS_TARGET','_top'); + $this->assertEquals('An Article ( and ), In New Results, volume 5, . [bibtex]',$first_entry->toHTML()); + } function testMultiSearch() { diff --git a/bibtexbrowser.php b/bibtexbrowser.php index f657a92..ce2bfcf 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -68,10 +68,6 @@ if (defined('ENCODING')) { // if you don't like it, you can be disable it by adding in bibtexbrowser.local.php // @define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',false); @define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',true); -// if you disable the Javascript progressive enhancement, -// you may want the links to be open in a new window/tab -// if yes, add in bibtexbrowser.local.php define('BIBTEXBROWSER_BIB_IN_NEW_WINDOW',true); -@define('BIBTEXBROWSER_BIB_IN_NEW_WINDOW',false); @define('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');// this is the name of a function @define('BIBLIOGRAPHYSECTIONS','DefaultBibliographySections');// this is the name of a function @define('BIBLIOGRAPHYTITLE','DefaultBibliographyTitle');// this is the name of a function @@ -134,7 +130,7 @@ if (defined('ENCODING')) { @define('BIBTEXBROWSER_GSID_LINKS',true); // should pdf, doi, url, gsid links be opened in a new window? -@define('BIBTEXBROWSER_LINKS_IN_NEW_WINDOW',false); +@define('BIBTEXBROWSER_LINKS_TARGET','_self');// can be _blank (new window), _top (with frames) // should authors be linked to [none/homepage/resultpage] // none: nothing @@ -291,6 +287,14 @@ function default_message() { echo ""; } +/** returns the target of links */ +function get_target() { + if (c('BIBTEXBROWSER_LINKS_TARGET')!='_self') { + return " target=\"".c('BIBTEXBROWSER_LINKS_TARGET')."\""; + } + else return ""; +} + /** @nodoc */ function _zetDB($bibtex_filenames) { @@ -1285,7 +1289,7 @@ class BibEntry { if ($altlabel==NULL) { $altlabel=$bibfield; } $str = $this->getIconOrTxt($altlabel,$iconurl); if ($this->hasField($bibfield)) { - return ''.$str.''; + return ''.$str.''; } return ''; } @@ -1296,7 +1300,7 @@ class BibEntry { $href = 'href="'.$this->getURL().'"'; // we add biburl and title to be able to retrieve this important information // using Xpath expressions on the XHTML source - $link = "getKey()."\" {$href}>$bibstr"; + $link = 'getKey()."\" {$href}>$bibstr"; return $link; } @@ -1329,7 +1333,7 @@ class BibEntry { function getDoiLink($iconurl=NULL) { $str = $this->getIconOrTxt('doi',$iconurl); if ($this->hasField('doi')) { - return ''.$str.''; + return ''.$str.''; } return ''; } @@ -1338,7 +1342,7 @@ class BibEntry { function getGSLink($iconurl=NULL) { $str = $this->getIconOrTxt('cites',$iconurl); if ($this->hasField('gsid')) { - return ' '.$str.''; + return ' '.$str.''; } return ''; } @@ -1908,7 +1912,7 @@ class BibEntry { foreach ($vals as $field => $href) { if ($this->hasField($field)) { // this is not a parsing but a simple replacement - $entry = str_replace('___'.$field.'___', ''.$this->getField($field).'', $entry); + $entry = str_replace('___'.$field.'___', ''.$this->getField($field).'', $entry); } } @@ -2248,7 +2252,7 @@ function DefaultBibliographyStyle(&$bibentry) { // title // usually in bold: .bibtitle { font-weight:bold; } $title = ''.$title.''; - if ($bibentry->hasField('url')) $title = ' '.$title.''; + if ($bibentry->hasField('url')) $title = ' '.$title.''; $coreInfo = $title; @@ -2366,7 +2370,7 @@ function JanosBibliographyStyle(&$bibentry) { // title $title = '"'.$title.'"'; - if ($bibentry->hasField('url')) $title = ' '.$title.''; + if ($bibentry->hasField('url')) $title = ' '.$title.''; $entry[] = $title; @@ -2481,7 +2485,7 @@ function VancouverBibliographyStyle(&$bibentry) { $title = $title . '. '; } if ($bibentry->hasField('url')) { - $title = ' '.$title.''; + $title = ' '.$title.''; } $entry[] = $title;