0.3 add shortcode for manual citations
This commit is contained in:
parent
975c34c35b
commit
82b0f660a2
|
@ -1,11 +1,11 @@
|
|||
<?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.6.1
|
||||
Description: Some tools for scientific and editorial bloggers.
|
||||
Version: 0.3
|
||||
Author: Gianluigi Filippelli
|
||||
Author URI: http://dropseaofulaula.blogspot.it/
|
||||
Plugin URI: https://github.com/ulaulaman/citations-tools
|
||||
Plugin URI: https://ulaulaman.github.io/citations-tools/
|
||||
License: GPLv2 or later
|
||||
*/
|
||||
/* ------------------------------------------------------ */
|
||||
|
@ -30,7 +30,7 @@ add_shortcode('ctdoi', 'ctdoi');
|
|||
return $link;
|
||||
}
|
||||
|
||||
# doi resolve
|
||||
# doi resolver
|
||||
add_shortcode('ctdoiresolve', 'ctdoiresolve');
|
||||
|
||||
function ctdoiresolve ($atts, $content = null) {
|
||||
|
@ -56,7 +56,7 @@ add_shortcode('ctdoiresolve', 'ctdoiresolve');
|
|||
$coins = $item['coins'];
|
||||
$fullCitation =$item['fullCitation'];
|
||||
|
||||
$citation = '<p>'.$fullCitation.' doi:<a href="https://dx.doi.org/'.$code.'" target="doi">'.$code.'</a>';
|
||||
$citation = '<div class="paperbox">'.$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>)';}
|
||||
|
@ -73,8 +73,97 @@ add_shortcode('ctdoiresolve', 'ctdoiresolve');
|
|||
else
|
||||
{$citation = $citation;}
|
||||
|
||||
$results = $citation.'</p>';
|
||||
$results = $citation.'</div>';
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
# paperdata
|
||||
add_shortcode('paperdata', 'paperdata');
|
||||
|
||||
function paperdata ($atts, $content = null) {
|
||||
|
||||
extract(
|
||||
shortcode_atts(
|
||||
array(
|
||||
'auth' => null,
|
||||
'year' => null,
|
||||
'title' => null,
|
||||
'journal' => null,
|
||||
'vol' => null,
|
||||
'issue' => null,
|
||||
'pages' => null,
|
||||
'code' => null,
|
||||
'arxiv' => null,
|
||||
'pdfurl' => null,
|
||||
'archiveurl' => null
|
||||
),
|
||||
$atts
|
||||
)
|
||||
);
|
||||
|
||||
$fullcitation = null;
|
||||
|
||||
if ( $auth <> null )
|
||||
{$fullcitation = $fullcitation.$auth;}
|
||||
else
|
||||
{$fullcitation = $fullcitation;}
|
||||
|
||||
if ( $year <> null )
|
||||
{$fullcitation = $fullcitation.', '.$year;}
|
||||
else
|
||||
{$fullcitation = $fullcitation;}
|
||||
|
||||
if ( $title <> null )
|
||||
{$fullcitation = $fullcitation.', '.$title;}
|
||||
else
|
||||
{$fullcitation = $fullcitation;}
|
||||
|
||||
if ( $journal <> null )
|
||||
{$fullcitation = $fullcitation.', <em>'.$journal.'</em>';}
|
||||
else
|
||||
{$fullcitation = $fullcitation;}
|
||||
|
||||
if ( $vol <> null )
|
||||
{$fullcitation = $fullcitation.', vol.'.$vol;}
|
||||
else
|
||||
{$fullcitation = $fullcitation;}
|
||||
|
||||
if ( $issue <> null )
|
||||
{$fullcitation = $fullcitation.', n.'.$issue;}
|
||||
else
|
||||
{$fullcitation = $fullcitation;}
|
||||
|
||||
if ( $pages <> null )
|
||||
{$fullcitation = $fullcitation.', pp. '.$pages;}
|
||||
else
|
||||
{$fullcitation = $fullcitation;}
|
||||
|
||||
$citation = '<div class="paperbox">'.$fullcitation;
|
||||
|
||||
if ( $code <> null )
|
||||
{$citation = $citation.' doi:<a href="https://dx.doi.org/'.$code.'" target="doi">'.$code.'</a>';}
|
||||
else
|
||||
{$citation = $citation;}
|
||||
|
||||
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;}
|
||||
|
||||
if ( $archiveurl <> null )
|
||||
{$citation = $citation.' (<a href="'.$archiveurl.'" target="archive">archive.org</a>)';}
|
||||
else
|
||||
{$citation = $citation;}
|
||||
|
||||
$results = $citation.'</div>';
|
||||
|
||||
return $results;
|
||||
|
||||
}
|
||||
/* ------------------------------------------------------ */
|
||||
|
|
Loading…
Reference in New Issue