本文整理汇总了PHP中PHPCR\Util\NodeHelper::isSystemItem方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeHelper::isSystemItem方法的具体用法?PHP NodeHelper::isSystemItem怎么用?PHP NodeHelper::isSystemItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPCR\Util\NodeHelper
的用法示例。
在下文中一共展示了NodeHelper::isSystemItem方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getChildren
public function getChildren($path)
{
$root = $this->session->getNode($path);
$children = array();
foreach ($root->getNodes() as $name => $node) {
if (NodeHelper::isSystemItem($node)) {
continue;
}
$child = $this->nodeToArray($name, $node);
foreach ($node->getNodes() as $childname => $grandson) {
$child['children'][] = $this->nodeToArray($childname, $grandson);
}
$children[] = $child;
}
return $children;
}
示例2: testIsSystemItem
public function testIsSystemItem()
{
$sys = $this->getMock('PHPCR\\Tests\\Stubs\\MockNode');
$sys->expects($this->once())->method('getDepth')->will($this->returnValue(0));
$sys->expects($this->once())->method('getName')->will($this->returnValue('jcr:root'));
$this->assertTrue(NodeHelper::isSystemItem($sys));
$sys = $this->getMock('PHPCR\\Tests\\Stubs\\MockNode');
$sys->expects($this->once())->method('getDepth')->will($this->returnValue(1));
$sys->expects($this->once())->method('getName')->will($this->returnValue('jcr:system'));
$this->assertTrue(NodeHelper::isSystemItem($sys));
$top = $this->getMock('PHPCR\\Tests\\Stubs\\MockNode');
$top->expects($this->once())->method('getDepth')->will($this->returnValue(1));
$top->expects($this->once())->method('getName')->will($this->returnValue('jcrname'));
$this->assertFalse(NodeHelper::isSystemItem($top));
$deep = $this->getMock('PHPCR\\Tests\\Stubs\\MockNode');
$deep->expects($this->once())->method('getDepth')->will($this->returnValue(2));
$this->assertFalse(NodeHelper::isSystemItem($deep));
}
示例3: exportDocumentViewRecursive
/**
* Recursively output node and all its children into the file in the
* document view format
*
* @param NodeInterface $node the node to output
* @param NamespaceRegistryInterface $ns The namespace registry to export namespaces too
* @param resource $stream the resource to write data out to
* @param boolean $skipBinary A boolean governing whether binary properties
* are to be serialized.
* @param boolean $noRecurse A boolean governing whether the subgraph at
* absPath is to be recursed.
* @param boolean $root Whether this is the root node of the resulting
* document, meaning the namespace declarations have to be included in
* it.
*/
private static function exportDocumentViewRecursive(NodeInterface $node, NamespaceRegistryInterface $ns, $stream, $skipBinary, $noRecurse, $root = false)
{
$nodename = self::escapeXmlName($node->getName());
fwrite($stream, "<{$nodename}");
if ($root) {
self::exportNamespaceDeclarations($ns, $stream);
}
foreach ($node->getProperties() as $name => $property) {
/** @var $property \PHPCR\PropertyInterface */
if ($property->isMultiple()) {
// skip multiple properties. jackrabbit does this too. cheap but whatever. use system view for a complete export
continue;
}
if (PropertyType::BINARY == $property->getType()) {
if ($skipBinary) {
continue;
}
$value = base64_encode($property->getString());
} else {
$value = htmlspecialchars($property->getString());
}
fwrite($stream, ' ' . self::escapeXmlName($name) . '="' . $value . '"');
}
if ($noRecurse || !$node->hasNodes()) {
fwrite($stream, '/>');
} else {
fwrite($stream, '>');
foreach ($node as $child) {
if (!($child->getDepth() == 1 && NodeHelper::isSystemItem($child))) {
self::exportDocumentViewRecursive($child, $ns, $stream, $skipBinary, $noRecurse);
}
}
fwrite($stream, "</{$nodename}>");
}
}
示例4: initVersionLabels
/**
* This method fetches all version labels, if the cache array is not initialized yet.
*/
private function initVersionLabels()
{
if (!is_null($this->versionLabels)) {
return;
}
$this->versionLabels = array();
$node = $this->getNode('jcr:versionLabels');
foreach ($node->getProperties() as $property) {
/* @var Property $property */
if (NodeHelper::isSystemItem($node)) {
$name = $property->getName();
$value = $this->objectManager->getNodeByIdentifier($property->getValue()->getIdentifier(), 'Version\\Version');
$this->versionLabels[$name] = $value;
}
}
}
示例5: mustVisit
/**
* Checks whether this item is a system item
*
* @param ItemInterface $item
*
* @return boolean
*/
public function mustVisit(ItemInterface $item)
{
return !NodeHelper::isSystemItem($item);
}
示例6: getChildren
/**
* Get the children of the document at this path by looking at the Child and Children mappings.
*
* {@inheritDoc}
*/
public function getChildren($path)
{
$root = $this->dm->find(null, $path);
$children = array();
if ($root) {
$rootManager = $this->getModelManager($root);
foreach ($this->getDocumentChildren($rootManager, $root) as $document) {
if ($document instanceof Generic && (NodeHelper::isSystemItem($document->getNode()) || !strncmp('phpcr_locale:', $document->getNode()->getName(), 13))) {
continue;
}
$manager = $this->getModelManager($document);
$child = $this->documentToArray($manager, $document);
if ($this->depth > 0) {
foreach ($this->getDocumentChildren($manager, $document) as $grandchild) {
$child['children'][] = $this->documentToArray($manager, $grandchild);
}
}
$children[] = $child;
}
}
return $children;
}