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


PHP PropFind::getPath方法代码示例

本文整理汇总了PHP中Sabre\DAV\PropFind::getPath方法的典型用法代码示例。如果您正苦于以下问题:PHP PropFind::getPath方法的具体用法?PHP PropFind::getPath怎么用?PHP PropFind::getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sabre\DAV\PropFind的用法示例。


在下文中一共展示了PropFind::getPath方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: propFind

 /**
  * PropFind
  *
  * This method handler is invoked before any after properties for a
  * resource are fetched. This allows us to add in any CalDAV specific
  * properties.
  *
  * @param DAV\PropFind $propFind
  * @param DAV\INode $node
  * @return void
  */
 function propFind(DAV\PropFind $propFind, DAV\INode $node)
 {
     $ns = '{' . self::NS_CALDAV . '}';
     if ($node instanceof ICalendarObjectContainer) {
         $propFind->handle($ns . 'max-resource-size', $this->maxResourceSize);
         $propFind->handle($ns . 'supported-calendar-data', function () {
             return new Xml\Property\SupportedCalendarData();
         });
         $propFind->handle($ns . 'supported-collation-set', function () {
             return new Xml\Property\SupportedCollationSet();
         });
     }
     if ($node instanceof DAVACL\IPrincipal) {
         $principalUrl = $node->getPrincipalUrl();
         $propFind->handle('{' . self::NS_CALDAV . '}calendar-home-set', function () use($principalUrl) {
             $calendarHomePath = $this->getCalendarHomeForPrincipal($principalUrl) . '/';
             return new Href($calendarHomePath);
         });
         // The calendar-user-address-set property is basically mapped to
         // the {DAV:}alternate-URI-set property.
         $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-address-set', function () use($node) {
             $addresses = $node->getAlternateUriSet();
             $addresses[] = $this->server->getBaseUri() . $node->getPrincipalUrl() . '/';
             return new Href($addresses, false);
         });
         // For some reason somebody thought it was a good idea to add
         // another one of these properties. We're supporting it too.
         $propFind->handle('{' . self::NS_CALENDARSERVER . '}email-address-set', function () use($node) {
             $addresses = $node->getAlternateUriSet();
             $emails = [];
             foreach ($addresses as $address) {
                 if (substr($address, 0, 7) === 'mailto:') {
                     $emails[] = substr($address, 7);
                 }
             }
             return new Xml\Property\EmailAddressSet($emails);
         });
         // These two properties are shortcuts for ical to easily find
         // other principals this principal has access to.
         $propRead = '{' . self::NS_CALENDARSERVER . '}calendar-proxy-read-for';
         $propWrite = '{' . self::NS_CALENDARSERVER . '}calendar-proxy-write-for';
         if ($propFind->getStatus($propRead) === 404 || $propFind->getStatus($propWrite) === 404) {
             $aclPlugin = $this->server->getPlugin('acl');
             $membership = $aclPlugin->getPrincipalMembership($propFind->getPath());
             $readList = [];
             $writeList = [];
             foreach ($membership as $group) {
                 $groupNode = $this->server->tree->getNodeForPath($group);
                 $listItem = Uri\split($group)[0] . '/';
                 // If the node is either ap proxy-read or proxy-write
                 // group, we grab the parent principal and add it to the
                 // list.
                 if ($groupNode instanceof Principal\IProxyRead) {
                     $readList[] = $listItem;
                 }
                 if ($groupNode instanceof Principal\IProxyWrite) {
                     $writeList[] = $listItem;
                 }
             }
             $propFind->set($propRead, new Href($readList));
             $propFind->set($propWrite, new Href($writeList));
         }
     }
     // instanceof IPrincipal
     if ($node instanceof ICalendarObject) {
         // The calendar-data property is not supposed to be a 'real'
         // property, but in large chunks of the spec it does act as such.
         // Therefore we simply expose it as a property.
         $propFind->handle('{' . self::NS_CALDAV . '}calendar-data', function () use($node) {
             $val = $node->get();
             if (is_resource($val)) {
                 $val = stream_get_contents($val);
             }
             // Taking out \r to not screw up the xml output
             return str_replace("\r", "", $val);
         });
     }
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:89,代码来源:Plugin.php

