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
ghost
left a comment
There was a problem hiding this comment.
Added possibility to specifiy a custom, possibly more human-readable label for the DOI link
| 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.
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
| * Prepares a doi url | ||
| * @param string $doi The DOI number | ||
| * @return string | ||
| * @since 6.x.x |
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.phpfile.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_settingstable during an update of the plugin.Translation of new labels
Versioning in code comments
Best regards, Matthias