-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom doi resolver url #71
base: master
Are you sure you want to change the base?
Conversation
Hello, the solution in ab73d45 is simpler in terms of changes to the codebase and it makes the modification of the DOI resolver base URL easiers since it is not "hidden" away deep down in the source code, however I still see problems with this approach: (1) The value of the constant can be changed editing the teachpress.php directly. The problem is that these changes will be overriden when the plugin gets updated. (2) The value of the constant can be changed by re-defining the constant in wp-config.php. However, this requires file access to the server of the Wordpress installation which cannot be guaranteed. I therefore think that a GUI/DB-based approach in implementing this feature is the better solution. Regards, Matthias |
… +++ Replaced hard with soft tabs
…er link +++ Replaced hard with soft tabs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added possibility to specifiy a custom, possibly more human-readable label for the DOI link
admin/settings.php
Outdated
@@ -825,9 +836,11 @@ private static function change_general_options () { | |||
private static function change_publication_options () { | |||
$checkbox_convert_bibtex = isset( $_POST['convert_bibtex'] ) ? 1 : ''; | |||
$checkbox_import_overwrite = isset( $_POST['import_overwrite'] ) ? 1 : ''; | |||
$doi_resolver_url_template_custom = isset( $_POST['doi_resolver_url_template_custom'] ) ? esc_url_raw( $_POST['doi_resolver_url_template_custom'] ) : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sanitized the custom doi resolver url template using the esc_url_raw
function which is build into WP. Is this enough?
See here: https://codex.wordpress.org/Function_Reference/esc_url_raw
core/templates.php
Outdated
* Prepares a doi url | ||
* @param string $doi The DOI number | ||
* @return string | ||
* @since 6.x.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which version should I put here?
We are using teachPress in one of our projects and we had to add the possibility to define a custom doi resolver url (e.g. Google Scholar) which is currently hardcoded in the
core/template.php
file.It would be great if this functionality could be officially added to this plugin.
Please note, there are still the following things missing since I didn't know how to implement them properly (any help here would be highly appreciated):
Adding the necessary configuration values holding the default and custom doi resolver url template in the
wp_teachpress_settings
table during an update of the plugin.Translation of new labels
Versioning in code comments
Best regards, Matthias