You are here

function biblio_ipni_process_file in Biblio Autocomplete 7

Same name and namespace in other branches
  1. 6 plugins/biblio_ipni/biblio_ipni.module \biblio_ipni_process_file()

IPNI data is delimited by newlines and the % character, this function parses this format into an array

Parameters

$file: Input file from IPNI

Return value

$ipni_matches An array of data parsed from $file

3 calls to biblio_ipni_process_file()
biblio_ipni_get_author_data in plugins/biblio_ipni/biblio_ipni.module
Function to get author data from IPNI
biblio_ipni_get_publication_data in plugins/biblio_ipni/biblio_ipni.module
Function to get publication data from IPNI
biblio_ipni_get_publication_data_short in plugins/biblio_ipni/biblio_ipni.module
Function to get short publication data from IPNI

File

plugins/biblio_ipni/biblio_ipni.module, line 176
Provides autocompletion of Biblio fields from IPNI.

Code

function biblio_ipni_process_file($file) {
  $ipni_result = explode("\n", $file);
  $i = 0;
  $ipni_matches = array();
  foreach ($ipni_result as $result) {
    $i++;
    $ipni_matches[] = explode('%', $result);
    if ($i > 10) {
      break;
    }
  }
  array_shift($ipni_matches);
  array_walk($ipni_matches, 'biblio_ipni_clean');
  return $ipni_matches;
}