public function testExpand() { $this->assertSame('D:displayname', DAV::expand('DAV: displayname'), 'DAV::expand() should return correct value when called with property in the DAV namespace'); $this->assertSame('testproperty xmlns="tests://tests/"', DAV::expand('tests://tests/ testproperty'), 'DAV::expand() should return correct value when called with property in custom namespace'); }
/** * Returns the ACL restrictions in XML format * * @return string XML */ public final function prop_acl_restrictions() { $retval = ''; foreach ($this->user_prop_acl_restrictions() as $restriction) { if (is_array($restriction)) { // An array of required principals $retval .= "\n<D:required-principal>"; foreach ($restriction as $principal) { if ($p = @DAVACL::$PRINCIPALS[$principal]) { $retval .= "\n{$p}"; } elseif ('/' === $principal[0]) { $retval .= "\n<D:href>" . DAV::xmlescape(DAV::encodeURIFullPath($principal)) . '</D:href>'; } else { $retval .= "\n<D:property><" . DAV::expand($principal) . '/></D:property>'; } } $retval .= "\n</D:required-principal>"; } else { // Normal predefined restrictions: $retval .= '<' . DAV::expand($restriction) . '/>'; } } return $retval; }