當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。