/modules/contrib/biblio/bibtexParse/PARSEENTRIES.php

https://github.com/mlncn/z-obsolete-scf · PHP · 615 lines · 401 code · 18 blank · 196 comment · 90 complexity · b0c6f8219e3db4e5da827c5e513f34b9 MD5 · raw file

  1. <?php
  2. /*
  3. v21
  4. Inspired by an awk BibTeX parser written by Nelson H. F. Beebe over 20 years ago although
  5. little of that remains.
  6. Released through http://bibliophile.sourceforge.net under the GPL licence.
  7. Do whatever you like with this -- some credit to the author(s) would be appreciated.
  8. A collection of PHP classes to manipulate bibtex files.
  9. If you make improvements, please consider contacting the administrators at bibliophile.sourceforge.net
  10. so that your improvements can be added to the release package.
  11. Mark Grimshaw 2006
  12. http://bibliophile.sourceforge.net
  13. (Amendments to file reading Daniel Pozzi for v1.1)
  14. 11/June/2005 - v1.53 Mark Grimshaw: Stopped expansion of @string when entry is enclosed in {...} or "..."
  15. 21/08/2004 v1.4 Guillaume Gardey, Added PHP string parsing and expand macro features.
  16. Fix bug with comments, strings macro.
  17. expandMacro = FALSE/TRUE to expand string macros.
  18. loadStringMacro($bibtex_string) to load a string. (array of lines)
  19. 22/08/2004 v1.4 Mark Grimshaw - a few adjustments to Guillaume's code.
  20. 28/04/2005 v1.5 Mark Grimshaw - a little debugging for @preamble
  21. 02/05/2005 G. Gardey - Add support for @string macro defined by curly brackets:
  22. @string{M12 = {December}}
  23. - Don't expand macro for bibtexCitation and bibtexEntryType
  24. - Better support for fields like journal = {Journal of } # JRNL23
  25. 03/05/2005 G. Gardey - Fix wrong field value parsing when an entry ends by
  26. someField = {value}}
  27. v2 ****************************************** v2
  28. 30/01/2006 v2.0 Esteban Zimanyi
  29. - Add support for @string defined by other strings as in @string( AA = BB # " xx " # C }
  30. - Add support for comments as defined in Bibtex, i.e., ignores everything that is outside
  31. entries delimited by '@' and the closing delimiter. In particular, comments in Bibtex do not
  32. necessarily have a % at the begining of the line !
  33. This required a complete rewrite of many functions as well as writing new ones !
  34. 31/01/2006 Mark Grimshaw
  35. - Ensured that @comment{...} is ignored in parseEntry().
  36. - Modified extractEntries() to ensure that entries where the start brace/parenthesis is on a
  37. new line are properly parsed.
  38. 10/02/2006 Mark Grimshaw
  39. - A 4th array, $this->undefinedStrings, is now returned that holds field values that are judged to be undefined strings.
  40. i.e. they are a non-numeric value that is not defined in a @string{...} entry and not enclosed by braces or double-quotes.
  41. This array will be empty unless the following condition is met:
  42. ($this->removeDelimit || $this->expandMacro && $this->fieldExtract)
  43. 24/04/2006 Esteban Zimanyi
  44. - When an undefined string is found in function removeDelimiters return the empty string
  45. - Return $this->undefinedStrings in the last position to allow compatibility with previous versions
  46. - Fix management of preamble in function returnArrays
  47. */
  48. // For a quick command-line test (php -f PARSEENTRIES.php) after installation, uncomment these lines:
  49. require_once(drupal_get_path('module', 'biblio') . '/biblio.contributors.inc');
  50. /*************************
  51. // Parse a file
  52. $parse = NEW PARSEENTRIES();
  53. $parse->expandMacro = TRUE;
  54. // $array = array("RMP" =>"Rev., Mod. Phys.");
  55. // $parse->loadStringMacro($array);
  56. // $parse->removeDelimit = FALSE;
  57. // $parse->fieldExtract = FALSE;
  58. $parse->openBib("bib.bib");
  59. $parse->extractEntries();
  60. $parse->closeBib();
  61. list($preamble, $strings, $entries, $undefinedStrings) = $parse->returnArrays();
  62. print_r($preamble);
  63. print "\n";
  64. print_r($strings);
  65. print "\n";
  66. print_r($entries);
  67. print "\n\n";
  68. *************************/
  69. /************************
  70. // Parse a bibtex PHP string
  71. $bibtex_data = <<< END
  72. @STRING{three = "THREE"}
  73. @STRING{two = "TWO"}
  74. @string{JRNL23 = {NatLA 23 } # " " # two # " " # three}
  75. @article{klitzing.1,
  76. author = "v. Klitzing and Dorda and Pepper",
  77. title = "New method for high mark@sirfragalot.com accuracy determination of fine structure constant based on quantized hall resistance",
  78. volume = "45",
  79. journal = {Journal of } # JRNL23,
  80. pages = "494",
  81. citeulike-article-id = {12222
  82. }
  83. ,
  84. ignoreMe = {blah}, }
  85. @article
  86. {
  87. klitzing.2,
  88. author = "Klaus von Klitzing",
  89. title = "The Quantized Hall Effect",
  90. volume = "58",
  91. journal = two,
  92. pages = "519",
  93. }
  94. END;
  95. $parse = NEW PARSEENTRIES();
  96. $parse->expandMacro = TRUE;
  97. // $parse->removeDelimit = FALSE;
  98. // $parse->fieldExtract = FALSE;
  99. $array = array("RMP" =>"Rev., Mod. Phys.");
  100. $parse->loadStringMacro($array);
  101. $parse->loadBibtexString($bibtex_data);
  102. $parse->extractEntries();
  103. list($preamble, $strings, $entries, $undefinedStrings) = $parse->returnArrays();
  104. print_r($preamble);
  105. print "\n";
  106. print_r($strings);
  107. print "\n";
  108. print_r($entries);
  109. print "\n\n";
  110. **********************/
  111. class PARSEENTRIES
  112. {
  113. function PARSEENTRIES()
  114. {
  115. $this->preamble = $this->strings = $this->undefinedStrings = $this->entries = array();
  116. $this->count = 0;
  117. $this->fieldExtract = TRUE;
  118. $this->removeDelimit = TRUE;
  119. $this->expandMacro = FALSE;
  120. $this->parseFile = TRUE;
  121. $this->outsideEntry = TRUE;
  122. }
  123. // Open bib file
  124. function openBib($file)
  125. {
  126. if(!is_file($file))
  127. die;
  128. $this->fid = fopen ($file,'r');
  129. $this->parseFile = TRUE;
  130. }
  131. // Load a bibtex string to parse it
  132. function loadBibtexString($bibtex_string)
  133. {
  134. if(is_string($bibtex_string))
  135. $this->bibtexString = explode("\n",$bibtex_string);
  136. else
  137. $this->bibtexString = $bibtex_string;
  138. $this->parseFile = FALSE;
  139. $this->currentLine = 0;
  140. }
  141. // Set strings macro
  142. function loadStringMacro($macro_array)
  143. {
  144. $this->userStrings = $macro_array;
  145. }
  146. // Close bib file
  147. function closeBib()
  148. {
  149. fclose($this->fid);
  150. }
  151. // Get a non-empty line from the bib file or from the bibtexString
  152. function getLine()
  153. {
  154. if($this->parseFile)
  155. {
  156. if(!feof($this->fid))
  157. {
  158. do
  159. {
  160. $line = trim(fgets($this->fid));
  161. }
  162. while(!feof($this->fid) && !$line);
  163. return $line;
  164. }
  165. return FALSE;
  166. }
  167. else
  168. {
  169. do
  170. {
  171. $line = trim($this->bibtexString[$this->currentLine]);
  172. $this->currentLine++;
  173. }
  174. while($this->currentLine < count($this->bibtexString) && !$line);
  175. return $line;
  176. }
  177. }
  178. // Extract value part of @string field enclosed by double-quotes or braces.
  179. // The string may be expanded with previously-defined strings
  180. function extractStringValue($string)
  181. {
  182. // $string contains a end delimiter, remove it
  183. $string = trim(substr($string,0,strlen($string)-1));
  184. // remove delimiters and expand
  185. $string = $this->removeDelimitersAndExpand($string);
  186. return $string;
  187. }
  188. // Extract a field
  189. function fieldSplit($seg)
  190. {
  191. // echo "**** ";print_r($seg);echo "<BR>";
  192. // handle fields like another-field = {}
  193. $array = preg_split("/,\s*([-_.:,a-zA-Z0-9]+)\s*={1}\s*/U", $seg, PREG_SPLIT_DELIM_CAPTURE);
  194. // echo "**** ";print_r($array);echo "<BR>";
  195. //$array = preg_split("/,\s*(\w+)\s*={1}\s*/U", $seg, PREG_SPLIT_DELIM_CAPTURE);
  196. if(!array_key_exists(1, $array))
  197. return array($array[0], FALSE);
  198. return array($array[0], $array[1]);
  199. }
  200. // Extract and format fields
  201. function reduceFields($oldString)
  202. {
  203. // 03/05/2005 G. Gardey. Do not remove all occurences, juste one
  204. // * correctly parse an entry ended by: somefield = {aValue}}
  205. $lg = strlen($oldString);
  206. if($oldString[$lg-1] == "}" || $oldString[$lg-1] == ")" || $oldString[$lg-1] == ",")
  207. $oldString = substr($oldString,0,$lg-1);
  208. // $oldString = rtrim($oldString, "}),");
  209. $split = preg_split("/=/", $oldString, 2);
  210. $string = $split[1];
  211. while($string)
  212. {
  213. list($entry, $string) = $this->fieldSplit($string);
  214. $values[] = $entry;
  215. }
  216. foreach($values as $value)
  217. {
  218. $pos = strpos($oldString, $value);
  219. $oldString = substr_replace($oldString, '', $pos, strlen($value));
  220. }
  221. $rev = strrev(trim($oldString));
  222. if($rev{0} != ',')
  223. $oldString .= ',';
  224. $keys = preg_split("/=,/", $oldString);
  225. // 22/08/2004 - Mark Grimshaw
  226. // I have absolutely no idea why this array_pop is required but it is. Seems to always be
  227. // an empty key at the end after the split which causes problems if not removed.
  228. array_pop($keys);
  229. foreach($keys as $key)
  230. {
  231. $value = trim(array_shift($values));
  232. $rev = strrev($value);
  233. // remove any dangling ',' left on final field of entry
  234. if($rev{0} == ',')
  235. $value = rtrim($value, ",");
  236. if(!$value)
  237. continue;
  238. // 21/08/2004 G.Gardey -> expand macro
  239. // Don't remove delimiters now needs to know if the value is a string macro
  240. // $this->entries[$this->count][strtolower(trim($key))] = trim($this->removeDelimiters(trim($value)));
  241. $key = strtolower(trim($key));
  242. $value = trim($value);
  243. $this->entries[$this->count][$key] = $value;
  244. }
  245. // echo "**** ";print_r($this->entries[$this->count]);echo "<BR>";
  246. }
  247. // Start splitting a bibtex entry into component fields.
  248. // Store the entry type and citation.
  249. function fullSplit($entry)
  250. {
  251. $matches = preg_split("/@(.*)[{(](.*),/U", $entry, 2, PREG_SPLIT_DELIM_CAPTURE);
  252. $this->entries[$this->count]['bibtexEntryType'] = strtolower(trim($matches[1]));
  253. // sometimes a bibtex entry will have no citation key
  254. if(preg_match("/=/", $matches[2])) // this is a field
  255. $matches = preg_split("/@(.*)\s*[{(](.*)/U", $entry, 2, PREG_SPLIT_DELIM_CAPTURE);
  256. // print_r($matches); print "<P>";
  257. $this->entries[$this->count]['bibtexCitation'] = $matches[2];
  258. $this->reduceFields($matches[3]);
  259. }
  260. // Grab a complete bibtex entry
  261. function parseEntry($entry)
  262. {
  263. $count = 0;
  264. $lastLine = FALSE;
  265. if(preg_match("/@(.*)([{(])/U", preg_quote($entry), $matches))
  266. {
  267. if(!array_key_exists(1, $matches))
  268. return $lastLine;
  269. if(preg_match("/string/i", trim($matches[1])))
  270. $this->strings[] = $entry;
  271. else if(preg_match("/preamble/i", trim($matches[1])))
  272. $this->preamble[] = $entry;
  273. else if(preg_match("/comment/i", $matches[1])); // MG (31/Jan/2006) -- ignore @comment
  274. else
  275. {
  276. if($this->fieldExtract)
  277. $this->fullSplit($entry);
  278. else
  279. $this->entries[$this->count] = $entry;
  280. $this->count++;
  281. }
  282. return $lastLine;
  283. }
  284. }
  285. // Remove delimiters from a string
  286. function removeDelimiters($string)
  287. {
  288. if($string && ($string{0} == "\""))
  289. {
  290. $string = substr($string, 1);
  291. $string = substr($string, 0, -1);
  292. }
  293. else if($string && ($string{0} == "{"))
  294. {
  295. if(strlen($string) > 0 && $string[strlen($string)-1] == "}")
  296. {
  297. $string = substr($string, 1);
  298. $string = substr($string, 0, -1);
  299. }
  300. }
  301. else if(!is_numeric($string) && !array_key_exists($string, $this->strings)
  302. && (array_search($string, $this->undefinedStrings) === FALSE))
  303. {
  304. $this->undefinedStrings[] = $string; // Undefined string that is not a year etc.
  305. return '';
  306. }
  307. return $string;
  308. }
  309. // This function works like explode('#',$val) but has to take into account whether
  310. // the character # is part of a string (i.e., is enclosed into "..." or {...} )
  311. // or defines a string concatenation as in @string{ "x # x" # ss # {xx{x}x} }
  312. function explodeString($val)
  313. {
  314. $openquote = $bracelevel = $i = $j = 0;
  315. while ($i < strlen($val))
  316. {
  317. if ($val[$i] == '"')
  318. $openquote = !$openquote;
  319. elseif ($val[$i] == '{')
  320. $bracelevel++;
  321. elseif ($val[$i] == '}')
  322. $bracelevel--;
  323. elseif ( $val[$i] == '#' && !$openquote && !$bracelevel )
  324. {
  325. $strings[] = substr($val,$j,$i-$j);
  326. $j=$i+1;
  327. }
  328. $i++;
  329. }
  330. $strings[] = substr($val,$j);
  331. return $strings;
  332. }
  333. // This function receives a string and a closing delimiter '}' or ')'
  334. // and looks for the position of the closing delimiter taking into
  335. // account the following Bibtex rules:
  336. // * Inside the braces, there can arbitrarily nested pairs of braces,
  337. // but braces must also be balanced inside quotes!
  338. // * Inside quotes, to place the " character it is not sufficient
  339. // to simply escape with \": Quotes must be placed inside braces.
  340. function closingDelimiter($val,$delimitEnd)
  341. {
  342. // echo "####>$delimitEnd $val<BR>";
  343. $openquote = $bracelevel = $i = $j = 0;
  344. while ($i < strlen($val))
  345. {
  346. // a '"' found at brace level 0 defines a value such as "ss{\"o}ss"
  347. if ($val[$i] == '"' && !$bracelevel)
  348. $openquote = !$openquote;
  349. elseif ($val[$i] == '{')
  350. $bracelevel++;
  351. elseif ($val[$i] == '}')
  352. $bracelevel--;
  353. if ( $val[$i] == $delimitEnd && !$openquote && !$bracelevel )
  354. return $i;
  355. $i++;
  356. }
  357. // echo "--> $bracelevel, $openquote";
  358. return 0;
  359. }
  360. // Remove enclosures around entry field values. Additionally, expand macros if flag set.
  361. function removeDelimitersAndExpand($string, $inpreamble = FALSE)
  362. {
  363. // only expand the macro if flag set, if strings defined and not in preamble
  364. if(!$this->expandMacro || empty($this->strings) || $inpreamble)
  365. $string = $this->removeDelimiters($string);
  366. else
  367. {
  368. $stringlist = $this->explodeString($string);
  369. $string = "";
  370. foreach ($stringlist as $str)
  371. {
  372. // trim the string since usually # is enclosed by spaces
  373. $str = trim($str);
  374. // replace the string if macro is already defined
  375. // strtolower is used since macros are case insensitive
  376. if (isset($this->strings[strtolower($str)]))
  377. $string .= $this->strings[strtolower($str)];
  378. else
  379. $string .= $this->removeDelimiters(trim($str));
  380. }
  381. }
  382. return $string;
  383. }
  384. // This function extract entries taking into account how comments are defined in BibTeX.
  385. // BibTeX splits the file in two areas: inside an entry and outside an entry, the delimitation
  386. // being indicated by the presence of a @ sign. When this character is met, BibTex expects to
  387. // find an entry. Before that sign, and after an entry, everything is considered a comment!
  388. function extractEntries()
  389. {
  390. $inside = $possibleEntryStart = FALSE;
  391. $entry="";
  392. while($line=$this->getLine())
  393. {
  394. if($possibleEntryStart)
  395. $line = $possibleEntryStart . $line;
  396. if (!$inside && strchr($line,"@"))
  397. {
  398. // throw all characters before the '@'
  399. $line=strstr($line,'@');
  400. if(!strchr($line, "{") && !strchr($line, "("))
  401. $possibleEntryStart = $line;
  402. elseif(preg_match("/@.*([{(])/U", preg_quote($line), $matches))
  403. {
  404. $inside = TRUE;
  405. if ($matches[1] == '{')
  406. $delimitEnd = '}';
  407. else
  408. $delimitEnd = ')';
  409. $possibleEntryStart = FALSE;
  410. }
  411. }
  412. if ($inside)
  413. {
  414. $entry .= " ".$line;
  415. if ($j=$this->closingDelimiter($entry,$delimitEnd))
  416. {
  417. // all characters after the delimiter are thrown but the remaining
  418. // characters must be kept since they may start the next entry !!!
  419. $lastLine = substr($entry,$j+1);
  420. $entry = substr($entry,0,$j+1);
  421. // Strip excess whitespaces from the entry
  422. $entry = preg_replace('/\s\s+/', ' ', $entry);
  423. $this->parseEntry($entry);
  424. $entry = strchr($lastLine,"@");
  425. if ($entry)
  426. $inside = TRUE;
  427. else
  428. $inside = FALSE;
  429. }
  430. }
  431. }
  432. }
  433. // Return arrays of entries etc. to the calling process.
  434. function returnArrays()
  435. {
  436. foreach($this->preamble as $value)
  437. {
  438. preg_match("/.*?[{(](.*)/", $value, $matches);
  439. $preamble = substr($matches[1], 0, -1);
  440. $preambles['bibtexPreamble'] = trim($this->removeDelimitersAndExpand(trim($preamble), TRUE));
  441. }
  442. if(isset($preambles))
  443. $this->preamble = $preambles;
  444. if($this->fieldExtract)
  445. {
  446. // Next lines must take into account strings defined by previously-defined strings
  447. $strings = $this->strings;
  448. // $this->strings is initialized with strings provided by user if they exists
  449. // it is supposed that there are no substitutions to be made in the user strings, i.e., no #
  450. $this->strings = isset($this->userStrings) ? $this->userStrings : array() ;
  451. foreach($strings as $value)
  452. {
  453. // changed 21/08/2004 G. Gardey
  454. // 23/08/2004 Mark G. account for comments on same line as @string - count delimiters in string value
  455. $value = trim($value);
  456. $matches = preg_split("/@\s*string\s*([{(])/i", $value, 2, PREG_SPLIT_DELIM_CAPTURE);
  457. $delimit = $matches[1];
  458. $matches = preg_split("/=/", $matches[2], 2, PREG_SPLIT_DELIM_CAPTURE);
  459. // macros are case insensitive
  460. $this->strings[strtolower(trim($matches[0]))] = $this->extractStringValue($matches[1]);
  461. }
  462. }
  463. // changed 21/08/2004 G. Gardey
  464. // 22/08/2004 Mark Grimshaw - stopped useless looping.
  465. // removeDelimit and expandMacro have NO effect if !$this->fieldExtract
  466. if($this->removeDelimit || $this->expandMacro && $this->fieldExtract)
  467. {
  468. for($i = 0; $i < count($this->entries); $i++)
  469. {
  470. foreach($this->entries[$i] as $key => $value)
  471. // 02/05/2005 G. Gardey don't expand macro for bibtexCitation
  472. // and bibtexEntryType
  473. if($key != 'bibtexCitation' && $key != 'bibtexEntryType')
  474. $this->entries[$i][$key] = trim($this->removeDelimitersAndExpand($this->entries[$i][$key]));
  475. }
  476. }
  477. // EZ: Remove this to be able to use the same instance for parsing several files,
  478. // e.g., parsing a entry file with its associated abbreviation file
  479. // if(empty($this->preamble))
  480. // $this->preamble = FALSE;
  481. // if(empty($this->strings))
  482. // $this->strings = FALSE;
  483. // if(empty($this->entries))
  484. // $this->entries = FALSE;
  485. return array($this->preamble, $this->strings, $this->entries, $this->undefinedStrings);
  486. }
  487. function bib2node(&$node_array, $node){
  488. list($preamble, $strings, $entries, $undefinedStrings) = $this->returnArrays();
  489. foreach($entries as $entry){
  490. $node_id = array_push($node_array, $node) - 1;
  491. $node_array[$node_id]['biblio_contributors'] = array();
  492. switch ($entry['bibtexEntryType']){
  493. case article:
  494. $node_array[$node_id]['biblio_type'] = 102;
  495. break;
  496. case book:
  497. $node_array[$node_id]['biblio_type'] = 100;
  498. break;
  499. case booklet:
  500. case inbook:
  501. $node_array[$node_id]['biblio_type'] = 101;
  502. break;
  503. case conference:
  504. $node_array[$node_id]['biblio_type'] = 103;
  505. break;
  506. case incollection:
  507. $node_array[$node_id]['biblio_type'] = 100;
  508. break;
  509. case inproceedings:
  510. $node_array[$node_id]['biblio_type'] = 103;
  511. break;
  512. case manual:
  513. $node_array[$node_id]['biblio_type'] = 129;
  514. break;
  515. case mastersthesis:
  516. $node_array[$node_id]['biblio_type'] = 108;
  517. break;
  518. case misc:
  519. $node_array[$node_id]['biblio_type'] = 129;
  520. break;
  521. case phdthesis:
  522. $node_array[$node_id]['biblio_type'] = 108;
  523. break;
  524. case proceedings:
  525. $node_array[$node_id]['biblio_type'] = 104;
  526. break;
  527. case techreport:
  528. $node_array[$node_id]['biblio_type'] = 109;
  529. break;
  530. case unpublished:
  531. $node_array[$node_id]['biblio_type'] = 124;
  532. break;
  533. }
  534. if (!empty($entry['author'])){
  535. // split on ' and '
  536. $authorArray = preg_split("/\s(and|&)\s/i", trim($entry['author']));
  537. foreach ($authorArray as $key => $author)
  538. {
  539. $node_array[$node_id]['biblio_contributors'][]= array('name' => utf8_encode($author), 'ctid' => 1);
  540. }
  541. }
  542. if (!empty($entry['bibtexCitation'])) $node_array[$node_id]['biblio_citekey'] = $entry['bibtexCitation'];
  543. if (!empty($entry['editor']))
  544. {
  545. $authorArray = preg_split("/\s(and|&)\s/i", trim($entry['editor']));
  546. foreach ($authorArray as $key => $author)
  547. {
  548. $node_array[$node_id]['biblio_contributors'][]= array('name' => utf8_encode($author), 'ctid' => 2);
  549. }
  550. }
  551. if (!empty($entry['journal']))$node_array[$node_id]['biblio_secondary_title'] = $entry['journal'];
  552. if (!empty($entry['booktitle']))$node_array[$node_id]['biblio_secondary_title'] = $entry['booktitle'];
  553. if (!empty($entry['series']))$node_array[$node_id]['biblio_secondary_title'] = $entry['series'];
  554. if (!empty($entry['volume'])) $node_array[$node_id]['biblio_volume'] = $entry['volume'];
  555. if (!empty($entry['number'])) $node_array[$node_id]['biblio_number'] = $entry['number'];
  556. if (!empty($entry['year'])) $node_array[$node_id]['biblio_year'] = $entry['year'];
  557. if (!empty($entry['note'])) $node_array[$node_id]['biblio_notes'] = $entry['note'];
  558. if (!empty($entry['month'])) $node_array[$node_id]['biblio_date'] = $entry['month'];
  559. if (!empty($entry['pages'])) $node_array[$node_id]['biblio_pages'] = $entry['pages'];
  560. if (!empty($entry['publisher'])) $node_array[$node_id]['biblio_publisher'] = $entry['publisher'];
  561. if (!empty($entry['organization'])) $node_array[$node_id]['biblio_publisher'] = $entry['organization'];
  562. if (!empty($entry['school'])) $node_array[$node_id]['biblio_publisher'] = $entry['school'];
  563. if (!empty($entry['institution'])) $node_array[$node_id]['biblio_publisher'] = $entry['institution'];
  564. if (!empty($entry['title'])) $node_array[$node_id]['title'] = $entry['title'];
  565. if (!empty($entry['type'])) $node_array[$node_id]['biblio_type_of_work'] = $entry['type'];
  566. if (!empty($entry['edition'])) $node_array[$node_id]['biblio_edition'] = $entry['edition'];
  567. if (!empty($entry['chapter'])) $node_array[$node_id]['biblio_section'] = $entry['chapter'];
  568. if (!empty($entry['address'])) $node_array[$node_id]['biblio_place_published'] = $entry['address'];
  569. if (!empty($entry['abstract'])) $node_array[$node_id]['biblio_abst_e'] = $entry['abstract'];
  570. if (!empty($entry['keywords'])) $node_array[$node_id]['biblio_keywords'] = $entry['keywords'];
  571. if (!empty($entry['isbn'])) $node_array[$node_id]['biblio_isbn'] = $entry['isbn'];
  572. if (!empty($entry['url'])) $node_array[$node_id]['biblio_url'] = $entry['url'];
  573. }
  574. }
  575. }
  576. ?>