本文整理汇总了PHP中Sabre\DAV\Server::calculateUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::calculateUri方法的具体用法?PHP Server::calculateUri怎么用?PHP Server::calculateUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\DAV\Server
的用法示例。
在下文中一共展示了Server::calculateUri方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calculateUri
public function calculateUri($uri)
{
$uri = parent::calculateUri($uri);
if (!empty($this->uniqueBaseFile) && '/' . $uri !== $this->uniqueBaseFile) {
$uri .= $this->uniqueBaseFile;
}
return $uri;
}
示例2: calendarMultiGetReport
/**
* This function handles the calendar-multiget REPORT.
*
* This report is used by the client to fetch the content of a series
* of urls. Effectively avoiding a lot of redundant requests.
*
* @param \DOMNode $dom
* @return void
*/
function calendarMultiGetReport($dom)
{
$properties = array_keys(DAV\XMLUtil::parseProperties($dom->firstChild));
$hrefElems = $dom->getElementsByTagNameNS('urn:DAV', 'href');
$xpath = new \DOMXPath($dom);
$xpath->registerNameSpace('cal', Plugin::NS_CALDAV);
$xpath->registerNameSpace('dav', 'urn:DAV');
$expand = $xpath->query('/cal:calendar-multiget/dav:prop/cal:calendar-data/cal:expand');
if ($expand->length > 0) {
$expandElem = $expand->item(0);
$start = $expandElem->getAttribute('start');
$end = $expandElem->getAttribute('end');
if (!$start || !$end) {
throw new DAV\Exception\BadRequest('The "start" and "end" attributes are required for the CALDAV:expand element');
}
$start = VObject\DateTimeParser::parseDateTime($start);
$end = VObject\DateTimeParser::parseDateTime($end);
if ($end <= $start) {
throw new DAV\Exception\BadRequest('The end-date must be larger than the start-date in the expand element.');
}
$expand = true;
} else {
$expand = false;
}
$needsJson = $xpath->evaluate("boolean(/cal:calendar-multiget/dav:prop/cal:calendar-data[@content-type='application/calendar+json'])");
$uris = [];
foreach ($hrefElems as $elem) {
$uris[] = $this->server->calculateUri($elem->nodeValue);
}
foreach ($this->server->getPropertiesForMultiplePaths($uris, $properties) as $uri => $objProps) {
if (($needsJson || $expand) && isset($objProps[200]['{' . self::NS_CALDAV . '}calendar-data'])) {
$vObject = VObject\Reader::read($objProps[200]['{' . self::NS_CALDAV . '}calendar-data']);
if ($expand) {
$vObject->expand($start, $end);
}
if ($needsJson) {
$objProps[200]['{' . self::NS_CALDAV . '}calendar-data'] = json_encode($vObject->jsonSerialize());
} else {
$objProps[200]['{' . self::NS_CALDAV . '}calendar-data'] = $vObject->serialize();
}
}
$propertyList[] = $objProps;
}
$prefer = $this->server->getHTTPPRefer();
$this->server->httpResponse->setStatus(207);
$this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
$this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
$this->server->httpResponse->setBody($this->server->generateMultiStatus($propertyList, $prefer['return-minimal']));
}