本文整理汇总了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;
}
示例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);
}