本文整理匯總了PHP中Sabre\DAV\INode::updateShares方法的典型用法代碼示例。如果您正苦於以下問題:PHP INode::updateShares方法的具體用法?PHP INode::updateShares怎麽用?PHP INode::updateShares使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sabre\DAV\INode
的用法示例。
在下文中一共展示了INode::updateShares方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updateProperties
/**
* This method is trigged when a user attempts to update a node's
* properties.
*
* A previous draft of the sharing spec stated that it was possible to use
* PROPPATCH to remove 'shared-owner' from the resourcetype, thus unsharing
* the calendar.
*
* Even though this is no longer in the current spec, we keep this around
* because OS X 10.7 may still make use of this feature.
*
* @param array $mutations
* @param array $result
* @param DAV\INode $node
* @return void
*/
public function updateProperties(array &$mutations, array &$result, DAV\INode $node)
{
if (!$node instanceof IShareableCalendar) {
return;
}
if (!isset($mutations['{DAV:}resourcetype'])) {
return;
}
// Only doing something if shared-owner is indeed not in the list.
if ($mutations['{DAV:}resourcetype']->is('{' . Plugin::NS_CALENDARSERVER . '}shared-owner')) {
return;
}
$shares = $node->getShares();
$remove = array();
foreach ($shares as $share) {
$remove[] = $share['href'];
}
$node->updateShares(array(), $remove);
// We're marking this update as 200 OK
$result[200]['{DAV:}resourcetype'] = null;
// Removing it from the mutations list
unset($mutations['{DAV:}resourcetype']);
}