本文整理汇总了PHP中Sabre\DAV\PropFind::get方法的典型用法代码示例。如果您正苦于以下问题:PHP PropFind::get方法的具体用法?PHP PropFind::get怎么用?PHP PropFind::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\DAV\PropFind
的用法示例。
在下文中一共展示了PropFind::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: propFindLate
/**
* This event is triggered when fetching properties.
*
* This event is scheduled late in the process, after most work for
* propfind has been done.
*/
function propFindLate(DAV\PropFind $propFind, DAV\INode $node)
{
// If the request was made using the SOGO connector, we must rewrite
// the content-type property. By default SabreDAV will send back
// text/x-vcard; charset=utf-8, but for SOGO we must strip that last
// part.
if (strpos($this->server->httpRequest->getHeader('User-Agent'), 'Thunderbird') === false) {
return;
}
$contentType = $propFind->get('{DAV:}getcontenttype');
list($part) = explode(';', $contentType);
if ($part === 'text/x-vcard' || $part === 'text/vcard') {
$propFind->set('{DAV:}getcontenttype', 'text/x-vcard');
}
}
示例2: propFindLate
/**
* This method is triggered *after* all properties have been retrieved.
* This allows us to inject the correct resourcetype for calendars that
* have been shared.
*
* @param DAV\PropFind $propFind
* @param DAV\INode $node
* @return void
*/
function propFindLate(DAV\PropFind $propFind, DAV\INode $node)
{
if ($node instanceof IShareableCalendar) {
if ($rt = $propFind->get('{DAV:}resourcetype')) {
if (count($node->getShares()) > 0) {
$rt->add('{' . Plugin::NS_CALENDARSERVER . '}shared-owner');
}
}
$propFind->handle('{' . Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes', function () {
return new Xml\Property\AllowedSharingModes(true, false);
});
}
}
示例3: propFindLate
/**
* This method is called when properties are retrieved.
*
* This specific handler is called very late in the process, because we
* want other systems to first have a chance to handle the properties.
*
* @param PropFind $propFind
* @param INode $node
* @return void
*/
function propFindLate(PropFind $propFind, INode $node)
{
$propFind->handle('{http://calendarserver.org/ns/}getctag', function () use($propFind) {
// If we already have a sync-token from the current propFind
// request, we can re-use that.
$val = $propFind->get('{http://sabredav.org/ns}sync-token');
if ($val) {
return $val;
}
$val = $propFind->get('{DAV:}sync-token');
if ($val && is_scalar($val)) {
return $val;
}
if ($val && $val instanceof Property\IHref) {
return substr($val->getHref(), strlen(Sync\Plugin::SYNCTOKEN_PREFIX));
}
// If we got here, the earlier two properties may simply not have
// been part of the earlier request. We're going to fetch them.
$result = $this->server->getProperties($propFind->getPath(), ['{http://sabredav.org/ns}sync-token', '{DAV:}sync-token']);
if (isset($result['{http://sabredav.org/ns}sync-token'])) {
return $result['{http://sabredav.org/ns}sync-token'];
}
if (isset($result['{DAV:}sync-token'])) {
$val = $result['{DAV:}sync-token'];
if (is_scalar($val)) {
return $val;
} elseif ($val instanceof Property\IHref) {
return substr($val->getHref(), strlen(Sync\Plugin::SYNCTOKEN_PREFIX));
}
}
});
}
示例4: propFindLate
/**
* This method is triggered *after* all properties have been retrieved.
* This allows us to inject the correct resourcetype for calendars that
* have been shared.
*
* @param DAV\PropFind $propFind
* @param DAV\INode $node
* @return void
*/
function propFindLate(DAV\PropFind $propFind, DAV\INode $node)
{
if ($node instanceof ISharedCalendar) {
$shareAccess = $node->getShareAccess();
if ($rt = $propFind->get('{DAV:}resourcetype')) {
switch ($shareAccess) {
case \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER:
$rt->add('{' . Plugin::NS_CALENDARSERVER . '}shared-owner');
break;
case \Sabre\DAV\Sharing\Plugin::ACCESS_READ:
case \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE:
$rt->add('{' . Plugin::NS_CALENDARSERVER . '}shared');
break;
}
}
$propFind->handle('{' . Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes', function () {
return new Xml\Property\AllowedSharingModes(true, false);
});
}
}