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/userfield/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/userfield/htmlbuilder.php
<?php

namespace Bitrix\Main\UserField;

use Bitrix\Main\Localization\Loc;
use Bitrix\Main\Text\HtmlFilter;

/**
 * Class HtmlBuilder
 * @package Bitrix\Main\UserField
 */
class HtmlBuilder
{
	protected $userTypeId;

	public function __construct($userTypeId)
	{
		$this->userTypeId = $userTypeId;
	}

	public function getCssClassName(array $additionalCss = array())
	{
		return trim('fields ' . $this->userTypeId . ' ' . implode(' ', $additionalCss));
	}

	public function wrapSingleField($html, array $additionalCss = array())
	{
		return '<span class="' . HtmlFilter::encode(static::getCssClassName($additionalCss)) . ' field-item">' . $html . '</span>';
	}

	public function wrapDisplayResult($html, $additionalCss = array())
	{
		return '<span class="' . HtmlFilter::encode(static::getCssClassName($additionalCss)) . ' field-wrap">' . $html . '</span>';
	}

	public function getMultipleValuesSeparator()
	{
		return '<span class="fields separator"></span>';
	}

	public function getCloneButton($fieldName)
	{
		return '<input type="button" value="' . HtmlFilter::encode(Loc::getMessage('USER_TYPE_PROP_ADD')) . '" onclick="BX.Main.UF.Factory.get(\'' . $this->userTypeId . '\').addRow(\'' . \CUtil::jsEscape($fieldName) . '\', this);" />';
	}

	public function getMobileCloneButton($fieldName)
	{
		return '<div class="add-field-button" onclick="BX.Main.UF.Factory.get(\'' .
			$this->userTypeId . '\').addMobileRow(\'' . \CUtil::jsEscape($fieldName) . '\', this);" >' . Loc::getMessage('CRM_FIELDS_ADD_FIELD') . '</div>';
	}

	/**
	 * @param array|null $attributes
	 * @param bool $encode
	 * @return string|null
	 */
	public function buildTagAttributes(?array $attributes, bool $encode = true): ?string
	{
		$s = '';
		if($attributes)
		{
			foreach($attributes as $attribute => $value)
			{
				if($encode)
				{
					$s .= htmlspecialcharsbx($attribute) . '="' . htmlspecialcharsbx($value) . '" ';
				}
				else
				{
					$s .= $attribute . '="' . $value . '" ';
				}
			}
		}

		return $s;
	}

	/**
	 * @param string|null $url
	 * @return string
	 */
	public function encodeUrl(?string $url): string
	{
		if (!preg_match('/^(callto:|mailto:|\/|[a-z0-9]+:\/\/)/i', $url))
		{
			$url = 'http://' . $url;
		}

		return (new \Bitrix\Main\Web\Uri($url))->getUri();
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit