当前位置: 首页>>代码示例>>PHP>>正文


PHP DOMElement::cloneNode方法代码示例

本文整理汇总了PHP中DOMElement::cloneNode方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMElement::cloneNode方法的具体用法?PHP DOMElement::cloneNode怎么用?PHP DOMElement::cloneNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DOMElement的用法示例。


在下文中一共展示了DOMElement::cloneNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getItem

 /**
  * @param array $values
  */
 public function getItem(array $values, flavorAsset $flavorAsset = null, thumbAsset $thumbAsset = null)
 {
     $item = $this->item->cloneNode(true);
     kXml::setNodeValue($this->xpath, 'guid', $values[AvnDistributionField::GUID], $item);
     kXml::setNodeValue($this->xpath, 'pubDate', $values[AvnDistributionField::PUB_DATE], $item);
     kXml::setNodeValue($this->xpath, 'title', $values[AvnDistributionField::TITLE], $item);
     kXml::setNodeValue($this->xpath, 'description', $values[AvnDistributionField::DESCRIPTION], $item);
     kXml::setNodeValue($this->xpath, 'link', $values[AvnDistributionField::LINK], $item);
     kXml::setNodeValue($this->xpath, 'category', $values[AvnDistributionField::CATEGORY], $item);
     kXml::setNodeValue($this->xpath, 'amg:passthru', $this->getPassthruJsonObj($values), $item);
     if ($flavorAsset) {
         $url = $this->getAssetUrl($flavorAsset);
         $type = $this->getContentTypeFromUrl($url);
         kXml::setNodeValue($this->xpath, 'media:content/@url', $url, $item);
         kXml::setNodeValue($this->xpath, 'media:content/@type', $type, $item);
         if ($values[AvnDistributionField::ORDER_SUB] == '1') {
             kXml::setNodeValue($this->xpath, 'media:content/@isDefault', 'true', $item);
         } else {
             kXml::setNodeValue($this->xpath, 'media:content/@isDefault', 'false', $item);
         }
     }
     if ($thumbAsset) {
         kXml::setNodeValue($this->xpath, 'media:thumbnail/@url', $this->getAssetUrl($thumbAsset), $item);
     }
     return $item;
 }
开发者ID:DBezemer,项目名称:server,代码行数:29,代码来源:AvnFeed.php

