Skip to content

Commit ab73d45

Browse files
committed
Add Parameter TEACHPRESS_DOI_RESOLVER
Simplier solution for #71
1 parent faa20cd commit ab73d45

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

core/templates.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ public static function prepare_publication_title ($row, $settings, $container_id
424424

425425
// for direct style (if a DOI numer exists)
426426
elseif ( $row['doi'] != '' && $settings['link_style'] === 'direct' ) {
427-
$doi_url = 'http://dx.doi.org/' . $row['doi'];
427+
$doi_url = TEACHPRESS_DOI_RESOLVER . $row['doi'];
428428
$title = tp_html::prepare_title($row['title'], 'decode');
429429
return '<a class="tp_title_link" href="' . $doi_url . '" title="' . $title . '" target="blank">' . $title . '</a>';
430430
}
@@ -499,7 +499,7 @@ public static function prepare_url($url, $doi = '', $mode = 'list') {
499499
* @since 5.0.0
500500
*/
501501
if ( $doi != '' ) {
502-
$doi_url = 'http://dx.doi.org/' . $doi;
502+
$doi_url = TEACHPRESS_DOI_RESOLVER . $doi;
503503
if ( $mode === 'list' ) {
504504
$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>';
505505
}
@@ -533,7 +533,7 @@ public static function prepare_altmetric($doi = '') {
533533
* @since 5.0.0
534534
*/
535535
if ( $doi != '' ) {
536-
$doi_url = 'http://dx.doi.org/' . $doi;
536+
$doi_url = TEACHPRESS_DOI_RESOLVER . $doi;
537537

538538
$end .= '<div data-badge-details="right" data-badge-type="large-donut" data-doi="'.$doi .'" data-condensed="true" class="altmetric-embed"></div>';
539539
}

teachpress.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@
246246
* @since 6.0.0
247247
*/
248248
define('TEACHPRESS_ALTMETRIC_SUPPORT', false);}
249+
250+
if ( !defined('TEACHPRESS_DOI_RESOLVER') ) {
251+
/**
252+
* This value defines if the URL for the DOI resolve service
253+
* @since 6.1.1
254+
*/
255+
define('TEACHPRESS_DOI_RESOLVER', 'https://dx.doi.org/');}
249256

250257

251258
/*********/

0 commit comments

Comments
 (0)