当前位置: 首页>>代码示例>>PHP>>正文


PHP Sabre_DAV_Server::createCollection方法代码示例

本文整理汇总了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);
 }
开发者ID:kumarsivarajan,项目名称:mollify,代码行数:33,代码来源:Plugin.php

示例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;
 }
开发者ID:paullarrow,项目名称:CDN-Sync-Tool,代码行数:22,代码来源:Plugin.php


注:本文中的Sabre_DAV_Server::createCollection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。