當前位置: 首頁>>代碼示例>>PHP>>正文


PHP NodeInterface::hasNodes方法代碼示例

本文整理匯總了PHP中PHPCR\NodeInterface::hasNodes方法的典型用法代碼示例。如果您正苦於以下問題:PHP NodeInterface::hasNodes方法的具體用法?PHP NodeInterface::hasNodes怎麽用?PHP NodeInterface::hasNodes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PHPCR\NodeInterface的用法示例。


在下文中一共展示了NodeInterface::hasNodes方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: nodeToArray

 /**
  *
  * Returns an array representation of a PHPCR node
  *
  * @param string $name
  * @param \PHPCR\NodeInterface $node
  *
  * @return array
  */
 private function nodeToArray($name, $node)
 {
     $has_children = $node->hasNodes();
     return array('data' => $name, 'attr' => array('id' => $node->getPath(), 'url_safe_id' => substr($node->getPath(), 1), 'rel' => 'node'), 'state' => $has_children ? 'closed' : null);
 }
開發者ID:EmmanuelVella,項目名稱:TreeBrowserBundle,代碼行數:14,代碼來源:PHPCRTree.php

示例2: 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}>");
     }
 }
開發者ID:viral810,項目名稱:ngSimpleCMS,代碼行數:50,代碼來源:ImportExport.php

示例3: testHasNodesTrue

 public function testHasNodesTrue()
 {
     $this->assertTrue($this->node->hasNodes());
 }
開發者ID:laurentiuc,項目名稱:phpcr-api-tests,代碼行數:4,代碼來源:NodeReadMethodsTest.php

示例4: hasNodes

 /**
  * {@inheritdoc}
  */
 public function hasNodes()
 {
     return $this->node->hasNodes();
 }
開發者ID:sulu,項目名稱:sulu,代碼行數:7,代碼來源:SuluNode.php

示例5: formatNodeName

 public function formatNodeName(NodeInterface $node)
 {
     return sprintf('%s%s', $node->getName(), $node->hasNodes() ? '/' : '');
 }
開發者ID:hason,項目名稱:phpcr-shell,代碼行數:4,代碼來源:ResultFormatterHelper.php


注:本文中的PHPCR\NodeInterface::hasNodes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。