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