+ $dtstart = $happeningObj->element->getElementsByTagName('dtstart');
+ if($dtstart->length == 0) {
+ // TRANS: Exception thrown when has no start date
+ throw new Exception(_m('No start date for event.'));
+ }
+
+ $dtend = $happeningObj->element->getElementsByTagName('dtend');
+ if($dtend->length == 0) {
+ // TRANS: Exception thrown when has no end date
+ throw new Exception(_m('No end date for event.'));
+ }
+
+ // convert RFC3339 dates delivered in Activity Stream to MySQL DATETIME date format
+ $start_time = new DateTime($dtstart->item(0)->nodeValue);
+ $start_time->setTimezone(new DateTimeZone('UTC'));
+ $start_time = $start_time->format('Y-m-d H:i:s');
+ $end_time = new DateTime($dtend->item(0)->nodeValue);
+ $end_time->setTimezone(new DateTimeZone('UTC'));
+ $end_time = $end_time->format('Y-m-d H:i:s');
+
+ // location is optional
+ $location = null;
+ $location_object = $happeningObj->element->getElementsByTagName('location');
+ if($location_object->length > 0) {
+ $location = $location_object->item(0)->nodeValue;
+ }
+
+ // url is optional
+ $url = null;
+ $url_object = $happeningObj->element->getElementsByTagName('url');
+ if($url_object->length > 0) {
+ $url = $url_object->item(0)->nodeValue;
+ }
+