FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
wordpress-plugin/src/TrackingRules.php at main · simpleanalytics/wordpress-plugin · GitHub
simpleanalytics
/
wordpress-plugin
Public
Notifications
You must be signed in to change notification settings
Fork
7
Star
4
Code
Issues
2
Pull requests
1
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
wordpress-plugin
/
src
/
TrackingRules.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (29 loc) · 870 Bytes
Breadcrumbs
wordpress-plugin
/
src
/
TrackingRules.php
Copy path
File metadata and controls
41 lines (29 loc) · 870 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
namespace
SimpleAnalytics
;
class
TrackingRules
{
protected
$
settings
;
public
function
__construct
(
WordPressSettings
$
settings
)
{
$
this
->
settings
=
$
settings
;
}
public
function
hasExcludedIp
():
bool
{
$
ip
=
$
_SERVER
[
'
HTTP_X_FORWARDED_FOR
'
] ?? (
$
_SERVER
[
'
REMOTE_ADDR
'
] ??
null
);
if
(
empty
(
$
ip
))
return
false
;
$
list
=
$
this
->
settings
->
array
(SettingName::
EXCLUDED_IP_ADDRESSES
);
return
in_array
(
$
ip
,
$
list
);
}
public
function
hasExcludedUserRole
():
bool
{
if
(!
is_user_logged_in
()) {
return
false
;
}
$
needle
=
$
this
->
settings
->
array
(SettingName::
EXCLUDED_ROLES
);
if
(
$
needle
=== []) {
return
true
;
}
$
current
=
wp_get_current_user
()->
roles
;
return
array_intersect
(
$
needle
,
$
current
) !== [];
}
}
Back
|
FazBrowse Home
|
New Git URL