Esempio n. 1
0
 /**
  * Generates a WebDAV propfind response body based on a list of nodes
  *
  * @param array $fileProperties The list with nodes
  * @return string
  */
 public function generateMultiStatus(array $fileProperties)
 {
     $dom = new DOMDocument('1.0', 'utf-8');
     //$dom->formatOutput = true;
     $multiStatus = $dom->createElement('d:multistatus');
     $dom->appendChild($multiStatus);
     // Adding in default namespaces
     foreach ($this->xmlNamespaces as $namespace => $prefix) {
         $multiStatus->setAttribute('xmlns:' . $prefix, $namespace);
     }
     foreach ($fileProperties as $entry) {
         $href = $entry['href'];
         unset($entry['href']);
         $response = new Sabre_DAV_Property_Response($href, $entry);
         $response->serialize($this, $multiStatus);
     }
     return $dom->saveXML();
 }
 /**
  * @depends testSerialize
  * @expectedException Sabre_DAV_Exception
  */
 function testSerializeBreak()
 {
     $innerProps = array(200 => array('{DAV:}link' => new STDClass()));
     $property = new Sabre_DAV_Property_Response('uri', $innerProps);
     $doc = new DOMDocument();
     $root = $doc->createElement('d:root');
     $root->setAttribute('xmlns:d', 'DAV:');
     $doc->appendChild($root);
     $objectTree = new Sabre_DAV_ObjectTree(new Sabre_DAV_SimpleCollection('rootdir'));
     $server = new Sabre_DAV_Server($objectTree);
     $property->serialize($server, $root);
 }