refactors to remove duplicated and ambiguous code
This commit is contained in:
+2
-11
@@ -1041,7 +1041,7 @@ class BibEntry {
|
|||||||
|
|
||||||
function setIndex($index) { $this->index = $index; }
|
function setIndex($index) { $this->index = $index; }
|
||||||
|
|
||||||
/** Tries to build a good URL for this entry */
|
/** Tries to build a good URL for this entry. The URL should be absolute (better for the generated RSS) */
|
||||||
function getURL() {
|
function getURL() {
|
||||||
if (defined('BIBTEXBROWSER_URL_BUILDER')) {
|
if (defined('BIBTEXBROWSER_URL_BUILDER')) {
|
||||||
$f = BIBTEXBROWSER_URL_BUILDER;
|
$f = BIBTEXBROWSER_URL_BUILDER;
|
||||||
@@ -1052,15 +1052,6 @@ class BibEntry {
|
|||||||
return BIBTEXBROWSER_URL.'?'.createQueryString(array(Q_KEY=>$this->getKey(), Q_FILE=>$this->filename));
|
return BIBTEXBROWSER_URL.'?'.createQueryString(array(Q_KEY=>$this->getKey(), Q_FILE=>$this->filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Tries to build a good absolute URL for this entry */
|
|
||||||
function getAbsoluteURL() {
|
|
||||||
if (defined('BIBTEXBROWSER_URL_BUILDER')) {
|
|
||||||
$f = BIBTEXBROWSER_URL_BUILDER;
|
|
||||||
return $f($this);
|
|
||||||
}
|
|
||||||
return "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'/'.$this->getURL();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** returns a "[pdf]" link if relevant */
|
/** returns a "[pdf]" link if relevant */
|
||||||
function getUrlLink() {
|
function getUrlLink() {
|
||||||
if ($this->hasField('url')) return ' <a'.(BIBTEXBROWSER_BIB_IN_NEW_WINDOW?' target="_blank" ':'').' href="'.$this->getField('url').'">[pdf]</a>';
|
if ($this->hasField('url')) return ' <a'.(BIBTEXBROWSER_BIB_IN_NEW_WINDOW?' target="_blank" ':'').' href="'.$this->getField('url').'">[pdf]</a>';
|
||||||
@@ -3547,7 +3538,7 @@ class RSSDisplay {
|
|||||||
?>
|
?>
|
||||||
<item>
|
<item>
|
||||||
<title><?php echo $this->text2rss($bibentry->getTitle());?></title>
|
<title><?php echo $this->text2rss($bibentry->getTitle());?></title>
|
||||||
<link><?php echo $bibentry->getAbsoluteURL();?></link>
|
<link><?php echo $bibentry->getURL();?></link>
|
||||||
<description>
|
<description>
|
||||||
<?php
|
<?php
|
||||||
// we are in XML, so we cannot have HTML entitites
|
// we are in XML, so we cannot have HTML entitites
|
||||||
|
|||||||
Reference in New Issue
Block a user