示例2: propFind

 /**
  * Our PROPFIND handler
  *
  * Here we set a contenttype, if the node didn't already have one.
  *
  * @param PropFind $propFind
  * @param INode $node
  * @return void
  */
 function propFind(PropFind $propFind, INode $node)
 {
     $propFind->handle('{DAV:}getcontenttype', function () use($propFind) {
         list(, $fileName) = URLUtil::splitPath($propFind->getPath());
         return $this->getContentType($fileName);
     });
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:16,代码来源:GuessContentType.php

示例3: propFind

 /**
  * This method is called after most properties have been found
  * it allows us to add in any Lock-related properties
  *
  * @param DAV\PropFind $propFind
  * @param DAV\INode $node
  * @return void
  */
 function propFind(DAV\PropFind $propFind, DAV\INode $node)
 {
     $propFind->handle('{DAV:}supportedlock', function () {
         return new DAV\Property\SupportedLock(!!$this->locksBackend);
     });
     $propFind->handle('{DAV:}lockdiscovery', function () use($propFind) {
         return new DAV\Property\LockDiscovery($this->getLocks($propFind->getPath()));
     });
 }
开发者ID:bogolubov,项目名称:owncollab_talks-1,代码行数:17,代码来源:Plugin.php

示例4: propFind

 /**
  * Called during PROPFIND operations.
  *
  * If there's any requested properties that don't have a value yet, this
  * plugin will look in the property storage backend to find them.
  *
  * @param PropFind $propFind
  * @param INode $node
  * @return void
  */
 function propFind(PropFind $propFind, INode $node)
 {
     $path = $propFind->getPath();
     $pathFilter = $this->pathFilter;
     if ($pathFilter && !$pathFilter($path)) {
         return;
     }
     $this->backend->propFind($propFind->getPath(), $propFind);
 }
开发者ID:MetallianFR68,项目名称:myroundcube,代码行数:19,代码来源:Plugin.php

示例5: propFindEarly

 /**
  * Adds all CardDAV-specific properties
  *
  * @param DAV\PropFind $propFind
  * @param DAV\INode $node
  * @return void
  */
 function propFindEarly(DAV\PropFind $propFind, DAV\INode $node)
 {
     $ns = '{' . self::NS_CARDDAV . '}';
     if ($node instanceof IAddressBook) {
         $propFind->handle($ns . 'max-resource-size', $this->maxResourceSize);
         $propFind->handle($ns . 'supported-address-data', function () {
             return new Property\SupportedAddressData();
         });
         $propFind->handle($ns . 'supported-collation-set', function () {
             return new Property\SupportedCollationSet();
         });
     }
     if ($node instanceof DAVACL\IPrincipal) {
         $path = $propFind->getPath();
         $propFind->handle('{' . self::NS_CARDDAV . '}addressbook-home-set', function () use($path) {
             return new DAV\Property\Href($this->getAddressBookHomeForPrincipal($path) . '/');
         });
         if ($this->directories) {
             $propFind->handle('{' . self::NS_CARDDAV . '}directory-gateway', function () {
                 return new DAV\Property\HrefList($this->directories);
             });
         }
     }
     if ($node instanceof ICard) {
         // The address-data property is not supposed to be a 'real'
         // property, but in large chunks of the spec it does act as such.
         // Therefore we simply expose it as a property.
         $propFind->handle('{' . self::NS_CARDDAV . '}address-data', function () use($node) {
             $val = $node->get();
             if (is_resource($val)) {
                 $val = stream_get_contents($val);
             }
             return $val;
         });
     }
     if ($node instanceof UserAddressBooks) {
         $propFind->handle('{http://calendarserver.org/ns/}me-card', function () use($node) {
             $props = $this->server->getProperties($node->getOwner(), ['{http://sabredav.org/ns}vcard-url']);
             if (isset($props['{http://sabredav.org/ns}vcard-url'])) {
                 return new DAV\Property\Href($props['{http://sabredav.org/ns}vcard-url']);
             }
         });
     }
 }
开发者ID:samj1912,项目名称:repo,代码行数:51,代码来源:Plugin.php

示例6: addPathNodesRecursively

    /**
     * Small helper to support PROPFIND with DEPTH_INFINITY.
     */
    private function addPathNodesRecursively(&$propFindRequests, PropFind $propFind) {

        $newDepth = $propFind->getDepth();
        $path = $propFind->getPath();

        if ($newDepth !== self::DEPTH_INFINITY) {
            $newDepth--;
        }

        foreach ($this->tree->getChildren($path) as $childNode) {
            $subPropFind = clone $propFind;
            $subPropFind->setDepth($newDepth);
            $subPath = $path ? $path . '/' . $childNode->getName() : $childNode->getName();
            $subPropFind->setPath($subPath);

            $propFindRequests[] = [
                $subPropFind,
                $childNode
            ];

            if (($newDepth === self::DEPTH_INFINITY || $newDepth >= 1) && $childNode instanceof ICollection) {
                $this->addPathNodesRecursively($propFindRequests, $subPropFind);
            }

        }
    }
开发者ID:nikosv,项目名称:openeclass,代码行数:29,代码来源:Server.php

示例7: propFindLate

 /**
  * This method is called when properties are retrieved.
  *
  * This specific handler is called very late in the process, because we
  * want other systems to first have a chance to handle the properties.
  *
  * @param PropFind $propFind
  * @param INode $node
  * @return void
  */
 function propFindLate(PropFind $propFind, INode $node)
 {
     $propFind->handle('{http://calendarserver.org/ns/}getctag', function () use($propFind) {
         // If we already have a sync-token from the current propFind
         // request, we can re-use that.
         $val = $propFind->get('{http://sabredav.org/ns}sync-token');
         if ($val) {
             return $val;
         }
         $val = $propFind->get('{DAV:}sync-token');
         if ($val && is_scalar($val)) {
             return $val;
         }
         if ($val && $val instanceof Property\IHref) {
             return substr($val->getHref(), strlen(Sync\Plugin::SYNCTOKEN_PREFIX));
         }
         // If we got here, the earlier two properties may simply not have
         // been part of the earlier request. We're going to fetch them.
         $result = $this->server->getProperties($propFind->getPath(), ['{http://sabredav.org/ns}sync-token', '{DAV:}sync-token']);
         if (isset($result['{http://sabredav.org/ns}sync-token'])) {
             return $result['{http://sabredav.org/ns}sync-token'];
         }
         if (isset($result['{DAV:}sync-token'])) {
             $val = $result['{DAV:}sync-token'];
             if (is_scalar($val)) {
                 return $val;
             } elseif ($val instanceof Property\IHref) {
                 return substr($val->getHref(), strlen(Sync\Plugin::SYNCTOKEN_PREFIX));
             }
         }
     });
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:42,代码来源:CorePlugin.php

示例8: propFind

 /**
  * Triggered before properties are looked up in specific nodes.
  *
  * @param DAV\PropFind $propFind
  * @param DAV\INode $node
  * @param array $requestedProperties
  * @param array $returnedProperties
  * @TODO really should be broken into multiple methods, or even a class.
  * @return bool
  */
 function propFind(DAV\PropFind $propFind, DAV\INode $node)
 {
     $path = $propFind->getPath();
     // Checking the read permission
     if (!$this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, false)) {
         // User is not allowed to read properties
         // Returning false causes the property-fetching system to pretend
         // that the node does not exist, and will cause it to be hidden
         // from listings such as PROPFIND or the browser plugin.
         if ($this->hideNodesFromListings) {
             return false;
         }
         // Otherwise we simply mark every property as 403.
         foreach ($propFind->getRequestedProperties() as $requestedProperty) {
             $propFind->set($requestedProperty, null, 403);
         }
         return;
     }
     /* Adding principal properties */
     if ($node instanceof IPrincipal) {
         $propFind->handle('{DAV:}alternate-URI-set', function () use($node) {
             return new DAV\Property\HrefList($node->getAlternateUriSet());
         });
         $propFind->handle('{DAV:}principal-URL', function () use($node) {
             return new DAV\Property\Href($node->getPrincipalUrl() . '/');
         });
         $propFind->handle('{DAV:}group-member-set', function () use($node) {
             $members = $node->getGroupMemberSet();
             foreach ($members as $k => $member) {
                 $members[$k] = rtrim($member, '/') . '/';
             }
             return new DAV\Property\HrefList($members);
         });
         $propFind->handle('{DAV:}group-membership', function () use($node) {
             $members = $node->getGroupMembership();
             foreach ($members as $k => $member) {
                 $members[$k] = rtrim($member, '/') . '/';
             }
             return new DAV\Property\HrefList($members);
         });
         $propFind->handle('{DAV:}displayname', [$node, 'getDisplayName']);
     }
     $propFind->handle('{DAV:}principal-collection-set', function () {
         $val = $this->principalCollectionSet;
         // Ensuring all collections end with a slash
         foreach ($val as $k => $v) {
             $val[$k] = $v . '/';
         }
         return new DAV\Property\HrefList($val);
     });
     $propFind->handle('{DAV:}current-user-principal', function () {
         if ($url = $this->getCurrentUserPrincipal()) {
             return new Property\Principal(Property\Principal::HREF, $url . '/');
         } else {
             return new Property\Principal(Property\Principal::UNAUTHENTICATED);
         }
     });
     $propFind->handle('{DAV:}supported-privilege-set', function () use($node) {
         return new Property\SupportedPrivilegeSet($this->getSupportedPrivilegeSet($node));
     });
     $propFind->handle('{DAV:}current-user-privilege-set', function () use($node, $propFind, $path) {
         if (!$this->checkPrivileges($path, '{DAV:}read-current-user-privilege-set', self::R_PARENT, false)) {
             $propFind->set('{DAV:}current-user-privilege-set', null, 403);
         } else {
             $val = $this->getCurrentUserPrivilegeSet($node);
             if (!is_null($val)) {
                 return new Property\CurrentUserPrivilegeSet($val);
             }
         }
     });
     $propFind->handle('{DAV:}acl', function () use($node, $propFind, $path) {
         /* The ACL property contains all the permissions */
         if (!$this->checkPrivileges($path, '{DAV:}read-acl', self::R_PARENT, false)) {
             $propFind->set('{DAV:}acl', null, 403);
         } else {
             $acl = $this->getACL($node);
             if (!is_null($acl)) {
                 return new Property\Acl($this->getACL($node));
             }
         }
     });
     $propFind->handle('{DAV:}acl-restrictions', function () {
         return new Property\AclRestrictions();
     });
     /* Adding ACL properties */
     if ($node instanceof IACL) {
         $propFind->handle('{DAV:}owner', function () use($node) {
             return new DAV\Property\Href($node->getOwner() . '/');
         });
     }
//.........这里部分代码省略.........
开发者ID:MetallianFR68,项目名称:myroundcube,代码行数:101,代码来源:Plugin.php

示例9: propFind

 /**
  * This method handler is invoked during fetching of properties.
  *
  * We use this event to add calendar-auto-schedule-specific properties.
  *
  * @param PropFind $propFind
  * @param INode $node
  * @return void
  */
 function propFind(PropFind $propFind, INode $node)
 {
     if ($node instanceof DAVACL\IPrincipal) {
         $caldavPlugin = $this->server->getPlugin('caldav');
         $principalUrl = $node->getPrincipalUrl();
         // schedule-outbox-URL property
         $propFind->handle('{' . self::NS_CALDAV . '}schedule-outbox-URL', function () use($principalUrl, $caldavPlugin) {
             $calendarHomePath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl);
             if (!$calendarHomePath) {
                 return null;
             }
             $outboxPath = $calendarHomePath . '/outbox/';
             return new Href($outboxPath);
         });
         // schedule-inbox-URL property
         $propFind->handle('{' . self::NS_CALDAV . '}schedule-inbox-URL', function () use($principalUrl, $caldavPlugin) {
             $calendarHomePath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl);
             if (!$calendarHomePath) {
                 return null;
             }
             $inboxPath = $calendarHomePath . '/inbox/';
             return new Href($inboxPath);
         });
         $propFind->handle('{' . self::NS_CALDAV . '}schedule-default-calendar-URL', function () use($principalUrl, $caldavPlugin) {
             // We don't support customizing this property yet, so in the
             // meantime we just grab the first calendar in the home-set.
             $calendarHomePath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl);
             if (!$calendarHomePath) {
                 return null;
             }
             $sccs = '{' . self::NS_CALDAV . '}supported-calendar-component-set';
             $result = $this->server->getPropertiesForPath($calendarHomePath, ['{DAV:}resourcetype', $sccs], 1);
             foreach ($result as $child) {
                 if (!isset($child[200]['{DAV:}resourcetype']) || !$child[200]['{DAV:}resourcetype']->is('{' . self::NS_CALDAV . '}calendar') || $child[200]['{DAV:}resourcetype']->is('{http://calendarserver.org/ns/}shared')) {
                     // Node is either not a calendar or a shared instance.
                     continue;
                 }
                 if (!isset($child[200][$sccs]) || in_array('VEVENT', $child[200][$sccs]->getValue())) {
                     // Either there is no supported-calendar-component-set
                     // (which is fine) or we found one that supports VEVENT.
                     return new Href($child['href']);
                 }
             }
         });
         // The server currently reports every principal to be of type
         // 'INDIVIDUAL'
         $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-type', function () {
             return 'INDIVIDUAL';
         });
     }
     // Mapping the old property to the new property.
     $propFind->handle('{http://calendarserver.org/ns/}calendar-availability', function () use($propFind, $node) {
         // In case it wasn't clear, the only difference is that we map the
         // old property to a different namespace.
         $availProp = '{' . self::NS_CALDAV . '}calendar-availability';
         $subPropFind = new PropFind($propFind->getPath(), [$availProp]);
         $this->server->getPropertiesByNode($subPropFind, $node);
         $propFind->set('{http://calendarserver.org/ns/}calendar-availability', $subPropFind->get($availProp), $subPropFind->getStatus($availProp));
     });
 }
