403Webshell
Server IP : 172.67.158.161  /  Your IP : 3.138.122.210
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/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Statistics/Track/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Statistics/Track/PageViewCookie.php
<?php declare(strict_types = 1);

namespace MailPoet\Statistics\Track;

if (!defined('ABSPATH')) exit;


use MailPoet\Settings\TrackingConfig;
use MailPoet\Util\Cookies;

class PageViewCookie {
  const COOKIE_NAME = 'mailpoet_page_view';
  const COOKIE_EXPIRY = 10 * 365 * 24 * 60 * 60; // 10 years (~ no expiry)

  /** @var Cookies */
  private $cookies;

  /** @var TrackingConfig */
  private $trackingConfig;

  public function __construct(
    Cookies $cookies,
    TrackingConfig $trackingConfig
  ) {
    $this->cookies = $cookies;
    $this->trackingConfig = $trackingConfig;
  }

  public function getPageViewTimestamp(): ?int {
    if (!$this->trackingConfig->isCookieTrackingEnabled()) {
      return null;
    }

    return $this->getTimestampCookie(self::COOKIE_NAME);
  }

  public function setPageViewTimestamp(int $timestamp): void {
    if (!$this->trackingConfig->isCookieTrackingEnabled()) {
      return;
    }

    $this->cookies->set(
      self::COOKIE_NAME,
      ['timestamp' => $timestamp],
      [
        'expires' => time() + self::COOKIE_EXPIRY,
        'path' => '/',
      ]
    );
  }

  private function getTimestampCookie(string $cookieName): ?int {
    $data = $this->cookies->get($cookieName);
    return is_array($data) && $data['timestamp']
      ? (int)$data['timestamp']
      : null;
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit