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


PHP INode::getSharedUrl方法代码示例

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

示例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);
         });
     }
 }
开发者ID:pageer,项目名称:sabre-dav,代码行数:39,代码来源:SharingPlugin.php


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