本文整理汇总了PHP中Sabre_DAV_Server::createCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Sabre_DAV_Server::createCollection方法的具体用法?PHP Sabre_DAV_Server::createCollection怎么用?PHP Sabre_DAV_Server::createCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre_DAV_Server
的用法示例。
在下文中一共展示了Sabre_DAV_Server::createCollection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: httpMkCalendar
/**
* This function handles the MKCALENDAR HTTP method, which creates
* a new calendar.
*
* @param string $uri
* @return void
*/
public function httpMkCalendar($uri)
{
// Due to unforgivable bugs in iCal, we're completely disabling MKCALENDAR support
// for clients matching iCal in the user agent
//$ua = $this->server->httpRequest->getHeader('User-Agent');
//if (strpos($ua,'iCal/')!==false) {
// throw new Sabre_DAV_Exception_Forbidden('iCal has major bugs in it\'s RFC3744 support. Therefore we are left with no other choice but disabling this feature.');
//}
$body = $this->server->httpRequest->getBody(true);
$properties = array();
if ($body) {
$dom = Sabre_DAV_XMLUtil::loadDOMDocument($body);
foreach ($dom->firstChild->childNodes as $child) {
if (Sabre_DAV_XMLUtil::toClarkNotation($child) !== '{DAV:}set') {
continue;
}
foreach (Sabre_DAV_XMLUtil::parseProperties($child, $this->server->propertyMap) as $k => $prop) {
$properties[$k] = $prop;
}
}
}
$resourceType = array('{DAV:}collection', '{urn:ietf:params:xml:ns:caldav}calendar');
$this->server->createCollection($uri, $resourceType, $properties);
$this->server->httpResponse->sendStatus(201);
$this->server->httpResponse->setHeader('Content-Length', 0);
}
示例2: browserPostAction
/**
* This method allows us to intercept the 'mkcalendar' sabreAction. This
* action enables the user to create new calendars from the browser plugin.
*
* @param string $uri
* @param string $action
* @param array $postVars
* @return bool
*/
public function browserPostAction($uri, $action, array $postVars)
{
if ($action !== 'mkaddressbook') {
return;
}
$resourceType = array('{DAV:}collection', '{urn:ietf:params:xml:ns:carddav}addressbook');
$properties = array();
if (isset($postVars['{DAV:}displayname'])) {
$properties['{DAV:}displayname'] = $postVars['{DAV:}displayname'];
}
$this->server->createCollection($uri . '/' . $postVars['name'], $resourceType, $properties);
return false;
}