PluginProbe
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce / 2.1.5
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce v2.1.5
2.15.0 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 All 62 releases
hurrytimer / includes / CookieDetection.php

CookieDetection.php in HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce 2.1.5, at includes/CookieDetection.php

37 lines 721 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Hurrytimer;
3
4 class CookieDetection
5 {
6 const COOKIE_PREFIX = '_ht_CDT-';
7
8 /**
9 * Find Campaign timer cookie.
10 *
11 * @param int $compaignId
12 *
13 * @return int|null
14 */
15 public function find( $compaignId)
16 {
17 $cookie_name = self::cookieName( $compaignId);
18 if (!isset($_COOKIE[$cookie_name]) || empty($_COOKIE[$cookie_name])) {
19 return null;
20 }
21
22 return intval($_COOKIE[$cookie_name]);
23 }
24
25 /**
26 * Cookie name with given Campaign id.
27 *
28 * @param int $compaignId
29 *
30 * @return string
31 */
32 public static function cookieName( $compaignId)
33 {
34 return self::COOKIE_PREFIX . $compaignId;
35 }
36 }
37