public function testParse_hrefs() { $_SERVER['SERVER_NAME'] = 'example.com'; $_SERVER['SERVER_PORT'] = 80; $this->assertSame(0, count(DAVACL::parse_hrefs('http://example.com')->URIs), 'DAVACL::parse_hrefs() should not parse the URL if it is not an XML piece'); $this->assertSame('/some/path/to/somewhere', DAVACL::parse_hrefs('<D:href>http://example.com/some/path/to/somewhere</D:href>')->URIs[0], 'DAVACL::parse_hrefs() should not change the URL if it is not an XML piece'); }
/** * Set the sponsor of this resource * @param string $sponsor The path to the new sponsor in an XML piece (<D:href></D:href>) * @return void */ public final function set_sponsor($sponsor) { $sponsor = DAVACL::parse_hrefs($sponsor); if (1 !== count($sponsor->URIs)) { throw new DAV_Status(DAV::HTTP_BAD_REQUEST, 'Illegal value for property sponsor.'); } $this->user_set_sponsor($sponsor->URIs[0]); }
/** * Sets the DAV: group-member-set property * * @param string $set an XML fragment * @see DAVACL_Principal */ public final function set_group_member_set($set) { $set = DAVACL::parse_hrefs($set)->URIs; return $this->user_set_group_member_set($set); }