/** * Test of procerss directory path */ public function testProcessDirectoryPath() { $this->assertEquals('home', FileManagerBaseModel::processDirectoryPath('home/')); $this->assertEquals('home', FileManagerBaseModel::processDirectoryPath('../home/')); $this->assertEquals('_home90_', FileManagerBaseModel::processDirectoryPath('@@!!...\\\\////_home90-MMMM(((**&&&_')); $this->assertEquals('home/test', FileManagerBaseModel::processDirectoryPath('../home/....&&&/test')); $this->assertEquals('', FileManagerBaseModel::processDirectoryPath('....////\\\\\\')); $this->assertEquals('', FileManagerBaseModel::processDirectoryPath('//////////////////////////////')); }
/** * Generate a tree * * @param array|boolean $userDirectories * @param string $treeId * @param string $currentPath * @param array $filters * @param string $treeClass * @return string */ public function __invoke($userDirectories = [], $treeId, $currentPath, array $filters = [], $treeClass = 'filetree') { $currentPath = $currentPath ? FileManagerBaseModel::processDirectoryPath($currentPath) : FileManagerBaseModel::getHomeDirectoryName(); return $this->getView()->partial('file-manager/patrial/directory-tree', ['id' => $treeId, 'class' => $treeClass, 'items' => $this->processDirectories($userDirectories, $currentPath, $filters), 'cookie_lifetime' => $this->treeCookieLifetimeDays]); }
/** * Set current path * * @param string $path * @return \FileManager\Form\FileManagerDirectory */ public function setPath($path) { $this->path = FileManagerBaseModel::processDirectoryPath($path); return $this; }