You are here

private function FMDiskFileSystem::getRelativePath in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

1 call to FMDiskFileSystem::getRelativePath()
FMDiskFileSystem::getAbsolutePath in src/Flmngr/FlmngrServer/fs/FMDiskFileSystem.php

File

src/Flmngr/FlmngrServer/fs/FMDiskFileSystem.php, line 86

Class

FMDiskFileSystem
Implements file system interface. Provides an interface to access file system (local disc FS). This is the correct module to replace if you want to implement some custom file system support (i. e. network file system like Amazon S3).

Namespace

Drupal\n1ed\Flmngr\FlmngrServer\fs

Code

private function getRelativePath($path) {
  if (strpos($path, "..") !== FALSE) {
    throw new MessageException(FMMessage::createMessage(FMMessage::FM_DIR_NAME_CONTAINS_INVALID_SYMBOLS));
  }
  if (strpos($path, '/') !== 0) {
    $path = '/' . $path;
  }
  $rootDirName = $this
    ->getRootDirName();
  if (strpos($path, "/" . $rootDirName) !== 0) {
    throw new MessageException(FMMessage::createMessage(FMMessage::FM_DIR_NAME_INCORRECT_ROOT));
  }
  return substr($path, strlen("/" . $rootDirName));
}