Google Analytics Dashboard for WP (GADWP) - Version 4.9.5

Version Description

  • Bug Fixes:
    • correction of some files with mixed endings, props by Edward Dekker
    • only load the necessary resources for frontend widget
    • corrected a JavaScript error on frontend sidebar widget
  • Enhancements:
    • introducing the gadwp_curl_options filter to allow changes on CURL options for the Google_IO_Curl class, props by Alexandre Simard
Download this release

Release Info

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

Code changes from version 4.9.4 to 4.9.5

Files changed (67) hide show
  1. admin/ajax-actions.php +133 -133
  2. admin/css/admin-widgets.css +191 -191
  3. admin/css/gadwp.css +205 -205
  4. admin/css/item-reports.css +123 -123
  5. admin/item-reports.php +56 -56
  6. admin/js/settings.js +39 -39
  7. admin/js/ui.js +25 -25
  8. admin/js/wp-color-picker-script.js +10 -10
  9. admin/settings.php +1358 -1358
  10. admin/setup.php +357 -357
  11. admin/widgets.php +65 -65
  12. common/ajax-actions.php +43 -43
  13. common/js/reports.js +1107 -1107
  14. config.php +422 -422
  15. front/ajax-actions.php +152 -152
  16. front/css/item-reports.css +184 -184
  17. front/css/widgets.css +74 -74
  18. front/item-reports.php +38 -38
  19. front/js/widgets.js +12 -12
  20. front/setup.php +123 -123
  21. front/tracking.php +64 -64
  22. front/tracking/code-classic.php +33 -33
  23. front/tracking/code-universal.php +138 -138
  24. front/tracking/events-classic.php +55 -55
  25. front/tracking/events-universal.php +67 -67
  26. front/widgets.php +194 -194
  27. gadwp.php +258 -258
  28. install/install.php +149 -149
  29. install/uninstall.php +34 -34
  30. readme.txt +9 -1
  31. tools/autoload.php +37 -37
  32. tools/gapi.php +867 -862
  33. tools/iso3166.php +254 -254
  34. tools/src/Google/Auth/Abstract.php +39 -39
  35. tools/src/Google/Auth/AppIdentity.php +100 -100
  36. tools/src/Google/Auth/AssertionCredentials.php +142 -142
  37. tools/src/Google/Auth/Exception.php +20 -20
  38. tools/src/Google/Auth/LoginTicket.php +75 -75
  39. tools/src/Google/Auth/OAuth2.php +546 -546
  40. tools/src/Google/Auth/Simple.php +64 -64
  41. tools/src/Google/Cache/Abstract.php +57 -57
  42. tools/src/Google/Cache/Apc.php +107 -107
  43. tools/src/Google/Cache/Exception.php +20 -20
  44. tools/src/Google/Cache/File.php +185 -185
  45. tools/src/Google/Cache/Memcache.php +177 -177
  46. tools/src/Google/Cache/Null.php +53 -53
  47. tools/src/Google/Client.php +760 -760
  48. tools/src/Google/Collection.php +92 -92
  49. tools/src/Google/Config.php +446 -446
  50. tools/src/Google/Exception.php +19 -19
  51. tools/src/Google/Http/Batch.php +137 -137
  52. tools/src/Google/Http/CacheParser.php +181 -181
  53. tools/src/Google/Http/MediaFileUpload.php +314 -314
  54. tools/src/Google/Http/REST.php +142 -142
  55. tools/src/Google/Http/Request.php +497 -497
  56. tools/src/Google/IO/Abstract.php +339 -339
  57. tools/src/Google/IO/Curl.php +152 -152
  58. tools/src/Google/IO/Exception.php +20 -20
  59. tools/src/Google/IO/Stream.php +201 -201
  60. tools/src/Google/Logger/Abstract.php +409 -409
  61. tools/src/Google/Logger/Exception.php +20 -20
  62. tools/src/Google/Logger/File.php +148 -148
  63. tools/src/Google/Logger/Null.php +39 -39
  64. tools/src/Google/Logger/Psr.php +92 -92
  65. tools/src/Google/Model.php +282 -282
  66. tools/src/Google/Service.php +44 -44
  67. tools/src/Google/Service/Analytics.php +0 -1653
