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


PHP Path::normalize方法代码示例

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


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

示例1: disallow

 /**
  * Disallows a permission for a given role.
  *
  * @param string $resourceType
  * @param string $folderPath
  * @param int    $permission
  * @param string $role
  *
  * @return $this|Acl
  */
 public function disallow($resourceType, $folderPath, $permission, $role)
 {
     $folderPath = Path::normalize($folderPath);
     if (!isset($this->rules[$folderPath][$role][$resourceType])) {
         $this->rules[$folderPath][$role][$resourceType] = new MaskBuilder();
     }
     /* @var $ruleMask MaskBuilder */
     $ruleMask = $this->rules[$folderPath][$role][$resourceType];
     $ruleMask->disallow($permission);
     return $this;
 }
开发者ID:mat33470,项目名称:PFA,代码行数:21,代码来源:Acl.php

示例2: rename

 /**
  * Renames current working folder
  *
  * @param string $newName new folder name
  *
  * @return array containing newName and newPath
  *
  * @throws \Exception if rename failed
  */
 public function rename($newName)
 {
     $disallowUnsafeCharacters = $this->app['config']->get('disallowUnsafeCharacters');
     if (!Folder::isValidName($newName, $disallowUnsafeCharacters) || $this->backend->isHiddenFolder($newName)) {
         throw new InvalidNameException('Invalid folder name');
     }
     $newBackendPath = dirname($this->getPath()) . '/' . $newName;
     if ($this->backend->has($newBackendPath)) {
         throw new AlreadyExistsException('File already exists');
     }
     $newClientPath = Path::normalize(dirname($this->getClientCurrentFolder()) . '/' . $newName);
     $dispatcher = $this->app['dispatcher'];
     $renameFolderEvent = new RenameFolderEvent($this->app, $this, $newName);
     $dispatcher->dispatch(CKFinderEvent::RENAME_FOLDER, $renameFolderEvent);
     $newName = $renameFolderEvent->getNewFolderName();
     if (!$renameFolderEvent->isPropagationStopped()) {
         if (!$this->getBackend()->rename($this->getPath(), $newBackendPath)) {
             throw new AccessDeniedException();
         }
         /* @var OperationManager $currentRequestOperation */
         $currentRequestOperation = $this->app['operation'];
         if ($currentRequestOperation->isAborted()) {
             // Don't continue in this case, no need to touch thumbs and cache entries
             return array('aborted' => true);
         }
         // Delete related thumbs path
         $this->thumbnailRepository->deleteThumbnails($this->resourceType, $this->getClientCurrentFolder());
         $this->app['cache']->changePrefix(Path::combine($this->resourceType->getName(), $this->getClientCurrentFolder()), Path::combine($this->resourceType->getName(), $newClientPath));
     }
     return array('newName' => $newName, 'newPath' => $newClientPath);
 }
开发者ID:vobinh,项目名称:PHP,代码行数:40,代码来源:WorkingFolder.php


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