Skip to content

Commit

Permalink
remove PUBMED URL redirects that match DOI or PMC (#3316)
Browse files Browse the repository at this point in the history
  • Loading branch information
GlazerMann committed Jul 21, 2020
1 parent 37ce3b6 commit ce68e85
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,14 @@ public function get_identifiers_from_url(?string $url_sent = NULL) : bool {
if ($this->wikiname() === 'cite web') $this->change_name_to('cite journal');
return $this->add_if_new('pmid', $match[1]);

} elseif (preg_match('~^ncbi\.nlm\.nih\.gov/entrez/eutils/elink.fcgi\?.+tool=sumsearch\.org.+id=(\d+)$~', $url, $match)) {
if ($url_sent) return FALSE; // Many do not work
if ($this->blank(['doi', 'pmc'])) return FALSE; // This is a redirect to the publisher, not pubmed
if ($match[1] == $this->get('pmc') || $match[1] == $this->get('pmid')) {
$this->forget($url_type);
}
return FALSE;

} elseif (preg_match("~^https?://(?:www\.|)amazon(?P<domain>\.[\w\.]{1,7})/.*dp/(?P<id>\d+X?)~i", $url, $match)) {

if ($this->wikiname() === 'cite web') $this->change_name_to('cite book');
Expand Down

0 comments on commit ce68e85

Please sign in to comment.