Plugin Author
kochm
(@kochm)
Could you please post the code you pasted into the source code here so I can check?
Here you go:
function formatDocument($doc, $csl=Null, $textonly=False, $showcover=False, $showlink=False) {
$result = '';
// format document with a given CSL style and the CiteProc.php
if ($csl != Null && class_exists("citeproc")){
// read the given CSL style from XML document, load it to a string, and convert it to an object
$cacheid = "csl-".$csl;
$csl_file = $this->getOutputFromCache($cacheid);
if (empty($csl_file)) {
$curl = curl_init($csl);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$http_headers = array(
'User-Agent: Junk', // Any User-Agent will do here
);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $http_headers);
$csl_file = curl_exec($curl);
if (curl_getinfo($curl,CURLINFO_HTTP_CODE) < 400) {
if ($csl_file !== false) {
$pos_body = stripos($csl_file, "<?xml version");
$csl_file = substr($csl_file, $pos_body);
$this->updateOutputInCache($cacheid, $csl_file);
} else {
echo "<p>1 Mendeley Plugin Error: Failed accessing Menedley API: " . curl_error($curl) . "</p>";
}
} else {
echo "<p>2 Mendeley Plugin Error: Failed accessing Mendeley API: " . curl_getinfo($curl,CURLINFO_HTTP_CODE) . "||||" . $csl_file . "</p>";
$csl_file = "";
}
curl_close($curl);
}
$csl_object = simplexml_load_string($csl_file);
Plugin Author
kochm
(@kochm)
Thanks! I included the additional code fragments in the plugins source code, tested everything and released a new version with the code.
It works! Thanks @kochm!
BTW, please credit @dinel2016 for the code. I just passed it along.