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


PHP Folder::getDirectoryListing方法代码示例

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


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

示例1: getNodes

 /**
  * Retrieves all files and sub-folders contained in a folder
  *
  * If we can't find anything in the current folder, we throw an exception as there is no point
  * in doing any more work, but if we're looking at a sub-folder, we return an empty array so
  * that it can be simply ignored
  *
  * @param Folder $folder
  * @param int $subDepth
  *
  * @return array
  *
  * @throws NotFoundServiceException
  */
 protected function getNodes($folder, $subDepth)
 {
     try {
         $nodes = $folder->getDirectoryListing();
     } catch (\Exception $exception) {
         $nodes = $this->recoverFromGetNodesError($subDepth, $exception);
     }
     return $nodes;
 }
开发者ID:efueger,项目名称:galleryplus,代码行数:23,代码来源:filesservice.php

示例2: remove

 /**
  * remove the users avatar
  * @return void
  */
 public function remove()
 {
     $regex = '/^avatar\\.([0-9]+\\.)?(jpg|png)$/';
     $avatars = $this->folder->getDirectoryListing();
     foreach ($avatars as $avatar) {
         if (preg_match($regex, $avatar->getName())) {
             $avatar->delete();
         }
     }
     $this->user->triggerChange('avatar');
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:15,代码来源:Avatar.php

示例3: getSharesInDir

 /**
  * @param \OCP\Files\Folder $folder
  * @return \OC_OCS_Result
  */
 private function getSharesInDir($folder)
 {
     if (!$folder instanceof \OCP\Files\Folder) {
         return new \OC_OCS_Result(null, 400, "not a directory");
     }
     $nodes = $folder->getDirectoryListing();
     /** @var \OCP\Share\IShare[] $shares */
     $shares = [];
     foreach ($nodes as $node) {
         $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser->getUID(), \OCP\Share::SHARE_TYPE_USER, $node, false, -1, 0));
         $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser->getUID(), \OCP\Share::SHARE_TYPE_GROUP, $node, false, -1, 0));
         $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser->getUID(), \OCP\Share::SHARE_TYPE_LINK, $node, false, -1, 0));
         if ($this->shareManager->outgoingServer2ServerSharesAllowed()) {
             $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser->getUID(), \OCP\Share::SHARE_TYPE_REMOTE, $node, false, -1, 0));
         }
     }
     $formatted = [];
     foreach ($shares as $share) {
         try {
             $formatted[] = $this->formatShare($share);
         } catch (NotFoundException $e) {
             //Ignore this share
         }
     }
     return new \OC_OCS_Result($formatted);
 }
开发者ID:gvde,项目名称:core,代码行数:30,代码来源:share20ocs.php

示例4: getSharesInDir

 /**
  * @param \OCP\Files\Folder $folder
  * @return \OC_OCS_Result
  */
 private function getSharesInDir($folder)
 {
     if (!$folder instanceof \OCP\Files\Folder) {
         return new \OC_OCS_Result(null, 400, "not a directory");
     }
     $nodes = $folder->getDirectoryListing();
     /** @var IShare[] $shares */
     $shares = [];
     foreach ($nodes as $node) {
         $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_USER, $node, false, -1, 0));
         $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_GROUP, $node, false, -1, 0));
         $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_LINK, $node, false, -1, 0));
         //TODO: Add federated shares
     }
     $formatted = [];
     foreach ($shares as $share) {
         $formatted[] = $this->formatShare($share);
     }
     return new \OC_OCS_Result($formatted);
 }
开发者ID:matt407,项目名称:core,代码行数:24,代码来源:share20ocs.php


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