Upload version 0.2.3

This commit is contained in:
ulaulaman 2018-02-01 00:19:54 +01:00 committed by GitHub
parent e683474d9c
commit 2f8c7ffea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 118 additions and 0 deletions

74
citations-tools.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/*
Plugin Name: Citations tools
Description: The plugin add some shortcodes add a link to a paper using the doi code or to resolve doi code and publish a full citation apa formatted.
Version: 0.2.3
Author: Gianluigi Filippelli
Author URI: http://dropseaofulaula.blogspot.it/
Plugin URI:
License: GPLv2 or later
*/
/* ------------------------------------------------------ */
# ---------------------------------------------------------
# doi
add_shortcode('doi', 'doi');
function doi ($atts, $content = null) {
extract(
shortcode_atts(
array(
'code' => null
),
$atts
)
);
$link = '<a href="https://dx.doi.org/'.$code.'/" target="doi">'.$content.'</a>';
return $link;
}
# doi resolve
add_shortcode('doiresolve', 'doiresolve');
function doiresolve ($atts, $content = null) {
extract(
shortcode_atts(
array(
'code' => null,
'arxiv' => null,
'pdfurl' => null
),
$atts
)
);
$fullCitation = null;
$getfile = 'https://search.crossref.org/dois?sort=score&page=1&rows=1&q='.$code;
$jsondata = file_get_contents($getfile);
$array = json_decode($jsondata,true);
$item=$array[0];
$doi = $item['doi'];
$coins = $item['coins'];
$fullCitation =$item['fullCitation'];
$citation = '<p>'.$fullCitation.' doi:<a href="https://dx.doi.org/'.$code.'" target="doi">'.$code.'</a>';
if ( $arxiv <> null )
{$citation = $citation.' (<a href="https://arxiv.org/abs/'.$arxiv.'" target="arxiv">arXiv</a>)';}
else
{$citation = $citation;}
if ( $pdfurl <> null )
{$citation = $citation.' (<a href="'.$pdfurl.'" target="pdf">pdf</a>)';}
else
{$citation = $citation;}
$results = $citation.'</p>';
return $results;
}
/* ------------------------------------------------------ */

44
readme.txt Normal file
View File

@ -0,0 +1,44 @@
=== Citations tools ===
Contributors: ulaulaman
Tags: doi, citations, research
Requires at least: 4.8.5
Tested up to: 4.9.2
Requires PHP: 7.0.18
Stable tag: trunk
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
The plugin add some shortcodes add a link to a paper using the doi code or to resolve doi code and publish a full citation apa formatted.
== Description ==
Using the standard for doi link, the plugin introduce a shortcode in order to create a link to a paper provided by doi.
How to use the shortcode:
[doi code="..."]Title of the paper[/doi]
Using the [crossref.org](https://www.crossref.org/) api, the plugin add also a shortcode that resolve a doi code and publish a full citation formatted using the apa standard.
How to use the shortcode:
[doiresolve code="..."]
There are also two optional parameters:
[doiresolve code="..." arxiv="..."]
if the paper has an arXiv version
[doiresolve code="..." pdfurl="..."]
if the paper has a free pdf version
== Installation ==
1. Extract the citations-tools.zip file and upload its contents to the /wp-content/plugins/ directory. Alternately, you can install directly from the Plugin directory within your WordPress Install.
2. Activate the plugin through the "Plugins" menu in WordPress.
3. Use the shortcode into your posts or pages.
== Changelog ==
0.2.3 add pdf link in doi resolver as ahortcode's parameter
0.2.2 add arXiv link in doi resolver as shortcode's parameter
0.2.1 add doi link in doi resolver
0.2 add shortcode to resolve doi using code
0.1 shortcode for doi link