Google Analytics Dashboard for WP (GADWP) - Version 4.9.2

Version Description

In case of errors refresh your page or clear your browser cache, as a first step. The Frontend Widget can be re-enabled from Appearance -> Widgets screen.

=

Download this release

Release Info

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

Code changes from version 4.9.1.2 to 4.9.2

admin/ajax-actions-ui.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
- /**
3
- * Author: Alin Marcu
4
- * Author URI: http://deconf.com
5
- * License: GPLv2 or later
6
- * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
- */
8
-
9
- // Exit if accessed directly
10
- if ( ! defined( 'ABSPATH' ) )
11
- exit();
12
-
13
- if ( ! class_exists( 'GADWP_UI_Ajax' ) ) {
14
-
15
- final class GADWP_UI_Ajax {
16
-
17
- public function __construct() {
18
- if ( current_user_can( 'manage_options' ) ) {
19
- // Admin Widget action
20
- add_action( 'wp_ajax_gadwp_dismiss_notices', array( $this, 'ajax_dismiss_notices' ) );
21
- }
22
- }
23
-
24
- /**
25
- * Ajax handler for dismissing Admin notices
26
- *
27
- * @return json|int
28
- */
29
- public function ajax_dismiss_notices() {
30
- if ( ! isset( $_POST['gadwp_security_dismiss_notices'] ) || ! wp_verify_nonce( $_POST['gadwp_security_dismiss_notices'], 'gadwp_dismiss_notices' ) ) {
31
- wp_die( - 30 );
32
- }
33
-
34
- if ( !current_user_can( 'manage_options' ) ) {
35
- wp_die( - 31 );
36
- }
37
-
38
- delete_option( 'gadwp_got_updated' );
39
-
40
- wp_send_json( 1 );
41
- }
42
- }
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/ajax-actions.php CHANGED
@@ -1,7 +1,8 @@
1
  <?php
2
  /**
3
  * Author: Alin Marcu
4
- * Author URI: http://deconf.com
 
5
  * License: GPLv2 or later
6
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  */
@@ -18,11 +19,15 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
18
 
19
  public function __construct() {
20
  $this->gadwp = GADWP();
21
-
22
  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'] ) ) ) {
23
  // Items action
24
  add_action( 'wp_ajax_gadwp_backend_item_reports', array( $this, 'ajax_item_reports' ) );
25
  }
 
 
 
 
26
  }
27
 
28
  /**
@@ -50,7 +55,7 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
50
  if ( ob_get_length() ) {
51
  ob_clean();
52
  }
53
-
54
  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'] ) ) ) ) {
55
  wp_die( - 31 );
56
  }
@@ -70,40 +75,59 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
70
  } else {
71
  $this->gadwp->gapi_controller->timeshift = (int) current_time( 'timestamp' ) - time();
72
  }
73
-
74
  if ( $filter_id ) {
75
  $uri_parts = explode( '/', get_permalink( $filter_id ), 4 );
76
-
77
  if ( isset( $uri_parts[3] ) ) {
78
  $uri = '/' . $uri_parts[3];
79
  } else {
80
  wp_die( - 25 );
81
  }
82
-
83
  // allow URL correction before sending an API request
84
  $filter = apply_filters( 'gadwp_backenditem_uri', $uri );
85
-
86
  $lastchar = substr( $filter, - 1 );
87
-
88
  if ( isset( $profile_info[6] ) && $profile_info[6] && $lastchar == '/' ) {
89
  $filter = $filter . $profile_info[6];
90
  }
91
-
92
  // Encode URL
93
  $filter = rawurlencode( rawurldecode( $filter ) );
94
  } else {
95
  $filter = false;
96
  }
97
-
98
  $queries = explode( ',', $query );
99
-
100
  $results = array();
101
-
102
  foreach ( $queries as $value ) {
103
  $results[] = $this->gadwp->gapi_controller->get( $projectId, $value, $from, $to, $filter );
104
  }
105
-
106
  wp_send_json( $results );
107
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
  }
1
  <?php
2
  /**
3
  * Author: Alin Marcu
4
+ * Author URI: https://deconf.com
5
+ * Copyright 2013 Alin Marcu
6
  * License: GPLv2 or later
7
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  */
19
 
20
  public function __construct() {
21
  $this->gadwp = GADWP();
22
+
23
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( ( 1 == $this->gadwp->config->options['backend_item_reports'] ) || ( 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
  /**
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
  }
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 );
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,4 +1,10 @@
1
- /* Admin Widget & Real-Time Stats*/
 
 
 
 
 
 
2
 
3
  /* Real-Time content */
4
  .gadwp-pline {
@@ -25,7 +31,7 @@
25
  padding-right: 5px;
26
  }
27
 
28
- [id^=gadwp-realtime] {
29
  margin: 10px 0 0 0;
30
  width: 100%;
31
  }
@@ -98,7 +104,7 @@
98
  min-width: 250px;
99
  }
100
 
101
- [id^=gadwp-mainchart] {
102
  width: 98%;
103
  height: 100%;
104
  margin: 10px auto 10px 0;
@@ -111,21 +117,22 @@
111
  height: 100%;
112
  }
113
 
114
- [id^=gadwp-trafficmediums], [id^=gadwp-traffictype], [id^=gadwp-socialnetworks], [id^=gadwp-trafficorganic] {
115
  width: 47%;
116
  margin: 10px 0 0 0;
117
  height: 200px;
 
118
  }
119
 
120
- [id^=gadwp-trafficmediums], [id^=gadwp-trafficorganic] {
121
  float: left;
122
  }
123
 
124
- [id^=gadwp-traffictype], [id^=gadwp-socialnetworks] {
125
  float: right;
126
  }
127
 
128
- [id^=gadwp-locations], [id^=gadwp-prs] {
129
  width: 98%;
130
  height: 100%;
131
  margin: 10px auto 10px 0;
@@ -136,17 +143,17 @@
136
  }
137
 
138
  /* Admin Widget content */
139
- [id^=gadwp-progressbar] {
140
  width: 100%;
141
  height: 3px;
142
  margin: 5px 0 0px 0;
143
  }
144
 
145
- .gadwp-wrapper {
146
  width: 100%;
147
  }
148
 
149
- .gadwp-wrapper .inside {
150
  display: table;
151
  margin: 0 auto;
152
  padding: 0px;
@@ -170,7 +177,7 @@
170
  margin: 0px 0px 0px 0px;
171
  text-overflow: ellipsis;
172
  overflow: hidden;
173
- white-space: nowrap;
174
  }
175
 
176
  #gadwp-widget .inside .small-box p {
@@ -179,7 +186,7 @@
179
  }
180
 
181
  @media screen and (max-width: 410px) {
182
- .gadwp-wrapper .inside .small-box {
183
  width: 45%;
184
  }
185
  }
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 {
31
  padding-right: 5px;
32
  }
33
 
34
+ [id^=gadwp-realtime-] {
35
  margin: 10px 0 0 0;
36
  width: 100%;
37
  }
104
  min-width: 250px;
105
  }
106
 
107
+ [id^=gadwp-areachart-] {
108
  width: 98%;
109
  height: 100%;
110
  margin: 10px auto 10px 0;
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;
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;
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 {
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,6 +1,13 @@
 
 
 
 
 
 
 
 
1
  /* Tab navigation */
2
- #gadwp-events, #gadwp-custom, #gadwp-advanced, #gadwp-exclude,
3
- #gadwp-config {
4
  display: none;
5
  }
6
 
@@ -72,12 +79,11 @@ td.gadwp-settings-roles {
72
  font-weight: normal;
73
  padding: 0;
74
  margin: 20px 0 15px 0;
75
-
76
  }
77
 
78
  #poststuff.gadwp h2.nav-tab-wrapper {
79
- border-bottom: 1px solid #ccc;
80
- padding-bottom: 0;
81
  }
82
 
83
  /* Options pages ON/OFF Switch */
@@ -108,7 +114,7 @@ input.gadwp-settings-switchoo-checkbox {
108
  background: transparent;
109
  border: 1px solid #ddd;
110
  border-radius: 2px;
111
- text-shadow: none;
112
  }
113
 
114
  .gadwp-settings-switchoo-inner {
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
 
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 */
114
  background: transparent;
115
  border: 1px solid #ddd;
116
  border-radius: 2px;
117
+ text-shadow: none;
118
  }
119
 
120
  .gadwp-settings-switchoo-inner {
admin/css/item-reports.css CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  /* Backend Item Reports */
2
  .column-gadwp_stats {
3
  width: 70px;
@@ -15,31 +23,31 @@
15
  padding-top: 5px;
16
  }
17
 
18
- [id^=gadwp-container] {
19
  width: 480px;
20
  }
21
 
22
- [id^=gadwp-mainchart] {
23
  height: 280px;
24
  }
25
 
26
- [id^=gadwp-progressbar] {
27
  width: 100%;
28
  height: 3px;
29
  margin: 5px 0 0px 0;
30
  }
31
 
32
- .gadwp-wrapper {
33
  width: 100%;
34
  }
35
 
36
- .gadwp-wrapper .inside {
37
  display: table;
38
  margin: 0 auto;
39
  padding: 0px;
40
  }
41
 
42
- .gadwp-wrapper .inside .small-box {
43
  width: 31.2%;
44
  float: left;
45
  margin: 10px 5px 10px 5px;
@@ -50,32 +58,44 @@
50
  box-shadow: 0px 0px 7px 0px #BBB;
51
  }
52
 
53
- .gadwp-wrapper .inside .small-box h3 {
54
- font-family: 'Open Sans', sans-serif;
55
  font-size: 1em;
56
  color: #777;
57
  padding: 0px 5px 0px 5px;
58
  margin: 0px 0px 0px 0px;
59
  text-overflow: ellipsis;
60
  overflow: hidden;
61
- white-space: nowrap;
62
  }
63
 
64
- .gadwp-wrapper .inside .small-box p {
65
  font-size: 1.2em;
66
  margin: 0px 0px 2px 0px;
67
  }
68
 
69
- [id^=gadwp-trafficmediums], [id^=gadwp-traffictype], [id^=gadwp-trafficorganic],
70
- [id^=gadwp-socialnetworks] {
71
- width: 49.6%;
 
 
 
 
 
72
  margin: 10px 0 0 0;
73
- border-right: 1px solid white;
74
  height: 200px;
75
  float: left;
76
  }
77
 
78
- [id^=gadwp-locations], [id^=gadwp-prs] {
 
 
 
 
 
 
 
 
79
  margin: 10px 0 0 0;
80
  }
81
 
@@ -86,19 +106,19 @@
86
  }
87
 
88
  @media screen and (max-width: 500px) {
89
- [id^=gadwp-container] {
90
  width: 410px;
91
  }
92
- .gadwp-wrapper .inside .small-box {
93
  width: 30.8%;
94
  }
95
  }
96
 
97
  @media screen and (max-width: 410px) {
98
- [id^=gadwp-container] {
99
  width: 260px;
100
  }
101
- .gadwp-wrapper .inside .small-box {
102
  width: 46%;
103
  }
104
  }
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;
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;
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
 
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,7 +1,8 @@
1
  <?php
2
  /**
3
- * Author: Alin Marcu
4
  * Author URI: https://deconf.com
 
5
  * License: GPLv2 or later
6
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  */
@@ -18,37 +19,29 @@ if ( ! class_exists( 'GADWP_Backend_Item_Reports' ) ) {
18
 
19
  public function __construct() {
20
  $this->gadwp = GADWP();
21
-
22
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && 1 == $this->gadwp->config->options['backend_item_reports'] ) {
23
  // Add custom column in Posts List
24
- add_filter( 'manage_posts_columns', array(
25
- $this,
26
- 'add_columns' ) );
27
-
28
  // Populate custom column in Posts List
29
- add_action( 'manage_posts_custom_column', array(
30
- $this,
31
- 'add_icons' ), 10, 2 );
32
-
33
  // Add custom column in Pages List
34
- add_filter( 'manage_pages_columns', array(
35
- $this,
36
- 'add_columns' ) );
37
-
38
  // Populate custom column in Pages List
39
- add_action( 'manage_pages_custom_column', array(
40
- $this,
41
- 'add_icons' ), 10, 2 );
42
  }
43
  }
