• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DOMNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getXml

 /**
  * @param \DOMNode $parent
  * @param SerializationContext $context
  * @return \DOMElement
  */
 public function getXml(\DOMNode $parent, SerializationContext $context)
 {
     $result = $context->getDocument()->createElementNS(Protocol::NS_METADATA, 'md:NameIDFormat');
     $parent->appendChild($result);
     $result->nodeValue = $this->value;
     return $result;
 }
开发者ID:LearnerNation,项目名称:lightsaml,代码行数:12,代码来源:NameIDFormat.php


示例2: getStateXML

 /**
  * Get some configuration variables as XML node attributes
  * @param \DOMElement|\DOMNode $node
  */
 public static function getStateXML($node)
 {
     $config = self::getState();
     foreach ($config as $k => $v) {
         $node->setAttribute($k, $v);
     }
 }
开发者ID:difra-org,项目名称:difra,代码行数:11,代码来源:Envi.php


示例3: append_style

 static function append_style(DOMNode $node, $new_style)
 {
     $style = rtrim($node->getAttribute(self::$_style_attr), ";");
     $style .= $new_style;
     $style = ltrim($style, ";");
     $node->setAttribute(self::$_style_attr, $style);
 }
开发者ID:fredcido,项目名称:simuweb,代码行数:7,代码来源:attribute_translator.cls.php


示例4: _buildNode

 /**
  * Builds and creates the Atom XML nodes required by this date
  *
  * The element node representing this date is created separately and
  * passed as the first parameter of this method.
  *
  * @param DOMNode $node the node representing this date.
  *
  * @return void
  */
 protected function _buildNode(DOMNode $node)
 {
     $document = $node->ownerDocument;
     $date_string = $this->_date->format('c');
     $text_node = $document->createTextNode($date_string);
     $node->appendChild($text_node);
 }
开发者ID:gauthierm,项目名称:xml-atom,代码行数:17,代码来源:Date.php