开发者ID:jakobsack,项目名称:sabre-dav,代码行数:69,代码来源:Plugin.php

示例10: handleGetProperties

 /**
  * Adds shares to propfind response
  *
  * @param PropFind $propFind propfind object
  * @param \Sabre\DAV\INode $sabreNode sabre node
  */
 public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $sabreNode)
 {
     if (!$sabreNode instanceof \OCA\DAV\Connector\Sabre\Node) {
         return;
     }
     // need prefetch ?
     if ($sabreNode instanceof \OCA\DAV\Connector\Sabre\Directory && $propFind->getDepth() !== 0 && !is_null($propFind->getStatus(self::SHARETYPES_PROPERTYNAME))) {
         $folderNode = $this->userFolder->get($propFind->getPath());
         $children = $folderNode->getDirectoryListing();
         $this->cachedShareTypes[$folderNode->getId()] = $this->getShareTypes($folderNode);
         foreach ($children as $childNode) {
             $this->cachedShareTypes[$childNode->getId()] = $this->getShareTypes($childNode);
         }
     }
     $propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use($sabreNode) {
         if (isset($this->cachedShareTypes[$sabreNode->getId()])) {
             $shareTypes = $this->cachedShareTypes[$sabreNode->getId()];
         } else {
             $node = $this->userFolder->get($sabreNode->getPath());
             $shareTypes = $this->getShareTypes($node);
         }
         return new ShareTypeList($shareTypes);
     });
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:30,代码来源:SharesPlugin.php