admin/ajax-actions.php CHANGED
@@ -1,133 +1,133 @@
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
- */
9
-
10
- // Exit if accessed directly
11
- if ( ! defined( 'ABSPATH' ) )
12
- exit();
13
-
14
- if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
15
-
16
- final class GADWP_Backend_Ajax {
17
-
18
- private $gadwp;
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'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) {
24
- // Items action
25
- add_action( 'wp_ajax_gadwp_backend_item_reports', array( $this, 'ajax_item_reports' ) );
26
- }
27
- if ( current_user_can( 'manage_options' ) ) {
28
- // Admin Widget action
29
- add_action( 'wp_ajax_gadwp_dismiss_notices', array( $this, 'ajax_dismiss_notices' ) );
30
- }
31
- }
32
-
33
- /**
34
- * Ajax handler for Item Reports
35
- *
36
- * @return json|int
37
- */
38
- public function ajax_item_reports() {
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;
46
- }
47
- $from = $_POST['from'];
48
- $to = $_POST['to'];
49
- $query = $_POST['query'];
50
- if ( isset( $_POST['filter'] ) ) {
51
- $filter_id = $_POST['filter'];
52
- } else {
53
- $filter_id = false;
54
- }
55
- if ( ob_get_length() ) {
56
- ob_clean();
57
- }
58
-
59
- if ( ! ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( ( 1 == $this->gadwp->config->options['backend_item_reports'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) ) {
60
- wp_die( - 31 );
61
- }
62
- if ( $this->gadwp->config->options['ga_dash_token'] && $this->gadwp->config->options['ga_dash_tableid_jail'] && $from && $to ) {
63
- if ( null === $this->gadwp->gapi_controller ) {
64
- $this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
65
- }
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 );
73
- if ( isset( $profile_info[4] ) ) {
74
- $this->gadwp->gapi_controller->timeshift = $profile_info[4];
75
- } else {
76
- $this->gadwp->gapi_controller->timeshift = (int) current_time( 'timestamp' ) - time();
77
- }
78
-
79
- if ( $filter_id ) {
80
- $uri_parts = explode( '/', get_permalink( $filter_id ), 4 );
81
-
82
- if ( isset( $uri_parts[3] ) ) {
83
- $uri = '/' . $uri_parts[3];
84
- } else {
85
- wp_die( - 25 );
86
- }
87
-
88
- // allow URL correction before sending an API request
89
- $filter = apply_filters( 'gadwp_backenditem_uri', $uri, $filter_id );
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
-
97
- // Encode URL
98
- $filter = rawurlencode( rawurldecode( $filter ) );
99
- } else {
100
- $filter = false;
101
- }
102
-
103
- $queries = explode( ',', $query );
104
-
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 );
112
- }
113
-
114
- /**
115
- * Ajax handler for dismissing Admin notices
116
- *
117
- * @return json|int
118
- */
119
- public function ajax_dismiss_notices() {
120
- if ( ! isset( $_POST['gadwp_security_dismiss_notices'] ) || ! wp_verify_nonce( $_POST['gadwp_security_dismiss_notices'], 'gadwp_dismiss_notices' ) ) {
121
- wp_die( - 30 );
122
- }
123
-
124
- if ( ! current_user_can( 'manage_options' ) ) {
125
- wp_die( - 31 );
126
- }
127
-
128
- delete_option( 'gadwp_got_updated' );
129
-
130
- wp_die();
131
- }
132
- }
133
- }
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
+ */
9
+
10
+ // Exit if accessed directly
11
+ if ( ! defined( 'ABSPATH' ) )
12
+ exit();
13
+
14
+ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
15
+
16
+ final class GADWP_Backend_Ajax {
17
+
18
+ private $gadwp;
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'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) {
24
+ // Items action
25
+ add_action( 'wp_ajax_gadwp_backend_item_reports', array( $this, 'ajax_item_reports' ) );
26
+ }
27
+ if ( current_user_can( 'manage_options' ) ) {
28
+ // Admin Widget action
29
+ add_action( 'wp_ajax_gadwp_dismiss_notices', array( $this, 'ajax_dismiss_notices' ) );
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Ajax handler for Item Reports
35
+ *
36
+ * @return json|int
37
+ */
38
+ public function ajax_item_reports() {
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;
46
+ }
47
+ $from = $_POST['from'];
48
+ $to = $_POST['to'];
49
+ $query = $_POST['query'];
50
+ if ( isset( $_POST['filter'] ) ) {
51
+ $filter_id = $_POST['filter'];
52
+ } else {
53
+ $filter_id = false;
54
+ }
55
+ if ( ob_get_length() ) {
56
+ ob_clean();
57
+ }
58
+
59
+ if ( ! ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( ( 1 == $this->gadwp->config->options['backend_item_reports'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) ) {
60
+ wp_die( - 31 );
61
+ }
62
+ if ( $this->gadwp->config->options['ga_dash_token'] && $this->gadwp->config->options['ga_dash_tableid_jail'] && $from && $to ) {
63
+ if ( null === $this->gadwp->gapi_controller ) {
64
+ $this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
65
+ }
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 );
73
+ if ( isset( $profile_info[4] ) ) {
74
+ $this->gadwp->gapi_controller->timeshift = $profile_info[4];
75
+ } else {
76
+ $this->gadwp->gapi_controller->timeshift = (int) current_time( 'timestamp' ) - time();
77
+ }
78
+
79
+ if ( $filter_id ) {
80
+ $uri_parts = explode( '/', get_permalink( $filter_id ), 4 );
81
+
82
+ if ( isset( $uri_parts[3] ) ) {
83
+ $uri = '/' . $uri_parts[3];
84
+ } else {
85
+ wp_die( - 25 );
86
+ }
87
+
88
+ // allow URL correction before sending an API request
89
+ $filter = apply_filters( 'gadwp_backenditem_uri', $uri, $filter_id );
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
+
97
+ // Encode URL
98
+ $filter = rawurlencode( rawurldecode( $filter ) );
99
+ } else {
100
+ $filter = false;
101
+ }
102
+
103
+ $queries = explode( ',', $query );
104
+
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 );
112
+ }
113
+
114
+ /**
115
+ * Ajax handler for dismissing Admin notices
116
+ *
117
+ * @return json|int
118
+ */
119
+ public function ajax_dismiss_notices() {
120
+ if ( ! isset( $_POST['gadwp_security_dismiss_notices'] ) || ! wp_verify_nonce( $_POST['gadwp_security_dismiss_notices'], 'gadwp_dismiss_notices' ) ) {
121
+ wp_die( - 30 );
122
+ }
123
+
124
+ if ( ! current_user_can( 'manage_options' ) ) {
125
+ wp_die( - 31 );
126
+ }
127
+
128
+ delete_option( 'gadwp_got_updated' );
129
+
130
+ wp_die();
131
+ }
132
+ }
133
+ }
admin/css/admin-widgets.css CHANGED
@@ -1,192 +1,192 @@
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
+ /**
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
  }
admin/css/gadwp.css CHANGED
@@ -1,206 +1,206 @@
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
+ /**
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
  }
admin/css/item-reports.css CHANGED
@@ -1,124 +1,124 @@
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-family: 'Open Sans', sans-serif;
63
- font-size: 1em;
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
- }
76
-
77
- .gadwp-floatwraper {
78
- display: table;
79
- width: 100%;
80
- height: 100%;
81
- }
82
-
83
- [id^=gadwp-piechart-].halfsize {
84
- width: 47%;
85
- margin: 10px 0 0 0;
86
- height: 200px;
87
- float: left;
88
- }
89
-
90
- [id^=gadwp-piechart-].floatleft {
91
- float: left;
92
- }
93
-
94
- [id^=gadwp-piechart-].floatright {
95
- float: right;
96
- }
97
-
98
- [id^=gadwp-tablechart-], [id^=gadwp-tablechart-] {
99
- margin: 10px 0 0 0;
100
- }
101
-
102
- .gadwp .ui-dialog-titlebar {
103
- font-size: 1.1em;
104
- text-overflow: ellipsis;
105
- overflow: hidden;
106
- }
107
-
108
- @media screen and (max-width: 500px) {
109
- [id^=gadwp-container-] {
110
- width: 410px;
111
- }
112
- [id^=gadwp-bottomstats-] .inside .small-box {
113
- width: 30.8%;
114
- }
115
- }
116
-
117
- @media screen and (max-width: 410px) {
118
- [id^=gadwp-container-] {
119
- width: 260px;
120
- }
121
- [id^=gadwp-bottomstats-] .inside .small-box {
122
- width: 46%;
123
- }
124
  }
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-family: 'Open Sans', sans-serif;
63
+ font-size: 1em;
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
+ }
76
+
77
+ .gadwp-floatwraper {
78
+ display: table;
79
+ width: 100%;
80
+ height: 100%;
81
+ }
82
+
83
+ [id^=gadwp-piechart-].halfsize {
84
+ width: 47%;
85
+ margin: 10px 0 0 0;
86
+ height: 200px;
87
+ float: left;
88
+ }
89
+
90
+ [id^=gadwp-piechart-].floatleft {
91
+ float: left;
92
+ }
93
+
94
+ [id^=gadwp-piechart-].floatright {
95
+ float: right;
96
+ }
97
+
98
+ [id^=gadwp-tablechart-], [id^=gadwp-tablechart-] {
99
+ margin: 10px 0 0 0;
100
+ }
101
+
102
+ .gadwp .ui-dialog-titlebar {
103
+ font-size: 1.1em;
104
+ text-overflow: ellipsis;
105
+ overflow: hidden;
106
+ }
107
+
108
+ @media screen and (max-width: 500px) {
109
+ [id^=gadwp-container-] {
110
+ width: 410px;
111
+ }
112
+ [id^=gadwp-bottomstats-] .inside .small-box {
113
+ width: 30.8%;
114
+ }
115
+ }
116
+
117
+ @media screen and (max-width: 410px) {
118
+ [id^=gadwp-container-] {
119
+ width: 260px;
120
+ }
121
+ [id^=gadwp-bottomstats-] .inside .small-box {
122
+ width: 46%;
123
+ }
124
  }
admin/item-reports.php CHANGED
@@ -1,56 +1,56 @@
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
- */
9
-
10
- // Exit if accessed directly
11
- if ( ! defined( 'ABSPATH' ) )
12
- exit();
13
-
14
- if ( ! class_exists( 'GADWP_Backend_Item_Reports' ) ) {
15
-
16
- final class GADWP_Backend_Item_Reports {
17
-
18
- private $gadwp;
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
- }
36
- }
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 {
48
- echo '<a id="gadwp-' . $id . '" title="' . get_the_title( $id ) . '" href="#' . $id . '"><img class="gadwp-icon-oldwp" src="' . GADWP_URL . 'admin/images/gadash-icon.png"</a>';
49
- }
50
- }
51
-
52
- public function add_columns( $columns ) {
53
- return array_merge( $columns, array( 'gadwp_stats' => __( 'Analytics', 'google-analytics-dashboard-for-wp' ) ) );
54
- }
55
- }
56
- }
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
+ */
9
+
10
+ // Exit if accessed directly
11
+ if ( ! defined( 'ABSPATH' ) )
12
+ exit();
13
+
14
+ if ( ! class_exists( 'GADWP_Backend_Item_Reports' ) ) {
15
+
16
+ final class GADWP_Backend_Item_Reports {
17
+
18
+ private $gadwp;
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
+ }
36
+ }
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 {
48
+ echo '<a id="gadwp-' . $id . '" title="' . get_the_title( $id ) . '" href="#' . $id . '"><img class="gadwp-icon-oldwp" src="' . GADWP_URL . 'admin/images/gadash-icon.png"</a>';
49
+ }
50
+ }
51
+
52
+ public function add_columns( $columns ) {
53
+ return array_merge( $columns, array( 'gadwp_stats' => __( 'Analytics', 'google-analytics-dashboard-for-wp' ) ) );
54
+ }
55
+ }
56
+ }
admin/js/settings.js CHANGED
@@ -1,40 +1,40 @@
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
+ /*-
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
  } );
admin/js/ui.js CHANGED
@@ -1,26 +1,26 @@
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
+ /*-
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
  } );
admin/js/wp-color-picker-script.js CHANGED
@@ -1,11 +1,11 @@
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
+ /*-
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
  } );
admin/settings.php CHANGED
@@ -1,1358 +1,1358 @@
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
- */
9
-
10
- // Exit if accessed directly
11
- if ( ! defined( 'ABSPATH' ) )
12
- exit();
13
-
14
- final class GADWP_Settings {
15
-
16
- private static function update_options( $who ) {
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;
59
- $options['automatic_updates_minorversion'] = 0;
60
- $network_settings = true;
61
- }
62
- $options = array_merge( $options, $new_options );
63
- $gadwp->config->options = $options;
64
- $gadwp->config->set_plugin_options( $network_settings );
65
- }
66
- return $options;
67
- }
68
-
69
- private static function navigation_tabs( $tabs ) {
70
- echo '<h2 class="nav-tab-wrapper">';
71
- foreach ( $tabs as $tab => $name ) {
72
- echo "<a class='nav-tab' id='tab-$tab' href='#top#gadwp-$tab'>$name</a>";
73
- }
74
- echo '</h2>';
75
- }
76
-
77
- public static function frontend_settings() {
78
- $gadwp = GADWP();
79
- if ( ! current_user_can( 'manage_options' ) ) {
80
- return;
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'] ) {
90
- $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' ) ) ) );
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
160
- self::output_sidebar();
161
- }
162
-
163
- public static function backend_settings() {
164
- $gadwp = GADWP();
165
- if ( ! current_user_can( 'manage_options' ) ) {
166
- return;
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'] ) {
176
- $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' ) ) ) );
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();
304
- }
305
-
306
- public static function tracking_settings() {
307
- $gadwp = GADWP();
308
-
309
- if ( ! current_user_can( 'manage_options' ) ) {
310
- return;
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
624
- self::output_sidebar();
625
- }
626
-
627
- public static function errors_debugging() {
628
- global $wp_version;
629
-
630
- $gadwp = GADWP();
631
-
632
- if ( ! current_user_can( 'manage_options' ) ) {
633
- return;
634
- }
635
-
636
- $anonim = $gadwp->config->options;
637
- $anonim['wp_version'] = $wp_version;
638
- $anonim['gadwp_version'] = GADWP_CURRENT_VERSION;
639
- if ( $anonim['ga_dash_token'] ) {
640
- $anonim['ga_dash_token'] = 'HIDDEN';
641
- }
642
- if ( $anonim['ga_dash_clientid'] ) {
643
- $anonim['ga_dash_clientid'] = 'HIDDEN';
644
- }
645
- if ( $anonim['ga_dash_clientsecret'] ) {
646
- $anonim['ga_dash_clientsecret'] = 'HIDDEN';
647
- }
648
- $options = self::update_options( 'frontend' );
649
- if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
650
- $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' ) ) ) );
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
-
715
- public static function general_settings() {
716
- $gadwp = GADWP();
717
-
718
- global $wp_version;
719
-
720
- if ( ! current_user_can( 'manage_options' ) ) {
721
- return;
722
- }
723
- $options = self::update_options( 'general' );
724
- printf( '<div id="gapi-warning" class="updated"><p>%1$s <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=general_screen&utm_campaign=gadwp">%2$s</a></p></div>', __( 'Loading the required libraries. If this results in a blank screen or a fatal error, try this solution:', 'google-analytics-dashboard-for-wp' ), __( 'Library conflicts between WordPress plugins', 'google-analytics-dashboard-for-wp' ) );
725
- if ( null === $gadwp->gapi_controller ) {
726
- $gadwp->gapi_controller = new GADWP_GAPI_Controller();
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() ) {
741
- if ( ! empty( $gadwp->config->options['ga_dash_profile_list'] ) ) {
742
- $profiles = $gadwp->config->options['ga_dash_profile_list'];
743
- } else {
744
- $profiles = $gadwp->gapi_controller->refresh_profiles();
745
- }
746
- if ( $profiles ) {
747
- $gadwp->config->options['ga_dash_profile_list'] = $profiles;
748
- if ( ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
749
- $profile = GADWP_Tools::guess_default_domain( $profiles );
750
- $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
751
- // $gadwp->config->options['ga_dash_tableid'] = $profile;
752
- }
753
- $gadwp->config->set_plugin_options();
754
- $options = self::update_options( 'general' );
755
- }
756
- }
757
- } catch ( Google_IO_Exception $e ) {
758
- GADWP_Tools::set_cache( 'last_error', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $e ), $gadwp->gapi_controller->error_timeout );
759
- return false;
760
- } catch ( Google_Service_Exception $e ) {
761
- GADWP_Tools::set_cache( 'last_error', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( "(" . $e->getCode() . ") " . $e->getMessage() ), $gadwp->gapi_controller->error_timeout );
762
- GADWP_Tools::set_cache( 'gapi_errors', $e->getErrors(), $gadwp->gapi_controller->error_timeout );
763
- return $e->getCode();
764
- } catch ( Exception $e ) {
765
- GADWP_Tools::set_cache( 'last_error', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $e ) . "\nResponseHttpCode:" . $e->getCode(), $gadwp->gapi_controller->error_timeout );
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();
972
- global $wp_version;
973
-
974
- if ( ! current_user_can( 'manage_network_options' ) ) {
975
- return;
976
- }
977
- $options = self::update_options( 'network' );
978
- /*
979
- * Include GAPI
980
- */
981
- echo '<div id="gapi-warning" class="updated"><p>' . __( 'Loading the required libraries. If this results in a blank screen or a fatal error, try this solution:', 'google-analytics-dashboard-for-wp' ) . ' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=general_screen&utm_campaign=gadwp">Library conflicts between WordPress plugins</a></p></div>';
982
-
983
- if ( null === $gadwp->gapi_controller ) {
984
- $gadwp->gapi_controller = new GADWP_GAPI_Controller();
985
- }
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( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
999
- switch_to_blog( $blog['blog_id'] );
1000
- GADWP_Tools::delete_cache( 'gapi_errors' );
1001
- restore_current_blog();
1002
- }
1003
- } else {
1004
- GADWP_Tools::delete_cache( 'gapi_errors' );
1005
- }
1006
- if ( $gadwp->config->options['ga_dash_token'] && $gadwp->gapi_controller->client->getAccessToken() ) {
1007
- if ( ! empty( $gadwp->config->options['ga_dash_profile_list'] ) ) {
1008
- $profiles = $gadwp->config->options['ga_dash_profile_list'];
1009
- } else {
1010
- $profiles = $gadwp->gapi_controller->refresh_profiles();
1011
- }
1012
- if ( $profiles ) {
1013
- $gadwp->config->options['ga_dash_profile_list'] = $profiles;
1014
- if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
1015
- $profile = GADWP_Tools::guess_default_domain( $profiles );
1016
- $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
1017
- // $gadwp->config->options['ga_dash_tableid'] = $profile;
1018
- }
1019
- $gadwp->config->set_plugin_options( true );
1020
- $options = self::update_options( 'network' );
1021
- }
1022
- }
1023
- } catch ( Google_IO_Exception $e ) {
1024
- GADWP_Tools::set_cache( 'last_error', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $e ), $gadwp->gapi_controller->error_timeout );
1025
- return false;
1026
- } catch ( Google_Service_Exception $e ) {
1027
- GADWP_Tools::set_cache( 'last_error', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( "(" . $e->getCode() . ") " . $e->getMessage() ), $gadwp->gapi_controller->error_timeout );
1028
- GADWP_Tools::set_cache( 'gapi_errors', $e->getErrors(), $gadwp->gapi_controller->error_timeout );
1029
- return $e->getCode();
1030
- } catch ( Exception $e ) {
1031
- GADWP_Tools::set_cache( 'last_error', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $e ) . "\nResponseHttpCode:" . $e->getCode(), $gadwp->gapi_controller->error_timeout );
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'] ) ) {
1045
- $profiles = $gadwp->config->options['ga_dash_profile_list'];
1046
- } else {
1047
- $profiles = $gadwp->gapi_controller->refresh_profiles();
1048
- }
1049
- if ( $profiles ) {
1050
- $gadwp->config->options['ga_dash_profile_list'] = $profiles;
1051
- if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
1052
- $profile = GADWP_Tools::guess_default_domain( $profiles );
1053
- $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
1054
- // $gadwp->config->options['ga_dash_tableid'] = $profile;
1055
- }
1056
- $gadwp->config->set_plugin_options( true );
1057
- $options = self::update_options( 'network' );
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>";