diff --git a/application/models/data/Doi.php b/application/models/data/Doi.php index 91cf4eb1..a31bda0e 100644 --- a/application/models/data/Doi.php +++ b/application/models/data/Doi.php @@ -131,9 +131,11 @@ class Doi extends Zend_Controller_Plugin_Abstract $orgs_en = array(); foreach($data['info'] as $k=>$v) { - $authors_en[$v['order']] = str_replace(",",",",$v['author_en']); - $orgs_en[$v['order']] = str_replace(",",",",$v['organization_en']); + $authors_en[(int)$v['order']] = str_replace(",","||||",$v['author_en']); + $orgs_en[(int)$v['order']] = str_replace(",","||||",$v['organization_en']); } + ksort($authors_en); + ksort($orgs_en); //$authors = "{".join(",",$authors)."}"; //$orgs = "{".join(",",$orgs)."}"; $authors_en = "{".join(",",$authors_en)."}"; @@ -152,8 +154,8 @@ class Doi extends Zend_Controller_Plugin_Abstract foreach($authors_en as $k=>$v) { $info[$k] = array( - 'author_en'=>str_replace("\"","",$authors_en[$k]), - 'organization_en'=>str_replace("\"","",$orgs_en[$k]), + 'author_en'=>str_replace("||||",",",str_replace("\"","",$authors_en[$k])), + 'organization_en'=>str_replace("||||",",",str_replace("\"","",$orgs_en[$k])), 'order'=> count($authors_en)+($k-1) ); } @@ -166,7 +168,23 @@ class Doi extends Zend_Controller_Plugin_Abstract /*$a = str_replace("{",'',$a); $a = str_replace("}",'',$a); $a = explode(",",$a); */ - return explode(',',substr($a,1,-1)); + //return explode(',',substr($a,1,-1)); + $regx1 = '/^{(.*)}$/'; + $regx2 = "/\"((\\\\\\\\|\\\\\"|[^\"])+)\"|[^,]+/"; + $regx3 = '/^[^"].*$|^"(.*)"$/'; + $match = null; + preg_match( $regx1,$a,$match); + $str = $match[1]; + preg_match_all($regx2, $str,$match); + $items = $match[0]; + $array = array(); + $count = count($items); + for($index = 0; $index < $count;++$index) + { + preg_match($regx3, $items[$index],$match); + $array[$index]=end($match); + } + return $array; } function view($id)