本文整理汇总了PHP中MOXMAN_Util_PathUtils::verifyPath方法的典型用法代码示例。如果您正苦于以下问题:PHP MOXMAN_Util_PathUtils::verifyPath方法的具体用法?PHP MOXMAN_Util_PathUtils::verifyPath怎么用?PHP MOXMAN_Util_PathUtils::verifyPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MOXMAN_Util_PathUtils
的用法示例。
在下文中一共展示了MOXMAN_Util_PathUtils::verifyPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFile
/**
* Returns a MOXMAN_Vfs_IFile instance based on the specified path.
*
* @param string $path Path of the file to retrive.
* @return MOXMAN_Vfs_IFile File instance for the specified path.
*/
public function getFile($path)
{
// Get file from cache
if ($this->cache->has($path)) {
return $this->cache->get($path);
}
// Never give access to the mc_access file
if ($this->getConfig()->get("filesystem.local.access_file_name") === basename($path)) {
throw new MOXMAN_Exception("Can't access the access_file_name.");
}
MOXMAN_Util_PathUtils::verifyPath($path, true);
// Force the path to an absolute path
$path = MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $path);
// If the path is out side the root then return null
if (!MOXMAN_Util_PathUtils::isChildOf($path, $this->rootPath)) {
$null = null;
return $null;
}
// Create the file and put it in the cache
$file = new MOXMAN_Vfs_Local_File($this, $path);
$this->cache->put($path, $file);
return $file;
}
示例2: copyDir
/** @ignore */
private function copyDir($from, $to)
{
$fromPathRoot = $from->getPath();
$files = $this->getFiles($fromPathRoot);
foreach ($files as $fromPath) {
$toPath = MOXMAN_Util_PathUtils::combine($to->getPath(), substr($fromPath, strlen($fromPathRoot)));
if (is_file($fromPath)) {
if ($to instanceof MOXMAN_Vfs_Local_File) {
copy($fromPath, $toPath);
} else {
$to->getFileSystem()->getFile($toPath)->importFrom($fromPath);
}
} else {
if ($to instanceof MOXMAN_Vfs_Local_File) {
MOXMAN_Util_PathUtils::verifyPath($toPath, true, "dir");
mkdir($toPath);
} else {
$to->getFileSystem()->getFile($toPath)->mkdir();
}
}
}
}