本文整理汇总了PHP中Sabre\DAV\INode::getSharedUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP INode::getSharedUrl方法的具体用法?PHP INode::getSharedUrl怎么用?PHP INode::getSharedUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\DAV\INode
的用法示例。
在下文中一共展示了INode::getSharedUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeGetProperties
/**
* This event is triggered when properties are requested for a certain
* node.
*
* This allows us to inject any properties early.
*
* @param string $path
* @param DAV\INode $node
* @param array $requestedProperties
* @param array $returnedProperties
* @return void
*/
public function beforeGetProperties($path, DAV\INode $node, &$requestedProperties, &$returnedProperties)
{
if ($node instanceof IShareableCalendar) {
if (($index = array_search('{' . Plugin::NS_CALENDARSERVER . '}invite', $requestedProperties)) !== false) {
unset($requestedProperties[$index]);
$returnedProperties[200]['{' . Plugin::NS_CALENDARSERVER . '}invite'] = new Property\Invite($node->getShares());
}
}
if ($node instanceof ISharedCalendar) {
if (($index = array_search('{' . Plugin::NS_CALENDARSERVER . '}shared-url', $requestedProperties)) !== false) {
unset($requestedProperties[$index]);
$returnedProperties[200]['{' . Plugin::NS_CALENDARSERVER . '}shared-url'] = new DAV\Property\Href($node->getSharedUrl());
}
// The 'invite' property is slightly different for the 'shared'
// instance of the calendar, as it also contains the owner
// information.
if (($index = array_search('{' . Plugin::NS_CALENDARSERVER . '}invite', $requestedProperties)) !== false) {
unset($requestedProperties[$index]);
// Fetching owner information
$props = $this->server->getPropertiesForPath($node->getOwner(), array('{http://sabredav.org/ns}email-address', '{DAV:}displayname'), 1);
$ownerInfo = array('href' => $node->getOwner());
if (isset($props[0][200])) {
// We're mapping the internal webdav properties to the
// elements caldav-sharing expects.
if (isset($props[0][200]['{http://sabredav.org/ns}email-address'])) {
$ownerInfo['href'] = 'mailto:' . $props[0][200]['{http://sabredav.org/ns}email-address'];
}
if (isset($props[0][200]['{DAV:}displayname'])) {
$ownerInfo['commonName'] = $props[0][200]['{DAV:}displayname'];
}
}
$returnedProperties[200]['{' . Plugin::NS_CALENDARSERVER . '}invite'] = new Property\Invite($node->getShares(), $ownerInfo);
}
}
}
示例2: propFindEarly
/**
* This event is triggered when properties are requested for a certain
* node.
*
* This allows us to inject any properties early.
*
* @param DAV\PropFind $propFind
* @param DAV\INode $node
* @return void
*/
function propFindEarly(DAV\PropFind $propFind, DAV\INode $node)
{
if ($node instanceof IShareableCalendar) {
$propFind->handle('{' . Plugin::NS_CALENDARSERVER . '}invite', function () use($node) {
return new Xml\Property\Invite($node->getShares());
});
}
if ($node instanceof ISharedCalendar) {
$propFind->handle('{' . Plugin::NS_CALENDARSERVER . '}shared-url', function () use($node) {
return new Href($node->getSharedUrl());
});
$propFind->handle('{' . Plugin::NS_CALENDARSERVER . '}invite', function () use($node) {
// Fetching owner information
$props = $this->server->getPropertiesForPath($node->getOwner(), ['{http://sabredav.org/ns}email-address', '{DAV:}displayname'], 0);
$ownerInfo = ['href' => $node->getOwner()];
if (isset($props[0][200])) {
// We're mapping the internal webdav properties to the
// elements caldav-sharing expects.
if (isset($props[0][200]['{http://sabredav.org/ns}email-address'])) {
$ownerInfo['href'] = 'mailto:' . $props[0][200]['{http://sabredav.org/ns}email-address'];
}
if (isset($props[0][200]['{DAV:}displayname'])) {
$ownerInfo['commonName'] = $props[0][200]['{DAV:}displayname'];
}
}
return new Xml\Property\Invite($node->getShares(), $ownerInfo);
});
}
}