示例11: propFind

 /**
  * Triggered by a `PROPFIND` or `GET`. The goal is to set an appropriated
  * Content-Type.
  *
  * @param  SabreDav\PropFind  $propFind    PropFind object.
  * @param  SabreDav\INode     $node        Node.
  */
 function propFind(SabreDav\PropFind $propFind, SabreDav\INode $node)
 {
     $propFind->handle('{DAV:}getcontenttype', function () use($propFind) {
         Mime::compute('katana://resource/mime.types');
         $extension = pathinfo($propFind->getPath(), PATHINFO_EXTENSION);
         return Mime::getMimeFromExtension($extension);
     });
 }
开发者ID:nurtext,项目名称:sabre-katana,代码行数:15,代码来源:Plugin.php

示例12: propFindEarly

    /**
     * Adds all CardDAV-specific properties
     *
     * @param DAV\PropFind $propFind
     * @param DAV\INode $node
     * @return void
     */
    function propFindEarly(DAV\PropFind $propFind, DAV\INode $node) {

        $ns = '{' . self::NS_CARDDAV . '}';

        if ($node instanceof IAddressBook) {

            $propFind->handle($ns . 'max-resource-size', $this->maxResourceSize);
            $propFind->handle($ns . 'supported-address-data', function() {
                return new Xml\Property\SupportedAddressData();
            });
            $propFind->handle($ns . 'supported-collation-set', function() {
                return new Xml\Property\SupportedCollationSet();
            });

        }
        if ($node instanceof DAVACL\IPrincipal) {

            $path = $propFind->getPath();

            $propFind->handle('{' . self::NS_CARDDAV . '}addressbook-home-set', function() use ($path) {
                return new Href($this->getAddressBookHomeForPrincipal($path) . '/');
            });

            if ($this->directories) $propFind->handle('{' . self::NS_CARDDAV . '}directory-gateway', function() {
                return new Href($this->directories);
            });

        }

        if ($node instanceof ICard) {

            // The address-data property is not supposed to be a 'real'
            // property, but in large chunks of the spec it does act as such.
            // Therefore we simply expose it as a property.
            $propFind->handle('{' . self::NS_CARDDAV . '}address-data', function() use ($node) {
                $val = $node->get();
                if (is_resource($val))
                    $val = stream_get_contents($val);

                return $val;

            });

        }

    }
开发者ID:nikosv,项目名称:openeclass,代码行数:53,代码来源:Plugin.php


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