Google Analytics Dashboard for WP (GADWP) - Version 5.0

Version Description

This is a major update, please read the release notes first.

Download this release

Release Info

Developer deconf
Plugin Icon 128x128 Google Analytics Dashboard for WP (GADWP)
Version 5.0
Comparing to
See all releases

Code changes from version 4.9.6.2 to 5.0

Files changed (90) hide show
  1. admin/ajax-actions.php +14 -4
  2. admin/css/admin-widgets.css +1 -192
  3. admin/css/gadwp.css +1 -206
  4. admin/css/item-reports.css +1 -125
  5. admin/item-reports.php +9 -9
  6. admin/js/settings.js +1 -40
  7. admin/js/ui.js +1 -26
  8. admin/js/wp-color-picker-script.js +1 -11
  9. admin/settings.php +1356 -949
  10. admin/setup.php +3 -3
  11. common/js/reports.js +0 -1118
  12. common/js/reports5.js +1 -0
  13. common/nprogress/nprogress.css +1 -87
  14. common/nprogress/nprogress.js +1 -477
  15. common/realtime/jquery.ui.tooltip.html.css +1 -52
  16. common/realtime/jquery.ui.tooltip.html.js +1 -16
  17. config.php +182 -216
  18. front/ajax-actions.php +7 -2
  19. front/css/item-reports.css +1 -185
  20. front/css/widgets.css +1 -75
  21. front/js/tracking-analytics-events.js +1 -0
  22. front/js/tracking-scrolldepth.js +7 -0
  23. front/js/tracking-tagmanager-events.js +1 -0
  24. front/js/widgets.js +1 -13
  25. front/setup.php +2 -1
  26. front/tracking-analytics.php +349 -0
  27. front/tracking-tagmanager.php +167 -0
  28. front/tracking.php +23 -34
  29. front/tracking/code-classic.php +0 -34
  30. front/tracking/code-universal.php +0 -142
  31. front/tracking/events-classic.php +0 -55
  32. front/tracking/events-universal.php +0 -67
  33. front/views/analytics-code.php +10 -0
  34. front/views/optimize-code.php +12 -0
  35. front/views/tagmanager-code.php +16 -0
  36. front/widgets.php +2 -2
  37. gadwp.php +4 -4
  38. install/install.php +44 -12
  39. readme.txt +49 -50
  40. realtime/jquery/jquery.ui.tooltip.html.css +1 -55
  41. realtime/jquery/jquery.ui.tooltip.html.js +1 -16
  42. tools/gapi.php +81 -72
  43. tools/src/Google/Auth/Abstract.php +15 -17
  44. tools/src/Google/Auth/AppIdentity.php +81 -62
  45. tools/src/Google/Auth/AssertionCredentials.php +103 -110
  46. tools/src/Google/Auth/ComputeEngine.php +146 -0
  47. tools/src/Google/Auth/Exception.php +5 -2
  48. tools/src/Google/Auth/LoginTicket.php +42 -47
  49. tools/src/Google/Auth/OAuth2.php +600 -501
  50. tools/src/Google/Auth/Simple.php +36 -38
  51. tools/src/Google/Cache/Abstract.php +27 -32
  52. tools/src/Google/Cache/Apc.php +78 -73
  53. tools/src/Google/Cache/Exception.php +5 -2
  54. tools/src/Google/Cache/File.php +166 -143
  55. tools/src/Google/Cache/Memcache.php +145 -139
  56. tools/src/Google/Cache/Null.php +30 -27
  57. tools/src/Google/Client.php +693 -739
  58. tools/src/Google/Collection.php +71 -63
  59. tools/src/Google/Config.php +424 -415
  60. tools/src/Google/Exception.php +2 -2
  61. tools/src/Google/Http/Batch.php +115 -108
  62. tools/src/Google/Http/CacheParser.php +154 -151
  63. tools/src/Google/Http/MediaFileUpload.php +301 -275
  64. tools/src/Google/Http/REST.php +148 -113
  65. tools/src/Google/Http/Request.php +477 -471
  66. tools/src/Google/IO/Abstract.php +288 -289
  67. tools/src/Google/IO/Curl.php +159 -118
  68. tools/src/Google/IO/Exception.php +51 -3
  69. tools/src/Google/IO/Stream.php +196 -155
  70. tools/src/Google/Logger/Abstract.php +353 -355
  71. tools/src/Google/Logger/Exception.php +5 -2
  72. tools/src/Google/Logger/File.php +122 -113
  73. tools/src/Google/Logger/Null.php +18 -15
  74. tools/src/Google/Logger/Psr.php +59 -59
  75. tools/src/Google/Model.php +240 -228
  76. tools/src/Google/Service.php +38 -27
  77. tools/src/Google/Service/Analytics.php +9761 -11618
  78. tools/src/Google/Service/Exception.php +97 -41
  79. tools/src/Google/Service/Resource.php +217 -202
  80. tools/src/Google/Signer/Abstract.php +6 -7
  81. tools/src/Google/Signer/P12.php +63 -47
  82. tools/src/Google/Task/Exception.php +24 -0
  83. tools/src/Google/Task/Retryable.php +36 -0
  84. tools/src/Google/Task/Runner.php +257 -0
  85. tools/src/Google/Utils.php +103 -117
  86. tools/src/Google/Utils/URITemplate.php +289 -276
  87. tools/src/Google/Verifier/Abstract.php +7 -8
  88. tools/src/Google/Verifier/Pem.php +45 -48
  89. tools/{autoload.php → src/Google/autoload.php} +11 -18
  90. tools/tools.php +19 -2
