27 public const LINE_REGEX =
'/^(([A-Z1-9]{2})\s+-(.*))|(.*)$/';
50 $contents = explode(self::RIS_EOL, $string);
66 foreach ($lines as $line) {
67 $line = trim((
string) $line);
70 preg_match(self::LINE_REGEX, $line, $matches);
71 if (!empty($matches[3])) {
72 $lastTag = $matches[2];
73 $record[$matches[2]][] = trim($matches[3]);
75 elseif (!empty($matches[2]) && $matches[2] ===
'ER') {
77 $recordset[] = $record;
79 } elseif (!empty($matches[4])) {
82 if (!empty($lastTag)) {
83 $lastEntry = count($record[$lastTag]) - 1;
86 $record[$lastTag][$lastEntry] .=
' ' . trim($matches[4]);
91 $recordset[] = $record;
94 $this->data = $recordset;
119 if (substr((
string) $first, 0, 3) === pack(
'CCC', 0xef, 0xbb, 0xbf)) {
120 $lines[0] = substr((
string) $first, 3);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
cleanData(array &$lines)
Clean up the data before processing.
parseString(string $string)
Parse a string of RIS data.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
parseArray(array $lines)
Take an array of lines and parse them into an RIS record.