Skip to content

Commit

Permalink
Add Parameter TEACHPRESS_DOI_RESOLVER
Browse files Browse the repository at this point in the history
Simplier solution for #71
  • Loading branch information
winkm89 committed Sep 16, 2017
1 parent faa20cd commit ab73d45
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public static function prepare_publication_title ($row, $settings, $container_id

// for direct style (if a DOI numer exists)
elseif ( $row['doi'] != '' && $settings['link_style'] === 'direct' ) {
$doi_url = 'http://dx.doi.org/' . $row['doi'];
$doi_url = TEACHPRESS_DOI_RESOLVER . $row['doi'];
$title = tp_html::prepare_title($row['title'], 'decode');
return '<a class="tp_title_link" href="' . $doi_url . '" title="' . $title . '" target="blank">' . $title . '</a>';
}
Expand Down Expand Up @@ -499,7 +499,7 @@ public static function prepare_url($url, $doi = '', $mode = 'list') {
* @since 5.0.0
*/
if ( $doi != '' ) {
$doi_url = 'http://dx.doi.org/' . $doi;
$doi_url = TEACHPRESS_DOI_RESOLVER . $doi;
if ( $mode === 'list' ) {
$end .= '<li><a class="tp_pub_list" style="background-image: url(' . get_tp_mimetype_images( 'html' ) . ')" href="' . $doi_url . '" title="' . __('Follow DOI:','teachpress') . $doi . '" target="_blank">doi:' . $doi . '</a></li>';
}
Expand Down Expand Up @@ -533,7 +533,7 @@ public static function prepare_altmetric($doi = '') {
* @since 5.0.0
*/
if ( $doi != '' ) {
$doi_url = 'http://dx.doi.org/' . $doi;
$doi_url = TEACHPRESS_DOI_RESOLVER . $doi;

$end .= '<div data-badge-details="right" data-badge-type="large-donut" data-doi="'.$doi .'" data-condensed="true" class="altmetric-embed"></div>';
}
Expand Down
7 changes: 7 additions & 0 deletions teachpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@
* @since 6.0.0
*/
define('TEACHPRESS_ALTMETRIC_SUPPORT', false);}

if ( !defined('TEACHPRESS_DOI_RESOLVER') ) {
/**
* This value defines if the URL for the DOI resolve service
* @since 6.1.1
*/
define('TEACHPRESS_DOI_RESOLVER', 'https://dx.doi.org/');}


/*********/
Expand Down

0 comments on commit ab73d45

Please sign in to comment.