本文整理匯總了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();
}
}
}
}