本文整理汇总了PHP中CKSource\CKFinder\Filesystem\Path::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::isValid方法的具体用法?PHP Path::isValid怎么用?PHP Path::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKSource\CKFinder\Filesystem\Path
的用法示例。
在下文中一共展示了Path::isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasValidPath
/**
* Checks if the current file folder path is valid.
*
* @return bool `true` if the path is valid.
*/
public function hasValidPath()
{
return Path::isValid($this->getPath());
}
示例2: __construct
/**
* Constructor
*
* @param CKFinder $app
*
* @throws \Exception
*/
public function __construct(CKFinder $app)
{
$this->app = $app;
/* @var $request \Symfony\Component\HttpFoundation\Request */
$request = $app['request_stack']->getCurrentRequest();
$resourceType = $app['resource_type_factory']->getResourceType((string) $request->get('type'));
$this->clientCurrentFolder = Path::normalize(trim((string) $request->get('currentFolder')));
if (!Path::isValid($this->clientCurrentFolder)) {
throw new InvalidNameException('Invalid path');
}
$resourceTypeDirectory = $resourceType->getDirectory();
parent::__construct($resourceType, $this->clientCurrentFolder);
$this->backend = $this->resourceType->getBackend();
$this->thumbnailRepository = $app['thumbnail_repository'];
$backend = $this->getBackend();
// Check if folder path is not hidden
if ($backend->isHiddenPath($this->getClientCurrentFolder())) {
throw new InvalidRequestException('Hidden folder path used');
}
// Check if resource type folder exists - if not then create it
$currentCommand = (string) $request->query->get('command');
$omitForCommands = array('Thumbnail');
if (!in_array($currentCommand, $omitForCommands) && !empty($resourceTypeDirectory) && !$backend->hasDirectory($this->path)) {
if ($this->clientCurrentFolder === '/') {
@$backend->createDir($resourceTypeDirectory);
if (!$backend->hasDirectory($resourceTypeDirectory)) {
throw new AccessDeniedException("Couldn't create resource type directory. Please check permissions.");
}
} else {
throw new FolderNotFoundException();
}
}
}