/** * Parses a webdav lock xml body, and returns a new Sabre_DAV_Locks_LockInfo object * * @param string $body * @return Sabre_DAV_Locks_LockInfo */ protected function parseLockRequest($body) { $xml = simplexml_load_string(Sabre_DAV_XMLUtil::convertDAVNamespace($body), null, LIBXML_NOWARNING); $xml->registerXPathNamespace('d', 'urn:DAV'); $lockInfo = new Sabre_DAV_Locks_LockInfo(); $children = $xml->children("urn:DAV"); $lockInfo->owner = (string) $children->owner; $lockInfo->token = Sabre_DAV_UUIDUtil::getUUID(); $lockInfo->scope = count($xml->xpath('d:lockscope/d:exclusive')) > 0 ? Sabre_DAV_Locks_LockInfo::EXCLUSIVE : Sabre_DAV_Locks_LockInfo::SHARED; return $lockInfo; }
/** * Creates a new calendar for a principal. * * If the creation was a success, an id must be returned that can be used to reference * this calendar in other methods, such as updateCalendar. * * This function must return a server-wide unique id that can be used * later to reference the calendar. * * @param string $principalUri * @param string $calendarUri * @param array $properties * @return string|int */ function createCalendar($principalUri, $calendarUri, array $properties) { $id = Sabre_DAV_UUIDUtil::getUUID(); $this->calendars[] = array_merge(array('id' => $id, 'principaluri' => $principalUri, 'uri' => $calendarUri, '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT', 'VTODO'))), $properties); return $id; }