コード例 #1
0
ファイル: Plugin.php プロジェクト: BlaBlaNet/hubzilla
 /**
  * This event is triggered when properties are requested for nodes.
  *
  * This allows us to inject any sharings-specific properties.
  *
  * @param PropFind $propFind
  * @param INode $node
  * @return void
  */
 function propFind(PropFind $propFind, INode $node)
 {
     if ($node instanceof ISharedNode) {
         $propFind->handle('{DAV:}share-access', function () use($node) {
             return new Property\ShareAccess($node->getShareAccess());
         });
         $propFind->handle('{DAV:}invite', function () use($node) {
             return new Property\Invite($node->getInvites());
         });
         $propFind->handle('{DAV:}share-resource-uri', function () use($node) {
             return new Property\Href($node->getShareResourceUri());
         });
     }
 }
コード例 #2
0
ファイル: SharingPlugin.php プロジェクト: BlaBlaNet/hubzilla
 /**
  * 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 ISharedCalendar) {
         $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->getInvites(), $ownerInfo);
         });
     }
 }