62  const RIS_EOL = 
"\r\n";
 
   63  const LINE_REGEX = 
'/^(([A-Z1-9]{2})\s+-(.*))|(.*)$/';
 
   89    $flags = FILE_SKIP_EMPTY_LINES | FILE_TEXT;
 
  109    $contents = explode (RISReader::RIS_EOL, $string);
 
  117    $recordset = array();
 
  120    $this->cleanData($lines);
 
  124    foreach ($lines as $line) {
 
  128      preg_match(self::LINE_REGEX, $line, $matches);
 
  129      if (!empty($matches[3])) {
 
  130        $lastTag = $matches[2];
 
  131        $record[$matches[2]][] = trim($matches[3]);
 
  134      elseif (!empty($matches[2]) && $matches[2] == 
'ER') {
 
  136        $recordset[] = $record;
 
  139      elseif (!empty($matches[4])) {
 
  142        if (!empty($lastTag)) {
 
  143          $lastEntry = count($record[$lastTag]) - 1;
 
  146          $record[$lastTag][$lastEntry] .= 
' ' . trim($matches[4]);
 
  150    if (!empty($record)) $recordset[] = $record;
 
  152    $this->data = $recordset;
 
  160    $format = 
"%s:\n\t%s\n";
 
  161    foreach ($this->data as $record) {
 
  162      foreach ($record as $key => $values) {
 
  163        foreach ($values as $value) {
 
  164          printf($format, RISTags::describeTag($key), $value);
 
  180    if (empty($lines)) 
return;
 
  187    if (substr($first, 0, 3) == pack(
'CCC', 0xef, 0xbb, 0xbf)) {
 
  188      $lines[0] = substr($first, 3);
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
The main class for parsing RIS files.
parseFile($filename, $context=NULL)
Parse an RIS file.
cleanData(&$lines)
Clean up the data before processing.
parseArray($lines)
Take an array of lines and parse them into an RIS record.
__construct($options=array())
parseString($string)
Parse a string of RIS data.
This is a library for parsing RIS files.
if(!is_array($argv)) $options