本文整理汇总了PHP中Sabre_DAV_Server::updateProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP Sabre_DAV_Server::updateProperties方法的具体用法?PHP Sabre_DAV_Server::updateProperties怎么用?PHP Sabre_DAV_Server::updateProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre_DAV_Server
的用法示例。
在下文中一共展示了Sabre_DAV_Server::updateProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateProperties
/**
* This event is triggered when a PROPPATCH method is executed
*
* @param array $mutations
* @param array $result
* @param Sabre_DAV_INode $node
* @return void
*/
public function updateProperties(&$mutations, &$result, $node)
{
if (!$node instanceof Sabre_CardDAV_UserAddressBooks) {
return true;
}
$meCard = '{http://calendarserver.org/ns/}me-card';
// The only property we care about
if (!isset($mutations[$meCard])) {
return true;
}
$value = $mutations[$meCard];
unset($mutations[$meCard]);
if ($value instanceof Sabre_DAV_Property_IHref) {
$value = $value->getHref();
$value = $this->server->calculateUri($value);
} elseif (!is_null($value)) {
$result[400][$meCard] = null;
return false;
}
$innerResult = $this->server->updateProperties($node->getOwner(), array('{http://sabredav.org/ns}vcard-url' => $value));
$closureResult = false;
foreach ($innerResult as $status => $props) {
if (is_array($props) && array_key_exists('{http://sabredav.org/ns}vcard-url', $props)) {
$result[$status][$meCard] = null;
$closureResult = $status >= 200 && $status < 300;
}
}
return $result;
}
示例2: testUpdatePropertiesEventSuccess
function testUpdatePropertiesEventSuccess()
{
$tree = array(new Sabre_DAV_SimpleDirectory('foo'));
$server = new Sabre_DAV_Server($tree);
$server->subscribeEvent('updateProperties', array($this, 'updatepropsuccess'));
$result = $server->updateProperties('foo', array('{DAV:}foo' => 'bar', '{DAV:}foo2' => 'bla'));
$expected = array('href' => 'foo', '200' => array('{DAV:}foo' => null), '201' => array('{DAV:}foo2' => null));
$this->assertEquals($expected, $result);
}
示例3: testSetBadNode
public function testSetBadNode()
{
$tree = array(new Sabre_DAV_SimpleCollection('foo'));
$server = new Sabre_DAV_Server($tree);
$server->addPlugin(new Sabre_DAVACL_Plugin());
$result = $server->updateProperties('foo', array('{DAV:}group-member-set' => new Sabre_DAV_Property_HrefList(array('bar', 'baz')), '{DAV:}bar' => 'baz'));
$expected = array('href' => 'foo', '403' => array('{DAV:}group-member-set' => null), '424' => array('{DAV:}bar' => null));
$this->assertEquals($expected, $result);
}