admin/ajax-actions.php CHANGED
@@ -39,7 +39,7 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
39
if ( ! isset( $_POST['gadwp_security_backend_item_reports'] ) || ! wp_verify_nonce( $_POST['gadwp_security_backend_item_reports'], 'gadwp_backend_item_reports' ) ) {
40
wp_die( - 30 );
41
}
42
- if ( isset( $_POST['projectId'] ) && $this->gadwp->config->options['switch_profile'] && $_POST['projectId'] !== 'false' ) {
43
$projectId = $_POST['projectId'];
44
} else {
45
$projectId = false;
@@ -52,6 +52,16 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
52
} else {
53
$filter_id = false;
54
}
55
if ( ob_get_length() ) {
56
ob_clean();
57
}
@@ -66,7 +76,7 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
66
} else {
67
wp_die( - 24 );
68
}
69
- if ( $projectId == false ) {
70
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
71
}
72
$profile_info = GADWP_Tools::get_selected_profile( $this->gadwp->config->options['ga_dash_profile_list'], $projectId );
@@ -90,7 +100,7 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
90
91
$lastchar = substr( $filter, - 1 );
92
93
- if ( isset( $profile_info[6] ) && $profile_info[6] && $lastchar == '/' ) {
94
$filter = $filter . $profile_info[6];
95
}
96
@@ -105,7 +115,7 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
105
$results = array();
106
107
foreach ( $queries as $value ) {
108
- $results[] = $this->gadwp->gapi_controller->get( $projectId, $value, $from, $to, $filter );
109
}
110
111
wp_send_json( $results );
39
if ( ! isset( $_POST['gadwp_security_backend_item_reports'] ) || ! wp_verify_nonce( $_POST['gadwp_security_backend_item_reports'], 'gadwp_backend_item_reports' ) ) {
40
wp_die( - 30 );
41
}
42
+ if ( isset( $_POST['projectId'] ) && $this->gadwp->config->options['switch_profile'] && 'false' !== $_POST['projectId'] ) {
43
$projectId = $_POST['projectId'];
44
} else {
45
$projectId = false;
52
} else {
53
$filter_id = false;
54
}
55
+ if ( isset( $_POST['metric'] ) ) {
56
+ $metric = $_POST['metric'];
57
+ } else {
58
+ $metric = 'sessions';
59
+ }
60
+
61
+ if ( $filter_id && $metric == 'sessions' ) { // Sessions metric is not available for item reports
62
+ $metric = 'pageviews';
63
+ }
64
+
65
if ( ob_get_length() ) {
66
ob_clean();
67
}
76
} else {
77
wp_die( - 24 );
78
}
79
+ if ( false == $projectId ) {
80
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
81
}
82
$profile_info = GADWP_Tools::get_selected_profile( $this->gadwp->config->options['ga_dash_profile_list'], $projectId );
100
101
$lastchar = substr( $filter, - 1 );
102
103
+ if ( isset( $profile_info[6] ) && $profile_info[6] && '/' == $lastchar ) {
104
$filter = $filter . $profile_info[6];
105
}
106
115
$results = array();
116
117
foreach ( $queries as $value ) {
118
+ $results[] = $this->gadwp->gapi_controller->get( $projectId, $value, $from, $to, $filter, $metric );
119
}
120
121
wp_send_json( $results );
admin/css/admin-widgets.css CHANGED
@@ -1,192 +1 @@
1
- /**
2
- * Author: Alin Marcu
3
- * Author URI: https://deconf.com
4
- * Copyright 2013 Alin Marcu
5
- * License: GPLv2 or later
6
- * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
- */
8
-
9
- /* Real-Time content */
10
- .gadwp-pline {
11
- width: 100%;
12
- margin: 0 0;
13
- padding: 5px 0 5px 0;
14
- background: #fff;
15
- -moz-box-shadow: 0px 0px 3px 0px #BBB;
16
- -webkit-box-shadow: 0px 0px 3px 0px #BBB;
17
- box-shadow: 0px 0px 3px 0px #BBB;
18
- display: table;
19
- overflow: hidden;
20
- }
21
-
22
- .gadwp-pleft {
23
- width: 90%;
24
- float: left;
25
- padding-left: 5px;
26
- }
27
-
28
- .gadwp-pright {
29
- width: 5%;
30
- float: right;
31
- padding-right: 5px;
32
- }
33
-
34
- [id^=gadwp-realtime-] {
35
- margin: 10px 0 0 0;
36
- width: 100%;
37
- }
38
-
39
- .gadwp-rt-box {
40
- width: 100%;
41
- margin: 0 0;
42
- background: #fff;
43
- text-align: center;
44
- -moz-box-shadow: 0px 0px 5px 0px #BBB;
45
- -webkit-box-shadow: 0px 0px 5px 0px #BBB;
46
- box-shadow: 0px 0px 5px 0px #BBB;
47
- display: table;
48
- }
49
-
50
- .gadwp-tdo-left {
51
- width: 60%;
52
- padding: 33px 0;
53
- float: left;
54
- text-align: center;
55
- }
56
-
57
- .gadwp-tdo-right {
58
- width: 35%;
59
- margin: 0px 10px 0px 0;
60
- text-align: left;
61
- font-weight: bold;
62
- vertical-align: middle;
63
- float: right;
64
- display: table;
65
- }
66
-
67
- .gadwp-online {
68
- font-size: 100px;
69
- font-weight: normal;
70
- line-height: 1em;
71
- margin: 0 auto;
72
- width: 80%;
73
- }
74
-
75
- .gadwp-bigtext {
76
- font-size: 14px;
77
- width: 100%;
78
- margin: 0 0;
79
- padding: 5px 5px 5px 5px;
80
- background: #fff;
81
- -moz-box-shadow: 0px 0px 3px 0px #BBB;
82
- -webkit-box-shadow: 0px 0px 3px 0px #BBB;
83
- box-shadow: 0px 0px 3px 0px #BBB;
84
- display: table;
85
- overflow: hidden;
86
- }
87
-
88
- .gadwp-bleft {
89
- float: left;
90
- width: 80%;
91
- }
92
-
93
- .gadwp-bright {
94
- float: right;
95
- width: 20%;
96
- }
97
-
98
- .gadwp-pgdetailsr {
99
- padding-left: 20px;
100
- text-align: right;
101
- }
102
-
103
- .gadwp-pgdetailsl {
104
- min-width: 250px;
105
- }
106
-
107
- [id^=gadwp-areachart-] {
108
- width: 98%;
109
- height: 100%;
110
- margin: 10px auto 10px 0;
111
- height: 250px;
112
- }
113
-
114
- .gadwp-floatwraper {
115
- display: table;
116
- width: 100%;
117
- height: 100%;
118
- }
119
-
120
- [id^=gadwp-piechart-].halfsize {
121
- width: 47%;
122
- margin: 10px 0 0 0;
123
- height: 200px;
124
- float: left;
125
- }
126
-
127
- [id^=gadwp-piechart-].floatleft {
128
- float: left;
129
- }
130
-
131
- [id^=gadwp-piechart-].floatright {
132
- float: right;
133
- }
134
-
135
- [id^=gadwp-tablechart-], [id^=gadwp-tablechart-] {
136
- width: 98%;
137
- height: 100%;
138
- margin: 10px auto 10px 0;
139
- }
140
-
141
- #dashboard-widgets-wrap .postbox {
142
- margin-right: 10px;
143
- }
144
-
145
- /* Admin Widget content */
146
- [id^=gadwp-progressbar-] {
147
- width: 100%;
148
- height: 3px;
149
- margin: 5px 0 0px 0;
150
- }
151
-
152
- [id^=gadwp-bottomstats-] {
153
- width: 100%;
154
- }
155
-
156
- [id^=gadwp-bottomstats-] .inside {
157
- display: table;
158
- margin: 0 auto;
159
- padding: 0px;
160
- }
161
-
162
- #gadwp-widget .inside .small-box {
163
- width: 30%;
164
- float: left;
165
- margin: 0 5px 10px 5px;
166
- background: #fff;
167
- text-align: center;
168
- -moz-box-shadow: 0px 0px 7px 0px #BBB;
169
- -webkit-box-shadow: 0px 0px 7px 0px #BBB;
170
- box-shadow: 0px 0px 7px 0px #BBB;
171
- }
172
-
173
- #gadwp-widget .inside .small-box h3 {
174
- font-size: 1em;
175
- color: #777;
176
- padding: 0px 5px 0px 5px;
177
- margin: 0px 0px 0px 0px;
178
- text-overflow: ellipsis;
179
- overflow: hidden;
180
- white-space: nowrap;
181
- }
182
-
183
- #gadwp-widget .inside .small-box p {
184
- font-size: 1.2em;
185
- margin: 0px 0px 2px 0px;
186
- }
187
-
188
- @media screen and (max-width: 410px) {
189
- [id^=gadwp-bottomstats-] .inside .small-box {
190
- width: 45%;
191
- }
192
- }
1
+ .gadwp-pline{width:100%;margin:0;padding:5px 0 5px 0;background:#fff;-moz-box-shadow:0 0 3px 0 #BBB;-webkit-box-shadow:0 0 3px 0 #BBB;box-shadow:0 0 3px 0 #BBB;display:table;overflow:hidden}.gadwp-pleft{width:90%;float:left;padding-left:5px}.gadwp-pright{width:5%;float:right;padding-right:5px}[id^=gadwp-realtime-]{margin:10px 0 0 0;width:100%}.gadwp-rt-box{width:100%;margin:0;background:#fff;text-align:center;-moz-box-shadow:0 0 5px 0 #BBB;-webkit-box-shadow:0 0 5px 0 #BBB;box-shadow:0 0 5px 0 #BBB;display:table}.gadwp-tdo-left{width:60%;padding:33px 0;float:left;text-align:center}.gadwp-tdo-right{width:35%;margin:0 10px 0 0;text-align:left;font-weight:bold;vertical-align:middle;float:right;display:table}.gadwp-online{font-size:100px;font-weight:normal;line-height:1em;margin:0 auto;width:80%}.gadwp-bigtext{font-size:14px;width:100%;margin:0;padding:5px 5px 5px 5px;background:#fff;-moz-box-shadow:0 0 3px 0 #BBB;-webkit-box-shadow:0 0 3px 0 #BBB;box-shadow:0 0 3px 0 #BBB;display:table;overflow:hidden}.gadwp-bleft{float:left;width:80%}.gadwp-bright{float:right;width:20%}.gadwp-pgdetailsr{padding-left:20px;text-align:right}.gadwp-pgdetailsl{min-width:250px}[id^=gadwp-areachart-]{width:98%;height:100%;margin:10px auto 10px 0;height:250px}.gadwp-floatwraper{display:table;width:100%;height:100%}[id^=gadwp-piechart-].halfsize{width:47%;margin:10px 0 0 0;height:200px;float:left}[id^=gadwp-piechart-].floatleft{float:left}[id^=gadwp-piechart-].floatright{float:right}[id^=gadwp-tablechart-],[id^=gadwp-tablechart-]{width:98%;height:100%;margin:10px auto 10px 0}#dashboard-widgets-wrap .postbox{margin-right:10px}[id^=gadwp-progressbar-]{width:100%;height:3px;margin:5px 0 0 0}[id^=gadwp-bottomstats-]{width:100%}[id^=gadwp-bottomstats-] .inside{display:table;margin:0 auto;padding:0}#gadwp-widget .inside .small-box{width:30%;float:left;margin:0 5px 10px 5px;background:#fff;text-align:center;-moz-box-shadow:0 0 7px 0 #BBB;-webkit-box-shadow:0 0 7px 0 #BBB;box-shadow:0 0 7px 0 #BBB}#gadwp-widget .inside .small-box h3{font-size:1em;color:#777;padding:0 5px 0 5px;margin:0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}#gadwp-widget .inside .small-box p{font-size:1.2em;margin:0 0 2px 0}@media screen and (max-width:410px){[id^=gadwp-bottomstats-] .inside .small-box{width:45%}}
admin/css/gadwp.css CHANGED
@@ -1,206 +1 @@
1
- /**
2
- * Author: Alin Marcu
3
- * Author URI: https://deconf.com
4
- * Copyright 2013 Alin Marcu
5
- * License: GPLv2 or later
6
- * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
- */
8
-
9
- /* Tab navigation */
10
- #gadwp-events, #gadwp-custom, #gadwp-advanced, #gadwp-exclude, #gadwp-config {
11
- display: none;
12
- }
13
-
14
- /* Options pages */
15
- table.gadwp-settings-options {
16
- padding-left: 10px;
17
- width: 100%;
18
- }
19
-
20
- .gadwp-settings-options td {
21
- padding: 0px 5px 5px 5px;
22
- }
23
-
24
- td.gadwp-settings-title, td.info {
25
- width: 130px;
26
- padding-left: 20px;
27
- }
28
-
29
- td.gadwp-settings-title-s {
30
- width: 300px;
31
- }
32
-
33
- .gadwp-help {
34
- padding-left: 15px;
35
- }
36
-
37
- td.gadwp-settings-info {
38
- padding-bottom: 15px;
39
- }
40
-
41
- td.gadwp-settings-title label {
42
- font-weight: bold;
43
- }
44
-
45
- .gadash-title {
46
- float: left;
47
- margin-right: 10px;
48
- margin-top: 2px;
49
- clear: left;
50
- }
51
-
52
- .gadash-desc {
53
- font-size: 1em;
54
- }
55
-
56
- .gadash-top {
57
- vertical-align: top;
58
- }
59
-
60
- pre.gadwp-settings-logdata {
61
- white-space: pre-wrap;
62
- }
63
-
64
- td.gadwp-settings-roles {
65
- padding-bottom: 15px;
66
- }
67
-
68
- #ga_speed_samplerate, #ga_realtime_pages {
69
- width: 50px;
70
- }
71
-
72
- #gapi-access-code {
73
- color: red !important;
74
- }
75
-
76
- #poststuff.gadwp h2 {
77
- padding-bottom: 0;
78
- font-size: 19.5px;
79
- font-weight: normal;
80
- padding: 0;
81
- margin: 20px 0 15px 0;
82
- }
83
-
84
- #poststuff.gadwp h2.nav-tab-wrapper {
85
- border-bottom: 1px solid #ccc;
86
- padding-bottom: 0;
87
- }
88
-
89
- /* Options pages ON/OFF Switch */
90
- .button-primary.gadwp-settings-switchoo {
91
- position: relative;
92
- width: 50px;
93
- float: left;
94
- border: none;
95
- padding: 0;
96
- height: 22px;
97
- -moz-box-shadow: none;
98
- -webkit-box-shadow: none;
99
- -o-box-shadow: none;
100
- box-shadow: none;
101
- -webkit-user-select: none;
102
- -moz-user-select: none;
103
- -ms-user-select: none;
104
- }
105
-
106
- input.gadwp-settings-switchoo-checkbox {
107
- display: none;
108
- }
109
-
110
- .gadwp-settings-switchoo-label {
111
- display: block;
112
- overflow: hidden;
113
- cursor: pointer;
114
- background: transparent;
115
- border: 1px solid #ddd;
116
- border-radius: 2px;
117
- text-shadow: none;
118
- }
119
-
120
- .gadwp-settings-switchoo-inner {
121
- width: 200%;
122
- margin-left: -100%;
123
- border-radius: 2px;
124
- -moz-transition: margin 0.2s ease-in 0s;
125
- -webkit-transition: margin 0.2s ease-in 0s;
126
- -o-transition: margin 0.2s ease-in 0s;
127
- transition: margin 0.2s ease-in 0s;
128
- }
129
-
130
- .gadwp-settings-switchoo-inner:before, .gadwp-settings-switchoo-inner:after {
131
- float: left;
132
- width: 50%;
133
- font-weight: normal;
134
- -moz-box-sizing: border-box;
135
- -webkit-box-sizing: border-box;
136
- -o-box-sizing: border-box;
137
- box-sizing: border-box;
138
- height: 22px;
139
- line-height: 22px;
140
- font-size: 12px;
141
- text-shadow: none;
142
- }
143
-
144
- .gadwp-settings-switchoo-inner:before {
145
- content: "On";
146
- padding-left: 5px;
147
- border-bottom: none;
148
- /* background-color: #00a0d2;
149
- color: #fff; /* inherit from button props */
150
- }
151
-
152
- .gadwp-settings-switchoo-inner:after {
153
- content: "Off";
154
- padding-right: 5px;
155
- background-color: #ddd;
156
- text-align: right;
157
- }
158
-
159
- .gadwp-settings-switchoo-switch {
160
- width: 22px;
161
- height: 22px;
162
- background: #fff;
163
- color: #ddd;
164
- border: 1px solid #ddd;
165
- border-radius: 2px;
166
- position: absolute;
167
- top: 0;
168
- bottom: 0;
169
- right: 27px;
170
- -moz-transition: all 0.2s ease-in 0s;
171
- -webkit-transition: all 0.2s ease-in 0s;
172
- -o-transition: all 0.2s ease-in 0s;
173
- transition: all 0.2s ease-in 0s;
174
- }
175
-
176
- .gadwp-settings-switchoo-switch:hover {
177
- color: #aaa;
178
- border-color: #aaa;
179
- }
180
-
181
- .gadwp-settings-switchoo-switch:after {
182
- margin: 0;
183
- outline: 0;
184
- display: inline-block;
185
- font: 400 16px/16px dashicons;
186
- content: "\f228";
187
- padding: 3px 0 0 3px;
188
- text-align: left;
189
- text-decoration: none;
190
- -webkit-font-smoothing: antialiased;
191
- -moz-osx-font-smoothing: grayscale;
192
- }
193
-
194
- .gadwp-settings-switchoo-checkbox:checked+.gadwp-settings-switchoo-label .gadwp-settings-switchoo-inner {
195
- margin-left: 0;
196
- }
197
-
198
- .gadwp-settings-switchoo-checkbox:checked+.gadwp-settings-switchoo-label .gadwp-settings-switchoo-switch {
199
- right: 0px;
200
- }
201
-
202
- .switch-desc {
203
- float: left;
204
- margin-left: 10px;
205
- line-height: 20px;
206
- }
1
+ #gadwp-events,#gadwp-custom,#gadwp-advanced,#gadwp-exclude,#gadwp-config,#gadwp-tmdatalayervars,#gadwp-tmintegration,#gadwp-integration{display:none}table.gadwp-settings-options{padding-left:10px;width:100%}.gadwp-settings-options td{padding:0 5px 5px 5px}td.gadwp-settings-title,td.info{width:140px;padding-left:20px}td.gadwp-settings-title-s{width:300px}.gadwp-help{padding-left:15px}td.gadwp-settings-info{padding-bottom:15px}td.gadwp-settings-title label{font-size:1.1em}.gadash-title{float:left;margin-right:10px;margin-top:2px;clear:left}.gadash-desc{font-size:1em}.gadash-top{vertical-align:top}pre.gadwp-settings-logdata{white-space:pre-wrap}td.gadwp-settings-roles{padding-bottom:15px}#ga_speed_samplerate,#ga_realtime_pages{width:50px}#gapi-access-code{color:red !important}#poststuff.gadwp h2{padding-bottom:0;font-size:19.5px;font-weight:normal;padding:0;margin:20px 0 15px 0}#poststuff.gadwp h2.nav-tab-wrapper{border-bottom:1px solid #ccc;padding-bottom:0}.button-primary.gadwp-settings-switchoo{position:relative;width:50px;float:left;border:0;padding:0;height:22px;-moz-box-shadow:none;-webkit-box-shadow:none;-o-box-shadow:none;box-shadow:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}input.gadwp-settings-switchoo-checkbox{display:none}.gadwp-settings-switchoo-label{display:block;overflow:hidden;cursor:pointer;background:transparent;border:1px solid #ddd;border-radius:2px;text-shadow:none}.gadwp-settings-switchoo-inner{width:200%;margin-left:-100%;border-radius:2px;-moz-transition:margin .2s ease-in 0;-webkit-transition:margin .2s ease-in 0;-o-transition:margin .2s ease-in 0;transition:margin .2s ease-in 0}.gadwp-settings-switchoo-inner:before,.gadwp-settings-switchoo-inner:after{float:left;width:50%;font-weight:normal;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;height:22px;line-height:22px;font-size:12px;text-shadow:none}.gadwp-settings-switchoo-inner:before{content:"On";padding-left:5px;border-bottom:0}.gadwp-settings-switchoo-inner:after{content:"Off";padding-right:5px;background-color:#ddd;text-align:right}.gadwp-settings-switchoo-switch{width:22px;height:22px;background:#fff;color:#ddd;border:1px solid #ddd;border-radius:2px;position:absolute;top:0;bottom:0;right:27px;-moz-transition:all .2s ease-in 0;-webkit-transition:all .2s ease-in 0;-o-transition:all .2s ease-in 0;transition:all .2s ease-in 0}.gadwp-settings-switchoo-switch:hover{color:#aaa;border-color:#aaa}.gadwp-settings-switchoo-switch:after{margin:0;outline:0;display:inline-block;font:400 16px/16px dashicons;content:"\f228";padding:3px 0 0 3px;text-align:left;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.gadwp-settings-switchoo-checkbox:checked+.gadwp-settings-switchoo-label .gadwp-settings-switchoo-inner{margin-left:0}.gadwp-settings-switchoo-checkbox:checked+.gadwp-settings-switchoo-label .gadwp-settings-switchoo-switch{right:0}.switch-desc{float:left;margin-left:10px;line-height:20px}
admin/css/item-reports.css CHANGED
@@ -1,125 +1 @@
1
- /**
2
- * Author: Alin Marcu
3
- * Author URI: https://deconf.com
4
- * Copyright 2013 Alin Marcu
5
- * License: GPLv2 or later
6
- * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
- */
8
-
9
- /* Backend Item Reports */
10
- .column-gadwp_stats {
11
- width: 70px;
12
- }
13
-
14
- .gadwp-icon {
15
- color: #555;
16
- }
17
-
18
- .gadwp-icon:hover {
19
- color: #2ea2cc;
20
- }
21
-
22
- .gadwp-icon-oldwp {
23
- padding-top: 5px;
24
- }
25
-
26
- [id^=gadwp-container-] {
27
- width: 480px;
28
- }
29
-
30
- [id^=gadwp-areachart-] {
31
- height: 280px;
32
- }
33
-
34
- [id^=gadwp-progressbar-] {
35
- width: 100%;
36
- height: 3px;
37
- margin: 5px 0 0px 0;
38
- }
39
-
40
- [id^=gadwp-bottomstats-] {
41
- width: 100%;
42
- }
43
-
44
- [id^=gadwp-bottomstats-] .inside {
45
- display: table;
46
- margin: 0 auto;
47
- padding: 0px;
48
- }
49
-
50
- [id^=gadwp-bottomstats-] .inside .small-box {
51
- width: 31.2%;
52
- float: left;
53
- margin: 10px 5px 10px 5px;
54
- background: #fff;
55
- text-align: center;
56
- -moz-box-shadow: 0px 0px 7px 0px #BBB;
57
- -webkit-box-shadow: 0px 0px 7px 0px #BBB;
58
- box-shadow: 0px 0px 7px 0px #BBB;
59
- }
60
-
61
- [id^=gadwp-bottomstats-] .inside .small-box h3 {
62
- font-size: 1em;
63
- font-weight: normal;
64
- color: #777;
65
- padding: 0px 5px 0px 5px;
66
- margin: 0px 0px 0px 0px;
67
- text-overflow: ellipsis;
68
- overflow: hidden;
69
- white-space: nowrap;
70
- }
71
-
72
- [id^=gadwp-bottomstats-] .inside .small-box p {
73
- font-size: 1.2em;
74
- margin: 0px 0px 2px 0px;
75
- color: black;
76
- }
77
-
78
- .gadwp-floatwraper {
79
- display: table;
80
- width: 100%;
81
- height: 100%;
82
- }
83
-
84
- [id^=gadwp-piechart-].halfsize {
85
- width: 47%;
86
- margin: 10px 0 0 0;
87
- height: 200px;
88
- float: left;
89
- }
90
-
91
- [id^=gadwp-piechart-].floatleft {
92
- float: left;
93
- }
94
-
95
- [id^=gadwp-piechart-].floatright {
96
- float: right;
97
- }
98
-
99
- [id^=gadwp-tablechart-], [id^=gadwp-tablechart-] {
100
- margin: 10px 0 0 0;
101
- }
102
-
103
- .gadwp .ui-dialog-titlebar {
104
- font-size: 1.1em;
105
- text-overflow: ellipsis;
106
- overflow: hidden;
107
- }
108
-
109
- @media screen and (max-width: 500px) {
110
- [id^=gadwp-container-] {
111
- width: 410px;
112
- }
113
- [id^=gadwp-bottomstats-] .inside .small-box {
114
- width: 30.8%;
115
- }
116
- }
117
-
118
- @media screen and (max-width: 410px) {
119
- [id^=gadwp-container-] {
120
- width: 260px;
121
- }
122
- [id^=gadwp-bottomstats-] .inside .small-box {
123
- width: 46%;
124
- }
125
- }
1
+ .column-gadwp_stats{width:70px}.gadwp-icon{color:#555}.gadwp-icon:hover{color:#2ea2cc}.gadwp-icon-oldwp{padding-top:5px}[id^=gadwp-container-]{width:480px}[id^=gadwp-areachart-]{height:280px}[id^=gadwp-progressbar-]{width:100%;height:3px;margin:5px 0 0 0}[id^=gadwp-bottomstats-]{width:100%}[id^=gadwp-bottomstats-] .inside{display:table;margin:0 auto;padding:0}[id^=gadwp-bottomstats-] .inside .small-box{width:31.2%;float:left;margin:10px 5px 10px 5px;background:#fff;text-align:center;-moz-box-shadow:0 0 7px 0 #BBB;-webkit-box-shadow:0 0 7px 0 #BBB;box-shadow:0 0 7px 0 #BBB}[id^=gadwp-bottomstats-] .inside .small-box h3{font-size:1em;font-weight:normal;color:#777;padding:0 5px 0 5px;margin:0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}[id^=gadwp-bottomstats-] .inside .small-box p{font-size:1.2em;margin:0 0 2px 0;color:black}.gadwp-floatwraper{display:table;width:100%;height:100%}[id^=gadwp-piechart-].halfsize{width:47%;margin:10px 0 0 0;height:200px;float:left}[id^=gadwp-piechart-].floatleft{float:left}[id^=gadwp-piechart-].floatright{float:right}[id^=gadwp-tablechart-],[id^=gadwp-tablechart-]{margin:10px 0 0 0}.gadwp .ui-dialog-titlebar{font-size:1.1em;text-overflow:ellipsis;overflow:hidden}@media screen and (max-width:500px){[id^=gadwp-container-]{width:410px}[id^=gadwp-bottomstats-] .inside .small-box{width:30.8%}}@media screen and (max-width:410px){[id^=gadwp-container-]{width:260px}[id^=gadwp-bottomstats-] .inside .small-box{width:46%}}
admin/item-reports.php CHANGED
@@ -1,8 +1,8 @@
1
<?php
2
/**
3
- * Author: Alin Marcu
4
* Author URI: https://deconf.com
5
- * Copyright 2013 Alin Marcu
6
* License: GPLv2 or later
7
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
*/
@@ -19,17 +19,17 @@ if ( ! class_exists( 'GADWP_Backend_Item_Reports' ) ) {
19
20
public function __construct() {
21
$this->gadwp = GADWP();
22
-
23
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && 1 == $this->gadwp->config->options['backend_item_reports'] ) {
24
// Add custom column in Posts List
25
add_filter( 'manage_posts_columns', array( $this, 'add_columns' ) );
26
-
27
// Populate custom column in Posts List
28
add_action( 'manage_posts_custom_column', array( $this, 'add_icons' ), 10, 2 );
29
-
30
// Add custom column in Pages List
31
add_filter( 'manage_pages_columns', array( $this, 'add_columns' ) );
32
-
33
// Populate custom column in Pages List
34
add_action( 'manage_pages_custom_column', array( $this, 'add_icons' ), 10, 2 );
35
}
@@ -37,11 +37,11 @@ if ( ! class_exists( 'GADWP_Backend_Item_Reports' ) ) {
37
38
public function add_icons( $column, $id ) {
39
global $wp_version;
40
-
41
- if ( $column != 'gadwp_stats' ) {
42
return;
43
}
44
-
45
if ( version_compare( $wp_version, '3.8.0', '>=' ) ) {
46
echo '<a id="gadwp-' . $id . '" title="' . get_the_title( $id ) . '" href="#' . $id . '" class="gadwp-icon dashicons-before dashicons-chart-area"></a>';
47
} else {
1
<?php
2
/**
3
+ * Author: Alin Marcu
4
* Author URI: https://deconf.com
5
+ * Copyright 2013 Alin Marcu
6
* License: GPLv2 or later
7
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
*/
19
20
public function __construct() {
21
$this->gadwp = GADWP();
22
+
23
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && 1 == $this->gadwp->config->options['backend_item_reports'] ) {
24
// Add custom column in Posts List
25
add_filter( 'manage_posts_columns', array( $this, 'add_columns' ) );
26
+
27
// Populate custom column in Posts List
28
add_action( 'manage_posts_custom_column', array( $this, 'add_icons' ), 10, 2 );
29
+
30
// Add custom column in Pages List
31
add_filter( 'manage_pages_columns', array( $this, 'add_columns' ) );
32
+
33
// Populate custom column in Pages List
34
add_action( 'manage_pages_custom_column', array( $this, 'add_icons' ), 10, 2 );
35
}
37
38
public function add_icons( $column, $id ) {
39
global $wp_version;
40
+
41
+ if ( 'gadwp_stats' != $column ) {
42
return;
43
}
44
+
45
if ( version_compare( $wp_version, '3.8.0', '>=' ) ) {
46
echo '<a id="gadwp-' . $id . '" title="' . get_the_title( $id ) . '" href="#' . $id . '" class="gadwp-icon dashicons-before dashicons-chart-area"></a>';
47
} else {
admin/js/settings.js CHANGED
@@ -1,40 +1 @@
1
- /*-
2
- * Author: Alin Marcu
3
- * Author URI: https://deconf.com
4
- * Copyright 2013 Alin Marcu
5
- * License: GPLv2 or later
6
- * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
- */
8
-
9
- /*
10
- * Navigation Tabs
11
- */
12
- jQuery( document ).ready( function () {
13
- if ( window.location.href.indexOf( "page=gadash_" ) != -1 ) {
14
- var ident = 'basic';
15
-
16
- if ( window.location.hash ) {
17
- ident = window.location.hash.split( '#' )[ 2 ].split( '-' )[ 1 ];
18
- } else if ( window.location.href.indexOf( "page=gadash_errors_debugging" ) != -1 ) {
19
- ident = 'errors';
20
- }
21
-
22
- jQuery( ".nav-tab-wrapper a" ).each( function ( index ) {
23
- jQuery( this ).removeClass( "nav-tab-active" );
24
- jQuery( "#" + this.hash.split( '#' )[ 2 ] ).hide();
25
- } );
26
- jQuery( "#tab-" + ident ).addClass( "nav-tab-active" );
27
- jQuery( "#gadwp-" + ident ).show();
28
- }
29
-
30
- jQuery( 'a[href^="#"]' ).click( function ( e ) {
31
- if ( window.location.href.indexOf( "page=gadash_" ) != -1 ) {
32
- jQuery( ".nav-tab-wrapper a" ).each( function ( index ) {
33
- jQuery( this ).removeClass( "nav-tab-active" );
34
- jQuery( "#" + this.hash.split( '#' )[ 2 ] ).hide();
35
- } );
36
- jQuery( this ).addClass( "nav-tab-active" );
37
- jQuery( "#" + this.hash.split( '#' )[ 2 ] ).show();
38
- }
39
- } );
40
- } );
1
+ jQuery(document).ready(function(){if(window.location.href.indexOf("page=gadash_")!=-1){var a="basic";if(window.location.hash){a=window.location.hash.split("#")[2].split("-")[1]}else{if(window.location.href.indexOf("page=gadash_errors_debugging")!=-1){a="errors"}}jQuery(".nav-tab-wrapper a").each(function(b){jQuery(this).removeClass("nav-tab-active");jQuery("#"+this.hash.split("#")[2]).hide()});jQuery("#tab-"+a).addClass("nav-tab-active");jQuery("#gadwp-"+a).show()}jQuery('a[href^="#"]').click(function(b){if(window.location.href.indexOf("page=gadash_")!=-1){jQuery(".nav-tab-wrapper a").each(function(c){jQuery(this).removeClass("nav-tab-active");jQuery("#"+this.hash.split("#")[2]).hide()});jQuery(this).addClass("nav-tab-active");jQuery("#"+this.hash.split("#")[2]).show()}})});
admin/js/ui.js CHANGED
@@ -1,26 +1 @@
1
- /*-
2
- * Author: Alin Marcu
3
- * Author URI: https://deconf.com
4
- * Copyright 2013 Alin Marcu
5
- * License: GPLv2 or later
6
- * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
- */
8
-
9
- "use strict";
10
-
11
- jQuery( document ).ready( function () {
12
-
13
- var gadwp_ui = {
14
- action : 'gadwp_dismiss_notices',
15
- gadwp_security_dismiss_notices : gadwp_ui_data.security,
16
- }
17
-
18
- jQuery( "#gadwp-notice .notice-dismiss" ).click( function () {
19
- jQuery.post( gadwp_ui_data.ajaxurl, gadwp_ui );
20
- } );
21
-
22
- if ( gadwp_ui_data.ed_bubble != '' ) {
23
- jQuery( '#toplevel_page_gadash_settings li > a[href*="page=gadash_errors_debugging"]' ).append( '&nbsp;<span class="awaiting-mod count-1"><span class="pending-count" style="padding:0 7px;">' + gadwp_ui_data.ed_bubble + '</span></span>' );
24
- }
25
-
26
- } );
1
+ "use strict";jQuery(document).ready(function(){var a={action:"gadwp_dismiss_notices",gadwp_security_dismiss_notices:gadwp_ui_data.security};jQuery("#gadwp-notice .notice-dismiss").click(function(){jQuery.post(gadwp_ui_data.ajaxurl,a)});if(gadwp_ui_data.ed_bubble!=""){jQuery('#toplevel_page_gadash_settings li > a[href*="page=gadash_errors_debugging"]').append('&nbsp;<span class="awaiting-mod count-1"><span class="pending-count" style="padding:0 7px;">'+gadwp_ui_data.ed_bubble+"</span></span>")}});
admin/js/wp-color-picker-script.js CHANGED
@@ -1,11 +1 @@
1
- /*-
2
- * Author: Alin Marcu
3
- * Author URI: https://deconf.com
4
- * Copyright 2013 Alin Marcu
5
- * License: GPLv2 or later
6
- * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
- */
8
-
9
- jQuery( document ).ready( function () {
10
- jQuery( '.ga_dash_style' ).wpColorPicker();
11
- } );
1
+ jQuery(document).ready(function(){jQuery(".ga_dash_style").wpColorPicker()});
admin/settings.php CHANGED
@@ -8,8 +8,9 @@
8
*/
9
10
// Exit if accessed directly
11
- if ( ! defined( 'ABSPATH' ) )
12
exit();
13
14
final class GADWP_Settings {
15
@@ -17,42 +18,50 @@ final class GADWP_Settings {
17
$gadwp = GADWP();
18
$network_settings = false;
19
$options = $gadwp->config->options; // Get current options
20
- if ( isset( $_POST['options']['ga_dash_hidden'] ) && isset( $_POST['options'] ) && ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) && $who != 'Reset' ) {
21
$new_options = $_POST['options'];
22
- if ( $who == 'tracking' ) {
23
$options['ga_dash_anonim'] = 0;
24
$options['ga_event_tracking'] = 0;
25
$options['ga_enhanced_links'] = 0;
26
$options['ga_dash_remarketing'] = 0;
27
- $options['ga_dash_adsense'] = 0;
28
$options['ga_event_bouncerate'] = 0;
29
$options['ga_crossdomain_tracking'] = 0;
30
$options['ga_aff_tracking'] = 0;
31
$options['ga_hash_tracking'] = 0;
32
if ( isset( $_POST['options']['ga_tracking_code'] ) ) {
33
$new_options['ga_tracking_code'] = trim( $new_options['ga_tracking_code'], "\t" );
34
}
35
if ( empty( $new_options['ga_track_exclude'] ) ) {
36
$new_options['ga_track_exclude'] = array();
37
}
38
- } else if ( $who == 'backend' ) {
39
$options['switch_profile'] = 0;
40
$options['backend_item_reports'] = 0;
41
$options['dashboard_widget'] = 0;
42
if ( empty( $new_options['ga_dash_access_back'] ) ) {
43
$new_options['ga_dash_access_back'][] = 'administrator';
44
}
45
- } else if ( $who == 'frontend' ) {
46
$options['frontend_item_reports'] = 0;
47
if ( empty( $new_options['ga_dash_access_front'] ) ) {
48
$new_options['ga_dash_access_front'][] = 'administrator';
49
}
50
- } else if ( $who == 'general' ) {
51
$options['ga_dash_userapi'] = 0;
52
if ( ! is_multisite() ) {
53
$options['automatic_updates_minorversion'] = 0;
54
}
55
- } else if ( $who == 'network' ) {
56
$options['ga_dash_userapi'] = 0;
57
$options['ga_dash_network'] = 0;
58
$options['ga_dash_excludesa'] = 0;
@@ -81,9 +90,9 @@ final class GADWP_Settings {
81
}
82
$options = self::update_options( 'frontend' );
83
if ( isset( $_POST['options']['ga_dash_hidden'] ) ) {
84
- $message = "<div class='updated'><p>" . __( "Settings saved.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
85
if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
86
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
87
}
88
}
89
if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
@@ -91,69 +100,72 @@ final class GADWP_Settings {
91
}
92
?>
93
<form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
94
- <div class="wrap">
95
<?php echo "<h2>" . __( "Google Analytics Frontend Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?><hr>
96
- </div>
97
- <div id="poststuff" class="gadwp">
98
- <div id="post-body" class="metabox-holder columns-2">
99
- <div id="post-body-content">
100
- <div class="settings-wrapper">
101
- <div class="inside">
102
<?php if (isset($message)) echo $message; ?>
103
<table class="gadwp-settings-options">
104
- <tr>
105
- <td colspan="2"><?php echo "<h2>" . __( "Permissions", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
106
- </tr>
107
- <tr>
108
- <td class="roles gadwp-settings-title"><label for="ga_dash_access_front"><?php _e("Show stats to:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
109
- <td class="gadwp-settings-roles">
110
- <?php
111
- if ( ! isset( $wp_roles ) ) {
112
- $wp_roles = new WP_Roles();
113
- }
114
- $i = 0;
115
- ?>
116
- <table>
117
- <tr>
118
- <?php
119
- foreach ( $wp_roles->role_names as $role => $name ) {
120
- if ( $role != 'subscriber' ) {
121
- $i++;
122
- ?>
123
- <td><label> <input type="checkbox" name="options[ga_dash_access_front][]" value="<?php echo $role; ?>" <?php if (in_array($role,$options['ga_dash_access_front']) || $role=='administrator') echo 'checked="checked"'; if ($role=='administrator') echo 'disabled="disabled"';?> /><?php echo $name; ?>
124
- </label></td>
125
- <?php
126
- }
127
- if ( $i % 4 == 0 ) {
128
- ?>
129
- </tr>
130
- <tr>
131
- <?php
132
- }
133
- }
134
- ?>
135
- </table>
136
- </td>
137
- </tr>
138
- <tr>
139
- <td colspan="2" class="gadwp-settings-title">
140
- <div class="button-primary gadwp-settings-switchoo">
141
- <input type="checkbox" name="options[frontend_item_reports]" value="1" class="gadwp-settings-switchoo-checkbox" id="frontend_item_reports" <?php checked( $options['frontend_item_reports'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="frontend_item_reports">
142
- <div class="gadwp-settings-switchoo-inner"></div>
143
- <div class="gadwp-settings-switchoo-switch"></div>
144
- </label>
145
- </div>
146
- <div class="switch-desc"><?php echo " ".__("enable web page reports on frontend", 'google-analytics-dashboard-for-wp' );?></div>
147
- </td>
148
- </tr>
149
- <tr>
150
- <td colspan="2"><hr></td>
151
- </tr>
152
- <tr>
153
- <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" /></td>
154
- </tr>
155
- </table>
156
- <input type="hidden" name="options[ga_dash_hidden]" value="Y">
157
<?php wp_nonce_field('gadash_form','gadash_security');?>
158
</form>
159
<?php
@@ -167,9 +179,9 @@ final class GADWP_Settings {
167
}
168
$options = self::update_options( 'backend' );
169
if ( isset( $_POST['options']['ga_dash_hidden'] ) ) {
170
- $message = "<div class='updated'><p>" . __( "Settings saved.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
171
if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
172
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
173
}
174
}
175
if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
@@ -177,127 +189,132 @@ final class GADWP_Settings {
177
}
178
?>
179
<form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
180
- <div class="wrap">
181
<?php echo "<h2>" . __( "Google Analytics Backend Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?><hr>
182
- </div>
183
- <div id="poststuff" class="gadwp">
184
- <div id="post-body" class="metabox-holder columns-2">
185
- <div id="post-body-content">
186
- <div class="settings-wrapper">
187
- <div class="inside">
188
<?php if (isset($message)) echo $message; ?>
189
<table class="gadwp-settings-options">
190
- <tr>
191
- <td colspan="2"><?php echo "<h2>" . __( "Permissions", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
192
- </tr>
193
- <tr>
194
- <td class="roles gadwp-settings-title"><label for="ga_dash_access_back"><?php _e("Show stats to:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
195
- <td class="gadwp-settings-roles">
196
- <?php
197
- if ( ! isset( $wp_roles ) ) {
198
- $wp_roles = new WP_Roles();
199
- }
200
- $i = 0;
201
- ?>
202
<table>
203
- <tr>
204
- <?php
205
-
206
- foreach ( $wp_roles->role_names as $role => $name ) {
207
- if ( $role != 'subscriber' ) {
208
- $i++;
209
- ?>
210
- <td><label> <input type="checkbox" name="options[ga_dash_access_back][]" value="<?php echo $role; ?>" <?php if (in_array($role,$options['ga_dash_access_back']) || $role=='administrator') echo 'checked="checked"'; if ($role=='administrator') echo 'disabled="disabled"';?> />
211
- <?php echo $name; ?>
212
- </label></td>
213
- <?php
214
- }
215
- if ( $i % 4 == 0 ) {
216
- ?>
217
- </tr>
218
- <tr>
219
- <?php
220
- }
221
- }
222
- ?>
223
- </table>
224
- </td>
225
- </tr>
226
- <tr>
227
- <td colspan="2" class="gadwp-settings-title">
228
- <div class="button-primary gadwp-settings-switchoo">
229
- <input type="checkbox" name="options[switch_profile]" value="1" class="gadwp-settings-switchoo-checkbox" id="switch_profile" <?php checked( $options['switch_profile'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="switch_profile">
230
- <div class="gadwp-settings-switchoo-inner"></div>
231
- <div class="gadwp-settings-switchoo-switch"></div>
232
- </label>
233
- </div>
234
- <div class="switch-desc"><?php _e ( "enable Switch View functionality", 'google-analytics-dashboard-for-wp' );?></div>
235
- </td>
236
- </tr>
237
- <tr>
238
- <td colspan="2" class="gadwp-settings-title">
239
- <div class="button-primary gadwp-settings-switchoo">
240
- <input type="checkbox" name="options[backend_item_reports]" value="1" class="gadwp-settings-switchoo-checkbox" id="backend_item_reports" <?php checked( $options['backend_item_reports'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="backend_item_reports">
241
- <div class="gadwp-settings-switchoo-inner"></div>
242
- <div class="gadwp-settings-switchoo-switch"></div>
243
- </label>
244
- </div>
245
- <div class="switch-desc"><?php _e ( "enable reports on Posts List and Pages List", 'google-analytics-dashboard-for-wp' );?></div>
246
- </td>
247
- </tr>
248
- <tr>
249
- <td colspan="2" class="gadwp-settings-title">
250
- <div class="button-primary gadwp-settings-switchoo">
251
- <input type="checkbox" name="options[dashboard_widget]" value="1" class="gadwp-settings-switchoo-checkbox" id="dashboard_widget" <?php checked( $options['dashboard_widget'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="dashboard_widget">
252
- <div class="gadwp-settings-switchoo-inner"></div>
253
- <div class="gadwp-settings-switchoo-switch"></div>
254
- </label>
255
- </div>
256
- <div class="switch-desc"><?php _e ( "enable the main Dashboard Widget", 'google-analytics-dashboard-for-wp' );?></div>
257
- </td>
258
- </tr>
259
- <tr>
260
- <td colspan="2"><hr><?php echo "<h2>" . __( "Real-Time Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
261
- </tr>
262
- <tr>
263
- <td colspan="2" class="gadwp-settings-title"> <?php _e("Maximum number of pages to display on real-time tab:", 'google-analytics-dashboard-for-wp'); ?>
264
- <input type="number" name="options[ga_realtime_pages]" id="ga_realtime_pages" value="<?php echo (int)$options['ga_realtime_pages']; ?>" size="3">
265
- </td>
266
- </tr>
267
- <tr>
268
- <td colspan="2"><hr><?php echo "<h2>" . __( "Location Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
269
- </tr>
270
- <tr>
271
- <td colspan="2" class="gadwp-settings-title">
272
<?php echo __("Target Geo Map to country:", 'google-analytics-dashboard-for-wp'); ?>
273
<input type="text" style="text-align: center;" name="options[ga_target_geomap]" value="<?php echo esc_attr($options['ga_target_geomap']); ?>" size="3">
274
- </td>
275
- </tr>
276
- <tr>
277
- <td colspan="2" class="gadwp-settings-title">
278
<?php echo __("Maps API Key:", 'google-analytics-dashboard-for-wp'); ?>
279
<input type="text" style="text-align: center;" name="options[maps_api_key]" value="<?php echo esc_attr($options['maps_api_key']); ?>" size="50">
280
- </td>
281
- </tr>
282
- <tr>
283
- <td colspan="2"><hr><?php echo "<h2>" . __( "404 Errors Report", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
284
- </tr>
285
- <tr>
286
- <td colspan="2" class="gadwp-settings-title">
287
<?php echo __("404 Page Title contains:", 'google-analytics-dashboard-for-wp'); ?>
288
<input type="text" style="text-align: center;" name="options[pagetitle_404]" value="<?php echo esc_attr($options['pagetitle_404']); ?>" size="20">
289
- </td>
290
- </tr>
291
- <tr>
292
- <td colspan="2"><hr></td>
293
- </tr>
294
- <tr>
295
- <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" /></td>
296
- </tr>
297
- </table>
298
- <input type="hidden" name="options[ga_dash_hidden]" value="Y">
299
<?php wp_nonce_field('gadash_form','gadash_security'); ?>
300
-
301
</form>
302
<?php
303
self::output_sidebar();
@@ -311,313 +328,629 @@ final class GADWP_Settings {
311
}
312
$options = self::update_options( 'tracking' );
313
if ( isset( $_POST['options']['ga_dash_hidden'] ) ) {
314
- $message = "<div class='updated'><p>" . __( "Settings saved.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
315
if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
316
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
317
}
318
}
319
if ( ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
320
$message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'google-analytics-dashboard-for-wp' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'google-analytics-dashboard-for-wp' ) ) ) );
321
}
322
- if ( ! $options['ga_dash_tracking'] ) {
323
- $message = "<div class='error'><p>" . __( "The tracking component is disabled. You should set <strong>Tracking Options</strong> to <strong>Enabled</strong>", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
324
- }
325
?>
326
<form name="ga_dash_form" method="post" action="<?php esc_url($_SERVER['REQUEST_URI']); ?>">
327
- <div class="wrap">
328
<?php echo "<h2>" . __( "Google Analytics Tracking Code", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?>
329
</div>
330
- <div id="poststuff" class="gadwp">
331
- <div id="post-body" class="metabox-holder columns-2">
332
- <div id="post-body-content">
333
- <div class="settings-wrapper">
334
- <div class="inside">
335
- <?php
336
- $tabs = array( 'basic' => __( "Basic Settings", 'google-analytics-dashboard-for-wp' ), 'events' => __( "Events Tracking", 'google-analytics-dashboard-for-wp' ), 'custom' => __( "Custom Definitions", 'google-analytics-dashboard-for-wp' ), 'exclude' => __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ), 'advanced' => __( "Advanced Settings", 'google-analytics-dashboard-for-wp' ) );
337
- self::navigation_tabs( $tabs );
338
- if ( isset( $message ) )
339
- echo $message;
340
- ?>
341
- <div id="gadwp-basic">
342
- <table class="gadwp-settings-options">
343
- <tr>
344
- <td colspan="2"><?php echo "<h2>" . __( "Tracking Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
345
- </tr>
346
- <tr>
347
- <td class="gadwp-settings-title"><label for="ga_dash_tracking"><?php _e("Tracking Options:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
348
- <td><select id="ga_dash_tracking" name="options[ga_dash_tracking]" onchange="this.form.submit()">
349
- <option value="0" <?php selected( $options['ga_dash_tracking'], 0 ); ?>><?php _e("Disabled", 'google-analytics-dashboard-for-wp');?></option>
350
- <option value="1" <?php selected( $options['ga_dash_tracking'], 1 ); ?>><?php _e("Enabled", 'google-analytics-dashboard-for-wp');?></option>
351
- </select></td>
352
- </tr>
353
- <?php if ($options['ga_dash_tracking']) {?>
354
<tr>
355
- <td class="gadwp-settings-title"></td>
356
- <td>
357
- <?php $profile_info = GADWP_Tools::get_selected_profile($gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail']); ?>
358
- <?php echo '<pre>' . __("View Name:", 'google-analytics-dashboard-for-wp') . "\t" . esc_html($profile_info[0]) . "<br />" . __("Tracking ID:", 'google-analytics-dashboard-for-wp') . "\t" . esc_html($profile_info[2]) . "<br />" . __("Default URL:", 'google-analytics-dashboard-for-wp') . "\t" . esc_html($profile_info[3]) . "<br />" . __("Time Zone:", 'google-analytics-dashboard-for-wp') . "\t" . esc_html($profile_info[5]) . '</pre>';?>
359
- </td>
360
- </tr>
361
- <?php }?>
362
<tr>
363
- <td colspan="2"><hr><?php echo "<h2>" . __( "Basic Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
364
- </tr>
365
- <tr>
366
- <td class="gadwp-settings-title"><label for="ga_dash_tracking_type"><?php _e("Tracking Type:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
367
- <td><select id="ga_dash_tracking_type" name="options[ga_dash_tracking_type]">
368
- <option value="classic" <?php selected( $options['ga_dash_tracking_type'], 'classic' ); ?>><?php _e("Classic Analytics", 'google-analytics-dashboard-for-wp');?></option>
369
- <option value="universal" <?php selected( $options['ga_dash_tracking_type'], 'universal' ); ?>><?php _e("Universal Analytics", 'google-analytics-dashboard-for-wp');?></option>
370
- </select></td>
371
- </tr>
372
- <tr>
373
- <td colspan="2" class="gadwp-settings-title">
374
- <div class="button-primary gadwp-settings-switchoo">
375
- <input type="checkbox" name="options[ga_dash_anonim]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_dash_anonim" <?php checked( $options['ga_dash_anonim'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="ga_dash_anonim">
376
- <div class="gadwp-settings-switchoo-inner"></div>
377
- <div class="gadwp-settings-switchoo-switch"></div>
378
- </label>
379
- </div>
380
- <div class="switch-desc"><?php echo " ".__("anonymize IPs while tracking", 'google-analytics-dashboard-for-wp' );?></div>
381
- </td>
382
- </tr>
383
- <tr>
384
- <td colspan="2" class="gadwp-settings-title">
385
- <div class="button-primary gadwp-settings-switchoo">
386
- <input type="checkbox" name="options[ga_dash_remarketing]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_dash_remarketing" <?php checked( $options['ga_dash_remarketing'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="ga_dash_remarketing">
387
- <div class="gadwp-settings-switchoo-inner"></div>
388
- <div class="gadwp-settings-switchoo-switch"></div>
389
- </label>
390
- </div>
391
- <div class="switch-desc"><?php echo " ".__("enable remarketing, demographics and interests reports", 'google-analytics-dashboard-for-wp' );?></div>
392
- </td>
393
- </tr>
394
- </table>
395
- </div>
396
- <div id="gadwp-events">
397
- <table class="gadwp-settings-options">
398
- <tr>
399
- <td colspan="2"><?php echo "<h2>" . __( "Events Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
400
- </tr>
401
- <tr>
402
- <td colspan="2" class="gadwp-settings-title">
403
- <div class="button-primary gadwp-settings-switchoo">
404
- <input type="checkbox" name="options[ga_event_tracking]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_event_tracking" <?php checked( $options['ga_event_tracking'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="ga_event_tracking">
405
- <div class="gadwp-settings-switchoo-inner"></div>
406
- <div class="gadwp-settings-switchoo-switch"></div>
407
- </label>
408
- </div>
409
- <div class="switch-desc"><?php echo " ".__("track downloads, mailto and outbound links", 'google-analytics-dashboard-for-wp' ); ?></div>
410
- </td>
411
- </tr>
412
- <tr>
413
- <td class="gadwp-settings-title"><label for="ga_event_downloads"><?php _e("Downloads Regex:", 'google-analytics-dashboard-for-wp'); ?></label></td>
414
- <td><input type="text" id="ga_event_downloads" name="options[ga_event_downloads]" value="<?php echo esc_attr($options['ga_event_downloads']); ?>" size="50"></td>
415
- </tr>
416
- <tr>
417
- <td colspan="2" class="gadwp-settings-title">
418
- <div class="button-primary gadwp-settings-switchoo">
419
- <input type="checkbox" name="options[ga_aff_tracking]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_aff_tracking" <?php checked( $options['ga_aff_tracking'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="ga_aff_tracking">
420
- <div class="gadwp-settings-switchoo-inner"></div>
421
- <div class="gadwp-settings-switchoo-switch"></div>
422
- </label>
423
- </div>
424
- <div class="switch-desc"><?php echo " ".__("track affiliate links matching this regex", 'google-analytics-dashboard-for-wp' ); ?></div>
425
- </td>
426
- </tr>
427
- <tr>
428
- <td class="gadwp-settings-title"><label for="ga_event_affiliates"><?php _e("Affiliates Regex:", 'google-analytics-dashboard-for-wp'); ?></label></td>
429
- <td><input type="text" id="ga_event_affiliates" name="options[ga_event_affiliates]" value="<?php echo esc_attr($options['ga_event_affiliates']); ?>" size="50"></td>
430
- </tr>
431
- <tr>
432
- <td colspan="2" class="gadwp-settings-title">
433
- <div class="button-primary gadwp-settings-switchoo">
434
- <input type="checkbox" name="options[ga_hash_tracking]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_hash_tracking" <?php checked( $options['ga_hash_tracking'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="ga_hash_tracking">
435
- <div class="gadwp-settings-switchoo-inner"></div>
436
- <div class="gadwp-settings-switchoo-switch"></div>
437
- </label>
438
- </div>
439
- <div class="switch-desc"><?php echo " ".__("track fragment identifiers, hashmarks (#) in URI links", 'google-analytics-dashboard-for-wp' ); ?></div>
440
- </td>
441
- </tr>
442
- </table>
443
- </div>
444
- <div id="gadwp-custom">
445
- <table class="gadwp-settings-options">
446
- <tr>
447
- <td colspan="2"><?php echo "<h2>" . __( "Custom Definitions", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
448
- </tr>
449
- <tr>
450
- <td class="gadwp-settings-title"><label for="ga_author_dimindex"><?php _e("Authors:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
451
- <td><select id="ga_author_dimindex" name="options[ga_author_dimindex]">
452
- <?php for ($i=0;$i<21;$i++){?>
453
- <option value="<?php echo $i;?>" <?php selected( $options['ga_author_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
454
- <?php }?>
455
- </select></td>
456
- </tr>
457
- <tr>
458
- <td class="gadwp-settings-title"><label for="ga_pubyear_dimindex"><?php _e("Publication Year:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
459
- <td><select id="ga_pubyear_dimindex" name="options[ga_pubyear_dimindex]">
460
- <?php for ($i=0;$i<21;$i++){?>
461
- <option value="<?php echo $i;?>" <?php selected( $options['ga_pubyear_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
462
- <?php }?>
463
- </select></td>
464
- </tr>
465
<tr>
466
- <td class="gadwp-settings-title"><label for="ga_pubyearmonth_dimindex"><?php _e("Publication Month:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
467
- <td><select id="ga_pubyearmonth_dimindex" name="options[ga_pubyearmonth_dimindex]">
468
- <?php for ($i=0;$i<21;$i++){?>
469
- <option value="<?php echo $i;?>" <?php selected( $options['ga_pubyearmonth_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
470
- <?php }?>
471
- </select></td>
472
- </tr>
473
- <tr>
474
- <td class="gadwp-settings-title"><label for="ga_category_dimindex"><?php _e("Categories:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
475
- <td><select id="ga_category_dimindex" name="options[ga_category_dimindex]">
476
- <?php for ($i=0;$i<21;$i++){?>
477
- <option value="<?php echo $i;?>" <?php selected( $options['ga_category_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
478
- <?php }?>
479
- </select></td>
480
- </tr>
481
- <tr>
482
- <td class="gadwp-settings-title"><label for="ga_user_dimindex"><?php _e("User Type:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
483
- <td><select id="ga_user_dimindex" name="options[ga_user_dimindex]">
484
- <?php for ($i=0;$i<21;$i++){?>
485
- <option value="<?php echo $i;?>" <?php selected( $options['ga_user_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
486
- <?php }?>
487
- </select></td>
488
- </tr>
489
- <tr>
490
- <td class="gadwp-settings-title"><label for="ga_tag_dimindex"><?php _e("Tags:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
491
- <td><select id="ga_tag_dimindex" name="options[ga_tag_dimindex]">
492
- <?php for ($i=0;$i<21;$i++){?>
493
- <option value="<?php echo $i;?>" <?php selected( $options['ga_tag_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
494
- <?php }?>
495
- </select></td>
496
- </tr>
497
- </table>
498
- </div>
499
- <div id="gadwp-advanced">
500
- <table class="gadwp-settings-options">
501
- <tr>
502
- <td colspan="2"><?php echo "<h2>" . __( "Advanced Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
503
- </tr>
504
- <tr>
505
- <td class="gadwp-settings-title"><label for="ga_speed_samplerate"><?php _e("Page Speed SR:", 'google-analytics-dashboard-for-wp'); ?></label></td>
506
- <td><input type="number" id="ga_speed_samplerate" name="options[ga_speed_samplerate]" value="<?php echo (int)($options['ga_speed_samplerate']); ?>" max="100" min="1"> %</td>
507
- </tr>
508
- <tr>
509
- <td colspan="2" class="gadwp-settings-title">
510
- <div class="button-primary gadwp-settings-switchoo">
511
- <input type="checkbox" name="options[ga_event_bouncerate]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_event_bouncerate" <?php checked( $options['ga_event_bouncerate'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="ga_event_bouncerate">
512
- <div class="gadwp-settings-switchoo-inner"></div>
513
- <div class="gadwp-settings-switchoo-switch"></div>
514
- </label>
515
- </div>
516
- <div class="switch-desc"><?php echo " ".__("exclude events from bounce-rate calculation", 'google-analytics-dashboard-for-wp' );?></div>
517
- </td>
518
- </tr>
519
- <tr>
520
- <td colspan="2" class="gadwp-settings-title">
521
- <div class="button-primary gadwp-settings-switchoo">
522
- <input type="checkbox" name="options[ga_enhanced_links]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_enhanced_links" <?php checked( $options['ga_enhanced_links'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="ga_enhanced_links">
523
- <div class="gadwp-settings-switchoo-inner"></div>
524
- <div class="gadwp-settings-switchoo-switch"></div>
525
- </label>
526
- </div>
527
- <div class="switch-desc"><?php echo " ".__("enable enhanced link attribution", 'google-analytics-dashboard-for-wp' );?></div>
528
- </td>
529
- </tr>
530
- <tr>
531
- <td colspan="2" class="gadwp-settings-title">
532
- <div class="button-primary gadwp-settings-switchoo">
533
- <input type="checkbox" name="options[ga_dash_adsense]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_dash_adsense" <?php checked( $options['ga_dash_adsense'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="ga_dash_adsense">
534
- <div class="gadwp-settings-switchoo-inner"></div>
535
- <div class="gadwp-settings-switchoo-switch"></div>
536
- </label>
537
- </div>
538
- <div class="switch-desc"><?php echo " ".__("enable AdSense account linking", 'google-analytics-dashboard-for-wp' );?></div>
539
- </td>
540
- </tr>
541
- <tr>
542
- <td colspan="2"><?php echo "<h2>" . __( "Cross-domain Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
543
- </tr>
544
- <tr>
545
- <td colspan="2" class="gadwp-settings-title">
546
- <div class="button-primary gadwp-settings-switchoo">
547
- <input type="checkbox" name="options[ga_crossdomain_tracking]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_crossdomain_tracking" <?php checked( $options['ga_crossdomain_tracking'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="ga_crossdomain_tracking">
548
- <div class="gadwp-settings-switchoo-inner"></div>
549
- <div class="gadwp-settings-switchoo-switch"></div>
550
- </label>
551
- </div>
552
- <div class="switch-desc"><?php echo " ".__("enable cross domain tracking", 'google-analytics-dashboard-for-wp' ); ?></div>
553
- </td>
554
- </tr>
555
- <tr>
556
- <td class="gadwp-settings-title"><label for="ga_crossdomain_list"><?php _e("Cross Domains:", 'google-analytics-dashboard-for-wp'); ?></label></td>
557
- <td><input type="text" id="ga_crossdomain_list" name="options[ga_crossdomain_list]" value="<?php echo esc_attr($options['ga_crossdomain_list']); ?>" size="50"></td>
558
- </tr>
559
- <tr>
560
- <td colspan="2"><?php echo "<h2>" . __( "Cookie Customization", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
561
- </tr>
562
- <tr>
563
- <td class="gadwp-settings-title"><label for="ga_cookiedomain"><?php _e("Cookie Domain:", 'google-analytics-dashboard-for-wp'); ?></label></td>
564
- <td><input type="text" id="ga_cookiedomain" name="options[ga_cookiedomain]" value="<?php echo esc_attr($options['ga_cookiedomain']); ?>" size="50"></td>
565
- </tr>
566
- <tr>
567
- <td class="gadwp-settings-title"><label for="ga_cookiename"><?php _e("Cookie Name:", 'google-analytics-dashboard-for-wp'); ?></label></td>
568
- <td><input type="text" id="ga_cookiename" name="options[ga_cookiename]" value="<?php echo esc_attr($options['ga_cookiename']); ?>" size="50"></td>
569
- </tr>
570
- <tr>
571
- <td class="gadwp-settings-title"><label for="ga_cookieexpires"><?php _e("Cookie Expires:", 'google-analytics-dashboard-for-wp'); ?></label></td>
572
- <td><input type="text" id="ga_cookieexpires" name="options[ga_cookieexpires]" value="<?php echo esc_attr($options['ga_cookieexpires']); ?>" size="10"> seconds</td>
573
- </tr>
574
- </table>
575
- </div>
576
- <div id="gadwp-exclude">
577
- <table class="gadwp-settings-options">
578
- <tr>
579
- <td colspan="2"><?php echo "<h2>" . __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
580
- </tr>
581
- <tr>
582
- <td class="roles gadwp-settings-title"><label for="ga_track_exclude"><?php _e("Exclude tracking for:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
583
- <td class="gadwp-settings-roles">
584
- <?php
585
- if ( ! isset( $wp_roles ) ) {
586
- $wp_roles = new WP_Roles();
587
- }
588
- $i = 0;
589
- ?> <table>
590
- <tr>
591
- <?php
592
- foreach ( $wp_roles->role_names as $role => $name ) {
593
- $i++;
594
- ?>
595
- <td><label> <input type="checkbox" name="options[ga_track_exclude][]" value="<?php echo $role; ?>" <?php if (in_array($role,$options['ga_track_exclude'])) echo 'checked="checked"'; ?> />
596
- <?php echo $name; ?>
597
- </label></td>
598
- <?php
599
- if ( $i % 4 == 0 ) {
600
- ?>
601
- </tr>
602
- <tr>
603
- <?php
604
- }
605
- }
606
- ?>
607
- </table>
608
- </td>
609
- </tr>
610
- </table>
611
- </div>
612
- <table class="gadwp-settings-options">
613
- <tr>
614
- <td colspan="2"><hr></td>
615
- </tr>
616
- <tr>
617
- <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" /></td>
618
- </tr>
619
- </table>
620
- <input type="hidden" name="options[ga_dash_hidden]" value="Y">
621
<?php wp_nonce_field('gadash_form','gadash_security'); ?>
622
</form>
623
<?php
@@ -651,64 +984,76 @@ final class GADWP_Settings {
651
}
652
?>
653
<div class="wrap">
654
- <?php echo "<h2>" . __( "Google Analytics Errors & Debugging", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?>
655
- </div>
656
<div id="poststuff" class="gadwp">
657
- <div id="post-body" class="metabox-holder columns-2">
658
- <div id="post-body-content">
659
- <div class="settings-wrapper">
660
- <div class="inside">
661
- <?php if (isset($message)) echo $message; ?>
662
- <?php
663
- $tabs = array( 'errors' => __( "Errors & Details", 'google-analytics-dashboard-for-wp' ), 'config' => __( "Plugin Settings", 'google-analytics-dashboard-for-wp' ) );
664
- self::navigation_tabs( $tabs );
665
- ?>
666
<div id="gadwp-errors">
667
- <table class="gadwp-settings-options">
668
- <tr>
669
- <td>
670
- <?php echo "<h2>" . __( "Last Error detected", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?>
671
- </td>
672
- </tr>
673
- <tr>
674
- <td>
675
- <?php
676
- $errors = print_r( GADWP_Tools::get_cache( 'last_error' ), true ) ? esc_html( print_r( GADWP_Tools::get_cache( 'last_error' ), true ) ) : __( "None", 'google-analytics-dashboard-for-wp' );
677
- echo '<pre class="gadwp-settings-logdata">Last Error: ';
678
- echo $errors;
679
- ?></pre>
680
- </td>
681
- </tr>
682
- <tr>
683
- <td colspan="2"><hr><?php echo "<h2>" . __( "Error Details", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
684
- </tr>
685
- <tr>
686
- <td>
687
- <?php
688
- echo '<pre class="gadwp-settings-logdata">Error Details: ';
689
- $error_details = print_r( GADWP_Tools::get_cache( 'gapi_errors' ), true ) ? "\n" . esc_html( print_r( GADWP_Tools::get_cache( 'last_error' ), true ) ) : __( "None", 'google-analytics-dashboard-for-wp' );
690
- echo $error_details;
691
- ?></pre><br />
692
- <hr>
693
- </td>
694
-
695
-
696
- <tr>
697
-
698
- </table>
699
- </div>
700
- <div id="gadwp-config">
701
- <table class="gadwp-settings-options">
702
- <tr>
703
- <td><?php echo "<h2>" . __( "Plugin Configuration", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
704
- </tr>
705
- <tr>
706
- <td><pre class="gadwp-settings-logdata"><?php echo esc_html(print_r($anonim, true));?></pre><br />
707
- <hr></td>
708
- </tr>
709
- </table>
710
- </div>
711
- <?php
712
self::output_sidebar();
713
}
714
@@ -727,14 +1072,14 @@ final class GADWP_Settings {
727
}
728
echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
729
if ( isset( $_POST['ga_dash_code'] ) ) {
730
- if ( ! stripos( 'x' . $_POST['ga_dash_code'], 'UA-', 1 ) == 1 ) {
731
try {
732
$gadwp->gapi_controller->client->authenticate( $_POST['ga_dash_code'] );
733
$gadwp->config->options['ga_dash_token'] = $gadwp->gapi_controller->client->getAccessToken();
734
$gadwp->config->options['automatic_updates_minorversion'] = 1;
735
$gadwp->config->set_plugin_options();
736
$options = self::update_options( 'general' );
737
- $message = "<div class='updated'><p>" . __( "Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
738
GADWP_Tools::delete_cache( 'gapi_errors' );
739
GADWP_Tools::delete_cache( 'last_error' );
740
if ( $gadwp->config->options['ga_dash_token'] && $gadwp->gapi_controller->client->getAccessToken() ) {
@@ -766,206 +1111,234 @@ final class GADWP_Settings {
766
$gadwp->gapi_controller->reset_token( false );
767
}
768
} else {
769
- $message = "<div class='error'><p>" . __( "The access code is <strong>NOT</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X). Try again, and use the red link to get your access code", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
770
}
771
}
772
if ( isset( $_POST['Clear'] ) ) {
773
if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
774
GADWP_Tools::clear_cache();
775
- $message = "<div class='updated'><p>" . __( "Cleared Cache.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
776
} else {
777
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
778
}
779
}
780
if ( isset( $_POST['Reset'] ) ) {
781
if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
782
$gadwp->gapi_controller->reset_token( true );
783
GADWP_Tools::clear_cache();
784
- $message = "<div class='updated'><p>" . __( "Token Reseted and Revoked.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
785
$options = self::update_options( 'Reset' );
786
} else {
787
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
788
}
789
}
790
if ( isset( $_POST['Reset_Err'] ) ) {
791
if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
792
GADWP_Tools::delete_cache( 'last_error' );
793
GADWP_Tools::delete_cache( 'gapi_errors' );
794
- $message = "<div class='updated'><p>" . __( "All errors reseted.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
795
} else {
796
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
797
}
798
}
799
if ( isset( $_POST['options']['ga_dash_hidden'] ) && ! isset( $_POST['Clear'] ) && ! isset( $_POST['Reset'] ) && ! isset( $_POST['Reset_Err'] ) ) {
800
- $message = "<div class='updated'><p>" . __( "Settings saved.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
801
if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
802
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
803
}
804
}
805
if ( isset( $_POST['Hide'] ) ) {
806
if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
807
- $message = "<div class='updated'><p>" . __( "All other domains/properties were removed.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
808
$lock_profile = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
809
$gadwp->config->options['ga_dash_profile_list'] = array( $lock_profile );
810
$options = self::update_options( 'general' );
811
} else {
812
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
813
}
814
}
815
?>
816
- <div class="wrap">
817
<?php echo "<h2>" . __( "Google Analytics Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?>
818
- <hr>
819
- </div>
820
- <div id="poststuff" class="gadwp">
821
- <div id="post-body" class="metabox-holder columns-2">
822
- <div id="post-body-content">
823
- <div class="settings-wrapper">
824
- <div class="inside">
825
- <?php
826
- if ( $gadwp->gapi_controller->gapi_errors_handler() || GADWP_Tools::get_cache( 'last_error' ) ) {
827
- $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'google-analytics-dashboard-for-wp' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'google-analytics-dashboard-for-wp' ) ) ) );
828
- }
829
- if ( isset( $_POST['Authorize'] ) ) {
830
- GADWP_Tools::clear_cache();
831
- $gadwp->gapi_controller->token_request();
832
- echo "<div class='updated'><p>" . __( "Use the red link (see below) to generate and get your access code!", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
833
- } else {
834
- if ( isset( $message ) ) {
835
- echo $message;
836
- }
837
- ?>
838
- <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
839
- <input type="hidden" name="options[ga_dash_hidden]" value="Y">
840
- <?php wp_nonce_field('gadash_form','gadash_security'); ?>
841
- <table class="gadwp-settings-options">
842
- <tr>
843
- <td colspan="2">
844
- <?php echo "<h2>" . __( "Plugin Authorization", 'google-analytics-dashboard-for-wp' ) . "</h2>";?>
845
- </td>
846
- </tr>
847
- <tr>
848
- <td colspan="2" class="gadwp-settings-info">
849
- <?php printf(__('You should watch the %1$s and read this %2$s before proceeding to authorization. This plugin requires a properly configured Google Analytics account!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video", 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("tutorial", 'google-analytics-dashboard-for-wp')));?>
850
- </td>
851
- </tr>
852
- <?php if (! $options['ga_dash_token'] || $options['ga_dash_userapi']) {?>
853
- <tr>
854
- <td colspan="2" class="gadwp-settings-info"><input name="options[ga_dash_userapi]" type="checkbox" id="ga_dash_userapi" value="1" <?php checked( $options['ga_dash_userapi'], 1 ); ?> onchange="this.form.submit()" <?php echo ($options['ga_dash_network'])?'disabled="disabled"':''; ?> /><?php echo " ".__("use your own API Project credentials", 'google-analytics-dashboard-for-wp' );?>
855
- </td>
856
- </tr>
857
- <?php } if ($options['ga_dash_userapi']) { ?>
858
- <tr>
859
- <td class="gadwp-settings-title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'google-analytics-dashboard-for-wp'); ?></label></td>
860
- <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?>" size="40" required="required"></td>
861
- </tr>
862
- <tr>
863
- <td class="gadwp-settings-title"><label for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'google-analytics-dashboard-for-wp'); ?></label></td>
864
- <td><input type="text" name="options[ga_dash_clientsecret]" value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>" size="40" required="required"> <input type="hidden" name="options[ga_dash_hidden]" value="Y">
865
- <?php wp_nonce_field('gadash_form','gadash_security'); ?>
866
- </td>
867
- </tr>
868
- <?php
869
- }
870
- if ( $options['ga_dash_token'] ) {
871
- ?>
872
- <tr>
873
- <td colspan="2"><input type="submit" name="Reset" class="button button-secondary" value="<?php _e( "Clear Authorization", 'google-analytics-dashboard-for-wp' ); ?>" <?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'google-analytics-dashboard-for-wp' ); ?>" /> <input type="submit" name="Reset_Err" class="button button-secondary" value="<?php _e( "Reset Errors", 'google-analytics-dashboard-for-wp' ); ?>" /></td>
874
- </tr>
875
- <tr>
876
- <td colspan="2"><hr></td>
877
- </tr>
878
- <tr>
879
- <td colspan="2"><?php echo "<h2>" . __( "General Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
880
- </tr>
881
- <tr>
882
- <td class="gadwp-settings-title"><label for="ga_dash_tableid_jail"><?php _e("Select View:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
883
- <td><select id="ga_dash_tableid_jail" <?php disabled(empty($options['ga_dash_profile_list']) || 1 == count($options['ga_dash_profile_list']), true); ?> name="options[ga_dash_tableid_jail]">
884
- <?php
885
- if ( ! empty( $options['ga_dash_profile_list'] ) ) {
886
- foreach ( $options['ga_dash_profile_list'] as $items ) {
887
- if ( $items[3] ) {
888
- echo '<option value="' . esc_attr( $items[1] ) . '" ' . selected( $items[1], $options['ga_dash_tableid_jail'], false );
889
- echo ' title="' . __( "View Name:", 'google-analytics-dashboard-for-wp' ) . ' ' . esc_attr( $items[0] ) . '">' . esc_html( GADWP_Tools::strip_protocol( $items[3] ) ) . ' &#8658; ' . esc_attr( $items[0] ) . '</option>';
890
- }
891
- }
892
- } else {
893
- echo '<option value="">' . __( "Property not found", 'google-analytics-dashboard-for-wp' ) . '</option>';
894
- }
895
- ?>
896
- </select>
897
- <?php
898
- if ( count( $options['ga_dash_profile_list'] ) > 1 ) {
899
- ?>&nbsp;<input type="submit" name="Hide" class="button button-secondary" value="<?php _e( "Lock Selection", 'google-analytics-dashboard-for-wp' ); ?>" /><?php
900
- }
901
- ?>
902
- </td>
903
- </tr>
904
- <?php
905
- if ( $options['ga_dash_tableid_jail'] ) {
906
- ?>
907
- <tr>
908
- <td class="gadwp-settings-title"></td>
909
- <td><?php
910
- $profile_info = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
911
- echo '<pre>' . __( "View Name:", 'google-analytics-dashboard-for-wp' ) . "\t" . esc_html( $profile_info[0] ) . "<br />" . __( "Tracking ID:", 'google-analytics-dashboard-for-wp' ) . "\t" . esc_html( $profile_info[2] ) . "<br />" . __( "Default URL:", 'google-analytics-dashboard-for-wp' ) . "\t" . esc_html( $profile_info[3] ) . "<br />" . __( "Time Zone:", 'google-analytics-dashboard-for-wp' ) . "\t" . esc_html( $profile_info[5] ) . '</pre>';
912
- ?></td>
913
- </tr>
914
- <?php
915
- }
916
- ?>
917
- <tr>
918
- <td class="gadwp-settings-title"><label for="ga_dash_style"><?php _e("Theme Color:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
919
- <td><input type="text" id="ga_dash_style" class="ga_dash_style" name="options[ga_dash_style]" value="<?php echo esc_attr($options['ga_dash_style']); ?>" size="10"></td>
920
- </tr>
921
- <tr>
922
- <td colspan="2"><hr></td>
923
- </tr>
924
- <?php if ( !is_multisite()) {?>
925
<tr>
926
- <td colspan="2"><?php echo "<h2>" . __( "Automatic Updates", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
927
- </tr>
928
- <tr>
929
- <td colspan="2" class="gadwp-settings-title">
930
- <div class="button-primary gadwp-settings-switchoo">
931
- <input type="checkbox" name="options[automatic_updates_minorversion]" value="1" class="gadwp-settings-switchoo-checkbox" id="automatic_updates_minorversion" <?php checked( $options['automatic_updates_minorversion'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="automatic_updates_minorversion">
932
- <div class="gadwp-settings-switchoo-inner"></div>
933
- <div class="gadwp-settings-switchoo-switch"></div>
934
- </label>
935
- </div>
936
- <div class="switch-desc"><?php echo " ".__( "automatic updates for minor versions (security and maintenance releases only)", 'google-analytics-dashboard-for-wp' );?></div>
937
- </td>
938
- </tr>
939
- <tr>
940
- <td colspan="2"><hr></td>
941
- </tr>
942
- <?php }?>
943
- <tr>
944
- <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" /></td>
945
- </tr>
946
- <?php } else {?>
947
- <tr>
948
- <td colspan="2"><hr></td>
949
- </tr>
950
- <tr>
951
- <td colspan="2"><input type="submit" name="Authorize" class="button button-secondary" id="authorize" value="<?php _e( "Authorize Plugin", 'google-analytics-dashboard-for-wp' ); ?>" <?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'google-analytics-dashboard-for-wp' ); ?>" /></td>
952
- </tr>
953
- <tr>
954
- <td colspan="2"><hr></td>
955
- </tr>
956
- </table>
957
- </form>
958
<?php
959
- self::output_sidebar();
960
- return;
961
- }
962
- ?>
963
- </table>
964
- </form>
965
- <?php
966
- }
967
self::output_sidebar();
968
}
969
// Network Settings
970
public static function general_settings_network() {
971
$gadwp = GADWP();
@@ -986,14 +1359,14 @@ final class GADWP_Settings {
986
987
echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
988
if ( isset( $_POST['ga_dash_code'] ) ) {
989
- if ( ! stripos( 'x' . $_POST['ga_dash_code'], 'UA-', 1 ) == 1 ) {
990
try {
991
$gadwp->gapi_controller->client->authenticate( $_POST['ga_dash_code'] );
992
$gadwp->config->options['ga_dash_token'] = $gadwp->gapi_controller->client->getAccessToken();
993
$gadwp->config->options['automatic_updates_minorversion'] = 1;
994
$gadwp->config->set_plugin_options( true );
995
$options = self::update_options( 'network' );
996
- $message = "<div class='updated'><p>" . __( "Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
997
if ( is_multisite() ) { // Cleanup errors on the entire network
998
foreach ( GADWP_Tools::get_sites( array( 'number' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
999
switch_to_blog( $blog['blog_id'] );
@@ -1032,13 +1405,13 @@ final class GADWP_Settings {
1032
$gadwp->gapi_controller->reset_token( false );
1033
}
1034
} else {
1035
- $message = "<div class='error'><p>" . __( "The access code is <strong>NOT</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X). Try again, and use the red link to get your access code", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
1036
}
1037
}
1038
if ( isset( $_POST['Refresh'] ) ) {
1039
if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1040
$gadwp->config->options['ga_dash_profile_list'] = array();
1041
- $message = "<div class='updated'><p>" . __( "Properties refreshed.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1042
$options = self::update_options( 'network' );
1043
if ( $gadwp->config->options['ga_dash_token'] && $gadwp->gapi_controller->client->getAccessToken() ) {
1044
if ( ! empty( $gadwp->config->options['ga_dash_profile_list'] ) ) {
@@ -1058,214 +1431,248 @@ final class GADWP_Settings {
1058
}
1059
}
1060
} else {
1061
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1062
}
1063
}
1064
if ( isset( $_POST['Clear'] ) ) {
1065
if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1066
GADWP_Tools::clear_cache();
1067
- $message = "<div class='updated'><p>" . __( "Cleared Cache.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1068
} else {
1069
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1070
}
1071
}
1072
if ( isset( $_POST['Reset'] ) ) {
1073
if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1074
$gadwp->gapi_controller->reset_token( true );
1075
GADWP_Tools::clear_cache();
1076
- $message = "<div class='updated'><p>" . __( "Token Reseted and Revoked.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1077
$options = self::update_options( 'Reset' );
1078
} else {
1079
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1080
}
1081
}
1082
if ( isset( $_POST['options']['ga_dash_hidden'] ) && ! isset( $_POST['Clear'] ) && ! isset( $_POST['Reset'] ) && ! isset( $_POST['Refresh'] ) ) {
1083
- $message = "<div class='updated'><p>" . __( "Settings saved.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1084
if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
1085
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1086
}
1087
}
1088
if ( isset( $_POST['Hide'] ) ) {
1089
if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1090
- $message = "<div class='updated'><p>" . __( "All other domains/properties were removed.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1091
$lock_profile = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
1092
$gadwp->config->options['ga_dash_profile_list'] = array( $lock_profile );
1093
$options = self::update_options( 'network' );
1094
} else {
1095
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1096
}
1097
}
1098
?>
1099
- <div class="wrap">
1100
- <?php echo "<h2>" . __( "Google Analytics Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?><hr>
1101
- </div>
1102
- <div id="poststuff" class="gadwp">
1103
- <div id="post-body" class="metabox-holder columns-2">
1104
- <div id="post-body-content">
1105
- <div class="settings-wrapper">
1106
- <div class="inside">
1107
- <?php
1108
- if ( $gadwp->gapi_controller->gapi_errors_handler() || GADWP_Tools::get_cache( 'last_error' ) ) {
1109
- $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'google-analytics-dashboard-for-wp' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'google-analytics-dashboard-for-wp' ) ) ) );
1110
- }
1111
- if ( isset( $_POST['Authorize'] ) ) {
1112
- GADWP_Tools::clear_cache();
1113
- $gadwp->gapi_controller->token_request();
1114
- echo "<div class='updated'><p>" . __( "Use the red link (see below) to generate and get your access code!", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1115
- } else {
1116
- if ( isset( $message ) ) {
1117
- echo $message;
1118
- }
1119
- ?>
1120
- <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
1121
- <input type="hidden" name="options[ga_dash_hidden]" value="Y">
1122
- <?php wp_nonce_field('gadash_form','gadash_security'); ?>
1123
- <table class="gadwp-settings-options">
1124
- <tr>
1125
- <td colspan="2"><?php echo "<h2>" . __( "Network Setup", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1126
- </tr>
1127
- <tr>
1128
- <td colspan="2" class="gadwp-settings-title">
1129
- <div class="button-primary gadwp-settings-switchoo">
1130
- <input type="checkbox" name="options[ga_dash_network]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_dash_network" <?php checked( $options['ga_dash_network'], 1); ?> onchange="this.form.submit()"> <label class="gadwp-settings-switchoo-label" for="ga_dash_network">
1131
- <div class="gadwp-settings-switchoo-inner"></div>
1132
- <div class="gadwp-settings-switchoo-switch"></div>
1133
- </label>
1134
- </div>
1135
- <div class="switch-desc"><?php echo " ".__("use a single Google Analytics account for the entire network", 'google-analytics-dashboard-for-wp' );?></div>
1136
- </td>
1137
- </tr>
1138
- <?php if ($options['ga_dash_network']){ //Network Mode check?>
1139
<tr>
1140
- <td colspan="2"><hr></td>
1141
- </tr>
1142
- <tr>
1143
- <td colspan="2"><?php echo "<h2>" . __( "Plugin Authorization", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1144
- </tr>
1145
- <tr>
1146
- <td colspan="2" class="gadwp-settings-info">
1147
- <?php printf(__('You should watch the %1$s and read this %2$s before proceeding to authorization. This plugin requires a properly configured Google Analytics account!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video", 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("tutorial", 'google-analytics-dashboard-for-wp')));?>
1148
- </td>
1149
- </tr>
1150
- <?php
1151
- if ( ! $options['ga_dash_token'] || $options['ga_dash_userapi'] ) {
1152
- ?>
1153
- <tr>
1154
- <td colspan="2" class="gadwp-settings-info"><input name="options[ga_dash_userapi]" type="checkbox" id="ga_dash_userapi" value="1" <?php checked( $options['ga_dash_userapi'], 1 ); ?> onchange="this.form.submit()" /><?php echo " ".__("use your own API Project credentials", 'google-analytics-dashboard-for-wp' );?>
1155
- </td>
1156
- </tr>
1157
- <?php
1158
- }
1159
- if ( $options['ga_dash_userapi'] ) {
1160
- ?>
1161
- <tr>
1162
- <td class="gadwp-settings-title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'google-analytics-dashboard-for-wp'); ?></label></td>
1163
- <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?>" size="40" required="required"></td>
1164
- </tr>
1165
- <tr>
1166
- <td class="gadwp-settings-title"><label for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'google-analytics-dashboard-for-wp'); ?></label></td>
1167
- <td><input type="text" name="options[ga_dash_clientsecret]" value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>" size="40" required="required"> <input type="hidden" name="options[ga_dash_hidden]" value="Y">
1168
- <?php wp_nonce_field('gadash_form','gadash_security'); ?>
1169
- </td>
1170
- </tr>
1171
- <?php
1172
- }
1173
- if ( $options['ga_dash_token'] ) {
1174
- ?>
1175
- <tr>
1176
- <td colspan="2"><input type="submit" name="Reset" class="button button-secondary" value="<?php _e( "Clear Authorization", 'google-analytics-dashboard-for-wp' ); ?>" /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'google-analytics-dashboard-for-wp' ); ?>" /> <input type="submit" name="Refresh" class="button button-secondary" value="<?php _e( "Refresh Properties", 'google-analytics-dashboard-for-wp' ); ?>" /></td>
1177
- </tr>
1178
- <tr>
1179
- <td colspan="2"><hr></td>
1180
- </tr>
1181
- <tr>
1182
- <td colspan="2"><?php echo "<h2>" . __( "Properties/Views Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1183
- </tr>
1184
- <?php
1185
- if ( isset( $options['ga_dash_tableid_network'] ) ) {
1186
- $options['ga_dash_tableid_network'] = json_decode( json_encode( $options['ga_dash_tableid_network'] ), false );
1187
- }
1188
- foreach ( GADWP_Tools::get_sites( array( 'number' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
1189
- ?>
1190
- <tr>
1191
- <td class="gadwp-settings-title-s"><label for="ga_dash_tableid_network"><?php echo '<strong>'.$blog['domain'].$blog['path'].'</strong>: ';?></label></td>
1192
- <td><select id="ga_dash_tableid_network" <?php disabled(!empty($options['ga_dash_profile_list']),false);?> name="options[ga_dash_tableid_network][<?php echo $blog['blog_id'];?>]">
1193
- <?php
1194
- if ( ! empty( $options['ga_dash_profile_list'] ) ) {
1195
- foreach ( $options['ga_dash_profile_list'] as $items ) {
1196
- if ( $items[3] ) {
1197
- $temp_id = $blog['blog_id'];
1198
- echo '<option value="' . esc_attr( $items[1] ) . '" ' . selected( $items[1], isset( $options['ga_dash_tableid_network']->$temp_id ) ? $options['ga_dash_tableid_network']->$temp_id : '', false );
1199
- echo ' title="' . __( "View Name:", 'google-analytics-dashboard-for-wp' ) . ' ' . esc_attr( $items[0] ) . '">' . esc_html( GADWP_Tools::strip_protocol( $items[3] ) ) . ' &#8658; ' . esc_attr( $items[0] ) . '</option>';
1200
- }
1201
- }
1202
- } else {
1203
- echo '<option value="">' . __( "Property not found", 'google-analytics-dashboard-for-wp' ) . '</option>';
1204
- }
1205
- ?>
1206
- </select> <br /></td>
1207
- </tr>
1208
- <?php
1209
- }
1210
- ?>
1211
- <tr>
1212
- <td colspan="2"><?php echo "<h2>" . __( "Automatic Updates", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1213
- </tr>
1214
- <tr>
1215
- <td colspan="2" class="gadwp-settings-title">
1216
- <div class="button-primary gadwp-settings-switchoo">
1217
- <input type="checkbox" name="options[automatic_updates_minorversion]" value="1" class="gadwp-settings-switchoo-checkbox" id="automatic_updates_minorversion" <?php checked( $options['automatic_updates_minorversion'], 1 ); ?>> <label class="gadwp-settings-switchoo-label" for="automatic_updates_minorversion">
1218
- <div class="gadwp-settings-switchoo-inner"></div>
1219
- <div class="gadwp-settings-switchoo-switch"></div>
1220
- </label>
1221
- </div>
1222
- <div class="switch-desc"><?php echo " ".__( "automatic updates for minor versions (security and maintenance releases only)", 'google-analytics-dashboard-for-wp' );?></div>
1223
- </td>
1224
- </tr>
1225
- <tr>
1226
- <td colspan="2"><hr><?php echo "<h2>" . __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1227
- </tr>
1228
- <tr>
1229
- <td colspan="2" class="gadwp-settings-title">
1230
- <div class="button-primary gadwp-settings-switchoo">
1231
- <input type="checkbox" name="options[ga_dash_excludesa]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_dash_excludesa"<?php checked( $options['ga_dash_excludesa'], 1); ?>"> <label class="gadwp-settings-switchoo-label" for="ga_dash_excludesa">
1232
- <div class="gadwp-settings-switchoo-inner"></div>
1233
- <div class="gadwp-settings-switchoo-switch"></div>
1234
- </label>
1235
- </div>
1236
- <div class="switch-desc"><?php echo " ".__("exclude Super Admin tracking for the entire network", 'google-analytics-dashboard-for-wp' );?></div>
1237
- </td>
1238
- </tr>
1239
- <tr>
1240
- <td colspan="2"><hr></td>
1241
- </tr>
1242
- <tr>
1243
- <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" /></td>
1244
- </tr>
1245
- <?php
1246
- } else {
1247
- ?>
1248
- <tr>
1249
- <td colspan="2"><hr></td>
1250
- </tr>
1251
- <tr>
1252
- <td colspan="2"><input type="submit" name="Authorize" class="button button-secondary" id="authorize" value="<?php _e( "Authorize Plugin", 'google-analytics-dashboard-for-wp' ); ?>" /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'google-analytics-dashboard-for-wp' ); ?>" /></td>
1253
- </tr>
1254
- <?php } //Network Mode check?>
1255
- <tr>
1256
- <td colspan="2"><hr></td>
1257
- </tr>
1258
- </table>
1259
- </form>
1260
- <?php
1261
- self::output_sidebar();
1262
- return;
1263
- }
1264
- ?>
1265
</table>
1266
- </form>
1267
- <?php
1268
- }
1269
self::output_sidebar();
1270
}
1271
@@ -1274,85 +1681,85 @@ final class GADWP_Settings {
1274
1275
$gadwp = GADWP();
1276
?>
1277
- </div>
1278
- </div>
1279
- </div>
1280
- <div id="postbox-container-1" class="postbox-container">
1281
- <div class="meta-box-sortables">
1282
- <div class="postbox">
1283
- <h3>
1284
- <span><?php _e("Setup Tutorial & Demo",'google-analytics-dashboard-for-wp') ?></span>
1285
- </h3>
1286
- <div class="inside">
1287
- <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=video&utm_campaign=gadwp" target="_blank"><img src="<?php echo plugins_url( 'images/google-analytics-dashboard.png' , __FILE__ );?>" width="100%" alt="" /></a>
1288
- </div>
1289
- </div>
1290
- <div class="postbox">
1291
- <h3>
1292
- <span><?php _e("Follow & Review",'google-analytics-dashboard-for-wp')?></span>
1293
- </h3>
1294
- <div class="inside">
1295
- <div class="gadash-desc">
1296
- <div style="margin-left: -10px;">
1297
- <div class="g-page" data-width="273" data-href="//plus.google.com/+Deconfcom" data-layout="landscape" data-showtagline="false" data-showcoverphoto="false" data-rel="publisher"></div>
1298
- </div>
1299
- <script type="text/javascript">
1300
(function() {
1301
- var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1302
- po.src = 'https://apis.google.com/js/platform.js';
1303
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1304
})();
1305
</script>
1306
- </div>
1307
- <br />
1308
- <div class="gadash-desc">
1309
- <a href="https://twitter.com/deconfcom" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @deconfcom</a>
1310
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
1311
- </div>
1312
- <br />
1313
- <div class="gadash-title">
1314
- <a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info"><img src="<?php echo plugins_url( 'images/star.png' , __FILE__ ); ?>" /></a>
1315
- </div>
1316
- <div class="gadash-desc">
1317
- <?php printf(__('Your feedback and review are both important, %s!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info">%s</a>', __('rate this plugin', 'google-analytics-dashboard-for-wp')));?>
1318
- </div>
1319
- </div>
1320
- </div>
1321
- <div class="postbox">
1322
- <h3>
1323
- <span><?php _e("Further Reading",'google-analytics-dashboard-for-wp')?></span>
1324
- </h3>
1325
- <div class="inside">
1326
- <div class="gadash-title">
1327
- <a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp"><img src="<?php echo plugins_url( 'images/clicky.png' , __FILE__ ); ?>" /></a>
1328
- </div>
1329
- <div class="gadash-desc">
1330
- <?php printf(__('%s service with users tracking at IP level.', 'google-analytics-dashboard-for-wp'), sprintf('<a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp">%s</a>', __('Web Analytics', 'google-analytics-dashboard-for-wp')));?>
1331
- </div>
1332
- <br />
1333
- <div class="gadash-title">
1334
- <a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp"><img src="<?php echo plugins_url( 'images/ssl.png' , __FILE__ ); ?>" /></a>
1335
- </div>
1336
- <div class="gadash-desc">
1337
- <?php printf(__('%s by moving your website to HTTPS/SSL.', 'google-analytics-dashboard-for-wp'), sprintf('<a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp">%s</a>', __('Improve search rankings', 'google-analytics-dashboard-for-wp')));?>
1338
- </div>
1339
- <br />
1340
- <div class="gadash-title">
1341
- <a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp"><img src="<?php echo plugins_url( 'images/wp.png' , __FILE__ ); ?>" /></a>
1342
- </div>
1343
- <div class="gadash-desc">
1344
- <?php printf(__('Other %s written by the same author', 'google-analytics-dashboard-for-wp'), sprintf('<a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp">%s</a>', __('WordPress Plugins', 'google-analytics-dashboard-for-wp')));?>
1345
- </div>
1346
- </div>
1347
- </div>
1348
- </div>
1349
- </div>
1350
- </div>
1351
- </div>
1352
<?php
1353
- //Dismiss the admin update notice
1354
- if ( version_compare( $wp_version, '4.2', '<' ) && current_user_can('manage_options') ) {
1355
- delete_option('gadwp_got_updated');
1356
}
1357
}
1358
}
8
*/
9
10
// Exit if accessed directly
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
exit();
13
+ }
14
15
final class GADWP_Settings {
16
18
$gadwp = GADWP();
19
$network_settings = false;
20
$options = $gadwp->config->options; // Get current options
21
+ if ( isset( $_POST['options']['ga_dash_hidden'] ) && isset( $_POST['options'] ) && ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) && 'Reset' != $who ) {
22
$new_options = $_POST['options'];
23
+ if ( 'tracking' == $who ) {
24
$options['ga_dash_anonim'] = 0;
25
$options['ga_event_tracking'] = 0;
26
$options['ga_enhanced_links'] = 0;
27
$options['ga_dash_remarketing'] = 0;
28
$options['ga_event_bouncerate'] = 0;
29
$options['ga_crossdomain_tracking'] = 0;
30
$options['ga_aff_tracking'] = 0;
31
$options['ga_hash_tracking'] = 0;
32
+ $options['ga_formsubmit_tracking'] = 0;
33
+ $options['ga_pagescrolldepth_tracking'] = 0;
34
+ $options['tm_pagescrolldepth_tracking'] = 0;
35
+ $options['amp_tracking_analytics'] = 0;
36
+ $options['amp_tracking_tagmanager'] = 0;
37
+ $options['optimize_pagehiding'] = 0; </