403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/web/dom/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/web/dom/namednodemap.php
<?php
namespace Bitrix\Main\Web\DOM;

/*
class NamedNodeMap extends NodeList
{
	public function getNamedItem($name)
	{
		for($index = 0; $index < $this->count(); $index++)
		{
			if($this->item($index)->getName() === $name)
			{
				return $this->item($index);
			}
		}

		return null;
	}

	public function setNamedItem(Node $node)
	{
		$this->offsetSet(null, $node);
	}

	public function removeNamedItem($name)
	{
		for($index = 0; $index < $this->count(); $index++)
		{
			if($this->item($index)->getName() === $name)
			{
				$this->offsetUnset($index);
			}
		}

		$this->rewind();
	}
}
*/

class NamedNodeMap extends NodeList
{
	protected $names = array();
	protected $nameByPosition = array();
	protected $positionByName = array();

	public function set(array $values)
	{
		$this->nameByPosition = array();
		$this->positionByName = array();

		parent::set($values);
	}

	public function get()
	{
		return $this->values;
	}

	public function key()
	{
		return $this->nameByPosition[$this->position];
	}

	public function getNamedItem($name)
	{
		if(!isset($this->positionByName[$name]))
		{
			return null;
		}

		return $this->item($this->positionByName[$name]);
	}

	/*
	 * Adds a node using its nodeName attribute.
	 * If a node with that name is already present in this map, it is replaced by the new one.
	 * Replacing a node by itself has no effect.
	 * As the nodeName attribute is used to derive the name which the node must be stored under,
	 * multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash.
	 * This is seen as preferable to allowing nodes to be aliased.
	 */
	public function setNamedItem(Attr $node)
	{
		$result = null;
		$name = $node->getName();
		if(isset($this->positionByName[$name]))
		{
			$position = $this->positionByName[$name];
			$result = $this->item($position);
		}
		else
		{
			$position = $this->getLength();
		}

		$this->values[$position] = $node;
		$this->nameByPosition[$position] = $name;
		$this->positionByName[$name] = $position;

		$this->length = count($this->values);

		return $result;
	}

	/*
	 * Removes a node specified by name.
	 * When this map contains the attributes attached to an element,
	 * if the removed attribute is known to have a default value,
	 * an attribute immediately appears containing the default value as well
	 * as the corresponding namespace URI, local name, and prefix when applicable.
	 */
	public function removeNamedItem($name)
	{
		$item = $this->getNamedItem($name);
		if($item)
		{
			$position = $this->positionByName[$name];
			unset($this->values[$position]);
			unset($this->nameByPosition[$position]);
			unset($this->positionByName[$name]);
			$this->length = count($this->values);

			return $item;
		}
		else
		{
			throw new \Bitrix\Main\Web\DOM\DomException('', \Bitrix\Main\Web\DOM\DomException::NOT_FOUND_ERR);
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit