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/engine/response/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/engine/response/htmlcontent.php
<?php
namespace Bitrix\Main\Engine\Response;

use Bitrix\Main\Engine\Response\ContentArea\DataSectionInterface;
use Bitrix\Main\ErrorCollection;
use Bitrix\Main\Page\Asset;
use Bitrix\Main\Page\AssetMode;
use Bitrix\Main\Engine\Response\ContentArea\ContentAreaInterface;

/**
 * Response type for rendering ajax html content from action
 */
class HtmlContent extends AjaxJson
{
	private $jsPathList = [];
	private $cssPathList = [];

	/**
	 * @param ContentAreaInterface $content
	 * @param string $status
	 * @param ErrorCollection|null $errorCollection
	 * @param array $additionalResponseParams
	 */
	public function __construct(ContentAreaInterface $content, $status = self::STATUS_SUCCESS, ErrorCollection $errorCollection = null, array $additionalResponseParams = [])
	{
		$html = $content->getHtml();

		$this->collectAssetsPathList();

		$result = [
			'html' => $html,
			'assets' => [
				'css' => $this->getCssList(),
				'js' => $this->getJsList(),
				'string' => $this->getStringList()
			],
			'additionalParams' => $additionalResponseParams,
		];
		if($content instanceof DataSectionInterface)
		{
			$result[$content->getSectionName()] = $content->getSectionData();
		}

		parent::__construct($result, $status, $errorCollection);

		$this->addHeader('X-Process-Assets', 'assets');
	}

	final protected function collectAssetsPathList()
	{
		Asset::getInstance()->getCss();
		Asset::getInstance()->getJs();
		Asset::getInstance()->getStrings();

		$this->jsPathList = Asset::getInstance()->getTargetList('JS');
		$this->cssPathList = Asset::getInstance()->getTargetList('CSS');
	}

	/**
	 * @return array
	 */
	final protected function getJsList()
	{
		$jsList = [];
		foreach($this->jsPathList as $targetAsset)
		{
			$assetInfo = Asset::getInstance()->getAssetInfo($targetAsset['NAME'], AssetMode::ALL);
			if (!empty($assetInfo['JS']))
			{
				$jsList = array_merge($jsList, $assetInfo['JS']);
			}
		}

		return $jsList;
	}

	/**
	 * @return array
	 */
	final protected function getCssList()
	{
		$cssList = [];
		foreach ($this->cssPathList as $targetAsset)
		{
			$assetInfo = Asset::getInstance()->getAssetInfo($targetAsset['NAME'], AssetMode::ALL);
			if (!empty($assetInfo['CSS']))
			{
				$cssList = array_merge($cssList, $assetInfo['CSS']);
			}
		}

		return $cssList;
	}

	/**
	 * @return array
	 */
	final protected function getStringList()
	{
		$stringList = [];
		foreach($this->cssPathList as $targetAsset)
		{
			$assetInfo = Asset::getInstance()->getAssetInfo($targetAsset['NAME'], AssetMode::ALL);
			if (!empty($assetInfo['STRINGS']))
			{
				$stringList = array_merge($stringList, $assetInfo['STRINGS']);
			}
		}

		foreach($this->jsPathList as $targetAsset)
		{
			$assetInfo = Asset::getInstance()->getAssetInfo($targetAsset['NAME'], AssetMode::ALL);
			if (!empty($assetInfo['STRINGS']))
			{
				$stringList = array_merge($stringList, $assetInfo['STRINGS']);
			}
		}

		$stringList[] = Asset::getInstance()->showFilesList();

		return $stringList;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit