本文整理汇总了PHP中Sabre\DAV\INode::getEtag方法的典型用法代码示例。如果您正苦于以下问题:PHP INode::getEtag方法的具体用法?PHP INode::getEtag怎么用?PHP INode::getEtag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\DAV\INode
的用法示例。
在下文中一共展示了INode::getEtag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleGetProperties
/**
* Adds all ownCloud-specific properties
*
* @param PropFind $propFind
* @param \Sabre\DAV\INode $node
* @return void
*/
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
{
if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
$propFind->handle(self::FILEID_PROPERTYNAME, function () use($node) {
return $node->getFileId();
});
$propFind->handle(self::INTERNAL_FILEID_PROPERTYNAME, function () use($node) {
return $node->getInternalFileId();
});
$propFind->handle(self::PERMISSIONS_PROPERTYNAME, function () use($node) {
$perms = $node->getDavPermissions();
if ($this->isPublic) {
// remove mount information
$perms = str_replace(['S', 'M'], '', $perms);
}
return $perms;
});
$propFind->handle(self::GETETAG_PROPERTYNAME, function () use($node) {
return $node->getEtag();
});
}
if ($node instanceof \OCA\DAV\Connector\Sabre\File) {
$propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function () use($node) {
/** @var $node \OCA\DAV\Connector\Sabre\File */
$directDownloadUrl = $node->getDirectDownload();
if (isset($directDownloadUrl['url'])) {
return $directDownloadUrl['url'];
}
return false;
});
}
if ($node instanceof \OCA\DAV\Connector\Sabre\Directory) {
$propFind->handle(self::SIZE_PROPERTYNAME, function () use($node) {
return $node->getSize();
});
}
$propFind->handle(self::OWNER_ID_PROPERTYNAME, function () use($node) {
$owner = $node->getOwner();
return $owner->getUID();
});
$propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function () use($node) {
$owner = $node->getOwner();
$displayName = $owner->getDisplayName();
return $displayName;
});
}
示例2: handleGetProperties
/**
* Adds all ownCloud-specific properties
*
* @param PropFind $propFind
* @param \Sabre\DAV\INode $node
* @return void
*/
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
{
if ($node instanceof \OC\Connector\Sabre\Node) {
$propFind->handle(self::FILEID_PROPERTYNAME, function () use($node) {
return $node->getFileId();
});
$propFind->handle(self::PERMISSIONS_PROPERTYNAME, function () use($node) {
return $node->getDavPermissions();
});
$propFind->handle(self::GETETAG_PROPERTYNAME, function () use($node) {
return $node->getEtag();
});
}
if ($node instanceof \OC\Connector\Sabre\File) {
$propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function () use($node) {
/** @var $node \OC\Connector\Sabre\File */
$directDownloadUrl = $node->getDirectDownload();
if (isset($directDownloadUrl['url'])) {
return $directDownloadUrl['url'];
}
return false;
});
}
if ($node instanceof \OC\Connector\Sabre\Directory) {
$propFind->handle(self::SIZE_PROPERTYNAME, function () use($node) {
return $node->getSize();
});
}
}
示例3: handleGetProperties
/**
* Adds all ownCloud-specific properties
*
* @param PropFind $propFind
* @param \Sabre\DAV\INode $node
* @return void
*/
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
{
if ($node instanceof \OC\Connector\Sabre\Node) {
$propFind->handle(self::FILEID_PROPERTYNAME, function () use($node) {
return $node->getFileId();
});
$propFind->handle(self::PERMISSIONS_PROPERTYNAME, function () use($node) {
$perms = $node->getDavPermissions();
if ($this->isPublic) {
// remove mount information
$perms = str_replace(['S', 'M'], '', $perms);
}
return $perms;
});
$propFind->handle(self::GETETAG_PROPERTYNAME, function () use($node) {
return $node->getEtag();
});
}
if ($node instanceof \OC\Connector\Sabre\File) {
$propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function () use($node) {
/** @var $node \OC\Connector\Sabre\File */
try {
$directDownloadUrl = $node->getDirectDownload();
if (isset($directDownloadUrl['url'])) {
return $directDownloadUrl['url'];
}
} catch (StorageNotAvailableException $e) {
// return empty download link when storage not available
return false;
}
return false;
});
}
if ($node instanceof \OC\Connector\Sabre\Directory) {
$propFind->handle(self::SIZE_PROPERTYNAME, function () use($node) {
return $node->getSize();
});
}
}