function _install_csl_from_github in Bibliography Module 6.2
Same name and namespace in other branches
- 7 modules/CiteProc/biblio_citeproc.admin.inc \_install_csl_from_github()
File
- modules/
CiteProc/ biblio_citeproc.admin.inc, line 333
Code
function _install_csl_from_github($path) {
$csl = '';
$github_URL = 'https://api.github.com/repos/citation-style-language/styles/contents/';
$URL = $github_URL . $path;
$result = drupal_http_request($URL);
if ($result->code == 200) {
$file = json_decode($result->data);
switch ($file->encoding) {
case 'base64':
$csl = base64_decode($file->content);
break;
}
_install_csl($file->name, $csl, $file->sha);
}
else {
$message = t('Attempt to get style: %name from GitHub resulted in an HTTP error: !code. ', array(
'%name' => $path,
'!code' => $result->code,
));
$mess_type = 'error';
drupal_set_message($message, $mess_type);
}
return;
}