PluginProbe
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce / 2.2.16
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce v2.2.16
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.2.16, at includes/CookieDetection.php

38 lines 722 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
18 $cookie_name = self::cookieName( $compaignId);
19 if (!isset($_COOKIE[$cookie_name]) || empty($_COOKIE[$cookie_name])) {
20 return null;
21 }
22
23 return intval($_COOKIE[$cookie_name]);
24 }
25
26 /**
27 * Cookie name with given Campaign id.
28 *
29 * @param int $compaignId
30 *
31 * @return string
32 */
33 public static function cookieName( $compaignId)
34 {
35 return self::COOKIE_PREFIX . $compaignId;
36 }
37 }
38