private static function readEvents($xml) { $events = array(); foreach ($xml->event_fact as $o) { $type = (string) $o['type']; $stdType = MergeForm::getStdType($type); $date = (string) $o['date']; $stdDate = (string) StructuredData::getDateKey($date); $place = (string) $o['place']; $stdPlace = StructuredData::getPlaceKey($place); $desc = (string) $o['desc']; // sometimes people put the references in the wrong fields, so gather them all together list($sources, $images, $notes) = MergeForm::readSourcesImagesNotes((string) $o['sources'], (string) $o['images'], (string) $o['notes']); $key = 'EVENT|' . $type . '|' . $date . '|' . $place . '|' . $desc . '|' . $sources . '|' . $notes . '|' . $images; $events[] = array('type' => $type, 'stdtype' => $stdType, 'date' => $date, 'stddate' => $stdDate, 'place' => $place, 'stdplace' => $stdPlace, 'description' => $desc, 'sources' => $sources, 'notes' => $notes, 'images' => $images, 'key' => $key); } return $events; }