本文整理汇总了PHP中OC\Files\View::getETag方法的典型用法代码示例。如果您正苦于以下问题:PHP View::getETag方法的具体用法?PHP View::getETag怎么用?PHP View::getETag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Files\View
的用法示例。
在下文中一共展示了View::getETag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPreview
/**
* @param string $owner
* @param int $fileId
* @param string $filePath
* @return array
*/
protected function getPreview($owner, $fileId, $filePath)
{
$info = $this->infoCache->getInfoById($owner, $fileId, $filePath);
if (!$info['exists'] || $info['view'] !== '') {
return $this->getPreviewFromPath($filePath, $info);
}
$preview = ['link' => $this->getPreviewLink($info['path'], $info['is_dir'], $info['view']), 'source' => '', 'isMimeTypeIcon' => true];
// show a preview image if the file still exists
if ($info['is_dir']) {
$preview['source'] = $this->getPreviewPathFromMimeType('dir');
} else {
$this->view->chroot('/' . $owner . '/files');
$fileInfo = $this->view->getFileInfo($info['path']);
if (!$fileInfo instanceof FileInfo) {
$pathPreview = $this->getPreviewFromPath($filePath, $info);
$preview['source'] = $pathPreview['source'];
} else {
if ($this->preview->isAvailable($fileInfo)) {
$preview['isMimeTypeIcon'] = false;
$preview['source'] = $this->urlGenerator->linkToRoute('core_ajax_preview', ['file' => $info['path'], 'c' => $this->view->getETag($info['path']), 'x' => 150, 'y' => 150]);
} else {
$preview['source'] = $this->getPreviewPathFromMimeType($fileInfo->getMimetype());
}
}
}
return $preview;
}
示例2: getPreview
/**
* @param string $owner
* @param int $fileId
* @param string $filePath
* @return array
*/
protected function getPreview($owner, $fileId, $filePath)
{
$this->view->chroot('/' . $owner . '/files');
$path = $this->view->getPath($fileId);
if ($path === null || $path === '' || !$this->view->file_exists($path)) {
return $this->getPreviewFromPath($filePath);
}
$is_dir = $this->view->is_dir($path);
$preview = ['link' => $this->getPreviewLink($path, $is_dir), 'source' => '', 'isMimeTypeIcon' => true];
// show a preview image if the file still exists
if ($is_dir) {
$preview['source'] = $this->getPreviewPathFromMimeType('dir');
} else {
$fileInfo = $this->view->getFileInfo($path);
if ($this->preview->isAvailable($fileInfo)) {
$preview['isMimeTypeIcon'] = false;
$preview['source'] = $this->urlGenerator->linkToRoute('core_ajax_preview', ['file' => $path, 'c' => $this->view->getETag($path), 'x' => 150, 'y' => 150]);
} else {
$preview['source'] = $this->getPreviewPathFromMimeType($fileInfo->getMimetype());
}
}
return $preview;
}
示例3: getETag
/**
* get the ETag for a file or folder
*
* @param string $path
* @return string
*/
public static function getETag($path)
{
return self::$defaultInstance->getETag($path);
}