Server IP : 104.21.14.103 / Your IP : 18.219.159.197 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Entities/ |
Upload File : |
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing namespace MailPoet\Entities; if (!defined('ABSPATH')) exit; use MailPoet\Doctrine\EntityTraits\AutoincrementedIdTrait; use MailPoet\Doctrine\EntityTraits\CreatedAtTrait; use MailPoet\Doctrine\EntityTraits\UpdatedAtTrait; use MailPoetVendor\Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity() * @ORM\Table(name="user_agents") */ class UserAgentEntity { use AutoincrementedIdTrait; use CreatedAtTrait; use UpdatedAtTrait; public const USER_AGENT_TYPE_HUMAN = 0; public const USER_AGENT_TYPE_MACHINE = 1; public const MACHINE_USER_AGENTS = [ 'Mozilla/5.0', ]; /** * @ORM\Column(type="string") * @var string */ private $hash; /** * @ORM\Column(type="string") * @var string */ private $userAgent; public function __construct( string $userAgent ) { $this->setUserAgent($userAgent); } public function getUserAgent(): string { return $this->userAgent; } public function setUserAgent(string $userAgent): void { $this->userAgent = $userAgent; $this->hash = (string)crc32($userAgent); } public function getHash(): string { return $this->hash; } public function getUserAgentType(): int { if (in_array($this->getUserAgent(), self::MACHINE_USER_AGENTS, true)) { return self::USER_AGENT_TYPE_MACHINE; } return self::USER_AGENT_TYPE_HUMAN; } }