本文整理汇总了PHP中Sabre\DAV\INode::getProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP INode::getProperties方法的具体用法?PHP INode::getProperties怎么用?PHP INode::getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\DAV\INode
的用法示例。
在下文中一共展示了INode::getProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: propFindNode
/**
* Fetches properties for a node.
*
* This event is called a bit later, so plugins have a chance first to
* populate the result.
*
* @param PropFind $propFind
* @param INode $node
* @return void
*/
function propFindNode(PropFind $propFind, INode $node)
{
if ($node instanceof IProperties && ($propertyNames = $propFind->get404Properties())) {
$nodeProperties = $node->getProperties($propertyNames);
foreach ($nodeProperties as $propertyName => $value) {
$propFind->set($propertyName, $value, 200);
}
}
}
示例2: copyNode
/**
* copyNode
*
* @param INode $source
* @param ICollection $destinationParent
* @param string $destinationName
* @return void
*/
protected function copyNode(INode $source, ICollection $destinationParent, $destinationName = null)
{
if (!$destinationName) {
$destinationName = $source->getName();
}
if ($source instanceof IFile) {
$data = $source->get();
// If the body was a string, we need to convert it to a stream
if (is_string($data)) {
$stream = fopen('php://temp', 'r+');
fwrite($stream, $data);
rewind($stream);
$data = $stream;
}
$destinationParent->createFile($destinationName, $data);
$destination = $destinationParent->getChild($destinationName);
} elseif ($source instanceof ICollection) {
$destinationParent->createDirectory($destinationName);
$destination = $destinationParent->getChild($destinationName);
foreach ($source->getChildren() as $child) {
$this->copyNode($child, $destination);
}
}
if ($source instanceof IProperties && $destination instanceof IProperties) {
$props = $source->getProperties([]);
$propPatch = new PropPatch($props);
$destination->propPatch($propPatch);
$propPatch->commit();
}
}
示例3: propFindNode
/**
* Fetches properties for a node.
*
* This event is called a bit later, so plugins have a chance first to
* populate the result.
*
* @param PropFind $propFind
* @param INode $node
* @return void
*/
function propFindNode(PropFind $propFind, INode $node)
{
if ($node instanceof IProperties && ($propertyNames = $propFind->get404Properties())) {
$nodeProperties = $node->getProperties($propertyNames);
foreach ($propertyNames as $propertyName) {
if (array_key_exists($propertyName, $nodeProperties)) {
$propFind->set($propertyName, $nodeProperties[$propertyName], 200);
}
}
}
}