%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.119.130.226 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/main/lib/web/dom/ |
Upload File : |
<?php namespace Bitrix\Main\Web\DOM; class Element extends Node { /** * @var Element $parentElement */ protected $parentElement; /** * @var NamedNodeMap $attributes */ protected $attributes; /** * @var string $tagName */ protected $tagName; /** * @var array $classList */ protected $classList; /** * @var string $id */ protected $id; /** * @var string $name */ protected $name; /** * @var string $className */ protected $className; /** * @var string $style */ protected $style; public function __construct($name) { $this->init(); $this->nodeType = self::ELEMENT_NODE; $this->nodeName = mb_strtoupper($name); $this->tagName = $this->nodeName; if(self::$isNodeListAsArray) { $this->attributes = array(); } else { $this->attributes = new NamedNodeMap; } } public function getTagName() { return $this->tagName; } public function getId() { return $this->getAttribute('id'); } public function setId($id) { $this->setAttribute('id', $id); } public function getName() { return $this->getAttribute('name'); } public function setName($id) { $this->setAttribute('name', $id); } public function getStyle() { return $this->getAttribute('style'); } public function setStyle($style) { $this->setAttribute('style', $style); } public function getClassName() { return $this->getAttribute('class'); } public function setClassName($className) { $this->setAttribute('class', $className); } public function getClassList() { return explode(' ', $this->getClassName()); } public function setClassList(array $classList) { $this->setAttribute('class', implode(' ', $classList)); } public function getParentElement() { return $this->parentElement; } public function getTextContent() { $content = ''; foreach($this->getChildNodesArray() as $child) { if($child->getNodeType() === self::COMMENT_NODE || $child->getNodeType() === self::PROCESSING_INSTRUCTION_NODE ) { continue; } $content .= $child->getTextContent(); } return $content; } protected function setParentElement(Element $parentElement) { $this->parentElement = $parentElement; } public function getAttributesArray() { if(self::$isNodeListAsArray) { return $this->attributes; } else { return $this->attributes->get(); } } public function setAttributeNode(Attr $attr) { if(self::$isNodeListAsArray) { $name = $attr->getName(); $this->attributes[$name] = $attr; } else { $this->getAttributes()->setNamedItem($attr); } $attr->setParentNode($this); } public function getAttributeNode($name) { $result = null; if($this->hasAttributes()) { if(self::$isNodeListAsArray) { $result = $this->attributes[$name]; } else { $result = $this->attributes->getNamedItem($name); } } return $result; } public function removeAttributeNode(Attr $oldNode) { if($this->attributes) { if(self::$isNodeListAsArray) { $name = $oldNode->getName(); unset($this->attributes[$name]); } else { $this->attributes->removeNamedItem($oldNode->getName()); } $oldNode->setParentNode(null); } } public function setAttribute($name, $value) { $attr = $this->getAttributeNode($name); if(!$attr) { $attr = $this->ownerDocument->createAttribute($name, $value); } else { $attr->setValue($value); } $this->setAttributeNode($attr); } /** * @param string $attributeName * @return bool */ public function hasAttribute($attributeName) { $result = false; if($this->hasAttributes()) { if(self::$isNodeListAsArray) { $result = array_key_exists($attributeName, $this->attributes); } else { $result = !is_null($this->attributes->getNamedItem($attributeName)); } } return $result; } public function getAttribute($name) { $attr = $this->getAttributeNode($name); if($attr) { return $attr->getValue(); } return null; } public function removeAttribute($name) { $attr = $this->getAttributeNode($name); if($attr) { $this->removeAttributeNode($attr); } } }