-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAPI.php
63 lines (50 loc) · 1.3 KB
/
API.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\AjaxOptOut;
use Piwik\Tracker\IgnoreCookie;
/**
* API for plugin AjaxOptOut
* @method static API getInstance()
*/
class API extends \Piwik\Plugin\API {
/**
* This method will return whether the user is tracked or not.
*
* Call: index.php?module=API&method=AjaxOptOut.isTracked
*
* @return int
*/
public function isTracked () {
$ret = !IgnoreCookie::isIgnoreCookieFound();
return $ret;
}
/**
* Sets the ignore cookie, so the user is not tracked through piwik any longer.
*
* Call: index.php?module=API&method=AjaxOptOut.doIgnore
*
* @return void
*/
public function doIgnore () {
// Do nothing if the cookie already is set.
if (IgnoreCookie::isIgnoreCookieFound()) {
return;
}
IgnoreCookie::setIgnoreCookie();
}
/**
* removes the ignore cookie, so the user is tracked through piwik from now on.
*
* Call: index.php?module=API&method=AjaxOptOut.doTrack
*
* @return void
*/
public function doTrack () {
IgnoreCookie::getIgnoreCookie()->delete();
}
}