null ), $atts ) ); $link = ''.$content.''; return $link; } # doi resolve add_shortcode('ctdoiresolve', 'ctdoiresolve'); function ctdoiresolve ($atts, $content = null) { extract( shortcode_atts( array( 'code' => null, 'arxiv' => null, 'pdfurl' => null, 'archiveurl' => 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 = '

'.$fullCitation.' doi:'.$code.''; if ( $arxiv <> null ) {$citation = $citation.' (arXiv)';} else {$citation = $citation;} if ( $pdfurl <> null ) {$citation = $citation.' (pdf)';} else {$citation = $citation;} if ( $archiveurl <> null ) {$citation = $citation.' (archive.org)';} else {$citation = $citation;} $results = $citation.'

'; return $results; } /* ------------------------------------------------------ */