示例2: addItem

 /**
  * @param array $values
  */
 public function addItem(array $values, flavorAsset $flavorAsset = null, thumbAsset $thumbAsset = null)
 {
     $item = $this->item->cloneNode(true);
     $channelNode = $this->xpath->query('/rss/channel', $item)->item(0);
     $channelNode->appendChild($item);
     $this->setNodeValue('guid', $values[AvnDistributionField::GUID], $item);
     $this->setNodeValue('pubDate', $values[AvnDistributionField::PUB_DATE], $item);
     $this->setNodeValue('title', $values[AvnDistributionField::TITLE], $item);
     $this->setNodeValue('description', $values[AvnDistributionField::DESCRIPTION], $item);
     $this->setNodeValue('link', $values[AvnDistributionField::LINK], $item);
     $this->setNodeValue('category', $values[AvnDistributionField::CATEGORY], $item);
     $this->setNodeValue('amg:passthru', $this->getPassthruJsonObj($values), $item);
     if ($flavorAsset) {
         $url = $this->getAssetUrl($flavorAsset);
         $type = $this->getContentTypeFromUrl($url);
         $this->setNodeValue('media:content/@url', $url, $item);
         $this->setNodeValue('media:content/@type', $type, $item);
         if ($values[AvnDistributionField::ORDER_SUB] == '1') {
             $this->setNodeValue('media:content/@isDefault', 'true', $item);
         } else {
             $this->setNodeValue('media:content/@isDefault', 'false', $item);
         }
     }
     if ($thumbAsset) {
         $this->setNodeValue('media:thumbnail/@url', $this->getAssetUrl($thumbAsset), $item);
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:30,代码来源:AvnFeed.php

示例3: filterElement

 /**
  * Filter a single element
  * 
  * @param DOMElement $element 
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     // We need to create invalid markup here, as there is no surrounding
     // element allowed for groups of dt and dd elements.
     $entry = new ezcDocumentXhtmlDomElement('div');
     $term = $element->cloneNode(true);
     $parent = $element->parentNode;
     // Replace header with new section node
     $parent->replaceChild($entry, $element);
     $entry->setProperty('type', 'varlistentry');
     $entry->appendChild($term);
     // Skip all preceeding child elements, until we reach the current node.
     $children = $parent->childNodes;
     $childCount = $children->length;
     for ($i = 0; $i < $childCount; ++$i) {
         if ($entry->isSameNode($children->item($i))) {
             break;
         }
     }
     ++$i;
     while (($node = $children->item($i)) !== null) {
         if ($node->nodeType === XML_ELEMENT_NODE && ($node->tagName === 'dt' || $node->tagName === 'dd')) {
             $new = $node->cloneNode(true);
             $entry->appendChild($new);
             $parent->removeChild($node);
         } else {
             ++$i;
         }
     }
 }
开发者ID:jackalope,项目名称:jr_cr_demo,代码行数:36,代码来源:definitionlist.php

示例4: handle

 /**
  * Handle a node
  *
  * Handle / transform a given node, and return the result of the
  * conversion.
  *
  * @param ezcDocumentElementVisitorConverter $converter
  * @param DOMElement $node
  * @param mixed $root
  * @return mixed
  */
 public function handle(ezcDocumentElementVisitorConverter $converter, DOMElement $node, $root)
 {
     $number = $converter->appendFootnote($node->cloneNode(true));
     $footnoteReference = $root->ownerDocument->createElement('a', $number);
     $footnoteReference->setAttribute('class', 'footnote');
     $footnoteReference->setAttribute('href', '#__footnote_' . $number);
     $root->appendChild($footnoteReference);
     return $root;
 }
开发者ID:bmdevel,项目名称:ezc,代码行数:20,代码来源:footnote.php

示例5: _getPlainText

 private function _getPlainText(DOMElement $tag)
 {
     // Work on a copy
     $clone = $tag->cloneNode(true);
     // Strip unneded tags (<small>)
     while (($tag = $clone->getElementsByTagName('small')) && $tag->length) {
         $tag->item(0)->parentNode->removeChild($tag->item(0));
     }
     return $clone->textContent;
 }
开发者ID:helpfulrobot,项目名称:entidi-silverstripe-autotoc,代码行数:10,代码来源:Tocifier.php

示例6: setFlavorAsset

 /**
  * @param array $flavorAssets
  */
 public function setFlavorAsset(DOMElement $item, array $flavorAssets)
 {
     $flavorAsset = $flavorAssets[0];
     /* @var $flavorAsset flavorAsset */
     $content = $this->content->cloneNode(true);
     $mediaGroup = $this->xpath->query('media:group', $item)->item(0);
     $mediaGroup->appendChild($content);
     $url = $this->getAssetUrl($flavorAsset);
     kXml::setNodeValue($this->xpath, '@url', $url, $content);
 }
开发者ID:DBezemer,项目名称:server,代码行数:13,代码来源:TimeWarnerFeed.php

示例7: setCuePoints

 public function setCuePoints(DOMElement $item, array $cuePoints)
 {
     foreach ($cuePoints as $cuePoint) {
         /* @var $cuePoint cuePoint */
         $content = $this->cuePoint->cloneNode(true);
         $mediaGroup = $this->xpath->query('.', $item)->item(0);
         $mediaGroup->appendChild($content);
         kXml::setNodeValue($this->xpath, '@type', self::MILLISECONDS, $content);
         kXml::setNodeValue($this->xpath, '@startTime', $cuePoint->getStartTime(), $content);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:11,代码来源:ComcastMrssFeed.php

示例8: appendTableToNode

 /**
  * @param \DOMNode $node
  * @return \DOMNode|null
  */
 public function appendTableToNode(\DOMNode $node)
 {
     if ($node->ownerDocument === null) {
         return null;
     }
     if ($node->ownerDocument === $this->dom) {
         return null;
     }
     $table = $node->ownerDocument->importNode($this->table->cloneNode(true), true);
     return $node->appendChild($table);
 }
开发者ID:dcarbone,项目名称:table-mapper,代码行数:15,代码来源:TableMapper.php

示例9: addThumbAsset

 public function addThumbAsset(DOMElement $item, asset $thumbAsset, $thumbnailCredit)
 {
     $thumbnailNode = $this->thumbnail->cloneNode(true);
     $item->appendChild($thumbnailNode);
     $url = $this->getAssetUrl($thumbAsset);
     $this->setNodeValue('@url', $url, $thumbnailNode);
     $this->setNodeValue('@width', $thumbAsset->getWidth(), $thumbnailNode);
     $this->setNodeValue('@height', $thumbAsset->getHeight(), $thumbnailNode);
     if ($thumbnailCredit) {
         $this->setNodeValue('@credit', $thumbnailCredit, $thumbnailNode);
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:12,代码来源:UverseFeed.php

示例10: setThumbAssets

 /**
  * @param array $flavorAssets
  */
 public function setThumbAssets(DOMElement $item, array $thumbAssets)
 {
     foreach ($thumbAssets as $thumbAsset) {
         /* @var $flavorAsset flavorAsset */
         $content = $this->thumbnail->cloneNode(true);
         $mediaGroup = $this->xpath->query('media:group', $item)->item(0);
         $mediaGroup->appendChild($content);
         $url = $this->getAssetUrl($thumbAsset);
         kXml::setNodeValue($this->xpath, '@url', $url, $content);
         kXml::setNodeValue($this->xpath, '@width', $thumbAsset->getWidth(), $content);
         kXml::setNodeValue($this->xpath, '@height', $thumbAsset->getHeight(), $content);
     }
 }
开发者ID:GElkayam,项目名称:server,代码行数:16,代码来源:ComcastMrssFeed.php

示例11: addCategory

 public function addCategory($item, $categoryValue)
 {
     $categories = explode(',', $categoryValue);
     if ($categories) {
         foreach ($categories as $category) {
             if ($category) {
                 $categoryNode = $this->category->cloneNode(true);
                 $categoryNode->nodeValue = $category;
                 $beforeNode = $this->xpath->query('media:copyright', $item)->item(0);
                 $item->insertBefore($categoryNode, $beforeNode);
             }
         }
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:14,代码来源:NdnFeed.php

示例12: getNextNodeTemplate

 /**
  * @param int
  * @throws \Exception
  * @return DOMNode
  */
 protected function getNextNodeTemplate($template_type)
 {
     if ($template_type == static::$TEMPLATE_TYPE_BEGRUENDUNG) {
         return $this->node_begruendung->cloneNode();
     }
     if ($template_type == static::$TEMPLATE_TYPE_ANTRAG) {
         if ($this->node_template_1_used && $this->node_template_n) {
             return $this->node_template_n->cloneNode();
         } else {
             $this->node_template_1_used = true;
             return $this->node_template_1->cloneNode();
         }
     }
     throw new Exception("Ungültiges Template");
 }
开发者ID:andi98,项目名称:antragsgruen,代码行数:20,代码来源:OdtTemplateEngine.php

示例13: getNextNodeTemplate

 /**
  * @param bool $lineNumbers
  *
  * @return \DOMNode
  */
 protected function getNextNodeTemplate($lineNumbers)
 {
     $node = $this->nodeText->cloneNode();
     /** @var \DOMElement $node */
     if ($lineNumbers) {
         if ($this->node_template_1_used) {
             $node->setAttribute('text:style-name', 'Antragsgrün_20_LineNumbered_20_Standard');
         } else {
             $this->node_template_1_used = true;
             $node->setAttribute('text:style-name', 'Antragsgrün_20_LineNumbered_20_First');
         }
     } else {
         $node->setAttribute('text:style-name', 'Antragsgrün_20_Standard');
     }
     return $node;
 }
开发者ID:CatoTH,项目名称:html2opendocument,代码行数:21,代码来源:Text.php

示例14: addItem

 public function addItem(array $values, $categoryNode, $thumbnailFile, $flavorFile)
 {
     $item = $this->item->cloneNode(true);
     $categoryNode->appendChild($item);
     $this->setNodeValue('@title', $values[UverseClickToOrderDistributionField::ITEM_TITLE], $item);
     $this->setNodeValue('@content_type', $values[UverseClickToOrderDistributionField::ITEM_CONTENT_TYPE], $item);
     $this->setNodeValue('@file', $thumbnailFile, $item);
     $this->setNodeValue('@destination', $values[UverseClickToOrderDistributionField::ITEM_DESTINATION], $item);
     if (strtolower($values[UverseClickToOrderDistributionField::ITEM_CONTENT_TYPE]) == self::VIDFILE_CONTENT_TYPE) {
         $this->setNodeValue('@vidfile', $flavorFile, $item);
     } else {
         $item->removeAttribute('vidfile');
     }
     $this->setNodeValue('@ccvidfile', $values[UverseClickToOrderDistributionField::ITEM_CCVIDFILE], $item);
     $this->setNodeValue('content', $values[UverseClickToOrderDistributionField::ITEM_CONTENT], $item);
     $this->setNodeValue('directions', $values[UverseClickToOrderDistributionField::ITEM_DIRECTIONS], $item);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:17,代码来源:UverseClickToOrderFeed.php

示例15: setThumbAsset

 /**
  * @param DOMElement $item
  * @param array $thumbAssets
  * @param array $remoteThumbailFileUrls
  */
 public function setThumbAsset($item, array $thumbAssets, $remoteThumbailFileUrls)
 {
     $node = $this->xpath->query('thumbnail', $item)->item(0);
     if (count($thumbAssets)) {
         foreach ($thumbAssets as $thumbAsset) {
             /* @var $thumbAsset thumbAsset */
             $thumbAssetId = $thumbAsset->getId();
             $url = '';
             if (!is_null($remoteThumbailFileUrls)) {
                 $url = $remoteThumbailFileUrls[$thumbAssetId];
             }
             $thumbnailNode = $this->thumbnail->cloneNode(true);
             $item->insertBefore($thumbnailNode, $node);
             $this->setNodeValue('@url', $url, $thumbnailNode);
             $this->setNodeValue('@height', $thumbAsset->getHeight(), $thumbnailNode);
             $this->setNodeValue('@width', $thumbAsset->getWidth(), $thumbnailNode);
         }
     }
     $node->parentNode->removeChild($node);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:25,代码来源:AttUverseDistributionFeedHelper.php


注:本文中的DOMElement::cloneNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。