44
 
45
  public function add_icons( $column, $id ) {
46
  global $wp_version;
47
-
48
  if ( $column != 'gadwp_stats' ) {
49
  return;
50
  }
51
-
52
  if ( version_compare( $wp_version, '3.8.0', '>=' ) ) {
53
  echo '<a id="gadwp-' . $id . '" title="' . get_the_title( $id ) . '" href="#' . $id . '" class="gadwp-icon dashicons-before dashicons-chart-area"></a>';
54
  } else {
@@ -57,8 +50,7 @@ if ( ! class_exists( 'GADWP_Backend_Item_Reports' ) ) {
57
  }
58
 
59
  public function add_columns( $columns ) {
60
- return array_merge( $columns, array(
61
- 'gadwp_stats' => __( 'Analytics', 'google-analytics-dashboard-for-wp' ) ) );
62
  }
63
  }
64
  }
1
  <?php
2
  /**
3
+ * Author: Alin Marcu
4
  * Author URI: https://deconf.com
5
+ * Copyright 2013 Alin Marcu
6
  * License: GPLv2 or later
7
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  */
19
 
20
  public function __construct() {
21
  $this->gadwp = GADWP();
22
+
23
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && 1 == $this->gadwp->config->options['backend_item_reports'] ) {
24
  // Add custom column in Posts List
25
+ add_filter( 'manage_posts_columns', array( $this, 'add_columns' ) );
26
+
 
 
27
  // Populate custom column in Posts List
28
+ add_action( 'manage_posts_custom_column', array( $this, 'add_icons' ), 10, 2 );
29
+
 
 
30
  // Add custom column in Pages List
31
+ add_filter( 'manage_pages_columns', array( $this, 'add_columns' ) );
32
+
 
 
33
  // Populate custom column in Pages List
34
+ add_action( 'manage_pages_custom_column', array( $this, 'add_icons' ), 10, 2 );
 
 
35
  }
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 {
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/ui.js CHANGED
@@ -8,9 +8,7 @@ jQuery( document ).ready( function () {
8
  }
9
 
10
  jQuery( "#gadwp-notice .notice-dismiss" ).click( function () {
11
- jQuery.post( gadwp_ui_data.ajaxurl, gadwp_ui, function ( response ) {
12
- return true;
13
- } );
14
  } );
15
 
16
  if (gadwp_ui_data.ed_bubble != ''){
8
  }
9
 
10
  jQuery( "#gadwp-notice .notice-dismiss" ).click( function () {
11
+ jQuery.post( gadwp_ui_data.ajaxurl, gadwp_ui );
 
 
12
  } );
13
 
14
  if (gadwp_ui_data.ed_bubble != ''){
admin/settings.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
-
3
  /**
4
  * Author: Alin Marcu
5
  * Author URI: https://deconf.com
 
6
  * License: GPLv2 or later
7
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  */
@@ -35,34 +35,30 @@ final class GADWP_Settings {
35
  if ( empty( $new_options['ga_track_exclude'] ) ) {
36
  $new_options['ga_track_exclude'] = array();
37
  }
38
- } else
39
- if ( $who == 'backend' ) {
40
- $options['switch_profile'] = 0;
41
- $options['backend_item_reports'] = 0;
42
- $options['dashboard_widget'] = 0;
43
- if ( empty( $new_options['ga_dash_access_back'] ) ) {
44
- $new_options['ga_dash_access_back'][] = 'administrator';
45
- }
46
- } else
47
- if ( $who == 'frontend' ) {
48
- $options['frontend_item_reports'] = 0;
49
- if ( empty( $new_options['ga_dash_access_front'] ) ) {
50
- $new_options['ga_dash_access_front'][] = 'administrator';
51
- }
52
- } else
53
- if ( $who == 'general' ) {
54
- $options['ga_dash_userapi'] = 0;
55
- if ( ! is_multisite() ) {
56
- $options['automatic_updates_minorversion'] = 0;
57
- }
58
- } else
59
- if ( $who == 'network' ) {
60
- $options['ga_dash_userapi'] = 0;
61
- $options['ga_dash_network'] = 0;
62
- $options['ga_dash_excludesa'] = 0;
63
- $options['automatic_updates_minorversion'] = 0;
64
- $network_settings = true;
65
- }
66
  $options = array_merge( $options, $new_options );
67
  $gadwp->config->options = $options;
68
  $gadwp->config->set_plugin_options( $network_settings );
@@ -139,6 +135,8 @@ final class GADWP_Settings {
139
 
140
 
141
 
 
 
142
  </table>
143
  </td>
144
  </tr>
@@ -168,6 +166,8 @@ final class GADWP_Settings {
168
 
169
 
170
 
 
 
171
  </form>
172
  <?php
173
  self::output_sidebar();
@@ -215,7 +215,7 @@ final class GADWP_Settings {
215
  <table>
216
  <tr>
217
  <?php
218
-
219
  foreach ( $wp_roles->role_names as $role => $name ) {
220
  if ( $role != 'subscriber' ) {
221
  $i++;
@@ -236,6 +236,8 @@ final class GADWP_Settings {
236
 
237
 
238
 
 
 
239
  </table>
240
  </td>
241
  </tr>
@@ -301,6 +303,8 @@ final class GADWP_Settings {
301
 
302
 
303
 
 
 
304
  </form>
305
  <?php
306
  self::output_sidebar();
@@ -308,7 +312,7 @@ final class GADWP_Settings {
308
 
309
  public static function tracking_settings() {
310
  $gadwp = GADWP();
311
-
312
  if ( ! current_user_can( 'manage_options' ) ) {
313
  return;
314
  }
@@ -336,12 +340,7 @@ final class GADWP_Settings {
336
  <div class="settings-wrapper">
337
  <div class="inside">
338
  <?php
339
- $tabs = array(
340
- 'basic' => __( "Basic Settings", 'google-analytics-dashboard-for-wp' ),
341
- 'events' => __( "Events Tracking", 'google-analytics-dashboard-for-wp' ),
342
- 'custom' => __( "Custom Definitions", 'google-analytics-dashboard-for-wp' ),
343
- 'exclude' => __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ),
344
- 'advanced' => __( "Advanced Settings", 'google-analytics-dashboard-for-wp' ) );
345
  self::navigation_tabs( $tabs );
346
  if ( isset( $message ) )
347
  echo $message;
@@ -602,6 +601,8 @@ final class GADWP_Settings {
602
 
603
 
604
 
 
 
605
  </table>
606
  </td>
607
  </tr>
@@ -620,6 +621,8 @@ final class GADWP_Settings {
620
 
621
 
622
 
 
 
623
  </form>
624
  <?php
625
  self::output_sidebar();
@@ -627,13 +630,13 @@ final class GADWP_Settings {
627
 
628
  public static function errors_debugging() {
629
  global $wp_version;
630
-
631
  $gadwp = GADWP();
632
-
633
  if ( ! current_user_can( 'manage_options' ) ) {
634
  return;
635
  }
636
-
637
  $anonim = $gadwp->config->options;
638
  $anonim['wp_version'] = $wp_version;
639
  $anonim['gadwp_version'] = GADWP_CURRENT_VERSION;
@@ -646,10 +649,6 @@ final class GADWP_Settings {
646
  if ( $anonim['ga_dash_clientsecret'] ) {
647
  $anonim['ga_dash_clientsecret'] = 'HIDDEN';
648
  }
649
- if ( $anonim['ga_dash_apikey'] ) {
650
- $anonim['ga_dash_apikey'] = 'HIDDEN';
651
- }
652
-
653
  $options = self::update_options( 'frontend' );
654
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
655
  $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' ) ) ) );
@@ -665,9 +664,7 @@ final class GADWP_Settings {
665
  <div class="inside">
666
  <?php if (isset($message)) echo $message; ?>
667
  <?php
668
- $tabs = array(
669
- 'errors' => __( "Errors & Details", 'google-analytics-dashboard-for-wp' ),
670
- 'config' => __( "Plugin Settings", 'google-analytics-dashboard-for-wp' ) );
671
  self::navigation_tabs( $tabs );
672
  ?>
673
  <div id="gadwp-errors">
@@ -680,7 +677,7 @@ final class GADWP_Settings {
680
  <tr>
681
  <td>
682
  <?php
683
- $errors = print_r( GADWP_Tools::get_cache( 'last_error' ), true ) ? esc_html( str_replace( $gadwp->config->access[2], '' , print_r( GADWP_Tools::get_cache( 'last_error' ), true ) ) ) : __( "None", 'google-analytics-dashboard-for-wp' );
684
  echo '<pre class="gadwp-settings-logdata">Last Error: ';
685
  echo $errors;
686
  ?></pre>
@@ -693,15 +690,15 @@ final class GADWP_Settings {
693
  <td>
694
  <?php
695
  echo '<pre class="gadwp-settings-logdata">Error Details: ';
696
- $error_details = print_r( GADWP_Tools::get_cache( 'gapi_errors' ), true ) ? "\n" . esc_html( str_replace( $gadwp->config->access[2], '' , print_r( GADWP_Tools::get_cache( 'last_error' ), true ) ) ) : __( "None", 'google-analytics-dashboard-for-wp' );
697
  echo $error_details;
698
  ?></pre><br />
699
  <hr>
700
  </td>
701
-
702
-
703
  <tr>
704
-
705
  </table>
706
  </div>
707
  <div id="gadwp-config">
@@ -721,9 +718,9 @@ final class GADWP_Settings {
721
 
722
  public static function general_settings() {
723
  $gadwp = GADWP();
724
-
725
  global $wp_version;
726
-
727
  if ( ! current_user_can( 'manage_options' ) ) {
728
  return;
729
  }
@@ -755,7 +752,7 @@ final class GADWP_Settings {
755
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
756
  $profile = GADWP_Tools::guess_default_domain( $profiles );
757
  $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
758
- //$gadwp->config->options['ga_dash_tableid'] = $profile;
759
  }
760
  $gadwp->config->set_plugin_options();
761
  $options = self::update_options( 'general' );
@@ -813,8 +810,7 @@ final class GADWP_Settings {
813
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
814
  $message = "<div class='updated'><p>" . __( "All other domains/properties were removed.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
815
  $lock_profile = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
816
- $gadwp->config->options['ga_dash_profile_list'] = array(
817
- $lock_profile );
818
  $options = self::update_options( 'general' );
819
  } else {
820
  $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
@@ -831,7 +827,7 @@ final class GADWP_Settings {
831
  <div class="settings-wrapper">
832
  <div class="inside">
833
  <?php
834
- if ( $gadwp->gapi_controller->gapi_errors_handler() || GADWP_Tools::get_cache('last_error') ) {
835
  $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' ) ) ) );
836
  }
837
  if ( isset( $_POST['Authorize'] ) ) {
@@ -839,7 +835,7 @@ final class GADWP_Settings {
839
  $gadwp->gapi_controller->token_request();
840
  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>";
841
  } else {
842
- if ( isset( $message ) ){
843
  echo $message;
844
  }
845
  ?>
@@ -863,10 +859,6 @@ final class GADWP_Settings {
863
  </td>
864
  </tr>
865
  <?php } if ($options['ga_dash_userapi']) { ?>
866
- <tr>
867
- <td class="gadwp-settings-title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'google-analytics-dashboard-for-wp'); ?></label></td>
868
- <td><input type="text" name="options[ga_dash_apikey]" value="<?php echo esc_attr($options['ga_dash_apikey']); ?>" size="40" required="required"></td>
869
- </tr>
870
  <tr>
871
  <td class="gadwp-settings-title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'google-analytics-dashboard-for-wp'); ?></label></td>
872
  <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?>" size="40" required="required"></td>
@@ -982,7 +974,7 @@ final class GADWP_Settings {
982
  public static function general_settings_network() {
983
  $gadwp = GADWP();
984
  global $wp_version;
985
-
986
  if ( ! current_user_can( 'manage_network_options' ) ) {
987
  return;
988
  }
@@ -991,11 +983,11 @@ final class GADWP_Settings {
991
  * Include GAPI
992
  */
993
  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>';
994
-
995
  if ( null === $gadwp->gapi_controller ) {
996
  $gadwp->gapi_controller = new GADWP_GAPI_Controller();
997
  }
998
-
999
  echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
1000
  if ( isset( $_POST['ga_dash_code'] ) ) {
1001
  if ( ! stripos( 'x' . $_POST['ga_dash_code'], 'UA-', 1 ) == 1 ) {
@@ -1007,8 +999,7 @@ final class GADWP_Settings {
1007
  $options = self::update_options( 'network' );
1008
  $message = "<div class='updated'><p>" . __( "Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1009
  if ( is_multisite() ) { // Cleanup errors on the entire network
1010
- foreach ( wp_get_sites( array(
1011
- 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
1012
  switch_to_blog( $blog['blog_id'] );
1013
  GADWP_Tools::delete_cache( 'gapi_errors' );
1014
  restore_current_blog();
@@ -1027,7 +1018,7 @@ final class GADWP_Settings {
1027
  if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
1028
  $profile = GADWP_Tools::guess_default_domain( $profiles );
1029
  $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
1030
- //$gadwp->config->options['ga_dash_tableid'] = $profile;
1031
  }
1032
  $gadwp->config->set_plugin_options( true );
1033
  $options = self::update_options( 'network' );
@@ -1064,7 +1055,7 @@ final class GADWP_Settings {
1064
  if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
1065
  $profile = GADWP_Tools::guess_default_domain( $profiles );
1066
  $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
1067
- //$gadwp->config->options['ga_dash_tableid'] = $profile;
1068
  }
1069
  $gadwp->config->set_plugin_options( true );
1070
  $options = self::update_options( 'network' );
@@ -1102,8 +1093,7 @@ final class GADWP_Settings {
1102
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1103
  $message = "<div class='updated'><p>" . __( "All other domains/properties were removed.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1104
  $lock_profile = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
1105
- $gadwp->config->options['ga_dash_profile_list'] = array(
1106
- $lock_profile );
1107
  $options = self::update_options( 'network' );
1108
  } else {
1109
  $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
@@ -1119,7 +1109,7 @@ final class GADWP_Settings {
1119
  <div class="settings-wrapper">
1120
  <div class="inside">
1121
  <?php
1122
- if ( $gadwp->gapi_controller->gapi_errors_handler() || GADWP_Tools::get_cache('last_error')) {
1123
  $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' ) ) ) );
1124
  }
1125
  if ( isset( $_POST['Authorize'] ) ) {
@@ -1127,7 +1117,7 @@ final class GADWP_Settings {
1127
  $gadwp->gapi_controller->token_request();
1128
  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>";
1129
  } else {
1130
- if ( isset( $message ) ){
1131
  echo $message;
1132
  }
1133
  ?>
@@ -1172,10 +1162,6 @@ final class GADWP_Settings {
1172
  }
1173
  if ( $options['ga_dash_userapi'] ) {
1174
  ?>
1175
- <tr>
1176
- <td class="gadwp-settings-title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'google-analytics-dashboard-for-wp'); ?></label></td>
1177
- <td><input type="text" name="options[ga_dash_apikey]" value="<?php echo esc_attr($options['ga_dash_apikey']); ?>" size="40" required="required"></td>
1178
- </tr>
1179
  <tr>
1180
  <td class="gadwp-settings-title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'google-analytics-dashboard-for-wp'); ?></label></td>
1181
  <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?>" size="40" required="required"></td>
@@ -1203,8 +1189,7 @@ final class GADWP_Settings {
1203
  if ( isset( $options['ga_dash_tableid_network'] ) ) {
1204
  $options['ga_dash_tableid_network'] = json_decode( json_encode( $options['ga_dash_tableid_network'] ), false );
1205
  }
1206
- foreach ( wp_get_sites( array(
1207
- 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
1208
  ?>
1209
  <tr>
1210
  <td class="gadwp-settings-title-s"><label for="ga_dash_tableid_network"><?php echo '<strong>'.$blog['domain'].$blog['path'].'</strong>: ';?></label></td>
@@ -1289,7 +1274,7 @@ final class GADWP_Settings {
1289
 
1290
  public static function output_sidebar() {
1291
  global $wp_version;
1292
-
1293
  $gadwp = GADWP();
1294
  ?>
1295
  </div>
@@ -1311,11 +1296,10 @@ final class GADWP_Settings {
1311
  </h3>
1312
  <div class="inside">
1313
  <div class="gadash-desc">
1314
- <div style="margin-left:-10px;">
1315
- <div class="g-page" data-width="273" data-href="//plus.google.com/+Deconfcom" data-layout="landscape" data-showtagline="false" data-showcoverphoto="false" data-rel="publisher"></div>
1316
- </div>
1317
-
1318
- <script type="text/javascript">
1319
  (function() {
1320
  var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1321
  po.src = 'https://apis.google.com/js/platform.js';
@@ -1325,8 +1309,8 @@ final class GADWP_Settings {
1325
  </div>
1326
  <br />
1327
  <div class="gadash-desc">
1328
- <a href="https://twitter.com/deconfcom" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @deconfcom</a>
1329
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
1330
  </div>
1331
  <br />
1332
  <div class="gadash-title">
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
  */
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 );
135
 
136
 
137
 
138
+
139
+
140
  </table>
141
  </td>
142
  </tr>
166
 
167
 
168
 
169
+
170
+
171
  </form>
172
  <?php
173
  self::output_sidebar();
215
  <table>
216
  <tr>
217
  <?php
218
+
219
  foreach ( $wp_roles->role_names as $role => $name ) {
220
  if ( $role != 'subscriber' ) {
221
  $i++;
236
 
237
 
238
 
239
+
240
+
241
  </table>
242
  </td>
243
  </tr>
303
 
304
 
305
 
306
+
307
+
308
  </form>
309
  <?php
310
  self::output_sidebar();
312
 
313
  public static function tracking_settings() {
314
  $gadwp = GADWP();
315
+
316
  if ( ! current_user_can( 'manage_options' ) ) {
317
  return;
318
  }
340
  <div class="settings-wrapper">
341
  <div class="inside">
342
  <?php
343
+ $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' ) );
 
 
 
 
 
344
  self::navigation_tabs( $tabs );
345
  if ( isset( $message ) )
346
  echo $message;
601
 
602
 
603
 
604
+
605
+
606
  </table>
607
  </td>
608
  </tr>
621
 
622
 
623
 
624
+
625
+
626
  </form>
627
  <?php
628
  self::output_sidebar();
630
 
631
  public static function errors_debugging() {
632
  global $wp_version;
633
+
634
  $gadwp = GADWP();
635
+
636
  if ( ! current_user_can( 'manage_options' ) ) {
637
  return;
638
  }
639
+
640
  $anonim = $gadwp->config->options;
641
  $anonim['wp_version'] = $wp_version;
642
  $anonim['gadwp_version'] = GADWP_CURRENT_VERSION;
649
  if ( $anonim['ga_dash_clientsecret'] ) {
650
  $anonim['ga_dash_clientsecret'] = 'HIDDEN';
651
  }
 
 
 
 
652
  $options = self::update_options( 'frontend' );
653
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
654
  $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' ) ) ) );
664
  <div class="inside">
665
  <?php if (isset($message)) echo $message; ?>
666
  <?php
667
+ $tabs = array( 'errors' => __( "Errors & Details", 'google-analytics-dashboard-for-wp' ), 'config' => __( "Plugin Settings", 'google-analytics-dashboard-for-wp' ) );
 
 
668
  self::navigation_tabs( $tabs );
669
  ?>
670
  <div id="gadwp-errors">
677
  <tr>
678
  <td>
679
  <?php
680
+ $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' );
681
  echo '<pre class="gadwp-settings-logdata">Last Error: ';
682
  echo $errors;
683
  ?></pre>
690
  <td>
691
  <?php
692
  echo '<pre class="gadwp-settings-logdata">Error Details: ';
693
+ $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' );
694
  echo $error_details;
695
  ?></pre><br />
696
  <hr>
697
  </td>
698
+
699
+
700
  <tr>
701
+
702
  </table>
703
  </div>
704
  <div id="gadwp-config">
718
 
719
  public static function general_settings() {
720
  $gadwp = GADWP();
721
+
722
  global $wp_version;
723
+
724
  if ( ! current_user_can( 'manage_options' ) ) {
725
  return;
726
  }
752
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
753
  $profile = GADWP_Tools::guess_default_domain( $profiles );
754
  $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
755
+ // $gadwp->config->options['ga_dash_tableid'] = $profile;
756
  }
757
  $gadwp->config->set_plugin_options();
758
  $options = self::update_options( 'general' );
810
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
811
  $message = "<div class='updated'><p>" . __( "All other domains/properties were removed.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
812
  $lock_profile = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
813
+ $gadwp->config->options['ga_dash_profile_list'] = array( $lock_profile );
 
814
  $options = self::update_options( 'general' );
815
  } else {
816
  $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
827
  <div class="settings-wrapper">
828
  <div class="inside">
829
  <?php
830
+ if ( $gadwp->gapi_controller->gapi_errors_handler() || GADWP_Tools::get_cache( 'last_error' ) ) {
831
  $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' ) ) ) );
832
  }
833
  if ( isset( $_POST['Authorize'] ) ) {
835
  $gadwp->gapi_controller->token_request();
836
  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>";
837
  } else {
838
+ if ( isset( $message ) ) {
839
  echo $message;
840
  }
841
  ?>
859
  </td>
860
  </tr>
861
  <?php } if ($options['ga_dash_userapi']) { ?>
 
 
 
 
862
  <tr>
863
  <td class="gadwp-settings-title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'google-analytics-dashboard-for-wp'); ?></label></td>
864
  <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?>" size="40" required="required"></td>
974
  public static function general_settings_network() {
975
  $gadwp = GADWP();
976
  global $wp_version;
977
+
978
  if ( ! current_user_can( 'manage_network_options' ) ) {
979
  return;
980
  }
983
  * Include GAPI
984
  */
985
  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>';
986
+
987
  if ( null === $gadwp->gapi_controller ) {
988
  $gadwp->gapi_controller = new GADWP_GAPI_Controller();
989
  }
990
+
991
  echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
992
  if ( isset( $_POST['ga_dash_code'] ) ) {
993
  if ( ! stripos( 'x' . $_POST['ga_dash_code'], 'UA-', 1 ) == 1 ) {
999
  $options = self::update_options( 'network' );
1000
  $message = "<div class='updated'><p>" . __( "Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1001
  if ( is_multisite() ) { // Cleanup errors on the entire network
1002
+ foreach ( wp_get_sites( array( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
 
1003
  switch_to_blog( $blog['blog_id'] );
1004
  GADWP_Tools::delete_cache( 'gapi_errors' );
1005
  restore_current_blog();
1018
  if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
1019
  $profile = GADWP_Tools::guess_default_domain( $profiles );
1020
  $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
1021
+ // $gadwp->config->options['ga_dash_tableid'] = $profile;
1022
  }
1023
  $gadwp->config->set_plugin_options( true );
1024
  $options = self::update_options( 'network' );
1055
  if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
1056
  $profile = GADWP_Tools::guess_default_domain( $profiles );
1057
  $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
1058
+ // $gadwp->config->options['ga_dash_tableid'] = $profile;
1059
  }
1060
  $gadwp->config->set_plugin_options( true );
1061
  $options = self::update_options( 'network' );
1093
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1094
  $message = "<div class='updated'><p>" . __( "All other domains/properties were removed.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1095
  $lock_profile = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
1096
+ $gadwp->config->options['ga_dash_profile_list'] = array( $lock_profile );
 
1097
  $options = self::update_options( 'network' );
1098
  } else {
1099
  $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1109
  <div class="settings-wrapper">
1110
  <div class="inside">
1111
  <?php
1112
+ if ( $gadwp->gapi_controller->gapi_errors_handler() || GADWP_Tools::get_cache( 'last_error' ) ) {
1113
  $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' ) ) ) );
1114
  }
1115
  if ( isset( $_POST['Authorize'] ) ) {
1117
  $gadwp->gapi_controller->token_request();
1118
  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>";
1119
  } else {
1120
+ if ( isset( $message ) ) {
1121
  echo $message;
1122
  }
1123
  ?>
1162
  }
1163
  if ( $options['ga_dash_userapi'] ) {
1164
  ?>
 
 
 
 
1165
  <tr>
1166
  <td class="gadwp-settings-title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'google-analytics-dashboard-for-wp'); ?></label></td>
1167
  <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?>" size="40" required="required"></td>
1189
  if ( isset( $options['ga_dash_tableid_network'] ) ) {
1190
  $options['ga_dash_tableid_network'] = json_decode( json_encode( $options['ga_dash_tableid_network'] ), false );
1191
  }
1192
+ foreach ( wp_get_sites( array( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
 
1193
  ?>
1194
  <tr>
1195
  <td class="gadwp-settings-title-s"><label for="ga_dash_tableid_network"><?php echo '<strong>'.$blog['domain'].$blog['path'].'</strong>: ';?></label></td>
1274
 
1275
  public static function output_sidebar() {
1276
  global $wp_version;
1277
+
1278
  $gadwp = GADWP();
1279
  ?>
1280
  </div>
1296
  </h3>
1297
  <div class="inside">
1298
  <div class="gadash-desc">
1299
+ <div style="margin-left: -10px;">
1300
+ <div class="g-page" data-width="273" data-href="//plus.google.com/+Deconfcom" data-layout="landscape" data-showtagline="false" data-showcoverphoto="false" data-rel="publisher"></div>
1301
+ </div>
1302
+ <script type="text/javascript">
 
1303
  (function() {
1304
  var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1305
  po.src = 'https://apis.google.com/js/platform.js';
1309
  </div>
1310
  <br />
1311
  <div class="gadash-desc">
1312
+ <a href="https://twitter.com/deconfcom" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @deconfcom</a>
1313
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
1314
  </div>
1315
  <br />
1316
  <div class="gadash-title">
admin/setup.php CHANGED
@@ -2,6 +2,7 @@
2
  /**
3
  * Author: Alin Marcu
4
  * Author URI: https://deconf.com
 
5
  * License: GPLv2 or later
6
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  */
@@ -18,7 +19,7 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
18
 
19
  public function __construct() {
20
  $this->gadwp = GADWP();
21
-
22
  // Styles & Scripts
23
  add_action( 'admin_enqueue_scripts', array( $this, 'load_styles_scripts' ) );
24
  // Site Menu
@@ -68,30 +69,34 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
68
  */
69
  public function load_styles_scripts( $hook ) {
70
  $new_hook = explode( '_page_', $hook );
71
-
72
  if ( isset( $new_hook[1] ) ) {
73
  $new_hook = '_page_' . $new_hook[1];
74
  } else {
75
  $new_hook = $hook;
76
  }
77
-
 
 
 
 
78
  /*
79
  * GADWP main stylesheet
80
  */
81
  wp_enqueue_style( 'gadwp', GADWP_URL . 'admin/css/gadwp.css', null, GADWP_CURRENT_VERSION );
82
-
83
  /*
84
  * GADWP UI
85
  */
86
-
87
  if ( GADWP_Tools::get_cache( 'gapi_errors' ) ) {
88
  $ed_bubble = '!';
89
  } else {
90
  $ed_bubble = '';
91
  }
92
-
93
  wp_enqueue_script( 'gadwp-backend-ui', plugins_url( 'js/ui.js', __FILE__ ), array( 'jquery' ), GADWP_CURRENT_VERSION, true );
94
-
95
  /* @formatter:off */
96
  wp_localize_script( 'gadwp-backend-ui', 'gadwp_ui_data', array(
97
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
@@ -100,29 +105,29 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
100
  )
101
  );
102
  /* @formatter:on */
103
-
104
- if ( $this->gadwp->config->options['switch_profile'] && count($this->gadwp->config->options['ga_dash_profile_list']) > 1 ) {
105
  $views = array();
106
  foreach ( $this->gadwp->config->options['ga_dash_profile_list'] as $items ) {
107
  if ( $items[3] ) {
108
- $views[$items[1]] = esc_js( GADWP_Tools::strip_protocol( $items[3] ) ); // . ' &#8658; ' . $items[0] );
109
  }
110
  }
111
  } else {
112
  $views = false;
113
  }
114
-
115
  /*
116
  * Main Dashboard Widgets Styles & Scripts
117
  */
118
  $widgets_hooks = array( 'index.php' );
119
-
120
  if ( in_array( $new_hook, $widgets_hooks ) ) {
121
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && $this->gadwp->config->options['dashboard_widget'] ) {
122
-
123
  if ( $this->gadwp->config->options['ga_target_geomap'] ) {
124
  $country_codes = GADWP_Tools::get_countrycodes();
125
- if ( isset( $country_codes[$this->gadwp->config->options['ga_target_geomap']] ) ){
126
  $region = $this->gadwp->config->options['ga_target_geomap'];
127
  } else {
128
  $region = false;
@@ -130,27 +135,27 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
130
  } else {
131
  $region = false;
132
  }
133
-
134
  wp_enqueue_style( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.css', null, GADWP_CURRENT_VERSION );
135
-
136
  wp_enqueue_style( 'gadwp-backend-item-reports', GADWP_URL . 'admin/css/admin-widgets.css', null, GADWP_CURRENT_VERSION );
137
-
138
  wp_register_style( 'jquery-ui-tooltip-html', GADWP_URL . 'common/realtime/jquery.ui.tooltip.html.css' );
139
-
140
  wp_enqueue_style( 'jquery-ui-tooltip-html' );
141
-
142
  wp_register_script( 'jquery-ui-tooltip-html', GADWP_URL . 'common/realtime/jquery.ui.tooltip.html.js' );
143
-
144
  if ( ! wp_script_is( 'googlejsapi' ) ) {
145
- wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi' );
146
  }
147
-
148
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
149
-
150
  wp_enqueue_script( 'gadwp-backend-dashboard-reports', GADWP_URL . 'common/js/reports.js', array( 'jquery', 'googlejsapi', 'gadwp-nprogress', 'jquery-ui-tooltip', 'jquery-ui-core', 'jquery-ui-position', 'jquery-ui-tooltip-html' ), GADWP_CURRENT_VERSION );
151
-
152
  /* @formatter:off */
153
- wp_localize_script( 'gadwp-backend-dashboard-reports', 'gadwp_item_data', array(
154
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
155
  'security' => wp_create_nonce( 'gadwp_backend_item_reports' ),
156
  'dateList' => array(
@@ -174,14 +179,15 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
174
  'contentpages' => __( "Pages", 'google-analytics-dashboard-for-wp' ),
175
  'referrers' => __( "Referrers", 'google-analytics-dashboard-for-wp' ),
176
  'searches' => __( "Searches", 'google-analytics-dashboard-for-wp' ),
177
- 'trafficdetails' => __( "Traffic Details", 'google-analytics-dashboard-for-wp' )
 
178
  ),
179
  'i18n' => array(
180
  __( "A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp' ), //0
181
  __( "Traffic Mediums", 'google-analytics-dashboard-for-wp' ),
182
  __( "Visitor Type", 'google-analytics-dashboard-for-wp' ),
183
- __( "Social Networks", 'google-analytics-dashboard-for-wp' ),
184
  __( "Search Engines", 'google-analytics-dashboard-for-wp' ),
 
185
  __( "Sessions", 'google-analytics-dashboard-for-wp' ),
186
  __( "Users", 'google-analytics-dashboard-for-wp' ),
187
  __( "Page Views", 'google-analytics-dashboard-for-wp' ),
@@ -193,16 +199,18 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
193
  __( "This report is unavailable", 'google-analytics-dashboard-for-wp' ),
194
  __( "report generated by", 'google-analytics-dashboard-for-wp' ), //14
195
  __( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . ' <a href="' . menu_page_url( 'gadash_settings', false ) . '">' . __( "authorize the plugin", 'google-analytics-dashboard-for-wp' ) . '</a>.',
196
- ),
197
- 'i18n_realtime' => array(
198
- __( "REFERRALS", 'google-analytics-dashboard-for-wp' ), //0
 
 
199
  __( "KEYWORDS", 'google-analytics-dashboard-for-wp' ),
200
  __( "SOCIAL", 'google-analytics-dashboard-for-wp' ),
201
  __( "CAMPAIGN", 'google-analytics-dashboard-for-wp' ),
202
  __( "DIRECT", 'google-analytics-dashboard-for-wp' ),
203
- __( "NEW", 'google-analytics-dashboard-for-wp' ), //5
204
  ),
205
- 'realtime_maxpages' => $this->gadwp->config->options['ga_realtime_pages'],
206
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
207
  'region' => $region,
208
  'language' => get_bloginfo( 'language' ),
@@ -213,17 +221,17 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
213
  /* @formatter:on */
214
  }
215
  }
216
-
217
  /*
218
  * Posts/Pages List Styles & Scripts
219
  */
220
  $contentstats_hooks = array( 'edit.php' );
221
  if ( in_array( $hook, $contentstats_hooks ) ) {
222
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && $this->gadwp->config->options['backend_item_reports'] ) {
223
-
224
  if ( $this->gadwp->config->options['ga_target_geomap'] ) {
225
  $country_codes = GADWP_Tools::get_countrycodes();
226
- if ( isset( $country_codes[$this->gadwp->config->options['ga_target_geomap']] ) ){
227
  $region = $this->gadwp->config->options['ga_target_geomap'];
228
  } else {
229
  $region = false;
@@ -231,23 +239,23 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
231
  } else {
232
  $region = false;
233
  }
234
-
235
  wp_enqueue_style( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.css', null, GADWP_CURRENT_VERSION );
236
-
237
  wp_enqueue_style( 'gadwp-backend-item-reports', GADWP_URL . 'admin/css/item-reports.css', null, GADWP_CURRENT_VERSION );
238
-
239
  wp_enqueue_style( "wp-jquery-ui-dialog" );
240
-
241
  if ( ! wp_script_is( 'googlejsapi' ) ) {
242
- wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi' );
243
  }
244
-
245
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
246
-
247
  wp_enqueue_script( 'gadwp-backend-item-reports', GADWP_URL . 'common/js/reports.js', array( 'gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog' ), GADWP_CURRENT_VERSION );
248
-
249
  /* @formatter:off */
250
- wp_localize_script( 'gadwp-backend-item-reports', 'gadwp_item_data', array(
251
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
252
  'security' => wp_create_nonce( 'gadwp_backend_item_reports' ),
253
  'dateList' => array(
@@ -269,7 +277,8 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
269
  'locations' => __( "Location", 'google-analytics-dashboard-for-wp' ),
270
  'referrers' => __( "Referrers", 'google-analytics-dashboard-for-wp' ),
271
  'searches' => __( "Searches", 'google-analytics-dashboard-for-wp' ),
272
- 'trafficdetails' => __( "Traffic Details", 'google-analytics-dashboard-for-wp' )
 
273
  ),
274
  'i18n' => array(
275
  __( "A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp' ), //0
@@ -288,6 +297,10 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
288
  __( "This report is unavailable", 'google-analytics-dashboard-for-wp' ),
289
  __( "report generated by", 'google-analytics-dashboard-for-wp' ), //14
290
  __( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . ' <a href="' . menu_page_url( 'gadash_settings', false ) . '">' . __( "authorize the plugin", 'google-analytics-dashboard-for-wp' ) . '</a>.',
 
 
 
 
291
  ),
292
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
293
  'region' => $region,
@@ -299,12 +312,12 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
299
  /* @formatter:on */
300
  }
301
  }
302
-
303
  /*
304
  * Settings Styles & Scripts
305
  */
306
  $settings_hooks = array( '_page_gadash_settings', '_page_gadash_backend_settings', '_page_gadash_frontend_settings', '_page_gadash_tracking_settings', '_page_gadash_errors_debugging' );
307
-
308
  if ( in_array( $new_hook, $settings_hooks ) ) {
309
  wp_enqueue_style( 'wp-color-picker' );
310
  wp_enqueue_script( 'wp-color-picker' );
@@ -330,19 +343,19 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
330
  * Add an admin notice after a manual or atuomatic update
331
  */
332
  function admin_notice() {
333
-
334
  $currentScreen = get_current_screen();
335
-
336
- if ( ! current_user_can( 'manage_options' ) || $currentScreen->base != 'dashboard') {
337
  return;
338
  }
339
-
340
  if ( get_option( 'gadwp_got_updated' ) ) :
341
  ?>
342
- <div id="gadwp-notice" class="notice is-dismissible">
343
- <p><?php echo sprintf( __('Google Analytics Dashboard for WP has been updated to version %s.', 'google-analytics-dashboard-for-wp' ), GADWP_CURRENT_VERSION).' '.sprintf( __('For details, check out %1$s and %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf(' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_notice&utm_medium=link&utm_content=release_notice&utm_campaign=gadwp">%s</a> ', __('the documentation page', 'google-analytics-dashboard-for-wp') ), sprintf(' <a href="%1$s">%2$s</a>', esc_url( get_admin_url( null, 'admin.php?page=gadash_settings' ) ), __('the plugin&#39;s settings page', 'google-analytics-dashboard-for-wp') ) ); ?></p>
344
- </div>
345
- <?php
 
346
  endif;
347
  }
348
  }
2
  /**
3
  * Author: Alin Marcu
4
  * Author URI: https://deconf.com
5
+ * Copyright 2013 Alin Marcu
6
  * License: GPLv2 or later
7
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  */
19
 
20
  public function __construct() {
21
  $this->gadwp = GADWP();
22
+
23
  // Styles & Scripts
24
  add_action( 'admin_enqueue_scripts', array( $this, 'load_styles_scripts' ) );
25
  // Site Menu
69
  */
70
  public function load_styles_scripts( $hook ) {
71
  $new_hook = explode( '_page_', $hook );
72
+
73
  if ( isset( $new_hook[1] ) ) {
74
  $new_hook = '_page_' . $new_hook[1];
75
  } else {
76
  $new_hook = $hook;
77
  }
78
+
79
+ $lang = get_bloginfo( 'language' );
80
+ $lang = explode( '-', $lang );
81
+ $lang = $lang[0];
82
+
83
  /*
84
  * GADWP main stylesheet
85
  */
86
  wp_enqueue_style( 'gadwp', GADWP_URL . 'admin/css/gadwp.css', null, GADWP_CURRENT_VERSION );
87
+
88
  /*
89
  * GADWP UI
90
  */
91
+
92
  if ( GADWP_Tools::get_cache( 'gapi_errors' ) ) {
93
  $ed_bubble = '!';
94
  } else {
95
  $ed_bubble = '';
96
  }
97
+
98
  wp_enqueue_script( 'gadwp-backend-ui', plugins_url( 'js/ui.js', __FILE__ ), array( 'jquery' ), GADWP_CURRENT_VERSION, true );
99
+
100
  /* @formatter:off */
101
  wp_localize_script( 'gadwp-backend-ui', 'gadwp_ui_data', array(
102
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
105
  )
106
  );
107
  /* @formatter:on */
108
+
109
+ if ( $this->gadwp->config->options['switch_profile'] && count( $this->gadwp->config->options['ga_dash_profile_list'] ) > 1 ) {
110
  $views = array();
111
  foreach ( $this->gadwp->config->options['ga_dash_profile_list'] as $items ) {
112
  if ( $items[3] ) {
113
+ $views[$items[1]] = esc_js( GADWP_Tools::strip_protocol( $items[3] ) ); // . ' &#8658; ' . $items[0] );
114
  }
115
  }
116
  } else {
117
  $views = false;
118
  }
119
+
120
  /*
121
  * Main Dashboard Widgets Styles & Scripts
122
  */
123
  $widgets_hooks = array( 'index.php' );
124
+
125
  if ( in_array( $new_hook, $widgets_hooks ) ) {
126
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && $this->gadwp->config->options['dashboard_widget'] ) {
127
+
128
  if ( $this->gadwp->config->options['ga_target_geomap'] ) {
129
  $country_codes = GADWP_Tools::get_countrycodes();
130
+ if ( isset( $country_codes[$this->gadwp->config->options['ga_target_geomap']] ) ) {
131
  $region = $this->gadwp->config->options['ga_target_geomap'];
132
  } else {
133
  $region = false;
135
  } else {
136
  $region = false;
137
  }
138
+
139
  wp_enqueue_style( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.css', null, GADWP_CURRENT_VERSION );
140
+
141
  wp_enqueue_style( 'gadwp-backend-item-reports', GADWP_URL . 'admin/css/admin-widgets.css', null, GADWP_CURRENT_VERSION );
142
+
143
  wp_register_style( 'jquery-ui-tooltip-html', GADWP_URL . 'common/realtime/jquery.ui.tooltip.html.css' );
144
+
145
  wp_enqueue_style( 'jquery-ui-tooltip-html' );
146
+
147
  wp_register_script( 'jquery-ui-tooltip-html', GADWP_URL . 'common/realtime/jquery.ui.tooltip.html.js' );
148
+
149
  if ( ! wp_script_is( 'googlejsapi' ) ) {
150
+ wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22language%22%3A%22' . $lang . '%22%2C%22packages%22%3A%5B%22corechart%22%2C%20%22table%22%2C%20%22orgchart%22%2C%20%22geochart%22%5D%7D%5D%7D%27', array(), null );
151
  }
152
+
153
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
154
+
155
  wp_enqueue_script( 'gadwp-backend-dashboard-reports', GADWP_URL . 'common/js/reports.js', array( 'jquery', 'googlejsapi', 'gadwp-nprogress', 'jquery-ui-tooltip', 'jquery-ui-core', 'jquery-ui-position', 'jquery-ui-tooltip-html' ), GADWP_CURRENT_VERSION );
156
+
157
  /* @formatter:off */
158
+ wp_localize_script( 'gadwp-backend-dashboard-reports', 'gadwpItemData', array(
159
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
160
  'security' => wp_create_nonce( 'gadwp_backend_item_reports' ),
161
  'dateList' => array(
179
  'contentpages' => __( "Pages", 'google-analytics-dashboard-for-wp' ),
180
  'referrers' => __( "Referrers", 'google-analytics-dashboard-for-wp' ),
181
  'searches' => __( "Searches", 'google-analytics-dashboard-for-wp' ),
182
+ 'trafficdetails' => __( "Traffic", 'google-analytics-dashboard-for-wp' ),
183
+ 'technologydetails' => __( "Technology", 'google-analytics-dashboard-for-wp' ),
184
  ),
185
  'i18n' => array(
186
  __( "A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp' ), //0
187
  __( "Traffic Mediums", 'google-analytics-dashboard-for-wp' ),
188
  __( "Visitor Type", 'google-analytics-dashboard-for-wp' ),
 
189
  __( "Search Engines", 'google-analytics-dashboard-for-wp' ),
190
+ __( "Social Networks", 'google-analytics-dashboard-for-wp' ),
191
  __( "Sessions", 'google-analytics-dashboard-for-wp' ),
192
  __( "Users", 'google-analytics-dashboard-for-wp' ),
193
  __( "Page Views", 'google-analytics-dashboard-for-wp' ),
199
  __( "This report is unavailable", 'google-analytics-dashboard-for-wp' ),
200
  __( "report generated by", 'google-analytics-dashboard-for-wp' ), //14
201
  __( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . ' <a href="' . menu_page_url( 'gadash_settings', false ) . '">' . __( "authorize the plugin", 'google-analytics-dashboard-for-wp' ) . '</a>.',
202
+ __( "Browser", 'google-analytics-dashboard-for-wp' ), //16
203
+ __( "Operating System", 'google-analytics-dashboard-for-wp' ),
204
+ __( "Screen Resolution", 'google-analytics-dashboard-for-wp' ),
205
+ __( "Mobile Brand", 'google-analytics-dashboard-for-wp' ),
206
+ __( "REFERRALS", 'google-analytics-dashboard-for-wp' ), //20
207
  __( "KEYWORDS", 'google-analytics-dashboard-for-wp' ),
208
  __( "SOCIAL", 'google-analytics-dashboard-for-wp' ),
209
  __( "CAMPAIGN", 'google-analytics-dashboard-for-wp' ),
210
  __( "DIRECT", 'google-analytics-dashboard-for-wp' ),
211
+ __( "NEW", 'google-analytics-dashboard-for-wp' ), //25
212
  ),
213
+ 'rtLimitPages' => $this->gadwp->config->options['ga_realtime_pages'],
214
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
215
  'region' => $region,
216
  'language' => get_bloginfo( 'language' ),
221
  /* @formatter:on */
222
  }
223
  }
224
+
225
  /*
226
  * Posts/Pages List Styles & Scripts
227
  */
228
  $contentstats_hooks = array( 'edit.php' );
229
  if ( in_array( $hook, $contentstats_hooks ) ) {
230
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && $this->gadwp->config->options['backend_item_reports'] ) {
231
+
232
  if ( $this->gadwp->config->options['ga_target_geomap'] ) {
233
  $country_codes = GADWP_Tools::get_countrycodes();
234
+ if ( isset( $country_codes[$this->gadwp->config->options['ga_target_geomap']] ) ) {
235
  $region = $this->gadwp->config->options['ga_target_geomap'];
236
  } else {
237
  $region = false;
239
  } else {
240
  $region = false;
241
  }
242
+
243
  wp_enqueue_style( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.css', null, GADWP_CURRENT_VERSION );
244
+
245
  wp_enqueue_style( 'gadwp-backend-item-reports', GADWP_URL . 'admin/css/item-reports.css', null, GADWP_CURRENT_VERSION );
246
+
247
  wp_enqueue_style( "wp-jquery-ui-dialog" );
248
+
249
  if ( ! wp_script_is( 'googlejsapi' ) ) {
250
+ wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22language%22%3A%22' . $lang . '%22%2C%22packages%22%3A%5B%22corechart%22%2C%20%22table%22%2C%20%22orgchart%22%2C%20%22geochart%22%5D%7D%5D%7D%27', array(), null );
251
  }
252
+
253
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
254
+
255
  wp_enqueue_script( 'gadwp-backend-item-reports', GADWP_URL . 'common/js/reports.js', array( 'gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog' ), GADWP_CURRENT_VERSION );
256
+
257
  /* @formatter:off */
258
+ wp_localize_script( 'gadwp-backend-item-reports', 'gadwpItemData', array(
259
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
260
  'security' => wp_create_nonce( 'gadwp_backend_item_reports' ),
261
  'dateList' => array(
277
  'locations' => __( "Location", 'google-analytics-dashboard-for-wp' ),
278
  'referrers' => __( "Referrers", 'google-analytics-dashboard-for-wp' ),
279
  'searches' => __( "Searches", 'google-analytics-dashboard-for-wp' ),
280
+ 'trafficdetails' => __( "Traffic", 'google-analytics-dashboard-for-wp' ),
281
+ 'technologydetails' => __( "Technology", 'google-analytics-dashboard-for-wp' ),
282
  ),
283
  'i18n' => array(
284
  __( "A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp' ), //0
297
  __( "This report is unavailable", 'google-analytics-dashboard-for-wp' ),
298
  __( "report generated by", 'google-analytics-dashboard-for-wp' ), //14
299
  __( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . ' <a href="' . menu_page_url( 'gadash_settings', false ) . '">' . __( "authorize the plugin", 'google-analytics-dashboard-for-wp' ) . '</a>.',
300
+ __( "Browser", 'google-analytics-dashboard-for-wp' ), //16
301
+ __( "Operating System", 'google-analytics-dashboard-for-wp' ),
302
+ __( "Screen Resolution", 'google-analytics-dashboard-for-wp' ),
303
+ __( "Mobile Brand", 'google-analytics-dashboard-for-wp' ),
304
  ),
305
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
306
  'region' => $region,
312
  /* @formatter:on */
313
  }
314
  }
315
+
316
  /*
317
  * Settings Styles & Scripts
318
  */
319
  $settings_hooks = array( '_page_gadash_settings', '_page_gadash_backend_settings', '_page_gadash_frontend_settings', '_page_gadash_tracking_settings', '_page_gadash_errors_debugging' );
320
+
321
  if ( in_array( $new_hook, $settings_hooks ) ) {
322
  wp_enqueue_style( 'wp-color-picker' );
323
  wp_enqueue_script( 'wp-color-picker' );
343
  * Add an admin notice after a manual or atuomatic update
344
  */
345
  function admin_notice() {
 
346
  $currentScreen = get_current_screen();
347
+
348
+ if ( ! current_user_can( 'manage_options' ) || $currentScreen->base != 'dashboard' ) {
349
  return;
350
  }
351
+
352
  if ( get_option( 'gadwp_got_updated' ) ) :
353
  ?>
354
+ <div id="gadwp-notice" class="notice is-dismissible">
355
+ <p><?php echo sprintf( __('Google Analytics Dashboard for WP has been updated to version %s.', 'google-analytics-dashboard-for-wp' ), GADWP_CURRENT_VERSION).' '.sprintf( __('For details, check out %1$s and %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf(' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_notice&utm_medium=link&utm_content=release_notice&utm_campaign=gadwp">%s</a> ', __('the documentation page', 'google-analytics-dashboard-for-wp') ), sprintf(' <a href="%1$s">%2$s</a>', esc_url( get_admin_url( null, 'admin.php?page=gadash_settings' ) ), __('the plugin&#39;s settings page', 'google-analytics-dashboard-for-wp') ) ); ?></p>
356
+ </div>
357
+
358
+ <?php
359
  endif;
360
  }
361
  }
admin/widgets.php CHANGED
@@ -1,7 +1,8 @@
1
  <?php
2
  /**
3
- * Author: Alin Marcu
4
  * Author URI: https://deconf.com
 
5
  * License: GPLv2 or later
6
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  */
@@ -29,12 +30,12 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
29
 
30
  public function dashboard_widget() {
31
  $projectId = 0;
32
-
33
  if ( empty( $this->gadwp->config->options['ga_dash_token'] ) ) {
34
  echo '<p>' . __( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Authorize Plugin", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
35
  return;
36
  }
37
-
38
  if ( current_user_can( 'manage_options' ) ) {
39
  if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
40
  $projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
@@ -50,12 +51,12 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
50
  return;
51
  }
52
  }
53
-
54
  if ( ! ( $projectId ) ) {
55
  echo '<p>' . __( "Something went wrong while retrieving property data. You need to create and properly configure a Google Analytics account:", 'google-analytics-dashboard-for-wp' ) . '</p> <form action="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" method="POST">' . get_submit_button( __( "Find out more!", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
56
  return;
57
  }
58
-
59
  ?>
60
  <div id="gadwp-window-1"></div>
61
  <?php
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
  */
30
 
31
  public function dashboard_widget() {
32
  $projectId = 0;
33
+
34
  if ( empty( $this->gadwp->config->options['ga_dash_token'] ) ) {
35
  echo '<p>' . __( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Authorize Plugin", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
36
  return;
37
  }
38
+
39
  if ( current_user_can( 'manage_options' ) ) {
40
  if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
41
  $projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
51
  return;
52
  }
53
  }
54
+
55
  if ( ! ( $projectId ) ) {
56
  echo '<p>' . __( "Something went wrong while retrieving property data. You need to create and properly configure a Google Analytics account:", 'google-analytics-dashboard-for-wp' ) . '</p> <form action="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" method="POST">' . get_submit_button( __( "Find out more!", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
57
  return;
58
  }
59
+
60
  ?>
61
  <div id="gadwp-window-1"></div>
62
  <?php
common/ajax-actions.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Common_Ajax' ) ) {
15
+
16
+ final class GADWP_Common_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'] ) || GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_front'] ) ) {
24
+ add_action( 'wp_ajax_gadwp_set_error', array( $this, 'ajax_set_error' ) );
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Ajax handler for storing JavaScript Errors
30
+ *
31
+ * @return json|int
32
+ */
33
+ public function ajax_set_error() {
34
+ if ( ! isset( $_POST['gadwp_security_set_error'] ) || ! ( wp_verify_nonce( $_POST['gadwp_security_set_error'], 'gadwp_backend_item_reports' ) || wp_verify_nonce( $_POST['gadwp_security_set_error'], 'gadwp_frontend_item_reports' ) ) ) {
35
+ wp_die( - 40 );
36
+ }
37
+
38
+ GADWP_Tools::set_cache( 'last_error', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $_POST['response'] ), 24 * 60 * 60 );
39
+
40
+ wp_die();
41
+ }
42
+ }
43
+ }
common/js/reports.js CHANGED
@@ -1,8 +1,12 @@
 
 
 
 
1
  "use strict";
2
 
3
- //Get the numeric ID
4
- gadwp_item_data.getID = function ( item ) {
5
- if ( gadwp_item_data.scope == 'admin-item' ) {
6
  if ( typeof item.id == "undefined" ) {
7
  return 0
8
  }
@@ -24,7 +28,7 @@ gadwp_item_data.getID = function ( item ) {
24
  }
25
 
26
  // Get the selector
27
- gadwp_item_data.getSelector = function ( scope ) {
28
  if ( scope == 'admin-item' ) {
29
  return 'a[id^="gadwp-"]';
30
  } else {
@@ -32,10 +36,10 @@ gadwp_item_data.getSelector = function ( scope ) {
32
  }
33
  }
34
 
35
- gadwp_item_data.responsiveDialog = function () {
36
- var dialog;
37
- var wWidth;
38
- var visible = jQuery( ".ui-dialog:visible" );
39
 
40
  // on each visible dialog
41
  visible.each( function () {
@@ -58,38 +62,33 @@ gadwp_item_data.responsiveDialog = function () {
58
  }
59
 
60
  jQuery.fn.extend( {
61
- gadwpItemReport : function ( item_id ) {
62
- var post_data;
63
- var slug = "-" + item_id;
64
- var dialog_title;
65
- var tools = {
66
- set_cookie : function ( name, value ) {
67
- var expires;
68
- var date_item = new Date();
69
-
70
- if ( gadwp_item_data.scope == 'admin-widgets' ) {
71
  name = "gadwp_wg_" + name;
72
  } else {
73
  name = "gadwp_ir_" + name;
74
  }
75
- date_item.setTime( date_item.getTime() + ( 24 * 60 * 60 * 1000 * 7 ) );
76
- expires = "expires=" + date_item.toUTCString();
77
  document.cookie = name + "=" + value + "; " + expires + "; path=/";
78
  },
79
- get_cookie : function ( name ) {
80
- var i = 0;
81
- var cookie;
82
- var cookies_array;
83
- var div;
84
 
85
- if ( gadwp_item_data.scope == 'admin-widgets' ) {
86
  name = "gadwp_wg_" + name + "=";
87
  } else {
88
  name = "gadwp_ir_" + name + "=";
89
  }
90
- cookies_array = document.cookie.split( ';' );
91
- for ( i = 0; i < cookies_array.length; i++ ) {
92
- cookie = cookies_array[ i ];
93
  while ( cookie.charAt( 0 ) == ' ' )
94
  cookie = cookie.substring( 1 );
95
  if ( cookie.indexOf( name ) == 0 )
@@ -104,33 +103,30 @@ jQuery.fn.extend( {
104
  }
105
  }
106
 
107
- var template = {
108
 
109
  addOptions : function ( id, list ) {
110
- var default_metric;
111
- var default_dimension;
112
- var default_view;
113
- var output = [];
114
 
115
  if ( list == false ) {
116
  return;
117
  }
118
 
119
- if ( !tools.get_cookie( 'default_metric' ) || !tools.get_cookie( 'default_dimension' ) ) {
120
- if ( gadwp_item_data.scope == 'admin-widgets' ) {
121
- default_metric = 'sessions';
122
  } else {
123
- default_metric = 'uniquePageviews';
124
  }
125
- default_dimension = '30daysAgo';
126
  } else {
127
- default_metric = tools.get_cookie( 'default_metric' );
128
- default_dimension = tools.get_cookie( 'default_dimension' );
129
- default_view = tools.get_cookie( 'default_view' );
130
  }
131
 
132
  jQuery.each( list, function ( key, value ) {
133
- if ( key == default_metric || key == default_dimension || key == default_view ) {
134
  output.push( '<option value="' + key + '" selected="selected">' + value + '</option>' );
135
  } else {
136
  output.push( '<option value="' + key + '">' + value + '</option>' );
@@ -151,7 +147,7 @@ jQuery.fn.extend( {
151
  }
152
 
153
  tpl = '<div id="gadwp-container' + slug + '">';
154
- if ( gadwp_item_data.viewList != false ) {
155
  tpl += '<select id="gadwp-sel-view' + slug + '"></select>';
156
  }
157
  tpl += '<select id="gadwp-sel-period' + slug + '"></select> ';
@@ -160,33 +156,28 @@ jQuery.fn.extend( {
160
  tpl += '<div id="gadwp-status' + slug + '"></div>';
161
  tpl += '<div id="gadwp-reports' + slug + '"></div>';
162
  tpl += '<div style="text-align:right;width:100%;font-size:0.8em;clear:both;margin-right:5px;margin-top:10px;">';
163
- tpl += gadwp_item_data.i18n[ 14 ];
164
  tpl += ' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_report&utm_medium=link&utm_content=back_report&utm_campaign=gadwp" rel="nofollow" style="text-decoration:none;font-size:1em;">GADWP</a>&nbsp;';
165
  tpl += '</div>';
166
  tpl += '</div>',
167
 
168
  jQuery( '#gadwp-window' + slug ).append( tpl );
169
 
170
- template.addOptions( '#gadwp-sel-view' + slug, gadwp_item_data.viewList );
171
- template.addOptions( '#gadwp-sel-period' + slug, gadwp_item_data.dateList );
172
- template.addOptions( '#gadwp-sel-report' + slug, gadwp_item_data.reportList );
173
 
174
  }
175
  }
176
 
177
- var reports = {
178
- npcounter : 0,
179
- prs : '',
180
- trafficchannels : '',
181
- trafficmediums : '',
182
- traffictype : '',
183
- trafficorganic : '',
184
- socialnetworks : '',
185
- locations : '',
186
- mainchart : '',
187
- bottomstats : '',
188
  realtime : '',
189
- realtime_running : null,
 
190
 
191
  getTitle : function ( scope ) {
192
  if ( scope == 'admin-item' ) {
@@ -207,88 +198,163 @@ jQuery.fn.extend( {
207
  jQuery( "#gadwp-status" + slug ).html( msg );
208
  },
209
 
210
- drawprs : function ( gadwp_prs ) {
211
- var chart_data = google.visualization.arrayToDataTable( gadwp_prs );
212
- var options = {
213
- page : 'enable',
214
- pageSize : 10,
215
- width : '100%',
216
- allowHtml : true
217
- };
218
- var chart = new google.visualization.Table( document.getElementById( 'gadwp-prs' + slug ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
 
220
- chart.draw( chart_data, options );
221
  },
222
 
223
- drawtrafficchannels : function ( gadwp_trafficchannels ) {
224
- var chart_data = google.visualization.arrayToDataTable( gadwp_trafficchannels );
225
- var options = {
226
- allowCollapse : true,
227
- allowHtml : true,
228
- height : '100%'
229
- };
230
- var chart = new google.visualization.OrgChart( document.getElementById( 'gadwp-trafficchannels' + slug ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
 
232
- chart.draw( chart_data, options );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  },
234
 
235
- drawtrafficmediums : function ( gadwp_trafficmediums ) {
236
- var chart_data = google.visualization.arrayToDataTable( gadwp_trafficmediums );
237
- var options = {
238
- is3D : false,
239
- tooltipText : 'percentage',
240
- legend : 'none',
241
- chartArea : {
242
- width : '99%',
243
- height : '80%'
244
- },
245
- title : gadwp_item_data.i18n[ 1 ],
246
- colors : gadwp_item_data.colorVariations
247
- };
248
- var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-trafficmediums' + slug ) );
249
 
250
- chart.draw( chart_data, options );
 
 
 
 
 
 
 
 
 
 
 
 
251
  },
252
 
253
- drawtraffictype : function ( gadwp_traffictype ) {
254
- var chart_data = google.visualization.arrayToDataTable( gadwp_traffictype );
255
- var options = {
256
- is3D : false,
257
- tooltipText : 'percentage',
258
- legend : 'none',
259
- chartArea : {
260
- width : '99%',
261
- height : '80%'
262
- },
263
- title : gadwp_item_data.i18n[ 2 ],
264
- colors : gadwp_item_data.colorVariations
265
  };
266
- var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-traffictype' + slug ) );
267
 
268
- chart.draw( chart_data, options );
269
  },
270
 
271
- drawsocialnetworks : function ( gadwp_socialnetworks ) {
272
- var chart_data = google.visualization.arrayToDataTable( gadwp_socialnetworks );
273
- var options = {
274
- is3D : false,
275
- tooltipText : 'percentage',
276
- legend : 'none',
277
- chartArea : {
278
- width : '99%',
279
- height : '80%'
280
- },
281
- title : gadwp_item_data.i18n[ 3 ],
282
- colors : gadwp_item_data.colorVariations
283
  };
284
- var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-socialnetworks' + slug ) );
285
 
286
- chart.draw( chart_data, options );
287
  },
288
 
289
- drawtrafficorganic : function ( gadwp_trafficorganic ) {
290
- var chart_data = google.visualization.arrayToDataTable( gadwp_trafficorganic );
291
- var options = {
 
 
292
  is3D : false,
293
  tooltipText : 'percentage',
294
  legend : 'none',
@@ -296,48 +362,40 @@ jQuery.fn.extend( {
296
  width : '99%',
297
  height : '80%'
298
  },
299
- title : gadwp_item_data.i18n[ 4 ],
300
- colors : gadwp_item_data.colorVariations
 
301
  };
302
- var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-trafficorganic' + slug ) );
303
 
304
- chart.draw( chart_data, options );
305
  },
306
 
307
- drawlocations : function ( gadwp_locations ) {
308
- var chart_data = google.visualization.arrayToDataTable( gadwp_locations );
309
- var options = {
310
- page : 'enable',
311
- pageSize : 10,
312
- width : '100%'
313
- };
314
- var chart = new google.visualization.Table( document.getElementById( 'gadwp-locations' + slug ) );
315
 
316
- chart.draw( chart_data, options );
317
- },
318
-
319
- drawmaplocations : function ( gadwp_locations ) {
320
- var chart_data = google.visualization.arrayToDataTable( gadwp_locations );
321
- var options = {
322
  chartArea : {
323
  width : '99%',
324
  height : '90%'
325
  },
326
- colors : [ gadwp_item_data.colorVariations[ 5 ], gadwp_item_data.colorVariations[ 4 ] ]
327
  }
328
- if ( gadwp_item_data.region ) {
329
- options.region = gadwp_item_data.region;
330
  options.displayMode = 'markers';
331
  options.datalessRegionColor = 'EFEFEF';
332
  }
333
- var chart = new google.visualization.GeoChart( document.getElementById( 'gadwp-map' + slug ) );
334
 
335
- chart.draw( chart_data, options );
336
  },
337
 
338
- drawmainchart : function ( gadwp_mainchart, format ) {
339
- var chart_data = google.visualization.arrayToDataTable( gadwp_mainchart );
340
- var formatter;
 
341
 
342
  if ( format ) {
343
  formatter = new google.visualization.NumberFormat( {
@@ -345,15 +403,15 @@ jQuery.fn.extend( {
345
  fractionDigits : 2
346
  } );
347
 
348
- formatter.format( chart_data, 1 );
349
  }
350
 
351
- var options = {
352
  legend : {
353
  position : 'none'
354
  },
355
  pointSize : 3,
356
- colors : [ gadwp_item_data.colorVariations[ 0 ], gadwp_item_data.colorVariations[ 4 ] ],
357
  chartArea : {
358
  width : '99%',
359
  height : '90%'
@@ -366,44 +424,41 @@ jQuery.fn.extend( {
366
  textPosition : 'none'
367
  }
368
  };
369
- var chart = new google.visualization.AreaChart( document.getElementById( 'gadwp-mainchart' + slug ) );
370
 
371
- chart.draw( chart_data, options );
372
  },
373
 
374
- drawbottomstats : function ( gadwp_bottomstats ) {
375
- jQuery( "#gdsessions" + slug ).text( gadwp_bottomstats[ 0 ] );
376
- jQuery( "#gdusers" + slug ).text( gadwp_bottomstats[ 1 ] );
377
- jQuery( "#gdpageviews" + slug ).text( gadwp_bottomstats[ 2 ] );
378
- jQuery( "#gdbouncerate" + slug ).text( gadwp_bottomstats[ 3 ] + "%" );
379
- jQuery( "#gdorganicsearch" + slug ).text( gadwp_bottomstats[ 4 ] );
380
- jQuery( "#gdpagespervisit" + slug ).text( gadwp_bottomstats[ 5 ] );
381
  },
382
 
383
- rt_onlyUniqueValues : function ( value, index, self ) {
384
  return self.indexOf( value ) === index;
385
  },
386
 
387
- rt_countsessions : function ( gadwp_realtime, searchvalue ) {
388
- var count = 0;
389
- var i = 0;
390
 
391
- for ( i = 0; i < gadwp_realtime[ "rows" ].length; i = i + 1 ) {
392
- if ( jQuery.inArray( searchvalue, gadwp_realtime[ "rows" ][ i ] ) > -1 ) {
393
- count += parseInt( gadwp_realtime[ "rows" ][ i ][ 6 ] );
394
  }
395
  }
396
  return count;
397
  },
398
 
399
- rt_generatetooltip : function ( gadwp_realtime ) {
400
- var count = 0;
401
- var table = "";
402
- var i = 0;
403
 
404
- for ( i = 0; i < gadwp_realtime.length; i = i + 1 ) {
405
- count += parseInt( gadwp_realtime[ i ].count );
406
- table += "<tr><td class='gadwp-pgdetailsl'>" + gadwp_realtime[ i ].value + "</td><td class='gadwp-pgdetailsr'>" + gadwp_realtime[ i ].count + "</td></tr>";
407
  }
408
  ;
409
  if ( count ) {
@@ -413,102 +468,69 @@ jQuery.fn.extend( {
413
  }
414
  },
415
 
416
- rt_pagedetails : function ( gadwp_realtime, searchvalue ) {
417
- var sant;
418
- var i = 0;
419
- var j = 0;
420
- var sum = 0;
421
- var newsum = 0;
422
- var newgadwp_realtime = [];
423
- var countrfr = 0;
424
- var countkwd = 0;
425
- var countdrt = 0;
426
- var countscl = 0;
427
- var countcpg = 0;
428
- var tablerfr = "";
429
- var tablekwd = "";
430
- var tablescl = "";
431
- var tablecpg = "";
432
- var tabledrt = "";
433
- var pagetitle;
434
- var pgstatstable;
435
-
436
- for ( i = 0; i < gadwp_realtime[ "rows" ].length; i = i + 1 ) {
437
- sant = 1;
438
- for ( j = 0; j < newgadwp_realtime.length; j = j + 1 ) {
439
- jQuery.each( gadwp_realtime[ "rows" ][ i ], function () {
440
- sum += parseFloat( this ) || 0;
441
- } );
442
- jQuery.each( newgadwp_realtime[ j ], function () {
443
- newsum += parseFloat( this ) || 0;
444
- } );
445
- if ( sum == newsum ) {
446
- newgadwp_realtime[ j ][ 6 ] = parseInt( newgadwp_realtime[ j ][ 6 ] ) + parseInt( gadwp_realtime[ "rows" ][ i ][ 6 ] );
447
- sant = 0;
448
- }
449
- }
450
- if ( sant ) {
451
- newgadwp_realtime.push( gadwp_realtime[ "rows" ][ i ].slice() );
452
- }
453
- }
454
 
455
- for ( i = 0; i < newgadwp_realtime.length; i = i + 1 ) {
456
- if ( newgadwp_realtime[ i ][ 0 ] == searchvalue ) {
457
- pagetitle = newgadwp_realtime[ i ][ 5 ];
458
 
459
- switch ( newgadwp_realtime[ i ][ 3 ] ) {
460
 
461
  case "REFERRAL":
462
- countrfr += parseInt( newgadwp_realtime[ i ][ 6 ] );
463
- tablerfr += "<tr><td class='gadwp-pgdetailsl'>" + newgadwp_realtime[ i ][ 1 ] + "</td><td class='gadwp-pgdetailsr'>" + newgadwp_realtime[ i ][ 6 ] + "</td></tr>";
464
  break;
465
  case "ORGANIC":
466
- countkwd += parseInt( newgadwp_realtime[ i ][ 6 ] );
467
- tablekwd += "<tr><td class='gadwp-pgdetailsl'>" + newgadwp_realtime[ i ][ 2 ] + "</td><td class='gadwp-pgdetailsr'>" + newgadwp_realtime[ i ][ 6 ] + "</td></tr>";
468
  break;
469
  case "SOCIAL":
470
- countscl += parseInt( newgadwp_realtime[ i ][ 6 ] );
471
- tablescl += "<tr><td class='gadwp-pgdetailsl'>" + newgadwp_realtime[ i ][ 1 ] + "</td><td class='gadwp-pgdetailsr'>" + newgadwp_realtime[ i ][ 6 ] + "</td></tr>";
472
  break;
473
  case "CUSTOM":
474
- countcpg += parseInt( newgadwp_realtime[ i ][ 6 ] );
475
- tablecpg += "<tr><td class='gadwp-pgdetailsl'>" + newgadwp_realtime[ i ][ 1 ] + "</td><td class='gadwp-pgdetailsr'>" + newgadwp_realtime[ i ][ 6 ] + "</td></tr>";
476
  break;
477
  case "DIRECT":
478
- countdrt += parseInt( newgadwp_realtime[ i ][ 6 ] );
479
  break;
480
  }
481
  }
482
  }
483
 
484
  if ( countrfr ) {
485
- tablerfr = "<table><tr><td>" + gadwp_item_data.i18n_realtime[ 0 ] + "(" + countrfr + ")</td></tr>" + tablerfr + "</table><br />";
486
  }
487
  if ( countkwd ) {
488
- tablekwd = "<table><tr><td>" + gadwp_item_data.i18n_realtime[ 1 ] + "(" + countkwd + ")</td></tr>" + tablekwd + "</table><br />";
489
  }
490
  if ( countscl ) {
491
- tablescl = "<table><tr><td>" + gadwp_item_data.i18n_realtime[ 2 ] + "(" + countscl + ")</td></tr>" + tablescl + "</table><br />";
492
  }
493
  if ( countcpg ) {
494
- tablecpg = "<table><tr><td>" + gadwp_item_data.i18n_realtime[ 3 ] + "(" + countcpg + ")</td></tr>" + tablecpg + "</table><br />";
495
  }
496
  if ( countdrt ) {
497
- tabledrt = "<table><tr><td>" + gadwp_item_data.i18n_realtime[ 4 ] + "(" + countdrt + ")</td></tr></table><br />";
498
  }
499
- return ( "<p><center><strong>" + pagetitle + "</strong></center></p>" + tablerfr + tablekwd + tablescl + tablecpg + tabledrt );
500
  },
501
 
502
- rt_refresh : function () {
503
  if ( reports.render.focusFlag ) {
504
- post_data.from = false;
505
- post_data.to = false;
506
- post_data.query = 'realtime';
507
- jQuery.post( gadwp_item_data.ajaxurl, post_data, function ( response ) {
508
  if ( jQuery.isArray( response ) ) {
509
  jQuery( '#gadwp-reports' + slug ).show();
510
  reports.realtime = response[ 0 ];
511
- reports.drawrealtime( reports.realtime );
512
  } else {
513
  reports.throwDebug( response );
514
  }
@@ -519,27 +541,8 @@ jQuery.fn.extend( {
519
  }
520
  },
521
 
522
- drawrealtime : function ( gadwp_realtime ) {
523
- var i = 0;
524
- var pagepath = [];
525
- var referrals = [];
526
- var keywords = [];
527
- var social = [];
528
- var visittype = [];
529
- var custom = [];
530
- var upagepathstats = [];
531
- var upagepath;
532
- var pgstatstable = "";
533
- var ureferralsstats = [];
534
- var ureferrals;
535
- var ukeywordsstats = [];
536
- var ukeywords;
537
- var usocialstats = [];
538
- var usocial;
539
- var ucustomstats = [];
540
- var ucustom;
541
- var uvisittype = [ "REFERRAL", "ORGANIC", "SOCIAL", "CUSTOM" ];
542
- var uvisitortype = [ "DIRECT", "NEW" ];
543
 
544
  jQuery( function () {
545
  jQuery( '#gadwp-widget *' ).tooltip( {
@@ -547,20 +550,20 @@ jQuery.fn.extend( {
547
  } );
548
  } );
549
 
550
- gadwp_realtime = gadwp_realtime[ 0 ];
551
 
552
- if ( jQuery.isNumeric( gadwp_realtime ) || typeof gadwp_realtime === "undefined" ) {
553
- gadwp_realtime = [];
554
- gadwp_realtime[ "totalsForAllResults" ] = []
555
- gadwp_realtime[ "totalsForAllResults" ][ "rt:activeUsers" ] = "0";
556
- gadwp_realtime[ "rows" ] = [];
557
  }
558
 
559
- if ( gadwp_realtime[ "totalsForAllResults" ][ "rt:activeUsers" ] !== document.getElementById( "gadwp-online" ).innerHTML ) {
560
  jQuery( "#gadwp-online" ).fadeOut( "slow" );
561
  jQuery( "#gadwp-online" ).fadeOut( 500 );
562
  jQuery( "#gadwp-online" ).fadeOut( "slow", function () {
563
- if ( ( parseInt( gadwp_realtime[ "totalsForAllResults" ][ "rt:activeUsers" ] ) ) < ( parseInt( document.getElementById( "gadwp-online" ).innerHTML ) ) ) {
564
  jQuery( "#gadwp-online" ).css( {
565
  'background-color' : '#FFE8E8'
566
  } );
@@ -569,7 +572,7 @@ jQuery.fn.extend( {
569
  'background-color' : '#E0FFEC'
570
  } );
571
  }
572
- document.getElementById( "gadwp-online" ).innerHTML = gadwp_realtime[ "totalsForAllResults" ][ "rt:activeUsers" ];
573
  } );
574
  jQuery( "#gadwp-online" ).fadeIn( "slow" );
575
  jQuery( "#gadwp-online" ).fadeIn( 500 );
@@ -580,97 +583,99 @@ jQuery.fn.extend( {
580
  } );
581
  }
582
 
583
- if ( gadwp_realtime[ "totalsForAllResults" ][ "rt:activeUsers" ] == 0 ) {
584
- gadwp_realtime[ "rows" ] = [];
585
  }
586
 
587
- for ( i = 0; i < gadwp_realtime[ "rows" ].length; i = i + 1 ) {
588
- pagepath.push( gadwp_realtime[ "rows" ][ i ][ 0 ] );
589
- if ( gadwp_realtime[ "rows" ][ i ][ 3 ] == "REFERRAL" ) {
590
- referrals.push( gadwp_realtime[ "rows" ][ i ][ 1 ] );
591
  }
592
- if ( gadwp_realtime[ "rows" ][ i ][ 3 ] == "ORGANIC" ) {
593
- keywords.push( gadwp_realtime[ "rows" ][ i ][ 2 ] );
594
  }
595
- if ( gadwp_realtime[ "rows" ][ i ][ 3 ] == "SOCIAL" ) {
596
- social.push( gadwp_realtime[ "rows" ][ i ][ 1 ] );
597
  }
598
- if ( gadwp_realtime[ "rows" ][ i ][ 3 ] == "CUSTOM" ) {
599
- custom.push( gadwp_realtime[ "rows" ][ i ][ 1 ] );
600
  }
601
- visittype.push( gadwp_realtime[ "rows" ][ i ][ 3 ] );
602
  }
603
 
604
- upagepath = pagepath.filter( reports.rt_onlyUniqueValues );
605
- for ( i = 0; i < upagepath.length; i = i + 1 ) {
606
- upagepathstats[ i ] = {
607
- "pagepath" : upagepath[ i ],
608
- "count" : reports.rt_countsessions( gadwp_realtime, upagepath[ i ] )
609
  }
610
  }
611
- upagepathstats.sort( function ( a, b ) {
612
  return b.count - a.count
613
  } );
614
 
615
- pgstatstable = "";
616
- for ( i = 0; i < upagepathstats.length; i = i + 1 ) {
617
- if ( i < gadwp_item_data.realtime_maxpages ) {
618
- pgstatstable += '<div class="gadwp-pline"><div class="gadwp-pleft"><a href="#" data-gadwp="' + reports.rt_pagedetails( gadwp_realtime, upagepathstats[ i ].pagepath ) + '">' + upagepathstats[ i ].pagepath.substring( 0, 70 ) + '</a></div><div class="gadwp-pright">' + upagepathstats[ i ].count + '</div></div>';
619
  }
620
  }
621
- document.getElementById( "gadwp-pages" ).innerHTML = '<br /><div class="gadwp-pg">' + pgstatstable + '</div>';
622
 
623
- ureferrals = referrals.filter( reports.rt_onlyUniqueValues );
624
- for ( i = 0; i < ureferrals.length; i = i + 1 ) {
625
- ureferralsstats[ i ] = {
626
- "value" : ureferrals[ i ],
627
- "count" : reports.rt_countsessions( gadwp_realtime, ureferrals[ i ] )
628
  };
629
  }
630
- ureferralsstats.sort( function ( a, b ) {
631
  return b.count - a.count
632
  } );
633
 
634
- ukeywords = keywords.filter( reports.rt_onlyUniqueValues );
635
- for ( i = 0; i < ukeywords.length; i = i + 1 ) {
636
- ukeywordsstats[ i ] = {
637
- "value" : ukeywords[ i ],
638
- "count" : reports.rt_countsessions( gadwp_realtime, ukeywords[ i ] )
639
  };
640
  }
641
- ukeywordsstats.sort( function ( a, b ) {
642
  return b.count - a.count
643
  } );
644
 
645
- usocial = social.filter( reports.rt_onlyUniqueValues );
646
- for ( i = 0; i < usocial.length; i = i + 1 ) {
647
- usocialstats[ i ] = {
648
- "value" : usocial[ i ],
649
- "count" : reports.rt_countsessions( gadwp_realtime, usocial[ i ] )
650
  };
651
  }
652
- usocialstats.sort( function ( a, b ) {
653
  return b.count - a.count
654
  } );
655
 
656
- ucustom = custom.filter( reports.rt_onlyUniqueValues );
657
- for ( i = 0; i < ucustom.length; i = i + 1 ) {
658
- ucustomstats[ i ] = {
659
- "value" : ucustom[ i ],
660
- "count" : reports.rt_countsessions( gadwp_realtime, ucustom[ i ] )
661
  };
662
  }
663
- ucustomstats.sort( function ( a, b ) {
664
  return b.count - a.count
665
  } );
666
 
667
- document.getElementById( "gadwp-tdo-right" ).innerHTML = '<div class="gadwp-bigtext"><a href="#" data-gadwp="' + reports.rt_generatetooltip( ureferralsstats ) + '"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 0 ] + '</a></div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisittype[ 0 ] ) + '</div></div>';
668
- document.getElementById( "gadwp-tdo-right" ).innerHTML += '<div class="gadwp-bigtext"><a href="#" data-gadwp="' + reports.rt_generatetooltip( ukeywordsstats ) + '"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 1 ] + '</a></div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisittype[ 1 ] ) + '</div></div>';
669
- document.getElementById( "gadwp-tdo-right" ).innerHTML += '<div class="gadwp-bigtext"><a href="#" data-gadwp="' + reports.rt_generatetooltip( usocialstats ) + '"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 2 ] + '</a></div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisittype[ 2 ] ) + '</div></div>';
670
- document.getElementById( "gadwp-tdo-right" ).innerHTML += '<div class="gadwp-bigtext"><a href="#" data-gadwp="' + reports.rt_generatetooltip( ucustomstats ) + '"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 3 ] + '</a></div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisittype[ 3 ] ) + '</div></div>';
 
 
 
671
 
672
- document.getElementById( "gadwp-tdo-right" ).innerHTML += '<div class="gadwp-bigtext"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 4 ] + '</div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisitortype[ 0 ] ) + '</div></div>';
673
- document.getElementById( "gadwp-tdo-right" ).innerHTML += '<div class="gadwp-bigtext"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 5 ] + '</div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisitortype[ 1 ] ) + '</div></div>';
674
  },
675
 
676
  throwDebug : function ( response ) {
@@ -682,10 +687,16 @@ jQuery.fn.extend( {
682
  "border-left" : "5px solid red"
683
  } );
684
  if ( response == '-24' ) {
685
- jQuery( "#gadwp-status" + slug ).html( gadwp_item_data.i18n[ 15 ] );
686
  } else {
687
- jQuery( "#gadwp-status" + slug ).html( gadwp_item_data.i18n[ 11 ] );
688
  console.log( "\n********************* GADWP Log ********************* \n\n" + response );
 
 
 
 
 
 
689
  }
690
  },
691
 
@@ -699,24 +710,20 @@ jQuery.fn.extend( {
699
  "text-align" : "center"
700
  } );
701
  if ( response == -21 ) {
702
- jQuery( target ).html( gadwp_item_data.i18n[ 12 ] + ' (' + response + ')' );
703
  } else {
704
- jQuery( target ).html( gadwp_item_data.i18n[ 13 ] + ' (' + response + ')' );
705
  }
706
  },
707
 
708
  render : function ( view, period, query ) {
709
- var projectId;
710
- var from;
711
- var to;
712
- var tpl;
713
- var focusFlag;
714
 
715
  if ( period == 'realtime' ) {
716
  jQuery( '#gadwp-sel-report' + slug ).hide();
717
  } else {
718
  jQuery( '#gadwp-sel-report' + slug ).show();
719
- clearInterval( reports.realtime_running );
720
  }
721
 
722
  jQuery( '#gadwp-status' + slug ).html( '' );
@@ -755,36 +762,36 @@ jQuery.fn.extend( {
755
  break;
756
  }
757
 
758