开发者 |
mbissinger
giodimilia |
---|---|
更新时间 | 2023年6月27日 18:16 |
PHP版本: | 7.0 及以上 |
WordPress版本: | 5.4 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
wp_nasaads_query_importer
can be used to query the NASA ADS and output the returned list of records. It can be inserted into any post with or without providing enclosed content:
[wp_nasaads_query_importer attributes]
or
[wp_nasaads_query_importer attributes] format [/wp_nasaads_query_importer]
Here, attributes are the shortcode's attributes and it is mandatory to either provide
Hawking, S.
will be submitted as "Hawking, S."
). Technically, a value is considered to be a single author if the string contains no AND, OR, double quotes or parentheses. If you need to include double quotes in the author field, please use single quotes around the attribute's value (see the examples below).YYYY
. Articles within a certain period can be searched by YYYY-YYYY
or YYYY TO YYYY
.refereed
. Read the Properties section of the search syntax for a list of all available properties.field+direction
where field
is the record field name to sort on and direction
is either desc
or asc
. The default is date desc,bibcode desc
.
25
.3
by default. The remaining number of authors are appended to the printed author list.true
or false
. The default is true
.never
, always
, or depends
(read the description in the plugin's settings page for details). The default is set to depends
.[wp_nasaads_query_importer] ... [/wp_nasaads_query_importer]
then the content within the shortcode tags is used as the template and, thus, overrides the plugin's global option.
The template is applied to each record in the list and may contain HTML entities to style the output. The data of the record is inserted by the following placeholders: %author, %affil, %title, %year, %month, %bibstem, %pub, %page, %volume, and %adsurl. See the NASA ADS search syntax for the definition of the record's fields with the exception of %year and %month which are derived from date, and %adsurl which is derived from bibcode.
Ultimate full control over the output and field records can be gained by new WordPress filters added by the plugin (see the WordPress filter section below).
WordPress filter
This plugins adds a few filters to WordPress, which can be used by third party plugins to further control the output and fetched record fields.
apply_filters( 'wp_nasaads_query_importer-record_mapping', array $mapping )
Defines which record fields are fetched from NASA ADS and on which placeholders they are mapped. The keys of the associative array $mapping
are the placeholder names (without the leading %) and their values the API fields names. The default definition can be found in the source code. (Source code)
apply_filters( 'wp_nasaads_query_importer-API_value', mixed $value, string $field )
Filters the $value
of a fetched API $field
before it is inserted into the record's data. (Source code)
apply_filters( 'nasa_das_query-format_[placeholder]', mixed $current_value, mixed $original_value, array $atts )
The final value returned by this filter will be the replacement for the placeholder (without the leading %). The $original_value
is that returned by the NASA ADS API while $current_value
is the value already modified by filter functions of higher priority. The shortcode attributes are passed as the associative array $atts
. See the source code of the author filter
for an example. (Source code)
Unfortunately, there is no way to query the NASA ADS API without providing a token. Since a token is personalized to an account at NASA ADS and they recommend to "keep your API key secret to protect it from abuse".
Don't worry. This plugin does not distribute your token any further! It will be used only for each query defined by the shortcodes in your blog! In doubts checkout the source code. Note, however, that your token is saved unencrypted as a plugin option in the database attached to your WordPress website. If your database or WordPress blog gets hacked then your token might get stolen. The token cannot be saved encrypted since the encryption method could be looked up in the source code easily. Thus, make sure to have the latest versions of WordPress and of database software installed in order to close any security issues! In case of a security problem you can simply generate a new token in your NASA ADS account settings. In this case your old token can no longer be used.
No, unfortunately this code is not backward compatible with version 0.3 or older since it has migrated to the more modern NASA ADS API.
That depends. Create an issue at GitHub with your requested feature and the developers will investigate whether the feature is of general interest (and there is a developer with same spare time to implement it).
In case you have discovered a bug please create an issue at GitHub.
Sure, thanks! Simply fork the GIT repository from GitHub and create a pull request of your feature branch once your code works.