示例5: _nodeToValue

 /**
  * Converts a node to a PHP value
  *
  * @param DOMNode $node
  * @return mixed
  */
 private static function _nodeToValue($node)
 {
     $type = null;
     if ($node instanceof DOMElement) {
         $type = $node->getAttribute('type');
     }
     switch ($type) {
         case 'datetime':
             return self::_timestampToUTC((string) $node->nodeValue);
         case 'date':
             return new DateTime((string) $node->nodeValue);
         case 'integer':
             return (int) $node->nodeValue;
         case 'boolean':
             $value = (string) $node->nodeValue;
             if (is_numeric($value)) {
                 return (bool) $value;
             } else {
                 return $value !== "true" ? false : true;
             }
         case 'array':
         case 'collection':
             return self::_nodeToArray($node);
         default:
             if ($node->hasChildNodes()) {
                 return self::_nodeToArray($node);
             } elseif (trim($node->nodeValue) === '') {
                 return null;
             } else {
                 return $node->nodeValue;
             }
     }
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:39,代码来源:Parser.php


示例6: processDataTag

	private function processDataTag( DOMNode $node ) {
		if( $node->hasAttribute( DATA_TYPE_ATTRIBUTE_NAME ) ) {
			switch( $node->getAttribute( DEPENDENCY_TYPE_ATTRIBUTE_NAME ) ) {
				case DATA_TYPE_STREAM_VALUE:
				/******* nothing for now
					$url = $this->buildURL( MODULE_STREAM_PATH . $node->nodeValue );
					if( $this->url_exists( $url ) ) {
						$this->xml->load( $url );
					}
				**********/
					break;
				case DATA_TYPE_PROCESSOR_VALUE:

					break;
				case DATA_TYPE_DYNAMICFILE_VALUE:
					if ( file_exists( MODULE_FILE_PATH . $node->nodeValue ) ) {
						ob_start();
						$file = MODULE_FILE_PATH . $node->nodeValue;
						include $file;
						$this->dynamicFileOutput .= ob_get_contents();
						ob_end_clean();
					}
					break;
				case DATA_TYPE_STATICFILE_VALUE:
					if ( file_exists( MODULE_FILE_PATH . $node->nodeValue ) ) {
						$this->staticFileOutput .= file_get_contents( MODULE_FILE_PATH . $node->nodeValue );
					} else {
						
						//echo "loading: " . MODULE_FILE_PATH . $node->nodeValue;
					}
					break;
			}
		}
	}
开发者ID:nathanfl,项目名称:medtele,代码行数:34,代码来源:Module.Class.php


示例7: drawThumbnailZone

 /**
  * Draw a final layout zone on its thumbnail.
  *
  * @access private
  *
  * @param ressource $thumbnail  The thumbnail ressource
  * @param DOMNode   $node       The current node zone
  * @param array     $clip       The clip rect to draw
  * @param int       $background The background color
  * @param int       $gridcolumn The number of columns in the grid
  * @param boolean   $lastChild  True if the current node is the last child of its parent node
  *
  * @return int The new X axis position;
  */
 private function drawThumbnailZone(&$thumbnail, $node, $clip, $background, $gridcolumn, $lastChild = false)
 {
     $x = $clip[0];
     $y = $clip[1];
     $width = $clip[2];
     $height = $clip[3];
     if (null !== ($spansize = preg_replace('/[^0-9]+/', '', $node->getAttribute('class')))) {
         $width = floor($width * $spansize / $gridcolumn);
     }
     if (false !== strpos($node->getAttribute('class'), 'Child')) {
         $height = floor($height / 2);
     }
     if (!$node->hasChildNodes()) {
         $this->drawRect($thumbnail, array($x, $y, $width, $height), $background, $width == $clip[2] || strpos($node->getAttribute('class'), 'hChild'), $lastChild);
         return $width + 2;
     }
     foreach ($node->childNodes as $child) {
         if (is_a($child, 'DOMText')) {
             continue;
         }
         if ('clear' == $child->getAttribute('class')) {
             $x = $clip[0];
             $y = $clip[1] + floor($height / 2) + 2;
             continue;
         }
         $x += $this->drawThumbnailZone($thumbnail, $child, array($x, $y, $clip[2], $height), $background, $gridcolumn, $node->isSameNode($node->parentNode->lastChild));
     }
     return $x + $width - 2;
 }
开发者ID:gobjila,项目名称:BackBee,代码行数:43,代码来源:LayoutRepository.php


示例8: recursiveStripQuotes

function recursiveStripQuotes(DOMNode $node)
{
    if (!$node->childNodes) {
        return;
    }
    $purge = array();
    foreach ($node->childNodes as $child) {
        $class = null;
        if ($child->attributes) {
            $class = $child->attributes->getNamedItem('class');
        }
        if ($class && $class->value == 'quoteheader') {
            $purge[] = $child;
        } elseif ($class && $class->value == 'quotefooter') {
            $purge[] = $child;
        } elseif ($child->nodeName == 'blockquote') {
            $purge[] = $child;
        } else {
            recursiveStripQuotes($child);
        }
    }
    foreach ($purge as $child) {
        $node->removeChild($child);
    }
    return $node;
}
开发者ID:ErikRoelofs,项目名称:wordcounter,代码行数:26,代码来源:index.php


示例9: getXml

 /**
  * @param \DOMNode $parent
  * @param \AerialShip\LightSaml\Meta\SerializationContext $context
  * @return \DOMNode
  */
 function getXml(\DOMNode $parent, SerializationContext $context)
 {
     $objXMLSecDSig = new \XMLSecurityDSig();
     $objXMLSecDSig->setCanonicalMethod($this->getCanonicalMethod());
     $key = $this->getXmlSecurityKey();
     switch ($key->type) {
         case \XMLSecurityKey::RSA_SHA256:
             $type = \XMLSecurityDSig::SHA256;
             break;
         case \XMLSecurityKey::RSA_SHA384:
             $type = \XMLSecurityDSig::SHA384;
             break;
         case \XMLSecurityKey::RSA_SHA512:
             $type = \XMLSecurityDSig::SHA512;
             break;
         default:
             $type = \XMLSecurityDSig::SHA1;
     }
     $objXMLSecDSig->addReferenceList(array($parent), $type, array(Protocol::XMLSEC_TRANSFORM_ALGORITHM_ENVELOPED_SIGNATURE, \XMLSecurityDSig::EXC_C14N), array('id_name' => $this->getIDName(), 'overwrite' => FALSE));
     $objXMLSecDSig->sign($key);
     $objXMLSecDSig->add509Cert($this->getCertificate()->getData(), false, false);
     $firstChild = $parent->hasChildNodes() ? $parent->firstChild : null;
     if ($firstChild && $firstChild->localName == 'Issuer') {
         // The signature node should come after the issuer node
         $firstChild = $firstChild->nextSibling;
     }
     $objXMLSecDSig->insertSignature($parent, $firstChild);
 }
开发者ID:LearnerNation,项目名称:lightsaml,代码行数:33,代码来源:SignatureCreator.php


示例10: checkPageLink

 /**
  * Check the status of a single link on a page
  *
  * @param BrokenExternalPageTrack $pageTrack
  * @param DOMNode $link
  */
 protected function checkPageLink(BrokenExternalPageTrack $pageTrack, DOMNode $link)
 {
     $class = $link->getAttribute('class');
     $href = $link->getAttribute('href');
     $markedBroken = preg_match('/\\b(ss-broken)\\b/', $class);
     // Check link
     $httpCode = $this->linkChecker->checkLink($href);
     if ($httpCode === null) {
         return;
     }
     // Null link means uncheckable, such as an internal link
     // If this code is broken then mark as such
     if ($foundBroken = $this->isCodeBroken($httpCode)) {
         // Create broken record
         $brokenLink = new BrokenExternalLink();
         $brokenLink->Link = $href;
         $brokenLink->HTTPCode = $httpCode;
         $brokenLink->TrackID = $pageTrack->ID;
         $brokenLink->StatusID = $pageTrack->StatusID;
         // Slight denormalisation here for performance reasons
         $brokenLink->write();
     }
     // Check if we need to update CSS class, otherwise return
     if ($markedBroken == $foundBroken) {
         return;
     }
     if ($foundBroken) {
         $class .= ' ss-broken';
     } else {
         $class = preg_replace('/\\s*\\b(ss-broken)\\b\\s*/', ' ', $class);
     }
     $link->setAttribute('class', trim($class));
 }
开发者ID:govtnz,项目名称:silverstripe-externallinks,代码行数:39,代码来源:CheckExternalLinksTask.php


示例11: copyNodes

 protected function copyNodes(DOMNode $dirty, DOMNode $clean)
 {
     foreach ($dirty->attributes as $name => $valueNode) {
         /* Copy over allowed attributes */
         if (isset($this->allowed[$dirty->nodeName][$name])) {
             $attr = $clean->ownerDocument->createAttribute($name);
             $attr->value = $valueNode->value;
             $clean->appendChild($attr);
         }
     }
     foreach ($dirty->childNodes as $child) {
         /* Copy allowed elements */
         if ($child->nodeType == XML_ELEMENT_NODE && isset($this->allowed[$child->nodeName])) {
             $node = $clean->ownerDocument->createElement($child->nodeName);
             $clean->appendChild($node);
             /* Examine children of this allowed element */
             $this->copyNodes($child, $node);
         } else {
             if ($child->nodeType == XML_TEXT_NODE) {
                 $text = $clean->ownerDocument->createTextNode($child->textContent);
                 $clean->appendChild($text);
             }
         }
     }
 }
开发者ID:zmwebdev,项目名称:PHPcookbook-code-3ed,代码行数:25,代码来源:tag-stripper.php


示例12: appendToDom

 public function appendToDom(\DOMNode $parent)
 {
     $node = $parent->appendChild(new \DOMElement('PaymentAccount'));
     $node->appendChild(new \DOMElement('PaymentAccountID', $this['PaymentAccountID']));
     $node->appendChild(new \DOMElement('PaymentAccountType', $this['PaymentAccountType']));
     $node->appendChild(new \DOMElement('PaymentAccountReferenceNumber', $this['PaymentAccountReferenceNumber']));
 }
开发者ID:zerve,项目名称:omnipay-elementexpress,代码行数:7,代码来源:PaymentAccount.php


示例13: castElement

 /**
  * Caste l'élement spécifié
  *
  * @param DOMNode $nodeParent DOMNode
  * @param String  $value      String
  *
  * @return void
  */
 function castElement($nodeParent, $value)
 {
     $value = utf8_encode($value);
     $attribute = $this->createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:type");
     $attribute->nodeValue = $value;
     $nodeParent->appendChild($attribute);
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:15,代码来源:CCDADomDocument.class.php


示例14: array2domAttr

 /**
  * Add dom attributes from array
  * @static
  * @param \DOMElement|\DOMNode $node
  * @param array $array
  * @param bool $verbal
  */
 public static function array2domAttr(&$node, $array, $verbal = false)
 {
     if (is_array($array) and !empty($array)) {
         foreach ($array as $k => $v) {
             if (is_numeric($k) and !is_array($v) and !is_object($v) and ctype_alnum($v)) {
                 $node->appendChild($node->ownerDocument->createElement(ctype_alpha($v[0]) ? $v : "_{$v}"));
             } elseif (is_array($v)) {
                 if (is_numeric($k)) {
                     $k = "_{$k}";
                 }
                 $newNode = $node->appendChild($node->ownerDocument->createElement($k));
                 self::array2domAttr($newNode, $v, $verbal);
             } elseif (is_object($v)) {
             } else {
                 if ($verbal) {
                     if (is_null($v)) {
                         $v = 'null';
                     } elseif ($v === false) {
                         $v = 'false';
                     } elseif ($v === true) {
                         $v = 'true';
                     } elseif ($v === 0) {
                         $v = '0';
                     }
                 }
                 $node->setAttribute(ctype_alpha($k[0]) ? $k : "_{$k}", $v);
             }
         }
     }
 }
开发者ID:difra-org,项目名称:difra,代码行数:37,代码来源:DOM.php


示例15: process

 /**
  * @param DOMNode $node
  * @param ProxyObject $proxy
  */
 private function process(DOMNode $node, ProxyObject $proxy)
 {
     $proxy->setName($node->nodeName);
     if ($node->hasAttributes()) {
         for ($i = 0; $i < $node->attributes->length; $i++) {
             $attribute = $node->attributes->item($i);
             $proxy->set($attribute->name, $attribute->value);
         }
     }
     if ($node->hasChildNodes()) {
         $nodeTypes = array();
         foreach ($node->childNodes as $childNode) {
             if ($childNode->nodeName === '#text') {
                 $proxy->setValue($childNode->nodeValue);
             } else {
                 $childProxy = new ProxyObject();
                 $this->process($childNode, $childProxy);
                 $nodeTypes[$childProxy->getName()][] = $childProxy;
             }
         }
         foreach ($nodeTypes as $tagName => $nodes) {
             $proxy->set($tagName, $nodes);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:chrisahhh-silverstripe-importer,代码行数:29,代码来源:XmlDataSource.php


示例16: appendToDom

 public function appendToDom(\DOMNode $parent)
 {
     $node = $parent->appendChild(new \DOMElement('Card'));
     // Append parameters.
     $node->appendChild(new \DOMElement('CVV', $this['CVV']));
     // Only one of the following field groups needs to be included; If more
     // than one is present, they will be given the following order of
     // precedence. To avoid unintended results only populate one field per
     // transaction.
     $cardData = ['MagneprintData' => false, 'EncryptedTrack2Data' => true, 'EncryptedTrack1Data' => true, 'EncryptedCardData' => true, 'Track2Data' => false, 'Track1Data' => false];
     do {
         foreach ($cardData as $field => $isEncrypted) {
             if (!empty($this[$field])) {
                 $node->appendChild(new \DOMElement($field, strtoupper($this[$field])));
                 if ($isEncrypted) {
                     $node->appendChild(new \DOMElement('CardDataKeySerialNumber', strtoupper($this['CardDataKeySerialNumber'])));
                     $node->appendChild(new \DOMElement('EncryptedFormat', $this['EncryptedFormat']));
                 }
                 break 2;
             }
         }
         if (!empty($this['CardNumber'])) {
             $node->appendChild(new \DOMElement('CardNumber', $this['CardNumber']));
         }
         if (!empty($this['ExpirationMonth']) && !empty($this['ExpirationYear'])) {
             $time = gmmktime(0, 0, 0, $this['ExpirationMonth'], 1, $this['ExpirationYear']);
             $node->appendChild(new \DOMElement('ExpirationMonth', gmdate('m', $time)));
             $node->appendChild(new \DOMElement('ExpirationYear', gmdate('y', $time)));
         }
     } while (false);
 }
开发者ID:zerve,项目名称:omnipay-elementexpress,代码行数:31,代码来源:Card.php


示例17: getEditXML

 /**
  * @param \DOMNode|\DOMElement $node
  * @param int $menuId
  */
 private function getEditXML($node, $menuId)
 {
     $menu = \Difra\Plugins\CMS\Menu::get($menuId);
     $node->setAttribute('depth', $menu->getDepth());
     $parentsNode = $node->appendChild($this->xml->createElement('parents'));
     \Difra\Plugins\CMS::getInstance()->getMenuItemsXML($parentsNode, $menu->getId());
 }
开发者ID:difra-org,项目名称:difra,代码行数:11,代码来源:menu.php


示例18: _parseInto

	/**
	 * Parse through a child node of this table, usually a tr, thead, or tbody.
	 *
	 * This is a recursive safe function.
	 *
	 * @param \DOMNode $node
	 */
	private function _parseInto(\DOMNode $node){
		if($node->hasChildNodes()){
			$nodes = $node->childNodes;
			for($i = 0; $i < $nodes->length; $i++){
				/** @var \DOMNode $node */
				$node = $nodes->item($i);
				$nodeType = $node->nodeName;

				switch($nodeType){
					case 'tr':
						// Increment to the next row on a TR tag!
						++$this->_currentRow;
						$this->_currentCol = 0;
						$this->_parseInto($node);
						break;
					case 'thead':
					case 'tbody':
						// These simply get parsed again for TR tags.
						$this->_parseInto($node);
						break;
					case 'td':
					case 'th':
						$this->_parseCell($node);
						break;
				}
			}
		}
	}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:35,代码来源:TableElement.php


示例19: _buildNode

 /**
  * Builds and creates the Atom XML nodes required by this content
  *
  * The element node representing this content is created separately and
  * passed as the first parameter of this method.
  *
  * The text content of this content is created as a CDATA section.
  *
  * @param DOMNode $node the node representing this content. Extra nodes
  *                      should be created and added to this node.
  *
  * @return void
  */
 protected function _buildNode(DOMNode $node)
 {
     $document = $node->ownerDocument;
     $node->setAttributeNS(XML_Atom_Node::NS, 'type', $this->_type);
     $cdata_node = $document->createCDATASection($this->_text);
     $node->appendChild($cdata_node);
 }
开发者ID:gauthierm,项目名称:xml-atom,代码行数:20,代码来源:Content.php


示例20: __construct

 /**
  * Create a MARC Sub Field
  * 
  * @param \DOMNode $node
  */
 public function __construct(\DOMNode $node = null)
 {
     if ($node != null) {
         $this->code = $node->getAttribute("code");
         $this->value = $node->nodeValue;
     }
 }
开发者ID:navtis,项目名称:xerxes,代码行数:12,代码来源:SubField.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DOMNodeList类代码示例发布时间:2022-05-23
下一篇:
PHP DOMImplementation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap