Пример #1
0
 /**
  * Parses a piece of XML with <D:href> pieces
  * 
  * @param string $hrefs
  * @return DAV_Element_href
  * @throws DAV_Status
  */
 public static function parse_hrefs($hrefs)
 {
     $href = new DAV_Element_href();
     if (!preg_match('@^\\s*(?:<D:href(?:\\s+[^>]*)?>\\s*[^\\s<]+\\s*</D:href>\\s*)*$@', $hrefs)) {
         return $href;
     }
     preg_match_all('@<D:href(?:\\s+[^>]*)?>\\s*([^\\s<]+)\\s*</D:href>@', $hrefs, $matches);
     foreach ($matches[1] as $match) {
         $href->addURI(DAV::parseURI($match, false));
     }
     return $href;
 }
Пример #2
0
 public function testToString()
 {
     $obj = new DAV_Element_href(array('/path1', '/path2'));
     $this->assertSame('<D:href>/path1</D:href><D:href>/path2</D:href>', str_replace("\n", '', $obj->__toString()), 'DAV_Element_href::__toString() should return a correct piece of XML');
 }