1
This commit is contained in:
@@ -309,6 +309,70 @@ function my_doiToFrag1($data){
|
||||
}
|
||||
|
||||
|
||||
function my_doiToFrag2($data){
|
||||
$p_refer_obj = Db::name('production_article_refer');
|
||||
if($data['refer_doi']==''){
|
||||
return 0;
|
||||
}
|
||||
$doi = str_replace('/','%2F',$data['refer_doi']);
|
||||
// $url = "https://citation.crosscite.org/format?doi=$doi&style=american-veterinary-medical-association&lang=en-US";
|
||||
$url = "https://citation.crosscite.org/format?doi=$doi&style=cancer-translational-medicine&lang=en-US";
|
||||
$res = myGet($url);
|
||||
$frag = trim(substr($res,strpos($res,'.')+1));
|
||||
$update = [];
|
||||
if($frag==""){
|
||||
$update['refer_frag'] = $data['refer_content'];
|
||||
}else{
|
||||
// preg_match("/[0-9]{4}/",$frag,$math);
|
||||
// $year = $math[0];
|
||||
// $qbj=trim(substr($frag,0,stripos($frag,$year))) ;
|
||||
if(mb_substr_count($frag,'.')!=3){
|
||||
$f = $frag." Available at: ".PHP_EOL."http://doi.org/".$data['refer_doi'];
|
||||
$update['refer_frag'] = $f;
|
||||
$update['cs'] = 1;
|
||||
}else{
|
||||
$res = explode('.',$frag);
|
||||
$update['author'] = prgeAuthor($res[0]);
|
||||
$update['title'] = trim($res[1]);
|
||||
$bj = bekjournal($res[2]);
|
||||
$update['joura'] = formateJournal(trim($bj[0]));
|
||||
$update['dateno'] = trim($bj[1]);
|
||||
$update['doilink'] = "http://doi.org/".$data['refer_doi'];
|
||||
$update['cs'] = 1;
|
||||
}
|
||||
}
|
||||
$p_refer_obj->where('p_refer_id',$data['p_refer_id'])->update($update);
|
||||
$p_refer_obj->close();
|
||||
}
|
||||
|
||||
function bekjournal($str){
|
||||
preg_match("/[0-9]{4}/",$str,$math);
|
||||
$year = $math[0];
|
||||
$frag[0]=trim(substr($str,0,stripos($str,$year))) ;
|
||||
$frag[1]=substr($str,stripos($str,$year));
|
||||
return $frag;
|
||||
}
|
||||
|
||||
function formateJournal($fullname){
|
||||
$obj = Db::name('journal_abbr');
|
||||
$r = $obj->where('full_name',$fullname)->find();
|
||||
if($r){
|
||||
return $r['little_name'];
|
||||
}else{
|
||||
return $fullname;
|
||||
}
|
||||
}
|
||||
|
||||
function prgeAuthor($author){
|
||||
$a = explode(',',$author);
|
||||
if(count($a)<7){
|
||||
return $author.'.';
|
||||
}else{
|
||||
return trim($a[0]).', '.trim($a[1]).', '.trim($a[2]).', et al.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function my_tg_pushmail($data){
|
||||
$res = sendEmail($data['email'],$data['title'],$data['title'],$data['content'],$data['tmail'],$data['tpassword'],$data['attachmentFile']);
|
||||
if(isset($res['status'])){
|
||||
|
||||
Reference in New Issue
Block a user