Google Analytics Dashboard for WP (GADWP) - Version 4.4.3

Version Description

  • Enhancement: further optimization on queries
  • Enhancement: less error prone while running JavaScript
  • Enhancement: GAPI errors handling improvement
  • Enhancement: added GADWP_IP_VERSION constant to force a particular Internet Protocol version when needed
  • Enhancement: run the clean-up method only in settings screen
  • Enhancement: added tabs to Tracking Code page
  • Enhancement: added a new menu item for errors and debugging
  • Enhancement: error alerts for Error & Debug sub-menu
  • Enhancement: disable file cache functionality in GAPI library
  • Enhancement: if cURL is not available fall-back to HTTP streams; cURL is no longer a requirement
  • Enhancement: wp_get_sites limit can now be adjusted through gadwp_sites_limit filter
Download this release

Release Info

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

Code changes from version 4.4.2 to 4.4.3

admin/ajax-actions.php CHANGED
@@ -56,7 +56,7 @@ if (! class_exists('GADASH_Backend_Ajax')) {
56
  die();
57
  }
58
 
59
- if ($GADASH_Config->options['ga_dash_token'] and function_exists('curl_version') and $projectId and $from and $to) {
60
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
61
  global $GADASH_GAPI;
62
  } else {
@@ -99,7 +99,7 @@ if (! class_exists('GADASH_Backend_Ajax')) {
99
  print($GADASH_GAPI->get_mainreport($projectId, $from, $to, $query));
100
  break;
101
  }
102
-
103
  die();
104
  }
105
 
@@ -133,7 +133,7 @@ if (! class_exists('GADASH_Backend_Ajax')) {
133
  die();
134
  }
135
 
136
- if ($GADASH_Config->options['ga_dash_token'] and function_exists('curl_version') and $projectId) {
137
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
138
  global $GADASH_GAPI;
139
  } else {
56
  die();
57
  }
58
 
59
+ if ($GADASH_Config->options['ga_dash_token'] and $projectId and $from and $to) {
60
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
61
  global $GADASH_GAPI;
62
  } else {
99
  print($GADASH_GAPI->get_mainreport($projectId, $from, $to, $query));
100
  break;
101
  }
102
+
103
  die();
104
  }
105
 
133
  die();
134
  }
135
 
136
+ if ($GADASH_Config->options['ga_dash_token'] and $projectId) {
137
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
138
  global $GADASH_GAPI;
139
  } else {
admin/css/ga_dash.css CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  /* Options pages */
2
  table.options {
3
  padding-left: 10px;
@@ -18,7 +24,7 @@ td.title-select {
18
  }
19
 
20
  td.debugging {
21
- width: 150px;
22
  }
23
 
24
  td.info {
@@ -47,10 +53,6 @@ td.title label {
47
  pre.gadash {
48
  }
49
 
50
- .show_hide, .log_data {
51
- display: none;
52
- }
53
-
54
  pre.log_data {
55
  white-space: pre-wrap;
56
  }
@@ -357,4 +359,4 @@ td.roles {
357
  .gadash-wrapper .inside .small-box {
358
  width: 45%;
359
  }
360
- }
1
+ /* Tab navigation */
2
+
3
+ #gadwp-events, #gadwp-custom, #gadwp-advanced, #gadwp-exclude, #gadwp-config{
4
+ display:none;
5
+ }
6
+
7
  /* Options pages */
8
  table.options {
9
  padding-left: 10px;
24
  }
25
 
26
  td.debugging {
27
+ width: 300px;
28
  }
29
 
30
  td.info {
53
  pre.gadash {
54
  }
55
 
 
 
 
 
56
  pre.log_data {
57
  white-space: pre-wrap;
58
  }
359
  .gadash-wrapper .inside .small-box {
360
  width: 45%;
361
  }
362
+ }
admin/dashboard_widgets.php CHANGED
@@ -37,6 +37,25 @@ if (! class_exists('GADASH_Widgets')) {
37
  $this,
38
  'ga_dash_settings_link'
39
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
  function ga_dash_admin_actions()
@@ -67,6 +86,10 @@ if (! class_exists('GADASH_Widgets')) {
67
  'GADASH_Settings',
68
  'tracking_settings'
69
  ));
 
 
 
 
70
  }
71
  }
72
 
@@ -86,6 +109,10 @@ if (! class_exists('GADASH_Widgets')) {
86
  'GADASH_Settings',
87
  'general_settings_network'
88
  ));
 
 
 
 
89
  }
90
  }
91
 
@@ -99,7 +126,8 @@ if (! class_exists('GADASH_Widgets')) {
99
  'toplevel_page_gadash_settings',
100
  'google-analytics_page_gadash_backend_settings',
101
  'google-analytics_page_gadash_frontend_settings',
102
- 'google-analytics_page_gadash_tracking_settings'
 
103
  );
104
 
105
  if (! in_array($hook, $valid_hooks) and 'index.php' != $hook)
@@ -155,11 +183,11 @@ if (! class_exists('GADASH_Widgets')) {
155
  function gadash_dashboard_widgets()
156
  {
157
  global $GADASH_Config;
158
-
159
  /*
160
  * Include GAPI
161
  */
162
- if ($GADASH_Config->options['ga_dash_token'] and function_exists('curl_version')) {
163
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
164
  global $GADASH_GAPI;
165
  } else {
@@ -564,7 +592,7 @@ if (! class_exists('GADASH_Widgets')) {
564
  data["totalsForAllResults"]["rt:activeUsers"] = "0";
565
  data["rows"]= [];
566
  }
567
-
568
  if (data["totalsForAllResults"]["rt:activeUsers"]!==document.getElementById("gadash-online").innerHTML){
569
  jQuery("#gadash-online").fadeOut("slow");
570
  jQuery("#gadash-online").fadeOut(500);
@@ -673,11 +701,28 @@ if (! class_exists('GADASH_Widgets')) {
673
  <div id="gadash-trafficchannels"></div>
674
  <div id="gadash-prs"></div>
675
  <script type="text/javascript">
676
- google.load("visualization", "1", {packages:["table","orgchart"]})
677
- NProgress.configure({ parent: "#gadash-progressbar" });
678
- NProgress.configure({ showSpinner: false });
679
- NProgress.start();
680
- npcounter = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
681
 
682
  jQuery.post(ajaxurl, {action: "gadashadmin_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo $query; ?>",gadashadmin_security_widget_reports: "<?php echo wp_create_nonce('gadashadmin_get_widgetreports'); ?>"}, function(response){
683
 
@@ -708,8 +753,7 @@ if (! class_exists('GADASH_Widgets')) {
708
  var options = {
709
  page: 'enable',
710
  pageSize: 10,
711
- width: '100%',
712
- allowHtml:true
713
  };
714
 
715
  var chart = new google.visualization.Table(document.getElementById('gadash-prs'));
@@ -741,11 +785,28 @@ if (! class_exists('GADASH_Widgets')) {
741
  </div>
742
  <script type="text/javascript">
743
  google.load("visualization", "1", {packages:["corechart","orgchart"]});
744
- NProgress.configure({ parent: "#gadash-progressbar" });
745
- NProgress.configure({ showSpinner: false });
746
- NProgress.start();
747
- npcounter = 0;
748
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
749
  jQuery.post(ajaxurl, {action: "gadashadmin_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "medium",gadashadmin_security_widget_reports: "<?php echo wp_create_nonce('gadashadmin_get_widgetreports'); ?>"}, function(response){
750
 
751
  if (!jQuery.isNumeric(response)){
@@ -888,10 +949,27 @@ if (! class_exists('GADASH_Widgets')) {
888
  <div id="gadash-locations"></div>
889
  <script type="text/javascript">
890
  google.load("visualization", "1", {packages:["geochart","table"]});
891
- NProgress.configure({ parent: "#gadash-progressbar" });
892
- NProgress.configure({ showSpinner: false });
893
- NProgress.start();
894
- npcounter = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
895
 
896
  jQuery.post(ajaxurl, {action: "gadashadmin_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo $query; ?>",gadashadmin_security_widget_reports: "<?php echo wp_create_nonce('gadashadmin_get_widgetreports'); ?>"}, function(response){
897
 
@@ -934,8 +1012,7 @@ if (! class_exists('GADASH_Widgets')) {
934
  var options = {
935
  page: 'enable',
936
  pageSize: 10,
937
- width: '100%',
938
- allowHtml:true
939
  };
940
 
941
  var chart = new google.visualization.Table(document.getElementById('gadash-locations'));
@@ -975,12 +1052,29 @@ if (! class_exists('GADASH_Widgets')) {
975
  </div>
976
  <script type="text/javascript">
977
 
978
- google.load("visualization", "1", {packages:["corechart"]})
979
- NProgress.configure({ parent: "#gadash-progressbar" });
980
- NProgress.configure({ showSpinner: false });
981
- NProgress.start();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
982
  npcounter = 0;
983
-
984
  jQuery.post(ajaxurl, {action: "gadashadmin_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo $query; ?>",gadashadmin_security_widget_reports: "<?php echo wp_create_nonce('gadashadmin_get_widgetreports'); ?>"}, function(response){
985
 
986
  if (!jQuery.isNumeric(response)){
37
  $this,
38
  'ga_dash_settings_link'
39
  ));
40
+ // Add error bubble
41
+ add_action('admin_print_scripts', array(
42
+ $this,
43
+ 'draw_error_bubble'
44
+ ), 10000);
45
+ }
46
+
47
+ function draw_error_bubble()
48
+ {
49
+ $bubble_msg = '!';
50
+ if (get_transient('ga_dash_gapi_errors')) {
51
+ ?>
52
+ <script type="text/javascript">
53
+ jQuery(document).ready(function() {
54
+ jQuery('#toplevel_page_gadash_settings li > a[href*="page=gadash_errors_debugging"]').append('&nbsp;<span class="awaiting-mod count-1"><span class="pending-count" style="padding:0 7px;"><?php echo $bubble_msg ?></span></span>');
55
+ });
56
+ </script>
57
+ <?php
58
+ }
59
  }
60
 
61
  function ga_dash_admin_actions()
86
  'GADASH_Settings',
87
  'tracking_settings'
88
  ));
89
+ add_submenu_page('gadash_settings', __("Errors & Debug", 'ga-dash'), __("Errors & Debug", 'ga-dash'), 'manage_options', 'gadash_errors_debugging', array(
90
+ 'GADASH_Settings',
91
+ 'errors_debugging'
92
+ ));
93
  }
94
  }
95
 
109
  'GADASH_Settings',
110
  'general_settings_network'
111
  ));
112
+ add_submenu_page('gadash_settings', __("Errors & Debug", 'ga-dash'), __("Errors & Debug", 'ga-dash'), 'manage_network', 'gadash_errors_debugging', array(
113
+ 'GADASH_Settings',
114
+ 'errors_debugging'
115
+ ));
116
  }
117
  }
118
 
126
  'toplevel_page_gadash_settings',
127
  'google-analytics_page_gadash_backend_settings',
128
  'google-analytics_page_gadash_frontend_settings',
129
+ 'google-analytics_page_gadash_tracking_settings',
130
+ 'google-analytics_page_gadash_errors_debugging'
131
  );
132
 
133
  if (! in_array($hook, $valid_hooks) and 'index.php' != $hook)
183
  function gadash_dashboard_widgets()
184
  {
185
  global $GADASH_Config;
186
+
187
  /*
188
  * Include GAPI
189
  */
190
+ if ($GADASH_Config->options['ga_dash_token']) {
191
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
192
  global $GADASH_GAPI;
193
  } else {
592
  data["totalsForAllResults"]["rt:activeUsers"] = "0";
593
  data["rows"]= [];
594
  }
595
+
596
  if (data["totalsForAllResults"]["rt:activeUsers"]!==document.getElementById("gadash-online").innerHTML){
597
  jQuery("#gadash-online").fadeOut("slow");
598
  jQuery("#gadash-online").fadeOut(500);
701
  <div id="gadash-trafficchannels"></div>
702
  <div id="gadash-prs"></div>
703
  <script type="text/javascript">
704
+ google.load("visualization", "1", {packages:["table","orgchart"]});
705
+
706
+ function checknpcounter(max) {
707
+ try {
708
+ if (npcounter == max) {
709
+ NProgress.done();
710
+ } else {
711
+ npcounter++;
712
+ NProgress.set((1/(max+1))*npcounter);
713
+ }
714
+ } catch(e) {}
715
+ }
716
+
717
+ try {
718
+ NProgress.configure({ parent: "#gadash-progressbar" });
719
+ NProgress.configure({ showSpinner: false });
720
+ NProgress.start();
721
+ } catch(e) {
722
+ jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border":"1px solid red","border-left":"5px solid red"});
723
+ jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'ga-dash'); ?>");
724
+ }
725
+ npcounter = 0;
726
 
727
  jQuery.post(ajaxurl, {action: "gadashadmin_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo $query; ?>",gadashadmin_security_widget_reports: "<?php echo wp_create_nonce('gadashadmin_get_widgetreports'); ?>"}, function(response){
728
 
753
  var options = {
754
  page: 'enable',
755
  pageSize: 10,
756
+ width: '100%'
 
757
  };
758
 
759
  var chart = new google.visualization.Table(document.getElementById('gadash-prs'));
785
  </div>
786
  <script type="text/javascript">
787
  google.load("visualization", "1", {packages:["corechart","orgchart"]});
788
+
789
+ function checknpcounter(max) {
790
+ try {
791
+ if (npcounter == max) {
792
+ NProgress.done();
793
+ } else {
794
+ npcounter++;
795
+ NProgress.set((1/(max+1))*npcounter);
796
+ }
797
+ } catch(e) {}
798
+ }
799
+
800
+ try {
801
+ NProgress.configure({ parent: "#gadash-progressbar" });
802
+ NProgress.configure({ showSpinner: false });
803
+ NProgress.start();
804
+ } catch(e) {
805
+ jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border":"1px solid red","border-left":"5px solid red"});
806
+ jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'ga-dash'); ?>");
807
+ }
808
+ npcounter = 0;
809
+
810
  jQuery.post(ajaxurl, {action: "gadashadmin_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "medium",gadashadmin_security_widget_reports: "<?php echo wp_create_nonce('gadashadmin_get_widgetreports'); ?>"}, function(response){
811
 
812
  if (!jQuery.isNumeric(response)){
949
  <div id="gadash-locations"></div>
950
  <script type="text/javascript">
951
  google.load("visualization", "1", {packages:["geochart","table"]});
952
+
953
+ function checknpcounter(max) {
954
+ try {
955
+ if (npcounter == max) {
956
+ NProgress.done();
957
+ } else {
958
+ npcounter++;
959
+ NProgress.set((1/(max+1))*npcounter);
960
+ }
961
+ } catch(e) {}
962
+ }
963
+
964
+ try {
965
+ NProgress.configure({ parent: "#gadash-progressbar" });
966
+ NProgress.configure({ showSpinner: false });
967
+ NProgress.start();
968
+ } catch(e) {
969
+ jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border":"1px solid red","border-left":"5px solid red"});
970
+ jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'ga-dash'); ?>");
971
+ }
972
+ npcounter = 0;
973
 
974
  jQuery.post(ajaxurl, {action: "gadashadmin_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo $query; ?>",gadashadmin_security_widget_reports: "<?php echo wp_create_nonce('gadashadmin_get_widgetreports'); ?>"}, function(response){
975
 
1012
  var options = {
1013
  page: 'enable',
1014
  pageSize: 10,
1015
+ width: '100%'
 
1016
  };
1017
 
1018
  var chart = new google.visualization.Table(document.getElementById('gadash-locations'));
1052
  </div>
1053
  <script type="text/javascript">
1054
 
1055
+ google.load("visualization", "1", {packages:["corechart"]});
1056
+
1057
+ function checknpcounter(max) {
1058
+ try {
1059
+ if (npcounter == max) {
1060
+ NProgress.done();
1061
+ } else {
1062
+ npcounter++;
1063
+ NProgress.set((1/(max+1))*npcounter);
1064
+ }
1065
+ } catch(e) {}
1066
+ }
1067
+
1068
+ try {
1069
+ NProgress.configure({ parent: "#gadash-progressbar" });
1070
+ NProgress.configure({ showSpinner: false });
1071
+ NProgress.start();
1072
+ } catch(e) {
1073
+ jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border":"1px solid red","border-left":"5px solid red"});
1074
+ jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'ga-dash'); ?>");
1075
+ }
1076
  npcounter = 0;
1077
+
1078
  jQuery.post(ajaxurl, {action: "gadashadmin_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo $query; ?>",gadashadmin_security_widget_reports: "<?php echo wp_create_nonce('gadashadmin_get_widgetreports'); ?>"}, function(response){
1079
 
1080
  if (!jQuery.isNumeric(response)){
admin/ga_dash_settings.php CHANGED
@@ -62,6 +62,16 @@ final class GADASH_Settings
62
  return $options;
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
65
  public static function frontend_settings()
66
  {
67
  global $GADASH_Config;
@@ -70,13 +80,13 @@ final class GADASH_Settings
70
  }
71
  $options = self::set_get_options('frontend');
72
  if (isset($_POST['options']['ga_dash_hidden'])) {
73
- $message = "<div class='updated'><p><strong>" . __("Settings saved.", 'ga-dash') . "</strong></p></div>";
74
  if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
75
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
76
  }
77
  }
78
  if (! $GADASH_Config->options['ga_dash_tableid_jail'] or ! $GADASH_Config->options['ga_dash_token']) {
79
- $message = "<div class='error'><p><strong>" . __("Something went wrong, you need to", 'ga-dash') . "</strong> <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('auhorize the plugin', 'ga-dash') . "</a><strong> " . __("or properly configure your", 'ga-dash') . '</strong> <a href="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" target="_blank">' . __('Google Analytics account', 'ga-dash') . "</a>" . "<stong>!</strong></p></div>";
80
  }
81
  ?>
82
  <form name="ga_dash_form" method="post"
@@ -126,10 +136,6 @@ final class GADASH_Settings
126
  }
127
  }
128
  ?>
129
-
130
-
131
-
132
-
133
  </table>
134
  </td>
135
  </tr>
@@ -175,10 +181,6 @@ final class GADASH_Settings
175
  </table>
176
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
177
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
178
-
179
-
180
-
181
-
182
  </form>
183
  <?php
184
  self::output_sidebar();
@@ -192,13 +194,13 @@ final class GADASH_Settings
192
  }
193
  $options = self::set_get_options('backend');
194
  if (isset($_POST['options']['ga_dash_hidden'])) {
195
- $message = "<div class='updated'><p><strong>" . __("Settings saved.", 'ga-dash') . "</strong></p></div>";
196
  if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
197
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
198
  }
199
  }
200
  if (! $GADASH_Config->options['ga_dash_tableid_jail'] or ! $GADASH_Config->options['ga_dash_token']) {
201
- $message = "<div class='error'><p><strong>" . __("Something went wrong, you need to", 'ga-dash') . "</strong> <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('auhorize the plugin', 'ga-dash') . "</a><strong> " . __("or properly configure your", 'ga-dash') . '</strong> <a href="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" target="_blank">' . __('Google Analytics account', 'ga-dash') . "</a>" . "<stong>!</strong></p></div>";
202
  }
203
  ?>
204
  <form name="ga_dash_form" method="post"
@@ -248,10 +250,6 @@ final class GADASH_Settings
248
  }
249
  }
250
  ?>
251
-
252
-
253
-
254
-
255
  </table>
256
  </td>
257
  </tr>
@@ -282,7 +280,7 @@ final class GADASH_Settings
282
  <?php echo '('.__("find out more", 'ga-dash')?> <a
283
  href="https://deconf.com/google-analytics-dashboard-real-time-reports/"
284
  target="_blank"><?php _e("about this feature", 'ga-dash') ?></a>
285
- )
286
  </td>
287
  </tr>
288
  <tr>
@@ -313,10 +311,6 @@ final class GADASH_Settings
313
  </table>
314
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
315
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
316
-
317
-
318
-
319
-
320
  </form>
321
  <?php
322
  self::output_sidebar();
@@ -335,321 +329,343 @@ final class GADASH_Settings
335
  }
336
  $options = self::set_get_options('tracking');
337
  if (isset($_POST['options']['ga_dash_hidden'])) {
338
- $message = "<div class='updated'><p><strong>" . __("Settings saved.", 'ga-dash') . "</strong></p></div>";
339
  if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
340
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
341
  }
342
  }
343
- if (! $GADASH_Config->options['ga_dash_tableid_jail'] or ! $GADASH_Config->options['ga_dash_token']) {
344
- $message = "<div class='error'><p><strong>" . __("Something went wrong, you need to", 'ga-dash') . "</strong> <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('auhorize the plugin', 'ga-dash') . "</a><strong> " . __("or properly configure your", 'ga-dash') . '</strong> <a href="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" target="_blank">' . __('Google Analytics account', 'ga-dash') . "</a>" . "<stong>!</strong></p></div>";
345
  }
 
 
 
 
 
346
  ?>
347
  <form name="ga_dash_form" method="post"
348
  action="<?php esc_url($_SERVER['REQUEST_URI']); ?>">
349
  <div class="wrap">
350
- <?php echo "<h2>" . __( "Google Analytics Tracking Code", 'ga-dash' ) . "</h2>"; ?><hr>
351
  </div>
 
352
  <div id="poststuff">
353
  <div id="post-body" class="metabox-holder columns-2">
354
  <div id="post-body-content">
355
  <div class="settings-wrapper">
356
  <div class="inside">
 
 
 
 
 
 
 
 
 
 
357
  <?php if (isset($message)) echo $message; ?>
358
- <table class="options">
359
- <tr>
360
- <td colspan="2"><?php echo "<h2>" . __( "Tracking Settings", 'ga-dash' ) . "</h2>"; ?></td>
361
- </tr>
362
- <tr>
363
- <td class="title"><label for="ga_dash_tracking"><?php _e("Tracking Options:", 'ga-dash' ); ?></label></td>
364
- <td><select id="ga_dash_tracking"
365
- name="options[ga_dash_tracking]" onchange="this.form.submit()">
366
- <option value="0"
367
- <?php selected( $options['ga_dash_tracking'], 0 ); ?>><?php _e("Disabled", 'ga-dash');?></option>
368
- <option value="1"
369
- <?php selected( $options['ga_dash_tracking'], 1 ); ?>><?php _e("Enabled", 'ga-dash');?></option>
370
- </select></td>
371
- </tr>
372
- <?php
373
- if ($options['ga_dash_tracking'] == 1) {
374
- ?>
375
- <tr>
376
- <td class="title"></td>
377
- <td><?php
378
- $profile_info = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $GADASH_Config->options['ga_dash_tableid_jail']);
379
- echo '<pre>' . __("View Name:", 'ga-dash') . "\t" . esc_html($profile_info[0]) . "<br />" . __("Tracking ID:", 'ga-dash') . "\t" . esc_html($profile_info[2]) . "<br />" . __("Default URL:", 'ga-dash') . "\t" . esc_html($profile_info[3]) . "<br />" . __("Time Zone:", 'ga-dash') . "\t" . esc_html($profile_info[5]) . '</pre>';
380
- ?></td>
381
- </tr>
382
- <?php
383
- }
384
- if ($options['ga_dash_tracking']) {
385
- ?>
386
- <tr>
387
- <td colspan="2"><hr><?php echo "<h2>" . __( "Basic Tracking", 'ga-dash' ) . "</h2>"; ?></td>
388
- </tr>
389
- <?php
390
- if ($options['ga_dash_tracking'] == 1) {
391
- ?>
392
- <tr>
393
- <td class="title"><label for="ga_dash_tracking_type"><?php _e("Tracking Type:", 'ga-dash' ); ?></label></td>
394
- <td><select id="ga_dash_tracking_type"
395
- name="options[ga_dash_tracking_type]">
396
- <option value="classic"
397
- <?php selected( $options['ga_dash_tracking_type'], 'classic' ); ?>><?php _e("Classic Analytics", 'ga-dash');?></option>
398
- <option value="universal"
399
- <?php selected( $options['ga_dash_tracking_type'], 'universal' ); ?>><?php _e("Universal Analytics", 'ga-dash');?></option>
400
- </select></td>
401
- </tr>
402
- <tr>
403
- <td colspan="2" class="title">
404
- <div class="onoffswitch">
405
- <input type="checkbox" name="options[ga_dash_anonim]"
406
- value="1" class="onoffswitch-checkbox" id="ga_dash_anonim"
407
- <?php checked( $options['ga_dash_anonim'], 1 ); ?>> <label
408
- class="onoffswitch-label" for="ga_dash_anonim">
409
- <div class="onoffswitch-inner"></div>
410
- <div class="onoffswitch-switch"></div>
411
- </label>
412
- </div>
413
- <div class="switch-desc"><?php _e ( " anonymize IPs while tracking", 'ga-dash' );?></div>
414
- </td>
415
- </tr>
416
- <tr>
417
- <td colspan="2" class="title">
418
- <div class="onoffswitch">
419
- <input type="checkbox" name="options[ga_dash_remarketing]"
420
- value="1" class="onoffswitch-checkbox"
421
- id="ga_dash_remarketing"
422
- <?php checked( $options['ga_dash_remarketing'], 1 ); ?>> <label
423
- class="onoffswitch-label" for="ga_dash_remarketing">
424
- <div class="onoffswitch-inner"></div>
425
- <div class="onoffswitch-switch"></div>
426
- </label>
427
- </div>
428
- <div class="switch-desc"><?php _e ( " enable remarketing, demographics and interests reports", 'ga-dash' );?></div>
429
- </td>
430
- </tr>
431
- <tr>
432
- <td colspan="2"><hr><?php echo "<h2>" . __( "Events Tracking", 'ga-dash' ) . "</h2>"; ?></td>
433
- </tr>
434
- <tr>
435
- <td colspan="2" class="title">
436
- <div class="onoffswitch">
437
- <input type="checkbox" name="options[ga_event_tracking]"
438
- value="1" class="onoffswitch-checkbox" id="ga_event_tracking"
439
- <?php checked( $options['ga_event_tracking'], 1 ); ?>> <label
440
- class="onoffswitch-label" for="ga_event_tracking">
441
- <div class="onoffswitch-inner"></div>
442
- <div class="onoffswitch-switch"></div>
443
- </label>
444
- </div>
445
- <div class="switch-desc"><?php _e(" track downloads, mailto and outbound links", 'ga-dash' ); ?></div>
446
- </td>
447
- </tr>
448
- <tr>
449
- <td class="title"><label for="ga_event_downloads"><?php _e("Downloads Regex:", 'ga-dash'); ?></label></td>
450
- <td><input type="text" id="ga_event_downloads"
451
- name="options[ga_event_downloads]"
452
- value="<?php echo esc_attr($options['ga_event_downloads']); ?>"
453
- size="50"></td>
454
- </tr>
455
- <tr>
456
- <td colspan="2" class="title">
457
- <div class="onoffswitch">
458
- <input type="checkbox" name="options[ga_aff_tracking]"
459
- value="1" class="onoffswitch-checkbox" id="ga_aff_tracking"
460
- <?php checked( $options['ga_aff_tracking'], 1 ); ?>> <label
461
- class="onoffswitch-label" for="ga_aff_tracking">
462
- <div class="onoffswitch-inner"></div>
463
- <div class="onoffswitch-switch"></div>
464
- </label>
465
- </div>
466
- <div class="switch-desc"><?php _e(" track affiliate links matching this regex", 'ga-dash' ); ?></div>
467
- </td>
468
- </tr>
469
- <tr>
470
- <td class="title"><label for="ga_event_affiliates"><?php _e("Affiliates Regex:", 'ga-dash'); ?></label></td>
471
- <td><input type="text" id="ga_event_affiliates"
472
- name="options[ga_event_affiliates]"
473
- value="<?php echo esc_attr($options['ga_event_affiliates']); ?>"
474
- size="50"></td>
475
- </tr>
476
- <tr>
477
- <td colspan="2" class="title">
478
- <div class="onoffswitch">
479
- <input type="checkbox" name="options[ga_hash_tracking]"
480
- value="1" class="onoffswitch-checkbox" id="ga_hash_tracking"
481
- <?php checked( $options['ga_hash_tracking'], 1 ); ?>> <label
482
- class="onoffswitch-label" for="ga_hash_tracking">
483
- <div class="onoffswitch-inner"></div>
484
- <div class="onoffswitch-switch"></div>
485
- </label>
486
- </div>
487
- <div class="switch-desc"><?php _e(" track fragment identifiers, hashmarks (#) in URI links", 'ga-dash' ); ?></div>
488
- </td>
489
- </tr>
490
- <tr>
491
- <td colspan="2"><hr><?php echo "<h2>" . __( "Custom Definitions", 'ga-dash' ) . "</h2>"; ?></td>
492
- </tr>
493
- <tr>
494
- <td class="title"><label for="ga_author_dimindex"><?php _e("Authors:", 'ga-dash' ); ?></label></td>
495
- <td><select id="ga_author_dimindex"
496
- name="options[ga_author_dimindex]">
 
 
 
497
  <?php for ($i=0;$i<21;$i++){?>
498
  <option value="<?php echo $i;?>"
499
- <?php selected( $options['ga_author_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
500
  <?php } ?>
501
  </select></td>
502
- </tr>
503
- <tr>
504
- <td class="title"><label for="ga_pubyear_dimindex"><?php _e("Publication Year:", 'ga-dash' ); ?></label></td>
505
- <td><select id="ga_pubyear_dimindex"
506
- name="options[ga_pubyear_dimindex]">
507
  <?php for ($i=0;$i<21;$i++){?>
508
  <option value="<?php echo $i;?>"
509
- <?php selected( $options['ga_pubyear_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
510
  <?php } ?>
511
  </select></td>
512
- </tr>
513
- <tr>
514
- <td class="title"><label for="ga_category_dimindex"><?php _e("Categories:", 'ga-dash' ); ?></label></td>
515
- <td><select id="ga_category_dimindex"
516
- name="options[ga_category_dimindex]">
517
  <?php for ($i=0;$i<21;$i++){?>
518
  <option value="<?php echo $i;?>"
519
- <?php selected( $options['ga_category_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
520
  <?php } ?>
521
  </select></td>
522
- </tr>
523
- <tr>
524
- <td class="title"><label for="ga_user_dimindex"><?php _e("User Type:", 'ga-dash' ); ?></label></td>
525
- <td><select id="ga_user_dimindex"
526
- name="options[ga_user_dimindex]">
527
  <?php for ($i=0;$i<21;$i++){?>
528
  <option value="<?php echo $i;?>"
529
- <?php selected( $options['ga_user_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
530
  <?php } ?>
531
  </select></td>
532
- </tr>
533
- <tr>
534
- <td colspan="2"><hr><?php echo "<h2>" . __( "Advanced Tracking", 'ga-dash' ) . "</h2>"; ?></td>
535
- </tr>
536
- <tr>
537
- <td class="title"><label for="ga_speed_samplerate"><?php _e("Page Speed SR:", 'ga-dash'); ?></label></td>
538
- <td><input type="number" id="ga_speed_samplerate"
539
- name="options[ga_speed_samplerate]"
540
- value="<?php echo (int)($options['ga_speed_samplerate']); ?>"
541
- max="100" min="1"> %</td>
542
- </tr>
543
- <tr>
544
- <td colspan="2" class="title">
545
- <div class="onoffswitch">
546
- <input type="checkbox" name="options[ga_event_bouncerate]"
547
- value="1" class="onoffswitch-checkbox"
548
- id="ga_event_bouncerate"
549
- <?php checked( $options['ga_event_bouncerate'], 1 ); ?>> <label
550
- class="onoffswitch-label" for="ga_event_bouncerate">
551
- <div class="onoffswitch-inner"></div>
552
- <div class="onoffswitch-switch"></div>
553
- </label>
554
- </div>
555
- <div class="switch-desc"><?php _e ( " exclude events from bounce-rate calculation", 'ga-dash' );?></div>
556
- </td>
557
- </tr>
558
- <tr>
559
- <td colspan="2" class="title">
560
- <div class="onoffswitch">
561
- <input type="checkbox" name="options[ga_enhanced_links]"
562
- value="1" class="onoffswitch-checkbox" id="ga_enhanced_links"
563
- <?php checked( $options['ga_enhanced_links'], 1 ); ?>> <label
564
- class="onoffswitch-label" for="ga_enhanced_links">
565
- <div class="onoffswitch-inner"></div>
566
- <div class="onoffswitch-switch"></div>
567
- </label>
568
- </div>
569
- <div class="switch-desc"><?php _e ( " enable enhanced link attribution", 'ga-dash' );?></div>
570
- </td>
571
- </tr>
572
- <tr>
573
- <td colspan="2" class="title">
574
- <div class="onoffswitch">
575
- <input type="checkbox" name="options[ga_dash_adsense]"
576
- value="1" class="onoffswitch-checkbox" id="ga_dash_adsense"
577
- <?php checked( $options['ga_dash_adsense'], 1 ); ?>> <label
578
- class="onoffswitch-label" for="ga_dash_adsense">
579
- <div class="onoffswitch-inner"></div>
580
- <div class="onoffswitch-switch"></div>
581
- </label>
582
- </div>
583
- <div class="switch-desc"><?php _e ( " enable AdSense account linking", 'ga-dash' );?></div>
584
- </td>
585
- </tr>
586
- <tr>
587
- <td colspan="2" class="title">
588
- <div class="onoffswitch">
589
- <input type="checkbox" name="options[ga_crossdomain_tracking]"
590
- value="1" class="onoffswitch-checkbox"
591
- id="ga_crossdomain_tracking"
592
- <?php checked( $options['ga_crossdomain_tracking'], 1 ); ?>>
593
- <label class="onoffswitch-label" for="ga_crossdomain_tracking">
594
- <div class="onoffswitch-inner"></div>
595
- <div class="onoffswitch-switch"></div>
596
- </label>
597
- </div>
598
- <div class="switch-desc"><?php _e(" enable cross domain tracking", 'ga-dash' ); ?></div>
599
- </td>
600
- </tr>
601
- <tr>
602
- <td class="title"><label for="ga_crossdomain_list"><?php _e("Cross Domains:", 'ga-dash'); ?></label></td>
603
- <td><input type="text" id="ga_crossdomain_list"
604
- name="options[ga_crossdomain_list]"
605
- value="<?php echo esc_attr($options['ga_crossdomain_list']); ?>"
606
- size="50"></td>
607
- </tr>
608
- <?php
609
- }
610
- ?>
611
- <tr>
612
- <td colspan="2"><hr><?php echo "<h2>" . __( "Exclude Tracking", 'ga-dash' ) . "</h2>"; ?></td>
613
- </tr>
614
- <tr>
615
- <td class="roles title"><label for="ga_track_exclude"><?php _e("Exclude tracking for:", 'ga-dash' ); ?></label></td>
616
- <td class="roles">
 
 
 
 
 
 
 
617
  <?php
618
- if (! isset($wp_roles)) {
619
- $wp_roles = new WP_Roles();
620
- }
621
- $i = 0;
622
- ?> <table>
623
- <tr>
624
  <?php
625
- foreach ($wp_roles->role_names as $role => $name) {
626
- $i ++;
627
- ?>
628
  <td><label> <input type="checkbox"
629
- name="options[ga_track_exclude][]"
630
- value="<?php echo $role; ?>"
631
- <?php if (in_array($role,$options['ga_track_exclude'])) echo 'checked="checked"'; ?> />
632
  <?php echo $name; ?>
633
  </label></td>
634
  <?php
635
- if ($i % 4 == 0) {
636
- ?>
637
  </tr>
638
- <tr>
639
  <?php
640
- }
641
  }
642
- ?>
643
-
644
-
645
-
646
-
647
- </table>
648
- </td>
649
- </tr>
650
- <?php
651
  }
652
- ?>
 
 
 
 
 
 
653
  <tr>
654
  <td colspan="2"><hr></td>
655
  </tr>
@@ -661,55 +677,153 @@ final class GADASH_Settings
661
  </table>
662
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
663
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
664
-
665
-
666
-
667
-
668
  </form>
669
  <?php
670
  self::output_sidebar();
671
  }
672
 
673
- public static function general_settings()
674
  {
675
  global $GADASH_Config;
676
- global $wp_version;
677
- /*
678
- * Include Tools
679
- */
680
- include_once ($GADASH_Config->plugin_path . '/tools/tools.php');
681
- $tools = new GADASH_Tools();
682
  if (! current_user_can('manage_options')) {
683
  return;
684
  }
685
- $options = self::set_get_options('general');
686
- /*
687
- * Include GAPI
688
- */
689
- echo '<div id="gapi-warning" class="updated"><p><strong>' . __('Loading the required libraries. If this results in a blank screen or a fatal error, try this solution:', "ga-dash") . ' </strong><a href="https://deconf.com/ask/question/ga-dashboard-absolutely-empty-general-settings#answer-770">Library conflicts between WordPress plugins</a></p></div>';
690
- include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
691
- global $GADASH_GAPI;
692
- echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
693
- if (isset($_POST['ga_dash_code'])) {
694
- if (! stripos('x' . $_POST['ga_dash_code'], 'UA-', 1) == 1) {
695
- try {
696
- $GADASH_GAPI->client->authenticate($_POST['ga_dash_code']);
697
- $GADASH_Config->options['ga_dash_token'] = $GADASH_GAPI->client->getAccessToken();
698
- $google_token = json_decode($GADASH_GAPI->client->getAccessToken());
699
- $GADASH_Config->options['ga_dash_refresh_token'] = $google_token->refresh_token;
700
- $GADASH_Config->set_plugin_options();
701
- $message = "<div class='updated'><p><strong>" . __("Plugin authorization succeeded.", 'ga-dash') . "</strong></p></div>";
702
- $options = self::set_get_options('general');
703
- delete_transient('ga_dash_gapi_errors');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
704
  } catch (Google_IO_Exception $e) {
705
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e));
706
  return false;
707
  } catch (Google_Service_Exception $e) {
708
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()));
709
- set_transient('ga_dash_gapi_errors', $e->getErrors(), $this->error_timeout);
710
  return $e->getCode();
711
  } catch (Exception $e) {
712
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e) . "\nResponseHttpCode:" . $e->getCode());
713
  $GADASH_GAPI->ga_dash_reset_token(false);
714
  }
715
  } else {
@@ -717,7 +831,6 @@ final class GADASH_Settings
717
  }
718
  }
719
 
720
- if (function_exists('curl_version')) {
721
  if ($GADASH_GAPI->client->getAccessToken()) {
722
  if ($GADASH_Config->options['ga_dash_profile_list']) {
723
  $profiles = $GADASH_Config->options['ga_dash_profile_list'];
@@ -735,61 +848,57 @@ final class GADASH_Settings
735
  $options = self::set_get_options('general');
736
  }
737
  }
738
- }
739
  if (isset($_POST['Clear'])) {
740
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
741
  $tools->ga_dash_clear_cache();
742
- $message = "<div class='updated'><p><strong>" . __("Cleared Cache.", 'ga-dash') . "</strong></p></div>";
743
  } else {
744
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
745
  }
746
  }
747
  if (isset($_POST['Reset'])) {
748
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
749
  $GADASH_GAPI->ga_dash_reset_token(true);
750
  $tools->ga_dash_clear_cache();
751
- $message = "<div class='updated'><p><strong>" . __("Token Reseted and Revoked.", 'ga-dash') . "</strong></p></div>";
752
  $options = self::set_get_options('Reset');
753
  } else {
754
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
755
  }
756
  }
757
- if (isset($_POST['Log'])) {
758
- $message = "<div class='updated'><p><strong>" . __("Dumping log data.", 'ga-dash') . "</strong></p></div>";
759
- }
760
- if (isset($_POST['options']['ga_dash_hidden']) and ! isset($_POST['Clear']) and ! isset($_POST['Reset']) and ! isset($_POST['Log'])) {
761
- $message = "<div class='updated'><p><strong>" . __("Settings saved.", 'ga-dash') . "</strong></p></div>";
762
  if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
763
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
764
  }
765
  }
766
  if (isset($_POST['Hide'])) {
767
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
768
- $message = "<div class='updated'><p><strong>" . __("All other domains/properties were removed.", 'ga-dash') . "</strong></p></div>";
769
  $lock_profile = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $GADASH_Config->options['ga_dash_tableid_jail']);
770
  $GADASH_Config->options['ga_dash_profile_list'] = array(
771
  $lock_profile
772
  );
773
  $options = self::set_get_options('general');
774
  } else {
775
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
776
  }
777
  }
778
- if (! function_exists('curl_version')) {
779
- $message = "<div class='error'><p><strong>" . __("PHP CURL is required. Ask your hosting provider to install/enable PHP CURL!", 'ga-dash') . "</strong></p></div>";
780
- }
781
  ?>
782
  <div class="wrap">
783
  <?php echo "<h2>" . __( "Google Analytics Settings", 'ga-dash' ) . "</h2>"; ?><hr>
784
- </div>
785
- <div id="poststuff">
786
- <div id="post-body" class="metabox-holder columns-2">
787
- <div id="post-body-content">
788
- <div class="settings-wrapper">
789
- <div class="inside">
790
 
791
  if ($GADASH_GAPI->gapi_errors_handler()) {
792
- $message = "<div class='error'><p><strong>" . __("Something went wrong. Please check the Debugging Data section for possible errors", 'ga-dash') . ".</strong></p></div>";
793
  }
794
 
795
  if (isset($_POST['Authorize'])) {
@@ -801,57 +910,58 @@ final class GADASH_Settings
801
  echo $message;
802
  ?>
803
  <form name="ga_dash_form" method="post"
804
- action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
805
- <input type="hidden" name="options[ga_dash_hidden]" value="Y">
806
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
807
  <table class="options">
808
- <tr>
809
- <td colspan="2"><?php echo "<h2>" . __( "Plugin Authorization", 'ga-dash' ) . "</h2>"; ?></td>
810
- </tr>
811
- <tr>
812
- <td colspan="2" class="info">
813
  <?php echo __("You should watch the",'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp' target='_blank'>". __("video",'ga-dash')."</a> ".__("and read this", 'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp' target='_blank'>". __("tutorial",'ga-dash')."</a> ".__("before proceeding to authorization. This plugin requires a properly configured Google Analytics account", 'ga-dash')."!";?>
814
  </td>
815
- </tr>
816
  <?php
817
  if (! $options['ga_dash_token'] or $options['ga_dash_userapi']) {
818
  ?>
819
  <tr>
820
- <td colspan="2" class="info"><input
821
- name="options[ga_dash_userapi]" type="checkbox"
822
- id="ga_dash_userapi" value="1"
823
- <?php checked( $options['ga_dash_userapi'], 1 ); ?>
824
- onchange="this.form.submit()"
825
- <?php echo ($options['ga_dash_network'])?'disabled="disabled"':''; ?> /><?php _e ( " use your own API Project credentials", 'ga-dash' );?>
826
  </td>
827
- </tr>
828
  }
829
  if ($options['ga_dash_userapi']) {
830
  ?>
831
  <tr>
832
- <td class="title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'ga-dash'); ?></label>
833
- </td>
834
- <td><input type="text" name="options[ga_dash_apikey]"
835
- value="<?php echo esc_attr($options['ga_dash_apikey']); ?>"
836
- size="40" required="required"></td>
837
- </tr>
838
- <tr>
839
- <td class="title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'ga-dash'); ?></label>
840
- </td>
841
- <td><input type="text" name="options[ga_dash_clientid]"
842
- value="<?php echo esc_attr($options['ga_dash_clientid']); ?>"
843
- size="40" required="required"></td>
844
- </tr>
845
- <tr>
846
- <td class="title"><label for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'ga-dash'); ?></label>
847
- </td>
848
- <td><input type="text" name="options[ga_dash_clientsecret]"
849
- value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>"
850
- size="40" required="required"> <input type="hidden"
851
- name="options[ga_dash_hidden]" value="Y">
 
852
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
853
  </td>
854
- </tr>
855
  <?php
856
  }
857
  ?>
@@ -859,25 +969,25 @@ final class GADASH_Settings
859
  if ($options['ga_dash_token']) {
860
  ?>
861
  <tr>
862
- <td colspan="2"><input type="submit" name="Reset"
863
- class="button button-secondary"
864
- value="<?php _e( "Clear Authorization", 'ga-dash' ); ?>"
865
- <?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> />
866
- <input type="submit" name="Clear"
867
- class="button button-secondary"
868
- value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /></td>
869
- </tr>
870
- <tr>
871
- <td colspan="2"><hr></td>
872
- </tr>
873
- <tr>
874
- <td colspan="2"><?php echo "<h2>" . __( "General Settings", 'ga-dash' ) . "</h2>"; ?></td>
875
- </tr>
876
- <tr>
877
- <td class="title"><label for="ga_dash_tableid_jail"><?php _e("Select Domain:", 'ga-dash' ); ?></label></td>
878
- <td><select id="ga_dash_tableid_jail"
879
- <?php disabled(is_array($options['ga_dash_profile_list']), false); ?>
880
- name="options[ga_dash_tableid_jail]">
881
  <?php
882
  if (is_array($options['ga_dash_profile_list'])) {
883
  foreach ($options['ga_dash_profile_list'] as $items) {
@@ -895,146 +1005,70 @@ final class GADASH_Settings
895
  _e("and/or hide all other domains", 'ga-dash');
896
  ?>
897
  <input type="submit" name="Hide" class="button button-secondary"
898
- value="<?php _e( "Hide Now", 'ga-dash' ); ?>" />
899
  <?php
900
  }
901
  ?>
902
  </td>
903
- </tr>
904
  <?php
905
  if ($options['ga_dash_tableid_jail']) {
906
  ?>
907
  <tr>
908
- <td class="title"></td>
909
- <td><?php
910
  $profile_info = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $GADASH_Config->options['ga_dash_tableid_jail']);
911
  echo '<pre>' . __("View Name:", 'ga-dash') . "\t" . esc_html($profile_info[0]) . "<br />" . __("Tracking ID:", 'ga-dash') . "\t" . esc_html($profile_info[2]) . "<br />" . __("Default URL:", 'ga-dash') . "\t" . esc_html($profile_info[3]) . "<br />" . __("Time Zone:", 'ga-dash') . "\t" . esc_html($profile_info[5]) . '</pre>';
912
  ?></td>
913
- </tr>
914
  <?php
915
  }
916
  ?>
917
- <td class="title"><label for="ga_dash_style"><?php _e("Theme Color:", 'ga-dash' ); ?></label></td>
918
- <td><input type="text" id="ga_dash_style" class="ga_dash_style"
919
- name="options[ga_dash_style]"
920
- value="<?php echo esc_attr($options['ga_dash_style']); ?>"
921
- size="10"></td>
922
- </tr>
923
- <tr>
924
- <td colspan="2"><hr></td>
925
- </tr>
926
- <tr>
927
- <td colspan="2"><?php echo __('A new frontend widget is available! To enable it, go to','ga-dash').' <a href="widgets.php">'.__('Appearance -> Widgets').'</a> '.__('and look for Google Analytics Dashboard.','ga-dash').' '.''; ?></td>
928
- </tr>
929
- <tr>
930
- <td colspan="2"><hr></td>
931
- </tr>
932
- <tr>
933
- <td class="debugging"><?php echo "<h2>" . __( "Debugging Data", 'ga-dash' ) . "</h2></td>".'<td><a href="#" id="show_hide" class="show_hide">Show Log</a>'; ?></td>
934
- </tr>
935
- <tr>
936
- <td colspan="2">
937
- <div class="log_data">
938
- <?php
939
- echo '<pre class="log_data">************************************* Start Log *************************************<br/><br/>';
940
- $anonim = $GADASH_Config->options;
941
- $anonim['wp_version'] = $wp_version;
942
- $anonim['gadwp_version'] = GADWP_CURRENT_VERSION;
943
- if ($anonim['ga_dash_token']) {
944
- $anonim['ga_dash_token'] = 'HIDDEN';
945
- }
946
- if ($anonim['ga_dash_refresh_token']) {
947
- $anonim['ga_dash_refresh_token'] = 'HIDDEN';
948
- }
949
- if ($anonim['ga_dash_clientid']) {
950
- $anonim['ga_dash_clientid'] = 'HIDDEN';
951
- }
952
- if ($anonim['ga_dash_clientsecret']) {
953
- $anonim['ga_dash_clientsecret'] = 'HIDDEN';
954
- }
955
- if ($anonim['ga_dash_apikey']) {
956
- $anonim['ga_dash_apikey'] = 'HIDDEN';
957
- }
958
- echo esc_html(print_r($anonim, true));
959
- echo '<br/>Last Error: ';
960
- echo esc_html(print_r(get_option('gadash_lasterror', 'N/A'), true));
961
- echo "\n" . esc_html(print_r(get_transient('ga_dash_gapi_errors'), true));
962
- echo '<br/><br/>************************************* End Log *************************************</pre>';
963
- ?>
964
- </div>
965
- </td>
966
- </tr>
967
- <tr>
968
- <td colspan="2"><hr></td>
969
- </tr>
970
- <tr>
971
- <td colspan="2" class="submit"><input type="submit"
972
- name="Submit" class="button button-primary"
973
- value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
974
- </tr>
975
  } else {
976
  ?>
977
  <tr>
978
- <td colspan="2"><hr></td>
979
- </tr>
980
- <tr>
981
- <td colspan="2"><input type="submit" name="Authorize"
982
- class="button button-secondary" id="authorize"
983
- value="<?php _e( "Authorize Plugin", 'ga-dash' ); ?>"
984
- <?php echo ((!function_exists('curl_version') OR ($options['ga_dash_network']))?'disabled="disabled"':''); ?> />
985
- <input type="submit" name="Clear"
986
- class="button button-secondary"
987
- value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /></td>
988
- </tr>
989
- <tr>
990
- <td colspan="2"><hr></td>
991
- </tr>
992
- <tr>
993
- <td class="debugging"><?php echo "<h2>" . __( "Debugging Data", 'ga-dash' ) . "</h2></td>".'<td><a href="#" id="show_hide" class="show_hide">Show Log</a>'; ?></td>
994
- </tr>
995
- <tr>
996
- <td colspan="2">
997
- <div class="log_data">
998
- <?php
999
- echo '<pre class="log_data">************************************* Start Log *************************************<br/><br/>';
1000
- $anonim = $GADASH_Config->options;
1001
- $anonim['wp_version'] = $wp_version;
1002
- $anonim['gadwp_version'] = GADWP_CURRENT_VERSION;
1003
- if ($anonim['ga_dash_token']) {
1004
- $anonim['ga_dash_token'] = 'HIDDEN';
1005
- }
1006
- if ($anonim['ga_dash_refresh_token']) {
1007
- $anonim['ga_dash_refresh_token'] = 'HIDDEN';
1008
- }
1009
- if ($anonim['ga_dash_clientid']) {
1010
- $anonim['ga_dash_clientid'] = 'HIDDEN';
1011
- }
1012
- if ($anonim['ga_dash_clientsecret']) {
1013
- $anonim['ga_dash_clientsecret'] = 'HIDDEN';
1014
- }
1015
- if ($anonim['ga_dash_apikey']) {
1016
- $anonim['ga_dash_apikey'] = 'HIDDEN';
1017
- }
1018
- echo esc_html(print_r($anonim, true));
1019
- echo '<br/>Last Error: ';
1020
- echo esc_html(print_r(get_option('gadash_lasterror', 'N/A'), true));
1021
- echo "\n" . esc_html(print_r(get_transient('ga_dash_gapi_errors'), true));
1022
- echo '<br/><br/>************************************* End Log *************************************</pre>';
1023
- ?>
1024
- </div>
1025
- </td>
1026
- </tr>
1027
- <tr>
1028
- <td colspan="2"><hr></td>
1029
- </tr>
1030
- </table>
1031
- </form>
1032
  <?php
1033
  self::output_sidebar();
1034
  return;
1035
  }
1036
  ?>
1037
- </form>
1038
  }
1039
  self::output_sidebar();
1040
  }
@@ -1055,7 +1089,7 @@ final class GADASH_Settings
1055
  /*
1056
  * Include GAPI
1057
  */
1058
- echo '<div id="gapi-warning" class="updated"><p><strong>' . __('Loading the required libraries. If this results in a blank screen or a fatal error, try this solution:', "ga-dash") . ' </strong><a href="https://deconf.com/ask/question/ga-dashboard-absolutely-empty-general-settings#answer-770">Library conflicts between WordPress plugins</a></p></div>';
1059
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
1060
  global $GADASH_GAPI;
1061
  echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
@@ -1067,10 +1101,10 @@ final class GADASH_Settings
1067
  $google_token = json_decode($GADASH_GAPI->client->getAccessToken());
1068
  $GADASH_Config->options['ga_dash_refresh_token'] = $google_token->refresh_token;
1069
  $GADASH_Config->set_plugin_options(true);
1070
- $message = "<div class='updated'><p><strong>" . __("Plugin authorization succeeded.", 'ga-dash') . "</strong></p></div>";
1071
  $options = self::set_get_options('network');
1072
  if (is_multisite()) { // Cleanup errors on the entire network
1073
- foreach (wp_get_sites() as $blog) {
1074
  switch_to_blog($blog['blog_id']);
1075
  delete_transient('ga_dash_gapi_errors');
1076
  restore_current_blog();
@@ -1079,14 +1113,14 @@ final class GADASH_Settings
1079
  delete_transient('ga_dash_gapi_errors');
1080
  }
1081
  } catch (Google_IO_Exception $e) {
1082
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e));
1083
  return false;
1084
  } catch (Google_Service_Exception $e) {
1085
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()));
1086
- set_transient('ga_dash_gapi_errors', $e->getErrors(), $this->error_timeout);
1087
  return $e->getCode();
1088
  } catch (Exception $e) {
1089
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e) . "\nResponseHttpCode:" . $e->getCode());
1090
  $GADASH_GAPI->ga_dash_reset_token(false);
1091
  }
1092
  } else {
@@ -1097,14 +1131,13 @@ final class GADASH_Settings
1097
  if (isset($_POST['Refresh'])) {
1098
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
1099
  $GADASH_Config->options['ga_dash_profile_list'] = '';
1100
- $message = "<div class='updated'><p><strong>" . __("Properties refreshed.", 'ga-dash') . "</strong></p></div>";
1101
  $options = self::set_get_options('network');
1102
  } else {
1103
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
1104
  }
1105
  }
1106
-
1107
- if (function_exists('curl_version')) {
1108
  if ($GADASH_GAPI->client->getAccessToken()) {
1109
  if ($GADASH_Config->options['ga_dash_profile_list']) {
1110
  $profiles = $GADASH_Config->options['ga_dash_profile_list'];
@@ -1122,60 +1155,56 @@ final class GADASH_Settings
1122
  $options = self::set_get_options('network');
1123
  }
1124
  }
1125
- }
1126
  if (isset($_POST['Clear'])) {
1127
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
1128
  $tools->ga_dash_clear_cache();
1129
- $message = "<div class='updated'><p><strong>" . __("Cleared Cache.", 'ga-dash') . "</strong></p></div>";
1130
  } else {
1131
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
1132
  }
1133
  }
1134
  if (isset($_POST['Reset'])) {
1135
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
1136
  $GADASH_GAPI->ga_dash_reset_token(true);
1137
  $tools->ga_dash_clear_cache();
1138
- $message = "<div class='updated'><p><strong>" . __("Token Reseted and Revoked.", 'ga-dash') . "</strong></p></div>";
1139
  $options = self::set_get_options('Reset');
1140
  } else {
1141
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
1142
  }
1143
  }
1144
- if (isset($_POST['Log'])) {
1145
- $message = "<div class='updated'><p><strong>" . __("Dumping log data.", 'ga-dash') . "</strong></p></div>";
1146
- }
1147
- if (isset($_POST['options']['ga_dash_hidden']) and ! isset($_POST['Clear']) and ! isset($_POST['Reset']) and ! isset($_POST['Log']) and ! isset($_POST['Refresh'])) {
1148
- $message = "<div class='updated'><p><strong>" . __("Settings saved.", 'ga-dash') . "</strong></p></div>";
1149
  if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
1150
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
1151
  }
1152
  }
1153
  if (isset($_POST['Hide'])) {
1154
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
1155
- $message = "<div class='updated'><p><strong>" . __("All other domains/properties were removed.", 'ga-dash') . "</strong></p></div>";
1156
  $lock_profile = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $GADASH_Config->options['ga_dash_tableid_jail']);
1157
  $GADASH_Config->options['ga_dash_profile_list'] = array(
1158
  $lock_profile
1159
  );
1160
  $options = self::set_get_options('network');
1161
  } else {
1162
- $message = "<div class='error'><p><strong>" . __("Cheating Huh?", 'ga-dash') . "</strong></p></div>";
1163
  }
1164
  }
1165
- if (! function_exists('curl_version')) {
1166
- $message = "<div class='error'><p><strong>" . __("PHP CURL is required. Ask your hosting provider to install/enable PHP CURL!", 'ga-dash') . "</strong></p></div>";
1167
- }
1168
  ?>
1169
  <div class="wrap">
1170
  <?php echo "<h2>" . __( "Google Analytics Settings", 'ga-dash' ) . "</h2>"; ?><hr>
1171
- </div>
1172
- <div id="poststuff">
1173
- <div id="post-body" class="metabox-holder columns-2">
1174
- <div id="post-body-content">
1175
- <div class="settings-wrapper">
1176
- <div class="inside">
1177
  if ($GADASH_GAPI->gapi_errors_handler()) {
1178
- $message = "<div class='error'><p><strong>" . __("Something went wrong. Please check the Debugging Data section for possible errors", 'ga-dash') . ".</strong></p></div>";
1179
  }
1180
  if (isset($_POST['Authorize'])) {
1181
  $tools->ga_dash_clear_cache();
@@ -1186,80 +1215,84 @@ final class GADASH_Settings
1186
  echo $message;
1187
  ?>
1188
  <form name="ga_dash_form" method="post"
1189
- action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
1190
- <input type="hidden" name="options[ga_dash_hidden]" value="Y">
 
1191
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
1192
  <table class="options">
1193
- <tr>
1194
- <td colspan="2"><?php echo "<h2>" . __( "Network Setup", 'ga-dash' ) . "</h2>"; ?></td>
1195
- </tr>
1196
- <tr>
1197
- <td colspan="2" class="title">
1198
- <div class="onoffswitch">
1199
- <input type="checkbox" name="options[ga_dash_network]"
1200
- value="1" class="onoffswitch-checkbox"
1201
- id="ga_dash_network"
1202
- <?php checked( $options['ga_dash_network'], 1); ?>
1203
- onchange="this.form.submit()"> <label
1204
- class="onoffswitch-label" for="ga_dash_network">
1205
- <div class="onoffswitch-inner"></div>
1206
- <div class="onoffswitch-switch"></div>
1207
- </label>
1208
- </div>
1209
- <div class="switch-desc"><?php _e ( " use a single Google Analytics account for the entire network", 'ga-dash' );?></div>
1210
- </td>
1211
- </tr>
1212
  <?php if ($options['ga_dash_network']){ //Network Mode check?>
1213
  <tr>
1214
- <td colspan="2"><hr></td>
1215
- </tr>
1216
- <tr>
1217
- <td colspan="2"><?php echo "<h2>" . __( "Plugin Authorization", 'ga-dash' ) . "</h2>"; ?></td>
1218
- </tr>
1219
- <tr>
1220
- <td colspan="2" class="info">
1221
  <?php echo __("You should watch the",'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/' target='_blank'>". __("video",'ga-dash')."</a> ".__("and read this", 'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/' target='_blank'>". __("tutorial",'ga-dash')."</a> ".__("before proceeding to authorization. This plugin requires a properly configured Google Analytics account", 'ga-dash')."!";?>
1222
  </td>
1223
- </tr>
1224
  <?php
1225
  if (! $options['ga_dash_token'] or $options['ga_dash_userapi']) {
1226
  ?>
1227
  <tr>
1228
- <td colspan="2" class="info"><input
1229
- name="options[ga_dash_userapi]" type="checkbox"
1230
- id="ga_dash_userapi" value="1"
1231
- <?php checked( $options['ga_dash_userapi'], 1 ); ?>
1232
- onchange="this.form.submit()" /><?php _e ( " use your own API Project credentials", 'ga-dash' );?>
1233
  </td>
1234
- </tr>
1235
  }
1236
  if ($options['ga_dash_userapi']) {
1237
  ?>
1238
  <tr>
1239
- <td class="title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'ga-dash'); ?></label>
1240
- </td>
1241
- <td><input type="text" name="options[ga_dash_apikey]"
1242
- value="<?php echo esc_attr($options['ga_dash_apikey']); ?>"
1243
- size="40" required="required"></td>
1244
- </tr>
1245
- <tr>
1246
- <td class="title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'ga-dash'); ?></label>
1247
- </td>
1248
- <td><input type="text" name="options[ga_dash_clientid]"
1249
- value="<?php echo esc_attr($options['ga_dash_clientid']); ?>"
1250
- size="40" required="required"></td>
1251
- </tr>
1252
- <tr>
1253
- <td class="title"><label
1254
- for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'ga-dash'); ?></label>
1255
- </td>
1256
- <td><input type="text" name="options[ga_dash_clientsecret]"
1257
- value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>"
1258
- size="40" required="required"> <input type="hidden"
1259
- name="options[ga_dash_hidden]" value="Y">
 
 
 
1260
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
1261
  </td>
1262
- </tr>
1263
  <?php
1264
  }
1265
  ?>
@@ -1267,34 +1300,34 @@ final class GADASH_Settings
1267
  if ($options['ga_dash_token']) {
1268
  ?>
1269
  <tr>
1270
- <td colspan="2"><input type="submit" name="Reset"
1271
- class="button button-secondary"
1272
- value="<?php _e( "Clear Authorization", 'ga-dash' ); ?>" />
1273
- <input type="submit" name="Clear"
1274
- class="button button-secondary"
1275
- value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /> <input
1276
- type="submit" name="Refresh"
1277
- class="button button-secondary"
1278
- value="<?php _e( "Refresh Properties", 'ga-dash' ); ?>" /></td>
1279
- </tr>
1280
- <tr>
1281
- <td colspan="2"><hr></td>
1282
- </tr>
1283
- <tr>
1284
- <td colspan="2"><?php echo "<h2>" . __( "Properties/Views Settings", 'ga-dash' ) . "</h2>"; ?></td>
1285
- </tr>
1286
  <?php
1287
  if (isset($options['ga_dash_tableid_network'])) {
1288
  $options['ga_dash_tableid_network'] = json_decode(json_encode($options['ga_dash_tableid_network']), FALSE);
1289
  }
1290
- foreach (wp_get_sites() as $blog) {
1291
  ?>
1292
  <tr>
1293
- <td class="title-select"><label
1294
- for="ga_dash_tableid_network"><?php echo '<strong>'.$blog['domain'].$blog['path'].'</strong>: ';?></label></td>
1295
- <td><select id="ga_dash_tableid_network"
1296
- <?php disabled(is_array($options['ga_dash_profile_list']),false);?>
1297
- name="options[ga_dash_tableid_network][<?php echo $blog['blog_id'];?>]">
1298
  <?php
1299
  if (is_array($options['ga_dash_profile_list'])) {
1300
  foreach ($options['ga_dash_profile_list'] as $items) {
@@ -1308,137 +1341,61 @@ final class GADASH_Settings
1308
  }
1309
  ?>
1310
  </select><br /></td>
1311
- </tr>
1312
  <?php
1313
  }
1314
  ?>
1315
  <tr>
1316
- <td colspan="2"><hr><?php echo "<h2>" . __( "Exclude Tracking", 'ga-dash' ) . "</h2>"; ?></td>
1317
- </tr>
1318
- <tr>
1319
- <td colspan="2" class="title">
1320
- <div class="onoffswitch">
1321
- <input type="checkbox" name="options[ga_dash_excludesa]"
1322
- value="1" class="onoffswitch-checkbox"
1323
- id="ga_dash_excludesa"<?php checked( $options['ga_dash_excludesa'], 1); ?>">
1324
- <label class="onoffswitch-label" for="ga_dash_excludesa">
1325
- <div class="onoffswitch-inner"></div>
1326
- <div class="onoffswitch-switch"></div>
1327
- </label>
1328
- </div>
1329
- <div class="switch-desc"><?php _e ( " exclude Super Admin tracking for the entire network", 'ga-dash' );?></div>
1330
- </td>
1331
- </tr>
1332
- <tr>
1333
- <td colspan="2"><hr></td>
1334
- </tr>
1335
- <tr>
1336
- <td class="debugging"><?php echo "<h2>" . __( "Debugging Data", 'ga-dash' ) . "</h2></td>".'<td><a href="#" id="show_hide" class="show_hide">Show Log</a>'; ?></td>
1337
- </tr>
1338
- <tr>
1339
- <td colspan="2">
1340
- <div class="log_data">
1341
- <?php
1342
- echo '<pre class="log_data">************************************* Start Log *************************************<br/><br/>';
1343
- $anonim = $GADASH_Config->options;
1344
- $anonim['wp_version'] = $wp_version;
1345
- $anonim['gadwp_version'] = GADWP_CURRENT_VERSION;
1346
- if ($anonim['ga_dash_token']) {
1347
- $anonim['ga_dash_token'] = 'HIDDEN';
1348
- }
1349
- if ($anonim['ga_dash_refresh_token']) {
1350
- $anonim['ga_dash_refresh_token'] = 'HIDDEN';
1351
- }
1352
- if ($anonim['ga_dash_clientid']) {
1353
- $anonim['ga_dash_clientid'] = 'HIDDEN';
1354
- }
1355
- if ($anonim['ga_dash_clientsecret']) {
1356
- $anonim['ga_dash_clientsecret'] = 'HIDDEN';
1357
- }
1358
- if ($anonim['ga_dash_apikey']) {
1359
- $anonim['ga_dash_apikey'] = 'HIDDEN';
1360
- }
1361
- echo esc_html(print_r($anonim, true));
1362
- echo '<br/>Last Error: ';
1363
- echo esc_html(print_r(get_option('gadash_lasterror', 'N/A'), true));
1364
- echo "\n" . esc_html(print_r(get_transient('ga_dash_gapi_errors'), true));
1365
- echo '<br/><br/>************************************* End Log *************************************</pre>';
1366
- ?>
1367
- </div>
1368
- </td>
1369
- </tr>
1370
- <tr>
1371
- <td colspan="2"><hr></td>
1372
- </tr>
1373
- <tr>
1374
- <td colspan="2" class="submit"><input type="submit"
1375
- name="Submit" class="button button-primary"
1376
- value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
1377
- </tr>
1378
  } else {
1379
  ?>
1380
- <td colspan="2"><hr></td>
1381
- </tr>
1382
- <tr>
1383
- <td colspan="2"><input type="submit" name="Authorize"
1384
- class="button button-secondary" id="authorize"
1385
- value="<?php _e( "Authorize Plugin", 'ga-dash' ); ?>"
1386
- <?php echo (!function_exists('curl_version')?'disabled="disabled"':''); ?> />
1387
- <input type="submit" name="Clear"
1388
- class="button button-secondary"
1389
- value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /></td>
1390
- </tr>
1391
- <tr>
1392
- <td colspan="2"><hr></td>
1393
- </tr>
1394
- <tr>
1395
- <td class="debugging"><?php echo "<h2>" . __( "Debugging Data", 'ga-dash' ) . "</h2></td>".'<td><a href="#" id="show_hide" class="show_hide">Show Log</a>'; ?></td>
1396
- </tr>
1397
- <tr>
1398
- <td colspan="2">
1399
- <div class="log_data">
1400
- <?php
1401
- echo '<pre class="log_data">************************************* Start Log *************************************<br/><br/>';
1402
- $anonim = $GADASH_Config->options;
1403
- $anonim['wp_version'] = $wp_version;
1404
- $anonim['gadwp_version'] = GADWP_CURRENT_VERSION;
1405
- if ($anonim['ga_dash_token']) {
1406
- $anonim['ga_dash_token'] = 'HIDDEN';
1407
- }
1408
- if ($anonim['ga_dash_refresh_token']) {
1409
- $anonim['ga_dash_refresh_token'] = 'HIDDEN';
1410
- }
1411
- if ($anonim['ga_dash_clientid']) {
1412
- $anonim['ga_dash_clientid'] = 'HIDDEN';
1413
- }
1414
- if ($anonim['ga_dash_clientsecret']) {
1415
- $anonim['ga_dash_clientsecret'] = 'HIDDEN';
1416
- }
1417
- if ($anonim['ga_dash_apikey']) {
1418
- $anonim['ga_dash_apikey'] = 'HIDDEN';
1419
- }
1420
- echo esc_html(print_r($anonim, true));
1421
- echo '<br/>Last Error: ';
1422
- echo esc_html(print_r(get_option('gadash_lasterror', 'N/A'), true));
1423
- echo "\n" . esc_html(print_r(get_transient('ga_dash_gapi_errors'), true));
1424
- echo '<br/><br/>************************************* End Log *************************************</pre>';
1425
- ?>
1426
- </div>
1427
- </td>
1428
- </tr>
1429
  <?php } //Network Mode check?>
1430
  <tr>
1431
- <td colspan="2"><hr></td>
1432
- </tr>
1433
- </table>
1434
- </form>
1435
  <?php
1436
  self::output_sidebar();
1437
  return;
1438
  }
1439
  ?>
1440
  </table>
1441
- </form>
1442
  <?php
1443
  }
1444
  self::output_sidebar();
@@ -1446,84 +1403,97 @@ final class GADASH_Settings
1446
 
1447
  public static function output_sidebar()
1448
  {
 
1449
  ?>
1450
  </div>
1451
- </div>
1452
- </div>
1453
- <div id="postbox-container-1" class="postbox-container">
1454
- <div class="meta-box-sortables">
1455
- <div class="postbox">
1456
- <h3>
1457
- <span><?php _e("Setup Tutorial & Demo",'ga-dash') ?></span>
1458
- </h3>
1459
- <div class="inside">
1460
- <a
1461
- href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=video&utm_campaign=gadwp"
1462
- target="_blank"><img
1463
- src="<?php echo plugins_url( 'images/google-analytics-dashboard.png' , __FILE__ );?>"
1464
- width="100%" alt="" /></a>
1465
- </div>
1466
- </div>
1467
- <div class="postbox">
1468
- <h3>
1469
- <span><?php _e("Support & Reviews",'ga-dash')?></span>
1470
- </h3>
1471
- <div class="inside">
1472
- <div class="gadash-title">
1473
- <a
1474
- href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=support&utm_campaign=gadwp"><img
1475
- src="<?php echo plugins_url( 'images/help.png' , __FILE__ ); ?>" /></a>
1476
- </div>
1477
- <div class="gadash-desc"><?php echo __('Plugin documentation and support on', 'ga-dash') . ' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=support&utm_campaign=gadwp">deconf.com</a>.'; ?></div>
1478
- <br />
1479
- <div class="gadash-title">
1480
- <a
1481
- href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info"><img
1482
- src="<?php echo plugins_url( 'images/star.png' , __FILE__ ); ?>" /></a>
1483
- </div>
1484
- <div class="gadash-desc"><?php echo __('Your feedback and review are both important,', 'ga-dash').' <a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info">'.__('rate this plugin', 'ga-dash').'</a>!'; ?></div>
1485
- </div>
1486
- </div>
1487
- <div class="postbox">
1488
- <h3>
1489
- <span><?php _e("Further Reading",'ga-dash')?></span>
1490
- </h3>
1491
- <div class="inside">
1492
- <div class="gadash-title">
1493
- <a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp"><img
1494
- src="<?php echo plugins_url( 'images/ssl.png' , __FILE__ ); ?>" /></a>
1495
- </div>
1496
- <div class="gadash-desc"><?php echo '<a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp">'.__('Improve search rankings', 'ga-dash').'</a> '.__('by moving your website to HTTPS/SSL.', 'ga-dash'); ?></div>
1497
- <br />
1498
- <div class="gadash-title">
1499
- <a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp"><img
1500
- src="<?php echo plugins_url( 'images/wp.png' , __FILE__ ); ?>" /></a>
1501
- </div>
1502
- <div class="gadash-desc"><?php echo __('Other', 'ga-dash').' <a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp">'.__('WordPress Plugins', 'ga-dash').'</a> '.__('written by the same author', 'ga-dash').'.'; ?></div>
1503
- </div>
1504
- </div>
1505
- <div class="postbox">
1506
- <h3>
1507
- <span><?php _e("Other Services",'ga-dash')?></span>
1508
- </h3>
1509
- <div class="inside">
1510
- <div class="gadash-title">
1511
- <a href="http://tracking.maxcdn.com/c/94142/36539/378"><img
1512
- src="<?php echo plugins_url( 'images/mcdn.png' , __FILE__ ); ?>" /></a>
1513
- </div>
1514
- <div class="gadash-desc"><?php echo __('Speed up your website and plug into a whole', 'ga-dash').' <a href="http://tracking.maxcdn.com/c/94142/36539/378">'.__('new level of site speed', 'ga-dash').'</a>.'; ?></div>
1515
- <br />
1516
- <div class="gadash-title">
1517
- <a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp"><img
1518
- src="<?php echo plugins_url( 'images/clicky.png' , __FILE__ ); ?>" /></a>
 
 
 
 
 
 
 
 
 
1519
  </div>
1520
- <div class="gadash-desc"><?php echo '<a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp">'.__('Web Analytics', 'ga-dash').'</a> '.__('service with users tracking at IP level.', 'ga-dash'); ?></div>
1521
  </div>
1522
- </div>
1523
- </div>
1524
- </div>
1525
- </div>
1526
- </div>
1527
  <?php
 
 
 
 
 
 
 
 
 
1528
  }
1529
  }
62
  return $options;
63
  }
64
 
65
+ private static function navigation_tabs($tabs)
66
+ {
67
+ echo '<div id="icon-themes" class="icon32"><br></div>';
68
+ echo '<h2 class="nav-tab-wrapper">';
69
+ foreach ($tabs as $tab => $name) {
70
+ echo "<a class='nav-tab' id='tab-$tab' href='#top#gadwp-$tab'>$name</a>";
71
+ }
72
+ echo '</h2>';
73
+ }
74
+
75
  public static function frontend_settings()
76
  {
77
  global $GADASH_Config;
80
  }
81
  $options = self::set_get_options('frontend');
82
  if (isset($_POST['options']['ga_dash_hidden'])) {
83
+ $message = "<div class='updated'><p>" . __("Settings saved.", 'ga-dash') . "</p></div>";
84
  if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
85
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
86
  }
87
  }
88
  if (! $GADASH_Config->options['ga_dash_tableid_jail'] or ! $GADASH_Config->options['ga_dash_token']) {
89
+ $message = "<div class='error'><p>" . __("Something went wrong, check", 'ga-dash') . " <a href='" . menu_page_url('gadash_errors_debugging', false) . "'>" . __('Errors & Debug', 'ga-dash'). "</a> " .__('or', 'ga-dash') . " <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('auhorize the plugin', 'ga-dash') . "</a>.</p></div>";
90
  }
91
  ?>
92
  <form name="ga_dash_form" method="post"
136
  }
137
  }
138
  ?>
 
 
 
 
139
  </table>
140
  </td>
141
  </tr>
181
  </table>
182
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
183
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
 
 
 
 
184
  </form>
185
  <?php
186
  self::output_sidebar();
194
  }
195
  $options = self::set_get_options('backend');
196
  if (isset($_POST['options']['ga_dash_hidden'])) {
197
+ $message = "<div class='updated'><p>" . __("Settings saved.", 'ga-dash') . "</p></div>";
198
  if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
199
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
200
  }
201
  }
202
  if (! $GADASH_Config->options['ga_dash_tableid_jail'] or ! $GADASH_Config->options['ga_dash_token']) {
203
+ $message = "<div class='error'><p>" . __("Something went wrong, check", 'ga-dash') . " <a href='" . menu_page_url('gadash_errors_debugging', false) . "'>" . __('Errors & Debug', 'ga-dash'). "</a> " .__('or', 'ga-dash') . " <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('auhorize the plugin', 'ga-dash') . "</a>.</p></div>";
204
  }
205
  ?>
206
  <form name="ga_dash_form" method="post"
250
  }
251
  }
252
  ?>
 
 
 
 
253
  </table>
254
  </td>
255
  </tr>
280
  <?php echo '('.__("find out more", 'ga-dash')?> <a
281
  href="https://deconf.com/google-analytics-dashboard-real-time-reports/"
282
  target="_blank"><?php _e("about this feature", 'ga-dash') ?></a>
283
+ )
284
  </td>
285
  </tr>
286
  <tr>
311
  </table>
312
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
313
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
 
 
 
 
314
  </form>
315
  <?php
316
  self::output_sidebar();
329
  }
330
  $options = self::set_get_options('tracking');
331
  if (isset($_POST['options']['ga_dash_hidden'])) {
332
+ $message = "<div class='updated'><p>" . __("Settings saved.", 'ga-dash') . "</p></div>";
333
  if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
334
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
335
  }
336
  }
337
+ if (! $GADASH_Config->options['ga_dash_tableid_jail']) {
338
+ $message = "<div class='error'><p>" . __("Something went wrong, check", 'ga-dash') . " <a href='" . menu_page_url('gadash_errors_debugging', false) . "'>" . __('Errors & Debug', 'ga-dash'). "</a> " .__('or', 'ga-dash') . " <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('auhorize the plugin', 'ga-dash') . "</a>.</p></div>";
339
  }
340
+
341
+ if (!$options['ga_dash_tracking']) {
342
+ $message = "<div class='error'><p>" . __("The tracking component is disabled. You should set",'ga-dash')." <strong>". __("Tracking Options",'ga-dash')."</strong> " .__("to",'ga-dash')." <strong>".__("Enabled", 'ga-dash') . "</strong>.</p></div>";
343
+ }
344
+
345
  ?>
346
  <form name="ga_dash_form" method="post"
347
  action="<?php esc_url($_SERVER['REQUEST_URI']); ?>">
348
  <div class="wrap">
349
+ <?php echo "<h2>" . __( "Google Analytics Tracking Code", 'ga-dash' ) . "</h2>"; ?>
350
  </div>
351
+
352
  <div id="poststuff">
353
  <div id="post-body" class="metabox-holder columns-2">
354
  <div id="post-body-content">
355
  <div class="settings-wrapper">
356
  <div class="inside">
357
+ <?php
358
+ $tabs = array(
359
+ 'basic' => __("Basic Settings", 'ga-dash'),
360
+ 'events' => __("Events Tracking", 'ga-dash'),
361
+ 'custom' => __("Custom Definitions", 'ga-dash'),
362
+ 'exclude' => __("Exclude Tracking", 'ga-dash'),
363
+ 'advanced' => __("Advanced Settings", 'ga-dash')
364
+ );
365
+ self::navigation_tabs($tabs);
366
+ ?>
367
  <?php if (isset($message)) echo $message; ?>
368
+ <div id="gadwp-basic">
369
+ <table class="options">
370
+ <tr>
371
+ <td colspan="2"><?php echo "<h2>" . __( "Tracking Settings", 'ga-dash' ) . "</h2>"; ?></td>
372
+ </tr>
373
+ <tr>
374
+ <td class="title"><label for="ga_dash_tracking"><?php _e("Tracking Options:", 'ga-dash' ); ?></label></td>
375
+ <td><select id="ga_dash_tracking"
376
+ name="options[ga_dash_tracking]" onchange="this.form.submit()">
377
+ <option value="0"
378
+ <?php selected( $options['ga_dash_tracking'], 0 ); ?>><?php _e("Disabled", 'ga-dash');?></option>
379
+ <option value="1"
380
+ <?php selected( $options['ga_dash_tracking'], 1 ); ?>><?php _e("Enabled", 'ga-dash');?></option>
381
+ </select></td>
382
+ </tr>
383
+ <?php if ($options['ga_dash_tracking']) {?>
384
+ <tr>
385
+ <td class="title"></td>
386
+ <td><?php
387
+ $profile_info = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $GADASH_Config->options['ga_dash_tableid_jail']);
388
+ echo '<pre>' . __("View Name:", 'ga-dash') . "\t" . esc_html($profile_info[0]) . "<br />" . __("Tracking ID:", 'ga-dash') . "\t" . esc_html($profile_info[2]) . "<br />" . __("Default URL:", 'ga-dash') . "\t" . esc_html($profile_info[3]) . "<br />" . __("Time Zone:", 'ga-dash') . "\t" . esc_html($profile_info[5]) . '</pre>';
389
+ ?></td>
390
+ </tr>
391
+ <?php }?>
392
+ <tr>
393
+ <td colspan="2"><hr><?php echo "<h2>" . __( "Basic Tracking", 'ga-dash' ) . "</h2>"; ?></td>
394
+ </tr>
395
+
396
+ <tr>
397
+ <td class="title"><label for="ga_dash_tracking_type"><?php _e("Tracking Type:", 'ga-dash' ); ?></label></td>
398
+ <td><select id="ga_dash_tracking_type"
399
+ name="options[ga_dash_tracking_type]">
400
+ <option value="classic"
401
+ <?php selected( $options['ga_dash_tracking_type'], 'classic' ); ?>><?php _e("Classic Analytics", 'ga-dash');?></option>
402
+ <option value="universal"
403
+ <?php selected( $options['ga_dash_tracking_type'], 'universal' ); ?>><?php _e("Universal Analytics", 'ga-dash');?></option>
404
+ </select></td>
405
+ </tr>
406
+ <tr>
407
+ <td colspan="2" class="title">
408
+ <div class="onoffswitch">
409
+ <input type="checkbox" name="options[ga_dash_anonim]"
410
+ value="1" class="onoffswitch-checkbox" id="ga_dash_anonim"
411
+ <?php checked( $options['ga_dash_anonim'], 1 ); ?>> <label
412
+ class="onoffswitch-label" for="ga_dash_anonim">
413
+ <div class="onoffswitch-inner"></div>
414
+ <div class="onoffswitch-switch"></div>
415
+ </label>
416
+ </div>
417
+ <div class="switch-desc"><?php _e ( " anonymize IPs while tracking", 'ga-dash' );?></div>
418
+ </td>
419
+ </tr>
420
+ <tr>
421
+ <td colspan="2" class="title">
422
+ <div class="onoffswitch">
423
+ <input type="checkbox" name="options[ga_dash_remarketing]"
424
+ value="1" class="onoffswitch-checkbox"
425
+ id="ga_dash_remarketing"
426
+ <?php checked( $options['ga_dash_remarketing'], 1 ); ?>> <label
427
+ class="onoffswitch-label" for="ga_dash_remarketing">
428
+ <div class="onoffswitch-inner"></div>
429
+ <div class="onoffswitch-switch"></div>
430
+ </label>
431
+ </div>
432
+ <div class="switch-desc"><?php _e ( " enable remarketing, demographics and interests reports", 'ga-dash' );?></div>
433
+ </td>
434
+ </tr>
435
+ </table>
436
+ </div>
437
+ <div id="gadwp-events">
438
+ <table class="options">
439
+ <tr>
440
+ <td colspan="2"><?php echo "<h2>" . __( "Events Tracking", 'ga-dash' ) . "</h2>"; ?></td>
441
+ </tr>
442
+ <tr>
443
+ <td colspan="2" class="title">
444
+ <div class="onoffswitch">
445
+ <input type="checkbox" name="options[ga_event_tracking]"
446
+ value="1" class="onoffswitch-checkbox"
447
+ id="ga_event_tracking"
448
+ <?php checked( $options['ga_event_tracking'], 1 ); ?>> <label
449
+ class="onoffswitch-label" for="ga_event_tracking">
450
+ <div class="onoffswitch-inner"></div>
451
+ <div class="onoffswitch-switch"></div>
452
+ </label>
453
+ </div>
454
+ <div class="switch-desc"><?php _e(" track downloads, mailto and outbound links", 'ga-dash' ); ?></div>
455
+ </td>
456
+ </tr>
457
+ <tr>
458
+ <td class="title"><label for="ga_event_downloads"><?php _e("Downloads Regex:", 'ga-dash'); ?></label></td>
459
+ <td><input type="text" id="ga_event_downloads"
460
+ name="options[ga_event_downloads]"
461
+ value="<?php echo esc_attr($options['ga_event_downloads']); ?>"
462
+ size="50"></td>
463
+ </tr>
464
+ <tr>
465
+ <td colspan="2" class="title">
466
+ <div class="onoffswitch">
467
+ <input type="checkbox" name="options[ga_aff_tracking]"
468
+ value="1" class="onoffswitch-checkbox" id="ga_aff_tracking"
469
+ <?php checked( $options['ga_aff_tracking'], 1 ); ?>> <label
470
+ class="onoffswitch-label" for="ga_aff_tracking">
471
+ <div class="onoffswitch-inner"></div>
472
+ <div class="onoffswitch-switch"></div>
473
+ </label>
474
+ </div>
475
+ <div class="switch-desc"><?php _e(" track affiliate links matching this regex", 'ga-dash' ); ?></div>
476
+ </td>
477
+ </tr>
478
+ <tr>
479
+ <td class="title"><label for="ga_event_affiliates"><?php _e("Affiliates Regex:", 'ga-dash'); ?></label></td>
480
+ <td><input type="text" id="ga_event_affiliates"
481
+ name="options[ga_event_affiliates]"
482
+ value="<?php echo esc_attr($options['ga_event_affiliates']); ?>"
483
+ size="50"></td>
484
+ </tr>
485
+ <tr>
486
+ <td colspan="2" class="title">
487
+ <div class="onoffswitch">
488
+ <input type="checkbox" name="options[ga_hash_tracking]"
489
+ value="1" class="onoffswitch-checkbox" id="ga_hash_tracking"
490
+ <?php checked( $options['ga_hash_tracking'], 1 ); ?>> <label
491
+ class="onoffswitch-label" for="ga_hash_tracking">
492
+ <div class="onoffswitch-inner"></div>
493
+ <div class="onoffswitch-switch"></div>
494
+ </label>
495
+ </div>
496
+ <div class="switch-desc"><?php _e(" track fragment identifiers, hashmarks (#) in URI links", 'ga-dash' ); ?></div>
497
+ </td>
498
+ </tr>
499
+ </table>
500
+ </div>
501
+ <div id="gadwp-custom">
502
+ <table class="options">
503
+ <tr>
504
+ <td colspan="2"><?php echo "<h2>" . __( "Custom Definitions", 'ga-dash' ) . "</h2>"; ?></td>
505
+ </tr>
506
+ <tr>
507
+ <td class="title"><label for="ga_author_dimindex"><?php _e("Authors:", 'ga-dash' ); ?></label></td>
508
+ <td><select id="ga_author_dimindex"
509
+ name="options[ga_author_dimindex]">
510
  <?php for ($i=0;$i<21;$i++){?>
511
  <option value="<?php echo $i;?>"
512
+ <?php selected( $options['ga_author_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
513
  <?php } ?>
514
  </select></td>
515
+ </tr>
516
+ <tr>
517
+ <td class="title"><label for="ga_pubyear_dimindex"><?php _e("Publication Year:", 'ga-dash' ); ?></label></td>
518
+ <td><select id="ga_pubyear_dimindex"
519
+ name="options[ga_pubyear_dimindex]">
520
  <?php for ($i=0;$i<21;$i++){?>
521
  <option value="<?php echo $i;?>"
522
+ <?php selected( $options['ga_pubyear_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
523
  <?php } ?>
524
  </select></td>
525
+ </tr>
526
+ <tr>
527
+ <td class="title"><label for="ga_category_dimindex"><?php _e("Categories:", 'ga-dash' ); ?></label></td>
528
+ <td><select id="ga_category_dimindex"
529
+ name="options[ga_category_dimindex]">
530
  <?php for ($i=0;$i<21;$i++){?>
531
  <option value="<?php echo $i;?>"
532
+ <?php selected( $options['ga_category_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
533
  <?php } ?>
534
  </select></td>
535
+ </tr>
536
+ <tr>
537
+ <td class="title"><label for="ga_user_dimindex"><?php _e("User Type:", 'ga-dash' ); ?></label></td>
538
+ <td><select id="ga_user_dimindex"
539
+ name="options[ga_user_dimindex]">
540
  <?php for ($i=0;$i<21;$i++){?>
541
  <option value="<?php echo $i;?>"
542
+ <?php selected( $options['ga_user_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
543
  <?php } ?>
544
  </select></td>
545
+ </tr>
546
+ </table>
547
+ </div>
548
+ <div id="gadwp-advanced">
549
+ <table class="options">
550
+ <tr>
551
+ <td colspan="2"><?php echo "<h2>" . __( "Advanced Tracking", 'ga-dash' ) . "</h2>"; ?></td>
552
+ </tr>
553
+ <tr>
554
+ <td class="title"><label for="ga_speed_samplerate"><?php _e("Page Speed SR:", 'ga-dash'); ?></label></td>
555
+ <td><input type="number" id="ga_speed_samplerate"
556
+ name="options[ga_speed_samplerate]"
557
+ value="<?php echo (int)($options['ga_speed_samplerate']); ?>"
558
+ max="100" min="1"> %</td>
559
+ </tr>
560
+ <tr>
561
+ <td colspan="2" class="title">
562
+ <div class="onoffswitch">
563
+ <input type="checkbox" name="options[ga_event_bouncerate]"
564
+ value="1" class="onoffswitch-checkbox"
565
+ id="ga_event_bouncerate"
566
+ <?php checked( $options['ga_event_bouncerate'], 1 ); ?>> <label
567
+ class="onoffswitch-label" for="ga_event_bouncerate">
568
+ <div class="onoffswitch-inner"></div>
569
+ <div class="onoffswitch-switch"></div>
570
+ </label>
571
+ </div>
572
+ <div class="switch-desc"><?php _e ( " exclude events from bounce-rate calculation", 'ga-dash' );?></div>
573
+ </td>
574
+ </tr>
575
+ <tr>
576
+ <td colspan="2" class="title">
577
+ <div class="onoffswitch">
578
+ <input type="checkbox" name="options[ga_enhanced_links]"
579
+ value="1" class="onoffswitch-checkbox"
580
+ id="ga_enhanced_links"
581
+ <?php checked( $options['ga_enhanced_links'], 1 ); ?>> <label
582
+ class="onoffswitch-label" for="ga_enhanced_links">
583
+ <div class="onoffswitch-inner"></div>
584
+ <div class="onoffswitch-switch"></div>
585
+ </label>
586
+ </div>
587
+ <div class="switch-desc"><?php _e ( " enable enhanced link attribution", 'ga-dash' );?></div>
588
+ </td>
589
+ </tr>
590
+ <tr>
591
+ <td colspan="2" class="title">
592
+ <div class="onoffswitch">
593
+ <input type="checkbox" name="options[ga_dash_adsense]"
594
+ value="1" class="onoffswitch-checkbox" id="ga_dash_adsense"
595
+ <?php checked( $options['ga_dash_adsense'], 1 ); ?>> <label
596
+ class="onoffswitch-label" for="ga_dash_adsense">
597
+ <div class="onoffswitch-inner"></div>
598
+ <div class="onoffswitch-switch"></div>
599
+ </label>
600
+ </div>
601
+ <div class="switch-desc"><?php _e ( " enable AdSense account linking", 'ga-dash' );?></div>
602
+ </td>
603
+ </tr>
604
+ <tr>
605
+ <td colspan="2" class="title">
606
+ <div class="onoffswitch">
607
+ <input type="checkbox"
608
+ name="options[ga_crossdomain_tracking]" value="1"
609
+ class="onoffswitch-checkbox" id="ga_crossdomain_tracking"
610
+ <?php checked( $options['ga_crossdomain_tracking'], 1 ); ?>>
611
+ <label class="onoffswitch-label"
612
+ for="ga_crossdomain_tracking">
613
+ <div class="onoffswitch-inner"></div>
614
+ <div class="onoffswitch-switch"></div>
615
+ </label>
616
+ </div>
617
+ <div class="switch-desc"><?php _e(" enable cross domain tracking", 'ga-dash' ); ?></div>
618
+ </td>
619
+ </tr>
620
+ <tr>
621
+ <td class="title"><label for="ga_crossdomain_list"><?php _e("Cross Domains:", 'ga-dash'); ?></label></td>
622
+ <td><input type="text" id="ga_crossdomain_list"
623
+ name="options[ga_crossdomain_list]"
624
+ value="<?php echo esc_attr($options['ga_crossdomain_list']); ?>"
625
+ size="50"></td>
626
+ </tr>
627
+ </table>
628
+ </div>
629
+ <div id="gadwp-exclude">
630
+ <table class="options">
631
+ <tr>
632
+ <td colspan="2"><?php echo "<h2>" . __( "Exclude Tracking", 'ga-dash' ) . "</h2>"; ?></td>
633
+ </tr>
634
+ <tr>
635
+ <td class="roles title"><label for="ga_track_exclude"><?php _e("Exclude tracking for:", 'ga-dash' ); ?></label></td>
636
+ <td class="roles">
637
  <?php
638
+ if (! isset($wp_roles)) {
639
+ $wp_roles = new WP_Roles();
640
+ }
641
+ $i = 0;
642
+ ?> <table>
643
+ <tr>
644
  <?php
645
+ foreach ($wp_roles->role_names as $role => $name) {
646
+ $i ++;
647
+ ?>
648
  <td><label> <input type="checkbox"
649
+ name="options[ga_track_exclude][]"
650
+ value="<?php echo $role; ?>"
651
+ <?php if (in_array($role,$options['ga_track_exclude'])) echo 'checked="checked"'; ?> />
652
  <?php echo $name; ?>
653
  </label></td>
654
  <?php
655
+ if ($i % 4 == 0) {
656
+ ?>
657
  </tr>
658
+ <tr>
659
  <?php
 
660
  }
 
 
 
 
 
 
 
 
 
661
  }
662
+ ?>
663
+ </table>
664
+ </td>
665
+ </tr>
666
+ </table>
667
+ </div>
668
+ <table class="options">
669
  <tr>
670
  <td colspan="2"><hr></td>
671
  </tr>
677
  </table>
678
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
679
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
 
 
 
 
680
  </form>
681
  <?php
682
  self::output_sidebar();
683
  }
684
 
685
+ public static function errors_debugging()
686
  {
687
  global $GADASH_Config;
 
 
 
 
 
 
688
  if (! current_user_can('manage_options')) {
689
  return;
690
  }
691
+ $options = self::set_get_options('frontend');
692
+
693
+ if (! $GADASH_Config->options['ga_dash_tableid_jail'] or ! $GADASH_Config->options['ga_dash_token']) {
694
+ $message = "<div class='error'><p><strong>" . __("Something went wrong, check", 'ga-dash') . " <a href='" . menu_page_url('gadash_errors_debugging', false) . "'>" . __('Errors & Debug', 'ga-dash'). "</a> " .__('or', 'ga-dash') . " <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('auhorize the plugin', 'ga-dash') . "</a>.</p></div>";
695
+ }
696
+ ?>
697
+
698
+ <div class="wrap">
699
+ <?php echo "<h2>" . __( "Google Analytics Errors & Debugging", 'ga-dash' ) . "</h2>"; ?>
700
+ </div>
701
+ <div id="poststuff">
702
+ <div id="post-body" class="metabox-holder columns-2">
703
+ <div id="post-body-content">
704
+ <div class="settings-wrapper">
705
+ <div class="inside">
706
+ <?php if (isset($message)) echo $message; ?>
707
+ <?php
708
+ $tabs = array(
709
+ 'errors' => __("Errors & Details", 'ga-dash'),
710
+ 'config' => __("Plugin Settings", 'ga-dash')
711
+ );
712
+ self::navigation_tabs($tabs);
713
+ ?>
714
+ <div id="gadwp-errors">
715
+ <table class="options">
716
+ <tr>
717
+ <td>
718
+ <?php echo __("For errors and/or other issues please check",'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=errors_screen&utm_campaign=gadwp' target='_blank'>". __("the plugin documentation page",'ga-dash')."</a> ".__("and related tutorials",'ga-dash').".";?>
719
+ </td>
720
+ </tr>
721
+ <tr>
722
+ <td><?php echo "<h2>" . __( "Last Error detected", 'ga-dash' ) . "</h2>"; ?></td>
723
+ </tr>
724
+ <tr>
725
+ <td>
726
+ <?php
727
+ $errors = esc_html(print_r(get_transient('gadash_lasterror'), true)) ? esc_html(print_r(get_transient('gadash_lasterror'), true)) : __("None", 'ga-dash');
728
+ echo '<pre class="log_data">Last Error: ';
729
+ echo $errors;
730
+ ?></pre>
731
+ </td>
732
+ </tr>
733
+ <tr>
734
+ <td colspan="2"><hr><?php echo "<h2>" . __( "Error Details", 'ga-dash' ) . "</h2>"; ?></td>
735
+ </tr>
736
+ <tr>
737
+ <td>
738
+ <?php
739
+ echo '<pre class="log_data">Error Details: ';
740
+ $error_details = esc_html(print_r(get_transient('ga_dash_gapi_errors'), true)) ? "\n" . esc_html(print_r(get_transient('ga_dash_gapi_errors'), true)) : __("None", 'ga-dash');
741
+ echo $error_details;
742
+ ?></pre><br />
743
+ <hr>
744
+ </td>
745
+
746
+
747
+ <tr>
748
+
749
+ </table>
750
+ </div>
751
+ <div id="gadwp-config">
752
+ <table class="options">
753
+ <tr>
754
+ <td><?php echo "<h2>" . __( "Plugin Configuration", 'ga-dash' ) . "</h2>"; ?></td>
755
+ </tr>
756
+ <tr>
757
+ <td><pre class="log_data"><?php
758
+ $anonim = $GADASH_Config->options;
759
+ $anonim['wp_version'] = $wp_version;
760
+ $anonim['gadwp_version'] = GADWP_CURRENT_VERSION;
761
+ if ($anonim['ga_dash_token']) {
762
+ $anonim['ga_dash_token'] = 'HIDDEN';
763
+ }
764
+ if ($anonim['ga_dash_refresh_token']) {
765
+ $anonim['ga_dash_refresh_token'] = 'HIDDEN';
766
+ }
767
+ if ($anonim['ga_dash_clientid']) {
768
+ $anonim['ga_dash_clientid'] = 'HIDDEN';
769
+ }
770
+ if ($anonim['ga_dash_clientsecret']) {
771
+ $anonim['ga_dash_clientsecret'] = 'HIDDEN';
772
+ }
773
+ if ($anonim['ga_dash_apikey']) {
774
+ $anonim['ga_dash_apikey'] = 'HIDDEN';
775
+ }
776
+ echo esc_html(print_r($anonim, true));
777
+ ?></pre><br />
778
+ <hr></td>
779
+ </tr>
780
+ </table>
781
+ </div>
782
+
783
+ <?php
784
+ self::output_sidebar();
785
+ }
786
+
787
+ public static function general_settings()
788
+ {
789
+ global $GADASH_Config;
790
+ global $wp_version;
791
+ /*
792
+ * Include Tools
793
+ */
794
+ include_once ($GADASH_Config->plugin_path . '/tools/tools.php');
795
+ $tools = new GADASH_Tools();
796
+ if (! current_user_can('manage_options')) {
797
+ return;
798
+ }
799
+ $options = self::set_get_options('general');
800
+ /*
801
+ * Include GAPI
802
+ */
803
+ 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:', "ga-dash") . ' <a href="https://deconf.com/ask/question/ga-dashboard-absolutely-empty-general-settings#answer-770">Library conflicts between WordPress plugins</a></p></div>';
804
+ include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
805
+ global $GADASH_GAPI;
806
+ echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
807
+ if (isset($_POST['ga_dash_code'])) {
808
+ if (! stripos('x' . $_POST['ga_dash_code'], 'UA-', 1) == 1) {
809
+ try {
810
+ $GADASH_GAPI->client->authenticate($_POST['ga_dash_code']);
811
+ $GADASH_Config->options['ga_dash_token'] = $GADASH_GAPI->client->getAccessToken();
812
+ $google_token = json_decode($GADASH_GAPI->client->getAccessToken());
813
+ $GADASH_Config->options['ga_dash_refresh_token'] = $google_token->refresh_token;
814
+ $GADASH_Config->set_plugin_options();
815
+ $message = "<div class='updated'><p>" . __("Plugin authorization succeeded.", 'ga-dash') . "</p></div>";
816
+ $options = self::set_get_options('general');
817
+ delete_transient('ga_dash_gapi_errors');
818
  } catch (Google_IO_Exception $e) {
819
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $GADASH_GAPI->error_timeout);
820
  return false;
821
  } catch (Google_Service_Exception $e) {
822
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()), $GADASH_GAPI->error_timeout);
823
+ set_transient('ga_dash_gapi_errors', $e->getErrors(), $GADASH_GAPI->error_timeout);
824
  return $e->getCode();
825
  } catch (Exception $e) {
826
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e) . "\nResponseHttpCode:" . $e->getCode(), $GADASH_GAPI->error_timeout);
827
  $GADASH_GAPI->ga_dash_reset_token(false);
828
  }
829
  } else {
831
  }
832
  }
833
 
 
834
  if ($GADASH_GAPI->client->getAccessToken()) {
835
  if ($GADASH_Config->options['ga_dash_profile_list']) {
836
  $profiles = $GADASH_Config->options['ga_dash_profile_list'];
848
  $options = self::set_get_options('general');
849
  }
850
  }
851
+
852
  if (isset($_POST['Clear'])) {
853
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
854
  $tools->ga_dash_clear_cache();
855
+ $message = "<div class='updated'><p>" . __("Cleared Cache.", 'ga-dash') . "</p></div>";
856
  } else {
857
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
858
  }
859
  }
860
  if (isset($_POST['Reset'])) {
861
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
862
  $GADASH_GAPI->ga_dash_reset_token(true);
863
  $tools->ga_dash_clear_cache();
864
+ $message = "<div class='updated'><p>" . __("Token Reseted and Revoked.", 'ga-dash') . "</p></div>";
865
  $options = self::set_get_options('Reset');
866
  } else {
867
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
868
  }
869
  }
870
+
871
+ if (isset($_POST['options']['ga_dash_hidden']) and ! isset($_POST['Clear']) and ! isset($_POST['Reset'])) {
872
+ $message = "<div class='updated'><p>" . __("Settings saved.", 'ga-dash') . "</p></div>";
 
 
873
  if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
874
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
875
  }
876
  }
877
  if (isset($_POST['Hide'])) {
878
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
879
+ $message = "<div class='updated'><p>" . __("All other domains/properties were removed.", 'ga-dash') . "</p></div>";
880
  $lock_profile = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $GADASH_Config->options['ga_dash_tableid_jail']);
881
  $GADASH_Config->options['ga_dash_profile_list'] = array(
882
  $lock_profile
883
  );
884
  $options = self::set_get_options('general');
885
  } else {
886
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
887
  }
888
  }
889
+
 
 
890
  ?>
891
  <div class="wrap">
892
  <?php echo "<h2>" . __( "Google Analytics Settings", 'ga-dash' ) . "</h2>"; ?><hr>
893
+ </div>
894
+ <div id="poststuff">
895
+ <div id="post-body" class="metabox-holder columns-2">
896
+ <div id="post-body-content">
897
+ <div class="settings-wrapper">
898
+ <div class="inside">
899
 
900
  if ($GADASH_GAPI->gapi_errors_handler()) {
901
+ $message = "<div class='error'><p>" . __("Something went wrong, check", 'ga-dash') . " <a href='" . menu_page_url('gadash_errors_debugging', false) . "'>" . __('Errors & Debug', 'ga-dash'). "</a> " .__('or', 'ga-dash') . " <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('auhorize the plugin', 'ga-dash') . "</a>.</p></div>";
902
  }
903
 
904
  if (isset($_POST['Authorize'])) {
910
  echo $message;
911
  ?>
912
  <form name="ga_dash_form" method="post"
913
+ action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
914
+ <input type="hidden" name="options[ga_dash_hidden]" value="Y">
915
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
916
  <table class="options">
917
+ <tr>
918
+ <td colspan="2"><?php echo "<h2>" . __( "Plugin Authorization", 'ga-dash' ) . "</h2>"; ?></td>
919
+ </tr>
920
+ <tr>
921
+ <td colspan="2" class="info">
922
  <?php echo __("You should watch the",'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp' target='_blank'>". __("video",'ga-dash')."</a> ".__("and read this", 'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp' target='_blank'>". __("tutorial",'ga-dash')."</a> ".__("before proceeding to authorization. This plugin requires a properly configured Google Analytics account", 'ga-dash')."!";?>
923
  </td>
924
+ </tr>
925
  <?php
926
  if (! $options['ga_dash_token'] or $options['ga_dash_userapi']) {
927
  ?>
928
  <tr>
929
+ <td colspan="2" class="info"><input
930
+ name="options[ga_dash_userapi]" type="checkbox"
931
+ id="ga_dash_userapi" value="1"
932
+ <?php checked( $options['ga_dash_userapi'], 1 ); ?>
933
+ onchange="this.form.submit()"
934
+ <?php echo ($options['ga_dash_network'])?'disabled="disabled"':''; ?> /><?php _e ( " use your own API Project credentials", 'ga-dash' );?>
935
  </td>
936
+ </tr>
937
  }
938
  if ($options['ga_dash_userapi']) {
939
  ?>
940
  <tr>
941
+ <td class="title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'ga-dash'); ?></label>
942
+ </td>
943
+ <td><input type="text" name="options[ga_dash_apikey]"
944
+ value="<?php echo esc_attr($options['ga_dash_apikey']); ?>"
945
+ size="40" required="required"></td>
946
+ </tr>
947
+ <tr>
948
+ <td class="title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'ga-dash'); ?></label>
949
+ </td>
950
+ <td><input type="text" name="options[ga_dash_clientid]"
951
+ value="<?php echo esc_attr($options['ga_dash_clientid']); ?>"
952
+ size="40" required="required"></td>
953
+ </tr>
954
+ <tr>
955
+ <td class="title"><label
956
+ for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'ga-dash'); ?></label>
957
+ </td>
958
+ <td><input type="text" name="options[ga_dash_clientsecret]"
959
+ value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>"
960
+ size="40" required="required"> <input type="hidden"
961
+ name="options[ga_dash_hidden]" value="Y">
962
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
963
  </td>
964
+ </tr>
965
  <?php
966
  }
967
  ?>
969
  if ($options['ga_dash_token']) {
970
  ?>
971
  <tr>
972
+ <td colspan="2"><input type="submit" name="Reset"
973
+ class="button button-secondary"
974
+ value="<?php _e( "Clear Authorization", 'ga-dash' ); ?>"
975
+ <?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> />
976
+ <input type="submit" name="Clear"
977
+ class="button button-secondary"
978
+ value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /></td>
979
+ </tr>
980
+ <tr>
981
+ <td colspan="2"><hr></td>
982
+ </tr>
983
+ <tr>
984
+ <td colspan="2"><?php echo "<h2>" . __( "General Settings", 'ga-dash' ) . "</h2>"; ?></td>
985
+ </tr>
986
+ <tr>
987
+ <td class="title"><label for="ga_dash_tableid_jail"><?php _e("Select Domain:", 'ga-dash' ); ?></label></td>
988
+ <td><select id="ga_dash_tableid_jail"
989
+ <?php disabled(is_array($options['ga_dash_profile_list']), false); ?>
990
+ name="options[ga_dash_tableid_jail]">
991
  <?php
992
  if (is_array($options['ga_dash_profile_list'])) {
993
  foreach ($options['ga_dash_profile_list'] as $items) {
1005
  _e("and/or hide all other domains", 'ga-dash');
1006
  ?>
1007
  <input type="submit" name="Hide" class="button button-secondary"
1008
+ value="<?php _e( "Hide Now", 'ga-dash' ); ?>" />
1009
  <?php
1010
  }
1011
  ?>
1012
  </td>
1013
+ </tr>
1014
  <?php
1015
  if ($options['ga_dash_tableid_jail']) {
1016
  ?>
1017
  <tr>
1018
+ <td class="title"></td>
1019
+ <td><?php
1020
  $profile_info = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $GADASH_Config->options['ga_dash_tableid_jail']);
1021
  echo '<pre>' . __("View Name:", 'ga-dash') . "\t" . esc_html($profile_info[0]) . "<br />" . __("Tracking ID:", 'ga-dash') . "\t" . esc_html($profile_info[2]) . "<br />" . __("Default URL:", 'ga-dash') . "\t" . esc_html($profile_info[3]) . "<br />" . __("Time Zone:", 'ga-dash') . "\t" . esc_html($profile_info[5]) . '</pre>';
1022
  ?></td>
1023
+ </tr>
1024
  <?php
1025
  }
1026
  ?>
1027
+ <td class="title"><label for="ga_dash_style"><?php _e("Theme Color:", 'ga-dash' ); ?></label></td>
1028
+ <td><input type="text" id="ga_dash_style"
1029
+ class="ga_dash_style" name="options[ga_dash_style]"
1030
+ value="<?php echo esc_attr($options['ga_dash_style']); ?>"
1031
+ size="10"></td>
1032
+ </tr>
1033
+ <tr>
1034
+ <td colspan="2"><hr></td>
1035
+ </tr>
1036
+ <tr>
1037
+ <td colspan="2"><?php echo __('A new frontend widget is available! To enable it, go to','ga-dash').' <a href="widgets.php">'.__('Appearance -> Widgets').'</a> '.__('and look for Google Analytics Dashboard.','ga-dash').' '.''; ?></td>
1038
+ </tr>
1039
+ <tr>
1040
+ <td colspan="2"><hr></td>
1041
+ </tr>
1042
+ <tr>
1043
+ <td colspan="2" class="submit"><input type="submit"
1044
+ name="Submit" class="button button-primary"
1045
+ value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
1046
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1047
  } else {
1048
  ?>
1049
  <tr>
1050
+ <td colspan="2"><hr></td>
1051
+ </tr>
1052
+ <tr>
1053
+ <td colspan="2"><input type="submit" name="Authorize"
1054
+ class="button button-secondary" id="authorize"
1055
+ value="<?php _e( "Authorize Plugin", 'ga-dash' ); ?>"
1056
+ <?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> />
1057
+ <input type="submit" name="Clear"
1058
+ class="button button-secondary"
1059
+ value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /></td>
1060
+ </tr>
1061
+ <tr>
1062
+ <td colspan="2"><hr></td>
1063
+ </tr>
1064
+ </table>
1065
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1066
  <?php
1067
  self::output_sidebar();
1068
  return;
1069
  }
1070
  ?>
1071
+ </form>
1072
  }
1073
  self::output_sidebar();
1074
  }
1089
  /*
1090
  * Include GAPI
1091
  */
1092
+ 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:', "ga-dash") . ' <a href="https://deconf.com/ask/question/ga-dashboard-absolutely-empty-general-settings#answer-770">Library conflicts between WordPress plugins</a></p></div>';
1093
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
1094
  global $GADASH_GAPI;
1095
  echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
1101
  $google_token = json_decode($GADASH_GAPI->client->getAccessToken());
1102
  $GADASH_Config->options['ga_dash_refresh_token'] = $google_token->refresh_token;
1103
  $GADASH_Config->set_plugin_options(true);
1104
+ $message = "<div class='updated'><p>" . __("Plugin authorization succeeded.", 'ga-dash') . "</p></div>";
1105
  $options = self::set_get_options('network');
1106
  if (is_multisite()) { // Cleanup errors on the entire network
1107
+ foreach (wp_get_sites(array( 'limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) {
1108
  switch_to_blog($blog['blog_id']);
1109
  delete_transient('ga_dash_gapi_errors');
1110
  restore_current_blog();
1113
  delete_transient('ga_dash_gapi_errors');
1114
  }
1115
  } catch (Google_IO_Exception $e) {
1116
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $GADASH_GAPI->error_timeout);
1117
  return false;
1118
  } catch (Google_Service_Exception $e) {
1119
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()), $GADASH_GAPI->error_timeout);
1120
+ set_transient('ga_dash_gapi_errors', $e->getErrors(), $GADASH_GAPI->error_timeout);
1121
  return $e->getCode();
1122
  } catch (Exception $e) {
1123
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e) . "\nResponseHttpCode:" . $e->getCode(), $GADASH_GAPI->error_timeout);
1124
  $GADASH_GAPI->ga_dash_reset_token(false);
1125
  }
1126
  } else {
1131
  if (isset($_POST['Refresh'])) {
1132
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
1133
  $GADASH_Config->options['ga_dash_profile_list'] = '';
1134
+ $message = "<div class='updated'><p>" . __("Properties refreshed.", 'ga-dash') . "</p></div>";
1135
  $options = self::set_get_options('network');
1136
  } else {
1137
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
1138
  }
1139
  }
1140
+
 
1141
  if ($GADASH_GAPI->client->getAccessToken()) {
1142
  if ($GADASH_Config->options['ga_dash_profile_list']) {
1143
  $profiles = $GADASH_Config->options['ga_dash_profile_list'];
1155
  $options = self::set_get_options('network');
1156
  }
1157
  }
1158
+
1159
  if (isset($_POST['Clear'])) {
1160
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
1161
  $tools->ga_dash_clear_cache();
1162
+ $message = "<div class='updated'><p>" . __("Cleared Cache.", 'ga-dash') . "</p></div>";
1163
  } else {
1164
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
1165
  }
1166
  }
1167
  if (isset($_POST['Reset'])) {
1168
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
1169
  $GADASH_GAPI->ga_dash_reset_token(true);
1170
  $tools->ga_dash_clear_cache();
1171
+ $message = "<div class='updated'><p>" . __("Token Reseted and Revoked.", 'ga-dash') . "</p></div>";
1172
  $options = self::set_get_options('Reset');
1173
  } else {
1174
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
1175
  }
1176
  }
1177
+
1178
+ if (isset($_POST['options']['ga_dash_hidden']) and ! isset($_POST['Clear']) and ! isset($_POST['Reset']) and ! isset($_POST['Refresh'])) {
1179
+ $message = "<div class='updated'><p>" . __("Settings saved.", 'ga-dash') . "</p></div>";
 
 
1180
  if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
1181
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
1182
  }
1183
  }
1184
  if (isset($_POST['Hide'])) {
1185
  if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
1186
+ $message = "<div class='updated'><p>" . __("All other domains/properties were removed.", 'ga-dash') . "</p></div>";
1187
  $lock_profile = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $GADASH_Config->options['ga_dash_tableid_jail']);
1188
  $GADASH_Config->options['ga_dash_profile_list'] = array(
1189
  $lock_profile
1190
  );
1191
  $options = self::set_get_options('network');
1192
  } else {
1193
+ $message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
1194
  }
1195
  }
1196
+
 
 
1197
  ?>
1198
  <div class="wrap">
1199
  <?php echo "<h2>" . __( "Google Analytics Settings", 'ga-dash' ) . "</h2>"; ?><hr>
1200
+ </div>
1201
+ <div id="poststuff">
1202
+ <div id="post-body" class="metabox-holder columns-2">
1203
+ <div id="post-body-content">
1204
+ <div class="settings-wrapper">
1205
+ <div class="inside">
1206
  if ($GADASH_GAPI->gapi_errors_handler()) {
1207
+ $message = "<div class='error'><p>" . __("Something went wrong, check", 'ga-dash') . " <a href='" . menu_page_url('gadash_errors_debugging', false) . "'>" . __('Errors & Debug', 'ga-dash'). "</a> " .__('or', 'ga-dash') . " <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('auhorize the plugin', 'ga-dash') . "</a>.</p></div>";
1208
  }
1209
  if (isset($_POST['Authorize'])) {
1210
  $tools->ga_dash_clear_cache();
1215
  echo $message;
1216
  ?>
1217
  <form name="ga_dash_form" method="post"
1218
+ action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
1219
+ <input type="hidden" name="options[ga_dash_hidden]"
1220
+ value="Y">
1221
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
1222
  <table class="options">
1223
+ <tr>
1224
+ <td colspan="2"><?php echo "<h2>" . __( "Network Setup", 'ga-dash' ) . "</h2>"; ?></td>
1225
+ </tr>
1226
+ <tr>
1227
+ <td colspan="2" class="title">
1228
+ <div class="onoffswitch">
1229
+ <input type="checkbox"
1230
+ name="options[ga_dash_network]" value="1"
1231
+ class="onoffswitch-checkbox" id="ga_dash_network"
1232
+ <?php checked( $options['ga_dash_network'], 1); ?>
1233
+ onchange="this.form.submit()"> <label
1234
+ class="onoffswitch-label" for="ga_dash_network">
1235
+ <div class="onoffswitch-inner"></div>
1236
+ <div class="onoffswitch-switch"></div>
1237
+ </label>
1238
+ </div>
1239
+ <div class="switch-desc"><?php _e ( " use a single Google Analytics account for the entire network", 'ga-dash' );?></div>
1240
+ </td>
1241
+ </tr>
1242
  <?php if ($options['ga_dash_network']){ //Network Mode check?>
1243
  <tr>
1244
+ <td colspan="2"><hr></td>
1245
+ </tr>
1246
+ <tr>
1247
+ <td colspan="2"><?php echo "<h2>" . __( "Plugin Authorization", 'ga-dash' ) . "</h2>"; ?></td>
1248
+ </tr>
1249
+ <tr>
1250
+ <td colspan="2" class="info">
1251
  <?php echo __("You should watch the",'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/' target='_blank'>". __("video",'ga-dash')."</a> ".__("and read this", 'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/' target='_blank'>". __("tutorial",'ga-dash')."</a> ".__("before proceeding to authorization. This plugin requires a properly configured Google Analytics account", 'ga-dash')."!";?>
1252
  </td>
1253
+ </tr>
1254
  <?php
1255
  if (! $options['ga_dash_token'] or $options['ga_dash_userapi']) {
1256
  ?>
1257
  <tr>
1258
+ <td colspan="2" class="info"><input
1259
+ name="options[ga_dash_userapi]" type="checkbox"
1260
+ id="ga_dash_userapi" value="1"
1261
+ <?php checked( $options['ga_dash_userapi'], 1 ); ?>
1262
+ onchange="this.form.submit()" /><?php _e ( " use your own API Project credentials", 'ga-dash' );?>
1263
  </td>
1264
+ </tr>
1265
  }
1266
  if ($options['ga_dash_userapi']) {
1267
  ?>
1268
  <tr>
1269
+ <td class="title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'ga-dash'); ?></label>
1270
+ </td>
1271
+ <td><input type="text" name="options[ga_dash_apikey]"
1272
+ value="<?php echo esc_attr($options['ga_dash_apikey']); ?>"
1273
+ size="40" required="required"></td>
1274
+ </tr>
1275
+ <tr>
1276
+ <td class="title"><label
1277
+ for="options[ga_dash_clientid]"><?php _e("Client ID:", 'ga-dash'); ?></label>
1278
+ </td>
1279
+ <td><input type="text"
1280
+ name="options[ga_dash_clientid]"
1281
+ value="<?php echo esc_attr($options['ga_dash_clientid']); ?>"
1282
+ size="40" required="required"></td>
1283
+ </tr>
1284
+ <tr>
1285
+ <td class="title"><label
1286
+ for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'ga-dash'); ?></label>
1287
+ </td>
1288
+ <td><input type="text"
1289
+ name="options[ga_dash_clientsecret]"
1290
+ value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>"
1291
+ size="40" required="required"> <input type="hidden"
1292
+ name="options[ga_dash_hidden]" value="Y">
1293
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
1294
  </td>
1295
+ </tr>
1296
  <?php
1297
  }
1298
  ?>
1300
  if ($options['ga_dash_token']) {
1301
  ?>
1302
  <tr>
1303
+ <td colspan="2"><input type="submit" name="Reset"
1304
+ class="button button-secondary"
1305
+ value="<?php _e( "Clear Authorization", 'ga-dash' ); ?>" />
1306
+ <input type="submit" name="Clear"
1307
+ class="button button-secondary"
1308
+ value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /> <input
1309
+ type="submit" name="Refresh"
1310
+ class="button button-secondary"
1311
+ value="<?php _e( "Refresh Properties", 'ga-dash' ); ?>" /></td>
1312
+ </tr>
1313
+ <tr>
1314
+ <td colspan="2"><hr></td>
1315
+ </tr>
1316
+ <tr>
1317
+ <td colspan="2"><?php echo "<h2>" . __( "Properties/Views Settings", 'ga-dash' ) . "</h2>"; ?></td>
1318
+ </tr>
1319
  <?php
1320
  if (isset($options['ga_dash_tableid_network'])) {
1321
  $options['ga_dash_tableid_network'] = json_decode(json_encode($options['ga_dash_tableid_network']), FALSE);
1322
  }
1323
+ foreach (wp_get_sites(array( 'limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) {
1324
  ?>
1325
  <tr>
1326
+ <td class="title-select"><label
1327
+ for="ga_dash_tableid_network"><?php echo '<strong>'.$blog['domain'].$blog['path'].'</strong>: ';?></label></td>
1328
+ <td><select id="ga_dash_tableid_network"
1329
+ <?php disabled(is_array($options['ga_dash_profile_list']),false);?>
1330
+ name="options[ga_dash_tableid_network][<?php echo $blog['blog_id'];?>]">
1331
  <?php
1332
  if (is_array($options['ga_dash_profile_list'])) {
1333
  foreach ($options['ga_dash_profile_list'] as $items) {
1341
  }
1342
  ?>
1343
  </select><br /></td>
1344
+ </tr>
1345
  <?php
1346
  }
1347
  ?>
1348
  <tr>
1349
+ <td colspan="2"><hr><?php echo "<h2>" . __( "Exclude Tracking", 'ga-dash' ) . "</h2>"; ?></td>
1350
+ </tr>
1351
+ <tr>
1352
+ <td colspan="2" class="title">
1353
+ <div class="onoffswitch">
1354
+ <input type="checkbox"
1355
+ name="options[ga_dash_excludesa]" value="1"
1356
+ class="onoffswitch-checkbox" id="ga_dash_excludesa"<?php checked( $options['ga_dash_excludesa'], 1); ?>">
1357
+ <label class="onoffswitch-label"
1358
+ for="ga_dash_excludesa">
1359
+ <div class="onoffswitch-inner"></div>
1360
+ <div class="onoffswitch-switch"></div>
1361
+ </label>
1362
+ </div>
1363
+ <div class="switch-desc"><?php _e ( " exclude Super Admin tracking for the entire network", 'ga-dash' );?></div>
1364
+ </td>
1365
+ </tr>
1366
+ <tr>
1367
+ <td colspan="2"><hr></td>
1368
+ </tr>
1369
+ <tr>
1370
+ <td colspan="2" class="submit"><input type="submit"
1371
+ name="Submit" class="button button-primary"
1372
+ value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
1373
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1374
  } else {
1375
  ?>
1376
+ <td colspan="2"><hr></td>
1377
+ </tr>
1378
+ <tr>
1379
+ <td colspan="2"><input type="submit" name="Authorize"
1380
+ class="button button-secondary" id="authorize"
1381
+ value="<?php _e( "Authorize Plugin", 'ga-dash' ); ?>"/>
1382
+ <input type="submit" name="Clear"
1383
+ class="button button-secondary"
1384
+ value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /></td>
1385
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1386
  <?php } //Network Mode check?>
1387
  <tr>
1388
+ <td colspan="2"><hr></td>
1389
+ </tr>
1390
+ </table>
1391
+ </form>
1392
  <?php
1393
  self::output_sidebar();
1394
  return;
1395
  }
1396
  ?>
1397
  </table>
1398
+ </form>
1399
  <?php
1400
  }
1401
  self::output_sidebar();
1403
 
1404
  public static function output_sidebar()
1405
  {
1406
+ global $GADASH_Config;
1407
  ?>
1408
  </div>
1409
+ </div>
1410
+ </div>
1411
+ <div id="postbox-container-1" class="postbox-container">
1412
+ <div class="meta-box-sortables">
1413
+ <div class="postbox">
1414
+ <h3>
1415
+ <span><?php _e("Setup Tutorial & Demo",'ga-dash') ?></span>
1416
+ </h3>
1417
+ <div class="inside">
1418
+ <a
1419
+ href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=video&utm_campaign=gadwp"
1420
+ target="_blank"><img
1421
+ src="<?php echo plugins_url( 'images/google-analytics-dashboard.png' , __FILE__ );?>"
1422
+ width="100%" alt="" /></a>
1423
+ </div>
1424
+ </div>
1425
+ <div class="postbox">
1426
+ <h3>
1427
+ <span><?php _e("Support & Reviews",'ga-dash')?></span>
1428
+ </h3>
1429
+ <div class="inside">
1430
+ <div class="gadash-title">
1431
+ <a
1432
+ href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=support&utm_campaign=gadwp"><img
1433
+ src="<?php echo plugins_url( 'images/help.png' , __FILE__ ); ?>" /></a>
1434
+ </div>
1435
+ <div class="gadash-desc"><?php echo __('Plugin documentation and support on', 'ga-dash') . ' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=support&utm_campaign=gadwp">deconf.com</a>.'; ?></div>
1436
+ <br />
1437
+ <div class="gadash-title">
1438
+ <a
1439
+ href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info"><img
1440
+ src="<?php echo plugins_url( 'images/star.png' , __FILE__ ); ?>" /></a>
1441
+ </div>
1442
+ <div class="gadash-desc"><?php echo __('Your feedback and review are both important,', 'ga-dash').' <a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info">'.__('rate this plugin', 'ga-dash').'</a>!'; ?></div>
1443
+ </div>
1444
+ </div>
1445
+ <div class="postbox">
1446
+ <h3>
1447
+ <span><?php _e("Further Reading",'ga-dash')?></span>
1448
+ </h3>
1449
+ <div class="inside">
1450
+ <div class="gadash-title">
1451
+ <a
1452
+ href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp"><img
1453
+ src="<?php echo plugins_url( 'images/ssl.png' , __FILE__ ); ?>" /></a>
1454
+ </div>
1455
+ <div class="gadash-desc"><?php echo '<a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp">'.__('Improve search rankings', 'ga-dash').'</a> '.__('by moving your website to HTTPS/SSL.', 'ga-dash'); ?></div>
1456
+ <br />
1457
+ <div class="gadash-title">
1458
+ <a
1459
+ href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp"><img
1460
+ src="<?php echo plugins_url( 'images/wp.png' , __FILE__ ); ?>" /></a>
1461
+ </div>
1462
+ <div class="gadash-desc"><?php echo __('Other', 'ga-dash').' <a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp">'.__('WordPress Plugins', 'ga-dash').'</a> '.__('written by the same author', 'ga-dash').'.'; ?></div>
1463
+ </div>
1464
+ </div>
1465
+ <div class="postbox">
1466
+ <h3>
1467
+ <span><?php _e("Other Services",'ga-dash')?></span>
1468
+ </h3>
1469
+ <div class="inside">
1470
+ <div class="gadash-title">
1471
+ <a href="http://tracking.maxcdn.com/c/94142/36539/378"><img
1472
+ src="<?php echo plugins_url( 'images/mcdn.png' , __FILE__ ); ?>" /></a>
1473
+ </div>
1474
+ <div class="gadash-desc"><?php echo __('Speed up your website and plug into a whole', 'ga-dash').' <a href="http://tracking.maxcdn.com/c/94142/36539/378">'.__('new level of site speed', 'ga-dash').'</a>.'; ?></div>
1475
+ <br />
1476
+ <div class="gadash-title">
1477
+ <a
1478
+ href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp"><img
1479
+ src="<?php echo plugins_url( 'images/clicky.png' , __FILE__ ); ?>" /></a>
1480
+ </div>
1481
+ <div class="gadash-desc"><?php echo '<a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp">'.__('Web Analytics', 'ga-dash').'</a> '.__('service with users tracking at IP level.', 'ga-dash'); ?></div>
1482
+ </div>
1483
+ </div>
1484
+ </div>
1485
+ </div>
1486
  </div>
 
1487
  </div>
 
 
 
 
 
1488
  <?php
1489
+
1490
+ /*
1491
+ * Include Tools
1492
+ */
1493
+ include_once ($GADASH_Config->plugin_path . '/tools/tools.php');
1494
+ $tools = new GADASH_Tools();
1495
+
1496
+ $tools->ga_dash_cleanup_timeouts();
1497
+
1498
  }
1499
  }
admin/js/admin.js CHANGED
@@ -1,65 +1,78 @@
1
- function checknpcounter(max) {
2
- if (npcounter == max) {
3
- NProgress.done();
4
- } else {
5
- npcounter++;
6
- NProgress.set((1/(max+1))*npcounter);
7
- }
8
- }
9
-
10
  jQuery(document).ready(
11
- function() {
12
- jQuery(".log_data").hide();
13
- jQuery(".show_hide").show();
14
- jQuery('.show_hide').click(function() {
15
- jQuery(".log_data").slideToggle();
16
- jQuery(this).text(jQuery(this).text() == 'Show Log' ? 'Hide Log' : 'Show Log');
17
- });
18
- }
19
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
- jQuery(window).resize(
22
- function() {
23
- if (typeof ga_dash_drawmainchart == "function"
24
- && typeof gadash_mainchart !== 'undefined'
25
- && !jQuery.isNumeric(gadash_mainchart)) {
26
- ga_dash_drawmainchart(gadash_mainchart);
27
- }
28
- if (typeof ga_dash_drawlocations == "function"
29
- && typeof gadash_locations !== 'undefined'
30
- && !jQuery.isNumeric(gadash_locations)) {
31
- ga_dash_drawmaplocations(gadash_locations);
32
- ga_dash_drawlocations(gadash_locations);
33
- }
34
- if (typeof ga_dash_drawtrafficchannels == "function"
35
- && typeof gadash_trafficchannels !== 'undefined'
36
- && !jQuery.isNumeric(gadash_trafficchannels)) {
37
- ga_dash_drawtrafficchannels(gadash_trafficchannels);
38
- }
39
- if (typeof ga_dash_drawprs == "function"
40
- && typeof gadash_prs !== 'undefined'
41
- && !jQuery.isNumeric(gadash_prs)) {
42
- ga_dash_drawprs(gadash_prs);
43
- }
44
- if (typeof ga_dash_drawtrafficmediums == "function"
45
- && typeof gadash_trafficmediums !== 'undefined'
46
- && !jQuery.isNumeric(gadash_trafficmediums)) {
47
- ga_dash_drawtrafficmediums(gadash_trafficmediums);
48
- }
49
- if (typeof ga_dash_drawtraffictype == "function"
50
- && typeof gadash_traffictype !== 'undefined'
51
- && !jQuery.isNumeric(gadash_traffictype)) {
52
- ga_dash_drawtraffictype(gadash_traffictype);
53
- }
54
- if (typeof ga_dash_drawsocialnetworks == "function"
55
- && typeof gadash_socialnetworks !== 'undefined'
56
- && !jQuery.isNumeric(gadash_socialnetworks)) {
57
- ga_dash_drawsocialnetworks(gadash_socialnetworks);
58
- }
59
- if (typeof ga_dash_drawtrafficorganic == "function"
60
- && typeof gadash_trafficorganic !== 'undefined'
61
- && !jQuery.isNumeric(gadash_trafficorganic)) {
62
- ga_dash_drawtrafficorganic(gadash_trafficorganic);
63
  }
64
- }
65
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  jQuery(document).ready(
2
+ function() {
3
+ if (window.location.href.indexOf("page=gadash_") != -1) {
4
+ var ident = 'basic';
5
+
6
+ if (window.location.hash) {
7
+ ident = window.location.hash.split('#')[2].split('-')[1];
8
+ }else if (window.location.href.indexOf("page=gadash_errors_debugging") != -1){
9
+ ident = 'errors';
10
+ }
11
+
12
+ jQuery(".nav-tab-wrapper a").each(function(index) {
13
+ jQuery(this).removeClass("nav-tab-active");
14
+ jQuery("#" + this.hash.split('#')[2]).hide();
15
+ });
16
+ jQuery("#tab-" + ident).addClass("nav-tab-active");
17
+ jQuery("#gadwp-" + ident).show();
18
+ }
19
+
20
+ jQuery('a[href^="#"]').click(function(e) {
21
+ if (window.location.href.indexOf("page=gadash_") != -1) {
22
+ jQuery(".nav-tab-wrapper a").each(function(index) {
23
+ jQuery(this).removeClass("nav-tab-active");
24
+ jQuery("#" + this.hash.split('#')[2]).hide();
25
+ });
26
+ jQuery(this).addClass("nav-tab-active");
27
+ jQuery("#" + this.hash.split('#')[2]).show();
28
+ }
29
+ });
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
+
33
  );
34
+
35
+ jQuery(window).resize(
36
+ function() {
37
+ if (typeof ga_dash_drawmainchart == "function"
38
+ && typeof gadash_mainchart !== 'undefined'
39
+ && !jQuery.isNumeric(gadash_mainchart)) {
40
+ ga_dash_drawmainchart(gadash_mainchart);
41
+ }
42
+ if (typeof ga_dash_drawlocations == "function"
43
+ && typeof gadash_locations !== 'undefined'
44
+ && !jQuery.isNumeric(gadash_locations)) {
45
+ ga_dash_drawmaplocations(gadash_locations);
46
+ ga_dash_drawlocations(gadash_locations);
47
+ }
48
+ if (typeof ga_dash_drawtrafficchannels == "function"
49
+ && typeof gadash_trafficchannels !== 'undefined'
50
+ && !jQuery.isNumeric(gadash_trafficchannels)) {
51
+ ga_dash_drawtrafficchannels(gadash_trafficchannels);
52
+ }
53
+ if (typeof ga_dash_drawprs == "function"
54
+ && typeof gadash_prs !== 'undefined'
55
+ && !jQuery.isNumeric(gadash_prs)) {
56
+ ga_dash_drawprs(gadash_prs);
57
+ }
58
+ if (typeof ga_dash_drawtrafficmediums == "function"
59
+ && typeof gadash_trafficmediums !== 'undefined'
60
+ && !jQuery.isNumeric(gadash_trafficmediums)) {
61
+ ga_dash_drawtrafficmediums(gadash_trafficmediums);
62
+ }
63
+ if (typeof ga_dash_drawtraffictype == "function"
64
+ && typeof gadash_traffictype !== 'undefined'
65
+ && !jQuery.isNumeric(gadash_traffictype)) {
66
+ ga_dash_drawtraffictype(gadash_traffictype);
67
+ }
68
+ if (typeof ga_dash_drawsocialnetworks == "function"
69
+ && typeof gadash_socialnetworks !== 'undefined'
70
+ && !jQuery.isNumeric(gadash_socialnetworks)) {
71
+ ga_dash_drawsocialnetworks(gadash_socialnetworks);
72
+ }
73
+ if (typeof ga_dash_drawtrafficorganic == "function"
74
+ && typeof gadash_trafficorganic !== 'undefined'
75
+ && !jQuery.isNumeric(gadash_trafficorganic)) {
76
+ ga_dash_drawtrafficorganic(gadash_trafficorganic);
77
+ }
78
+ });
config.php CHANGED
@@ -186,10 +186,10 @@ if (! class_exists('GADASH_Config')) {
186
  include_once ($this->plugin_path . '/tools/tools.php');
187
  $tools = new GADASH_Tools();
188
  $tools->ga_dash_clear_cache();
189
- delete_option('gadash_lasterror');
190
  update_option('gadwp_version', GADWP_CURRENT_VERSION);
191
  if (is_multisite()) { // Cleanup errors on the entire network
192
- foreach (wp_get_sites() as $blog) {
193
  switch_to_blog($blog['blog_id']);
194
  delete_transient('ga_dash_gapi_errors');
195
  restore_current_blog();
186
  include_once ($this->plugin_path . '/tools/tools.php');
187
  $tools = new GADASH_Tools();
188
  $tools->ga_dash_clear_cache();
189
+ delete_transient('gadash_lasterror');
190
  update_option('gadwp_version', GADWP_CURRENT_VERSION);
191
  if (is_multisite()) { // Cleanup errors on the entire network
192
+ foreach (wp_get_sites(array( 'limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) {
193
  switch_to_blog($blog['blog_id']);
194
  delete_transient('ga_dash_gapi_errors');
195
  restore_current_blog();
front/ajax-actions.php CHANGED
@@ -62,7 +62,7 @@ if (! class_exists('GADASH_Frontend_Ajax')) {
62
  die();
63
  }
64
 
65
- if ($GADASH_Config->options['ga_dash_token'] and function_exists('curl_version') and $GADASH_Config->options['ga_dash_tableid_jail']) {
66
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
67
  global $GADASH_GAPI;
68
  } else {
@@ -126,7 +126,7 @@ if (! class_exists('GADASH_Frontend_Ajax')) {
126
  die();
127
  }
128
 
129
- if ($GADASH_Config->options['ga_dash_token'] and function_exists('curl_version') and $GADASH_Config->options['ga_dash_tableid_jail']) {
130
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
131
  global $GADASH_GAPI;
132
  include_once ($GADASH_Config->plugin_path . '/tools/tools.php');
62
  die();
63
  }
64
 
65
+ if ($GADASH_Config->options['ga_dash_token'] and $GADASH_Config->options['ga_dash_tableid_jail']) {
66
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
67
  global $GADASH_GAPI;
68
  } else {
126
  die();
127
  }
128
 
129
+ if ($GADASH_Config->options['ga_dash_token'] and $GADASH_Config->options['ga_dash_tableid_jail']) {
130
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
131
  global $GADASH_GAPI;
132
  include_once ($GADASH_Config->plugin_path . '/tools/tools.php');
front/css/content_stats.css CHANGED
@@ -26,32 +26,38 @@
26
  text-transform: uppercase;
27
  font-weight: 600;
28
  font-size: 14px;
29
- padding-bottom: 5px;
30
  }
31
 
32
- #gadash-widget{
33
  padding:0 5px;
34
  }
35
 
36
- #gadash-widgetchart {
37
  width: 100%;
38
  }
39
 
40
- #gadash-widgettotals {
41
  margin: 0 0 10px 0;
42
  width: 100%;
43
  display: table;
44
  clear: both;
45
  }
46
 
47
- #gadash-widgettotals .gadash-left {
48
  padding: 10px 0 0 0;
49
  width: 45%;
50
  float: left;
51
  font-weight: 600;
52
  }
 
 
 
 
 
 
53
 
54
- #gadash-widgettotals .gadash-right {
55
  padding: 10px 0 0 0;
56
  float: left;
57
  font-style: italic;
26
  text-transform: uppercase;
27
  font-weight: 600;
28
  font-size: 14px;
29
+ padding-bottom: 2px;
30
  }
31
 
32
+ #gadwp-widget{
33
  padding:0 5px;
34
  }
35
 
36
+ #gadwp-widgetchart {
37
  width: 100%;
38
  }
39
 
40
+ #gadwp-widgettotals {
41
  margin: 0 0 10px 0;
42
  width: 100%;
43
  display: table;
44
  clear: both;
45
  }
46
 
47
+ #gadwp-widgettotals .gadwp-left {
48
  padding: 10px 0 0 0;
49
  width: 45%;
50
  float: left;
51
  font-weight: 600;
52
  }
53
+
54
+ #gadwp-progressbar{
55
+ width:100%;
56
+ height:3px;
57
+ margin:3px 0;
58
+ }
59
 
60
+ #gadwp-widgettotals .gadwp-right {
61
  padding: 10px 0 0 0;
62
  float: left;
63
  font-style: italic;
front/frontend.php CHANGED
@@ -69,15 +69,35 @@ if (! class_exists('GADASH_Frontend')) {
69
  $post_id = $post->ID;
70
 
71
  $content .= '<script type="text/javascript">
72
- gadash_firstclick = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  npcounter = 0;
74
 
75
  jQuery(document).ready(function(){
76
  jQuery("#gadwp-title").click(function(){
77
  if (gadash_firstclick){
78
- NProgress.configure({ parent: "#gadwp-content" });
79
- NProgress.configure({ showSpinner: false });
80
- NProgress.start();
 
 
 
 
 
 
 
81
  if(typeof ga_dash_drawpagesessions == "function"){
82
  jQuery.post("' . admin_url('admin-ajax.php') . '", {action: "gadash_get_frontend_pagereports",gadash_pageurl: "' . $page_url . '",gadash_postid: "' . $post_id . '",query: "pageviews",gadash_security_pagereports: "' . wp_create_nonce('gadash_get_frontend_pagereports') . '"}, function(response){
83
  gadash_pagesessions = jQuery.parseJSON(response);
@@ -151,8 +171,7 @@ if (! class_exists('GADASH_Frontend')) {
151
  var options = {
152
  page: "enable",
153
  pageSize: 6,
154
- width: "100%",
155
- allowHtml:true
156
  };
157
 
158
  var chart = new google.visualization.Table(document.getElementById("gadwp-searches"));
@@ -167,8 +186,9 @@ if (! class_exists('GADASH_Frontend')) {
167
  <div id="gadwp-title">
168
  <a href="#gadwp">' . __('Google Analytics Reports', "ga-dash") . ' <span id="gadwp-arrow">&#x25BC;</span></a>
169
  </div>
 
170
  <div id="gadwp-content">
171
- ' . ($GADASH_Config->options['ga_dash_frontend_stats'] ? '<div id="gadwp-sessions" class="gadwp-spinner"></div>' : '') . ($GADASH_Config->options['ga_dash_frontend_keywords'] ? '<div id="gadwp-searches" class="gadwp-spinner"></div>' : '') . '
172
  </div>
173
  </div>
174
  </p>';
69
  $post_id = $post->ID;
70
 
71
  $content .= '<script type="text/javascript">
72
+
73
+ gadash_firstclick = true;
74
+
75
+ function checknpcounter(max) {
76
+ try {
77
+ if (npcounter == max) {
78
+ NProgress.done();
79
+ } else {
80
+ npcounter++;
81
+ NProgress.set((1/(max+1))*npcounter);
82
+ }
83
+ } catch(e) {}
84
+ }
85
+
86
  npcounter = 0;
87
 
88
  jQuery(document).ready(function(){
89
  jQuery("#gadwp-title").click(function(){
90
  if (gadash_firstclick){
91
+
92
+ try {
93
+ NProgress.configure({ parent: "#gadwp-progressbar" });
94
+ NProgress.configure({ showSpinner: false });
95
+ NProgress.start();
96
+ } catch(e) {
97
+ jQuery("#gadwp-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border":"1px solid red","border-left":"5px solid red","font-size":"13px"});
98
+ jQuery("#gadwp-progressbar").html("'.__("A JavaScript Error is blocking plugin resources!", 'ga-dash').'");
99
+ }
100
+
101
  if(typeof ga_dash_drawpagesessions == "function"){
102
  jQuery.post("' . admin_url('admin-ajax.php') . '", {action: "gadash_get_frontend_pagereports",gadash_pageurl: "' . $page_url . '",gadash_postid: "' . $post_id . '",query: "pageviews",gadash_security_pagereports: "' . wp_create_nonce('gadash_get_frontend_pagereports') . '"}, function(response){
103
  gadash_pagesessions = jQuery.parseJSON(response);
171
  var options = {
172
  page: "enable",
173
  pageSize: 6,
174
+ width: "100%"
 
175
  };
176
 
177
  var chart = new google.visualization.Table(document.getElementById("gadwp-searches"));
186
  <div id="gadwp-title">
187
  <a href="#gadwp">' . __('Google Analytics Reports', "ga-dash") . ' <span id="gadwp-arrow">&#x25BC;</span></a>
188
  </div>
189
+ <div id="gadwp-progressbar"></div>
190
  <div id="gadwp-content">
191
+ ' . ($GADASH_Config->options['ga_dash_frontend_stats'] ? '<div id="gadwp-sessions"></div>' : '') . ($GADASH_Config->options['ga_dash_frontend_keywords'] ? '<div id="gadwp-searches" class="gadwp-spinner"></div>' : '') . '
192
  </div>
193
  </div>
194
  </p>';
front/tracking.php CHANGED
@@ -30,7 +30,7 @@ if (! class_exists('GADASH_Tracking')) {
30
  }
31
  }
32
 
33
- function ga_dash_tracking($head)
34
  {
35
  global $GADASH_Config;
36
  /*
30
  }
31
  }
32
 
33
+ function ga_dash_tracking()
34
  {
35
  global $GADASH_Config;
36
  /*
front/widgets.php CHANGED
@@ -95,13 +95,13 @@ class GADSH_Frontend_Widget extends WP_Widget
95
 
96
  switch ($instance['display']) {
97
  case '1':
98
- echo '<div id="gadash-widget"><div id="gadash-widgetchart"></div><div id="gadash-widgettotals"></div></div>';
99
  break;
100
  case '2':
101
- echo '<div id="gadash-widget"><div id="gadash-widgetchart"></div></div>';
102
  break;
103
  case '3':
104
- echo '<div id="gadash-widget"><div id="gadash-widgettotals"></div></div>';
105
  break;
106
  }
107
 
@@ -110,16 +110,16 @@ class GADSH_Frontend_Widget extends WP_Widget
110
  jQuery.post("' . admin_url('admin-ajax.php') . '", {action: "gadash_get_frontendwidget_data",gadash_anonim: "' . $instance['anonim'] . '",gadash_period: "' . $instance['period'] . '"}, function(response){
111
  response = jQuery.parseJSON(response);
112
  if (!jQuery.isNumeric(response)){
113
- if (jQuery("#gadash-widgetchart")[0]){
114
  gadash_widgetsessions=jQuery.parseJSON(response[0]);
115
  google.setOnLoadCallback(ga_dash_drawfwidgetsessions(gadash_widgetsessions));
116
  }
117
- if (jQuery("#gadash-widgettotals")[0]){
118
  ga_dash_drawtotalsstats(jQuery.parseJSON(response[1]));
119
  }
120
  }else{
121
- jQuery("#gadash-widgetchart").css({"background-color":"#F7F7F7","height":"auto","padding-top":"50px","padding-bottom":"50px","color":"#000","text-align":"center"});
122
- jQuery("#gadash-widgetchart").html("' . __("This report is unavailable", 'ga-dash') . ' ("+response+")");
123
  }
124
  });';
125
 
@@ -133,10 +133,9 @@ class GADSH_Frontend_Widget extends WP_Widget
133
  titlePosition: "in",
134
  chartArea: {width: "95%",height:"75%"},
135
  hAxis: { textPosition: "none"},
136
- vAxis: { textPosition: "none", minValue: 0, gridlines: {color: "transparent"}, baselineColor: "transparent"},
137
- allowHtml:true
138
  }
139
- var chart = new google.visualization.AreaChart(document.getElementById("gadash-widgetchart"));
140
  ' . $formater . '
141
  chart.draw(data, options);
142
  }
@@ -144,7 +143,7 @@ class GADSH_Frontend_Widget extends WP_Widget
144
  if (response == null){
145
  response = 0;
146
  }
147
- jQuery("#gadash-widgettotals").html("<div class=\"gadash-left\">' . __("Period:", 'ga-dash') . '</div> <div class=\"gadash-right\">' . $periodtext . '</div><div class=\"gadash-left\">' . __("Sessions:", 'ga-dash') . '</div> <div class=\"gadash-right\">"+response+"</div>");
148
  }';
149
 
150
  echo '</script>';
95
 
96
  switch ($instance['display']) {
97
  case '1':
98
+ echo '<div id="gadwp-widget"><div id="gadwp-widgetchart"></div><div id="gadwp-widgettotals"></div></div>';
99
  break;
100
  case '2':
101
+ echo '<div id="gadwp-widget"><div id="gadwp-widgetchart"></div></div>';
102
  break;
103
  case '3':
104
+ echo '<div id="gadwp-widget"><div id="gadwp-widgettotals"></div></div>';
105
  break;
106
  }
107
 
110
  jQuery.post("' . admin_url('admin-ajax.php') . '", {action: "gadash_get_frontendwidget_data",gadash_anonim: "' . $instance['anonim'] . '",gadash_period: "' . $instance['period'] . '"}, function(response){
111
  response = jQuery.parseJSON(response);
112
  if (!jQuery.isNumeric(response)){
113
+ if (jQuery("#gadwp-widgetchart")[0]){
114
  gadash_widgetsessions=jQuery.parseJSON(response[0]);
115
  google.setOnLoadCallback(ga_dash_drawfwidgetsessions(gadash_widgetsessions));
116
  }
117
+ if (jQuery("#gadwp-widgettotals")[0]){
118
  ga_dash_drawtotalsstats(jQuery.parseJSON(response[1]));
119
  }
120
  }else{
121
+ jQuery("#gadwp-widgetchart").css({"background-color":"#F7F7F7","height":"auto","padding-top":"50px","padding-bottom":"50px","color":"#000","text-align":"center"});
122
+ jQuery("#gadwp-widgetchart").html("' . __("This report is unavailable", 'ga-dash') . ' ("+response+")");
123
  }
124
  });';
125
 
133
  titlePosition: "in",
134
  chartArea: {width: "95%",height:"75%"},
135
  hAxis: { textPosition: "none"},
136
+ vAxis: { textPosition: "none", minValue: 0, gridlines: {color: "transparent"}, baselineColor: "transparent"}
 
137
  }
138
+ var chart = new google.visualization.AreaChart(document.getElementById("gadwp-widgetchart"));
139
  ' . $formater . '
140
  chart.draw(data, options);
141
  }
143
  if (response == null){
144
  response = 0;
145
  }
146
+ jQuery("#gadwp-widgettotals").html("<div class=\"gadwp-left\">' . __("Period:", 'ga-dash') . '</div> <div class=\"gadwp-right\">' . $periodtext . '</div><div class=\"gadwp-left\">' . __("Sessions:", 'ga-dash') . '</div> <div class=\"gadwp-right\">"+response+"</div>");
147
  }';
148
 
149
  echo '</script>';
gadwp.php CHANGED
@@ -4,10 +4,10 @@
4
  * Plugin URI: https://deconf.com
5
  * Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6
  * Author: Alin Marcu
7
- * Version: 4.4.2
8
  * Author URI: https://deconf.com
9
  */
10
- define('GADWP_CURRENT_VERSION', '4.4.2');
11
 
12
  /*
13
  * Include Install
4
  * Plugin URI: https://deconf.com
5
  * Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6
  * Author: Alin Marcu
7
+ * Version: 4.4.3
8
  * Author URI: https://deconf.com
9
  */
10
+ define('GADWP_CURRENT_VERSION', '4.4.3');
11
 
12
  /*
13
  * Include Install
install/uninstall.php CHANGED
@@ -13,12 +13,12 @@ class GADASH_Uninstall
13
  {
14
  global $wpdb;
15
  if (is_multisite()) { // Cleanup Network install
16
- foreach (wp_get_sites() as $blog) {
17
  switch_to_blog($blog['blog_id']);
18
  $sqlquery = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_gadash%%'");
19
  $sqlquery = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_gadash%%'");
20
  delete_option('gadash_options');
21
- delete_option('gadash_lasterror');
22
  delete_transient('ga_dash_refresh_token');
23
  delete_transient('ga_dash_gapi_errors');
24
  restore_current_blog();
@@ -29,7 +29,7 @@ class GADASH_Uninstall
29
  $sqlquery = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_gadash%%'");
30
  $sqlquery = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_gadash%%'");
31
  delete_option('gadash_options');
32
- delete_option('gadash_lasterror');
33
  delete_transient('ga_dash_refresh_token');
34
  delete_transient('ga_dash_gapi_errors');
35
  }
13
  {
14
  global $wpdb;
15
  if (is_multisite()) { // Cleanup Network install
16
+ foreach (wp_get_sites(array( 'limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) {
17
  switch_to_blog($blog['blog_id']);
18
  $sqlquery = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_gadash%%'");
19
  $sqlquery = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_gadash%%'");
20
  delete_option('gadash_options');
21
+ delete_transient('gadash_lasterror');
22
  delete_transient('ga_dash_refresh_token');
23
  delete_transient('ga_dash_gapi_errors');
24
  restore_current_blog();
29
  $sqlquery = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_gadash%%'");
30
  $sqlquery = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_gadash%%'");
31
  delete_option('gadash_options');
32
+ delete_transient('gadash_lasterror');
33
  delete_transient('ga_dash_refresh_token');
34
  delete_transient('ga_dash_gapi_errors');
35
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://deconf.com/donate/
4
  Tags: google,analytics,google analytics,dashboard,analytics dashboard,google analytics dashboard,google analytics widget,tracking,realtime,wpmu,multisite
5
  Requires at least: 2.8
6
  Tested up to: 4.1
7
- Stable tag: 4.4.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -126,13 +126,26 @@ This plugin it's released under the GPLv2, you can use it free of charge on your
126
 
127
  == Changelog ==
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  = 4.4.2 =
130
- - Bug Fix: additioal check for frontend widget
131
 
132
  = 4.4.1 =
133
  - Bug Fix: frontend widget nonce issue while using a cache plugin, reported by [Rick](https://deconf.com/ask/author/rickbates/)
134
  - Bug Fix: clear the buffer immediately before returning AJAX response
135
- - Bug Fix: add fullpath while loading autoload.php
136
 
137
  = 4.4 =
138
  - Bug Fix: frontend reports and widget are not responsive
4
  Tags: google,analytics,google analytics,dashboard,analytics dashboard,google analytics dashboard,google analytics widget,tracking,realtime,wpmu,multisite
5
  Requires at least: 2.8
6
  Tested up to: 4.1
7
+ Stable tag: 4.4.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
126
 
127
  == Changelog ==
128
 
129
+ = 4.4.3 =
130
+ - Enhancement: further optimization on queries
131
+ - Enhancement: less error prone while running JavaScript
132
+ - Enhancement: GAPI errors handling improvement
133
+ - Enhancement: added GADWP_IP_VERSION constant to force a particular Internet Protocol version when needed
134
+ - Enhancement: run the clean-up method only in settings screen
135
+ - Enhancement: added tabs to Tracking Code page
136
+ - Enhancement: added a new menu item for errors and debugging
137
+ - Enhancement: error alerts for Error & Debug sub-menu
138
+ - Enhancement: disable file cache functionality in GAPI library
139
+ - Enhancement: if cURL is not available fall-back to HTTP streams; cURL is no longer a requirement
140
+ - Enhancement: wp_get_sites limit can now be adjusted through gadwp_sites_limit filter
141
+
142
  = 4.4.2 =
143
+ - Bug Fix: additional check for frontend widget
144
 
145
  = 4.4.1 =
146
  - Bug Fix: frontend widget nonce issue while using a cache plugin, reported by [Rick](https://deconf.com/ask/author/rickbates/)
147
  - Bug Fix: clear the buffer immediately before returning AJAX response
148
+ - Bug Fix: add full-path while loading autoload.php
149
 
150
  = 4.4 =
151
  - Bug Fix: frontend reports and widget are not responsive
tools/gapi.php CHANGED
@@ -24,14 +24,19 @@ if (! class_exists('GADASH_GAPI')) {
24
  {
25
  global $GADASH_Config;
26
 
27
- if (! function_exists('curl_version')) {
28
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': CURL disabled. Please enable CURL!');
29
- return;
30
- }
31
-
32
  include_once ($GADASH_Config->plugin_path . '/tools/autoload.php');;
33
 
34
- $this->client = new Google_Client();
 
 
 
 
 
 
 
 
 
 
35
  $this->client->setScopes('https://www.googleapis.com/auth/analytics.readonly');
36
  $this->client->setAccessType('offline');
37
  $this->client->setApplicationName('Google Analytics Dashboard');
@@ -77,29 +82,24 @@ if (! class_exists('GADASH_GAPI')) {
77
  /**
78
  * Handles errors returned by GAPI
79
  *
80
- * @return boolean
81
  */
82
  function gapi_errors_handler()
83
  {
84
- $errors = (array) get_transient('ga_dash_gapi_errors');
85
 
86
- if (isset($errors[0]['reason'])) {
87
-
88
- if ($errors[0]['reason'] == 'dailyLimitExceeded') {
89
- return TRUE;
90
- }
91
 
92
- if ($errors[0]['reason'] == 'insufficientPermissions') {
93
- $this->ga_dash_reset_token(false);
94
  return TRUE;
95
  }
96
 
97
- if ($errors[0]['reason'] == 'invalidCredentials' || $errors[0]['reason'] == 'authError') {
98
  $this->ga_dash_reset_token(false);
99
  return TRUE;
100
  }
101
 
102
- if ($errors[0]['reason'] == 'invalidParameter' or $errors[0]['reason'] == 'badRequest') {
103
  return TRUE;
104
  }
105
  }
@@ -188,20 +188,20 @@ if (! class_exists('GADASH_GAPI')) {
188
  $profile->getTimezone()
189
  );
190
  }
191
- update_option('gadash_lasterror', 'N/A');
192
  return $ga_dash_profile_list;
193
  } else {
194
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': No properties were found in this account!');
195
  return '';
196
  }
197
  } catch (Google_IO_Exception $e) {
198
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e));
199
  return '';
200
  } catch (Google_Service_Exception $e) {
201
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()));
202
- set_transient('ga_dash_gapi_errors', $e->getErrors(), $this->error_timeout);
203
  } catch (Exception $e) {
204
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e));
205
  return '';
206
  }
207
  }
@@ -211,7 +211,7 @@ if (! class_exists('GADASH_GAPI')) {
211
  *
212
  * @return token|boolean
213
  */
214
- function ga_dash_refresh_token()
215
  {
216
  global $GADASH_Config;
217
  try {
@@ -245,14 +245,14 @@ if (! class_exists('GADASH_GAPI')) {
245
  return $transient;
246
  }
247
  } catch (Google_IO_Exception $e) {
248
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e));
249
  return false;
250
  } catch (Google_Service_Exception $e) {
251
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()));
252
- set_transient('ga_dash_gapi_errors', $e->getErrors(), $this->error_timeout);
253
  return $e->getCode();
254
  } catch (Exception $e) {
255
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e));
256
  return false;
257
  }
258
  }
@@ -307,7 +307,7 @@ if (! class_exists('GADASH_GAPI')) {
307
  * @param unknown $serial
308
  * @return number|Google_Service_Analytics_GaData
309
  */
310
- function handle_corereports($projectId, $from, $to, $metrics, $options, $serial)
311
  {
312
  try {
313
 
@@ -334,11 +334,11 @@ if (! class_exists('GADASH_GAPI')) {
334
  $data = $transient;
335
  }
336
  } catch (Google_Service_Exception $e) {
337
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()));
338
- set_transient('ga_dash_gapi_errors', $e->getErrors(), $this->error_timeout);
339
  return $e->getCode();
340
  } catch (Exception $e) {
341
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e));
342
  return $e->getCode();
343
  }
344
 
@@ -480,16 +480,16 @@ if (! class_exists('GADASH_GAPI')) {
480
  function get_contentpages($projectId, $from, $to)
481
  {
482
  $metrics = 'ga:pageviews';
483
- $dimensions = 'ga:pageTitle,ga:hostname,ga:pagePath';
484
 
485
  $serial = 'gadash_qr4' . $projectId . $from;
486
-
487
  $data = $this->handle_corereports($projectId, $from, $to, $metrics, array(
488
  'dimensions' => $dimensions,
489
  'sort' => '-ga:pageviews',
490
  'quotaUser' => $this->managequota . 'p' . $projectId
491
  ), $serial);
492
-
493
  if (is_numeric($data)) {
494
  return $data;
495
  }
@@ -498,7 +498,7 @@ if (! class_exists('GADASH_GAPI')) {
498
  $i = 0;
499
 
500
  while (isset($data['rows'][$i][0])) {
501
- $ga_dash_data .= '["' . $this->prepare_json($data['rows'][$i][0]) . '",' . (int) $data['rows'][$i][3] . '],';
502
  $i ++;
503
  }
504
 
@@ -523,7 +523,7 @@ if (! class_exists('GADASH_GAPI')) {
523
  function get_referrers($projectId, $from, $to)
524
  {
525
  $metrics = 'ga:sessions';
526
- $dimensions = 'ga:source,ga:fullReferrer,ga:medium';
527
 
528
  $serial = 'gadash_qr5' . $projectId . $from;
529
 
@@ -541,7 +541,7 @@ if (! class_exists('GADASH_GAPI')) {
541
  $ga_dash_data = "";
542
  $i = 0;
543
  while (isset($data['rows'][$i][0])) {
544
- $ga_dash_data .= '["' . $this->prepare_json($data["rows"][$i][0]) . '",' . (int) $data["rows"][$i][3] . '],';
545
  $i ++;
546
  }
547
 
@@ -902,7 +902,7 @@ if (! class_exists('GADASH_GAPI')) {
902
  }
903
 
904
  if ($ga_dash_data) {
905
- return '[["' . __('Top Searches', "ga-dash") . '", "' . __('Sessions', "ga-dash") . '"],' . rtrim($ga_dash_data, ',') . ' ]';
906
  } else {
907
  return - 22;
908
  }
@@ -937,11 +937,11 @@ if (! class_exists('GADASH_GAPI')) {
937
  $data = $transient;
938
  }
939
  } catch (Google_Service_Exception $e) {
940
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()));
941
- set_transient('ga_dash_gapi_errors', $e->getErrors(), $this->error_timeout);
942
  return $e->getCode();
943
  } catch (Exception $e) {
944
- update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e));
945
  return $e->getCode();
946
  }
947
 
@@ -967,6 +967,7 @@ if (! class_exists('GADASH_GAPI')) {
967
  }
968
  }
969
  }
 
970
  if (! isset($GLOBALS['GADASH_GAPI'])) {
971
  $GLOBALS['GADASH_GAPI'] = new GADASH_GAPI();
972
  }
24
  {
25
  global $GADASH_Config;
26
 
 
 
 
 
 
27
  include_once ($GADASH_Config->plugin_path . '/tools/autoload.php');;
28
 
29
+ $config = new Google_Config();
30
+ $config->setCacheClass('Google_Cache_Null');
31
+ if (function_exists('curl_version')){
32
+ $curlversion = curl_version();
33
+
34
+ if (isset($curlversion['version']) AND version_compare($curlversion['version'], '7.10.8') >= 0 AND defined('GADWP_IP_VERSION') AND GADWP_IP_VERSION){
35
+ $config->setClassConfig('Google_IO_Curl', array('options' => array(CURLOPT_IPRESOLVE => GADWP_IP_VERSION))); // Force CURL_IPRESOLVE_V4 OR CURL_IPRESOLVE_V6
36
+ }
37
+ }
38
+
39
+ $this->client = new Google_Client($config);
40
  $this->client->setScopes('https://www.googleapis.com/auth/analytics.readonly');
41
  $this->client->setAccessType('offline');
42
  $this->client->setApplicationName('Google Analytics Dashboard');
82
  /**
83
  * Handles errors returned by GAPI
84
  *
85
+ * @return int|boolean
86
  */
87
  function gapi_errors_handler()
88
  {
89
+ $errors = get_transient('ga_dash_gapi_errors');
90
 
91
+ if (isset($errors[1][0]['reason'])) {
 
 
 
 
92
 
93
+ if ($errors[1][0]['reason'] == 'dailyLimitExceeded') {
 
94
  return TRUE;
95
  }
96
 
97
+ if ($errors[1][0]['reason'] == 'invalidCredentials' || $errors[1][0]['reason'] == 'authError' || $errors[1][0]['reason'] == 'insufficientPermissions') {
98
  $this->ga_dash_reset_token(false);
99
  return TRUE;
100
  }
101
 
102
+ if ($errors[1][0]['reason'] == 'invalidParameter' or $errors[1][0]['reason'] == 'badRequest') {
103
  return TRUE;
104
  }
105
  }
188
  $profile->getTimezone()
189
  );
190
  }
191
+ set_transient('gadash_lasterror', 'None');
192
  return $ga_dash_profile_list;
193
  } else {
194
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': No properties were found in this account!', $this->error_timeout);
195
  return '';
196
  }
197
  } catch (Google_IO_Exception $e) {
198
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $this->error_timeout);
199
  return '';
200
  } catch (Google_Service_Exception $e) {
201
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()), $this->error_timeout);
202
+ set_transient('ga_dash_gapi_errors', array($e->getCode(),(array)$e->getErrors()), $this->error_timeout);
203
  } catch (Exception $e) {
204
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e),$this->error_timeout);
205
  return '';
206
  }
207
  }
211
  *
212
  * @return token|boolean
213
  */
214
+ private function ga_dash_refresh_token()
215
  {
216
  global $GADASH_Config;
217
  try {
245
  return $transient;
246
  }
247
  } catch (Google_IO_Exception $e) {
248
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $this->error_timeout);
249
  return false;
250
  } catch (Google_Service_Exception $e) {
251
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()), $this->error_timeout);
252
+ set_transient('ga_dash_gapi_errors', array($e->getCode(),(array)$e->getErrors()), $this->error_timeout);
253
  return $e->getCode();
254
  } catch (Exception $e) {
255
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $this->error_timeout);
256
  return false;
257
  }
258
  }
307
  * @param unknown $serial
308
  * @return number|Google_Service_Analytics_GaData
309
  */
310
+ private function handle_corereports($projectId, $from, $to, $metrics, $options, $serial)
311
  {
312
  try {
313
 
334
  $data = $transient;
335
  }
336
  } catch (Google_Service_Exception $e) {
337
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()), $this->error_timeout);
338
+ set_transient('ga_dash_gapi_errors', array($e->getCode(),(array)$e->getErrors()), $this->error_timeout);
339
  return $e->getCode();
340
  } catch (Exception $e) {
341
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $this->error_timeout);
342
  return $e->getCode();
343
  }
344
 
480
  function get_contentpages($projectId, $from, $to)
481
  {
482
  $metrics = 'ga:pageviews';
483
+ $dimensions = 'ga:pageTitle';
484
 
485
  $serial = 'gadash_qr4' . $projectId . $from;
486
+
487
  $data = $this->handle_corereports($projectId, $from, $to, $metrics, array(
488
  'dimensions' => $dimensions,
489
  'sort' => '-ga:pageviews',
490
  'quotaUser' => $this->managequota . 'p' . $projectId
491
  ), $serial);
492
+
493
  if (is_numeric($data)) {
494
  return $data;
495
  }
498
  $i = 0;
499
 
500
  while (isset($data['rows'][$i][0])) {
501
+ $ga_dash_data .= '["' . $this->prepare_json($data['rows'][$i][0]) . '",' . (int) $data['rows'][$i][1] . '],';
502
  $i ++;
503
  }
504
 
523
  function get_referrers($projectId, $from, $to)
524
  {
525
  $metrics = 'ga:sessions';
526
+ $dimensions = 'ga:source';
527
 
528
  $serial = 'gadash_qr5' . $projectId . $from;
529
 
541
  $ga_dash_data = "";
542
  $i = 0;
543
  while (isset($data['rows'][$i][0])) {
544
+ $ga_dash_data .= '["' . $this->prepare_json($data["rows"][$i][0]) . '",' . (int) $data["rows"][$i][1] . '],';
545
  $i ++;
546
  }
547
 
902
  }
903
 
904
  if ($ga_dash_data) {
905
+ return '[["' . __('Searches', "ga-dash") . '", "' . __('Sessions', "ga-dash") . '"],' . rtrim($ga_dash_data, ',') . ' ]';
906
  } else {
907
  return - 22;
908
  }
937
  $data = $transient;
938
  }
939
  } catch (Google_Service_Exception $e) {
940
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()), $this->error_timeout);
941
+ set_transient('ga_dash_gapi_errors', array($e->getCode(),(array)$e->getErrors()), $this->error_timeout);
942
  return $e->getCode();
943
  } catch (Exception $e) {
944
+ set_transient('gadash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $this->error_timeout);
945
  return $e->getCode();
946
  }
947
 
967
  }
968
  }
969
  }
970
+
971
  if (! isset($GLOBALS['GADASH_GAPI'])) {
972
  $GLOBALS['GADASH_GAPI'] = new GADASH_GAPI();
973
  }
tools/nprogress/nprogress.css CHANGED
@@ -1,89 +1,73 @@
1
  /* Make clicks pass-through */
2
  #nprogress {
3
- pointer-events: none;
4
  }
5
 
6
  #nprogress .bar {
7
- background: #29d;
8
- position: fixed;
9
- z-index: 1031;
10
- top: 0;
11
- left: 0;
12
- width: 100%;
13
- height: 2px;
 
 
14
  }
15
 
16
  /* Fancy blur effect */
17
  #nprogress .peg {
18
- display: block;
19
- position: absolute;
20
- right: 0px;
21
- width: 100px;
22
- height: 100%;
23
- box-shadow: 0 0 10px #29d, 0 0 5px #29d;
24
- opacity: 1.0;
25
- -webkit-transform: rotate(3deg) translate(0px, -4px);
26
- -ms-transform: rotate(3deg) translate(0px, -4px);
27
- transform: rotate(3deg) translate(0px, -4px);
 
28
  }
29
 
30
  /* Remove these to get rid of the spinner */
31
  #nprogress .spinner {
32
- display: block;
33
- position: fixed;
34
- z-index: 1031;
35
- top: 15px;
36
- right: 15px;
37
  }
38
 
39
  #nprogress .spinner-icon {
40
- width: 18px;
41
- height: 18px;
42
- box-sizing: border-box;
43
- border: solid 2px transparent;
44
- border-top-color: #29d;
45
- border-left-color: #29d;
46
- border-radius: 50%;
47
- -webkit-animation: nprogress-spinner 400ms linear infinite;
48
- animation: nprogress-spinner 400ms linear infinite;
49
- }
50
 
51
- .nprogress-custom-parent {
52
- overflow: hidden;
53
- position: relative;
54
- }
55
 
56
- .nprogress-custom-parent #nprogress .spinner, .nprogress-custom-parent #nprogress .bar
57
- {
58
- position: absolute;
59
  }
60
 
61
- @
62
- -webkit-keyframes nprogress-spinner { 0% {
63
- -webkit-transform: rotate(0deg);
64
  }
65
 
66
- 100%
67
- {
68
- -webkit-transform
69
- :
70
-
71
- rotate
72
- (360deg);
73
-
74
  }
 
 
 
 
75
  }
76
- @
77
- keyframes nprogress-spinner { 0% {
78
- transform: rotate(0deg);
79
- }
80
- 100%
81
- {
82
- transform
83
- :
84
-
85
- rotate
86
- (360deg);
87
-
88
  }
89
- }
1
  /* Make clicks pass-through */
2
  #nprogress {
3
+ pointer-events: none;
4
  }
5
 
6
  #nprogress .bar {
7
+ background: #29d;
8
+
9
+ position: fixed;
10
+ z-index: 1031;
11
+ top: 0;
12
+ left: 0;
13
+
14
+ width: 100%;
15
+ height: 2px;
16
  }
17
 
18
  /* Fancy blur effect */
19
  #nprogress .peg {
20
+ display: block;
21
+ position: absolute;
22
+ right: 0px;
23
+ width: 100px;
24
+ height: 100%;
25
+ box-shadow: 0 0 10px #29d, 0 0 5px #29d;
26
+ opacity: 1.0;
27
+
28
+ -webkit-transform: rotate(3deg) translate(0px, -4px);
29
+ -ms-transform: rotate(3deg) translate(0px, -4px);
30
+ transform: rotate(3deg) translate(0px, -4px);
31
  }
32
 
33
  /* Remove these to get rid of the spinner */
34
  #nprogress .spinner {
35
+ display: block;
36
+ position: fixed;
37
+ z-index: 1031;
38
+ top: 15px;
39
+ right: 15px;
40
  }
41
 
42
  #nprogress .spinner-icon {
43
+ width: 18px;
44
+ height: 18px;
45
+ box-sizing: border-box;
 
 
 
 
 
 
 
46
 
47
+ border: solid 2px transparent;
48
+ border-top-color: #29d;
49
+ border-left-color: #29d;
50
+ border-radius: 50%;
51
 
52
+ -webkit-animation: nprogress-spinner 400ms linear infinite;
53
+ animation: nprogress-spinner 400ms linear infinite;
 
54
  }
55
 
56
+ .nprogress-custom-parent {
57
+ overflow: hidden;
58
+ position: relative;
59
  }
60
 
61
+ .nprogress-custom-parent #nprogress .spinner,
62
+ .nprogress-custom-parent #nprogress .bar {
63
+ position: absolute;
 
 
 
 
 
64
  }
65
+
66
+ @-webkit-keyframes nprogress-spinner {
67
+ 0% { -webkit-transform: rotate(0deg); }
68
+ 100% { -webkit-transform: rotate(360deg); }
69
  }
70
+ @keyframes nprogress-spinner {
71
+ 0% { transform: rotate(0deg); }
72
+ 100% { transform: rotate(360deg); }
 
 
 
 
 
 
 
 
 
73
  }
 
tools/src/Google/IO/Curl.php CHANGED
@@ -39,6 +39,7 @@ class Google_IO_Curl extends Google_IO_Abstract
39
  */
40
  public function executeRequest(Google_Http_Request $request)
41
  {
 
42
  $curl = curl_init();
43
 
44
  if ($request->getPostBody()) {
@@ -53,6 +54,7 @@ class Google_IO_Curl extends Google_IO_Abstract
53
  }
54
  curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaders);
55
  }
 
56
  curl_setopt($curl, CURLOPT_URL, $request->getUrl());
57
 
58
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod());
@@ -68,6 +70,12 @@ class Google_IO_Curl extends Google_IO_Abstract
68
  if ($request->canGzip()) {
69
  curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
70
  }
 
 
 
 
 
 
71
 
72
  foreach ($this->options as $key => $var) {
73
  curl_setopt($curl, $key, $var);
39
  */
40
  public function executeRequest(Google_Http_Request $request)
41
  {
42
+
43
  $curl = curl_init();
44
 
45
  if ($request->getPostBody()) {
54
  }
55
  curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaders);
56
  }
57
+
58
  curl_setopt($curl, CURLOPT_URL, $request->getUrl());
59
 
60
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod());
70
  if ($request->canGzip()) {
71
  curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
72
  }
73
+
74
+ $options = $this->client->getClassConfig('Google_IO_Curl', 'options');
75
+
76
+ if (is_array($options)){
77
+ $this->setOptions($options);
78
+ }
79
 
80
  foreach ($this->options as $key => $var) {
81
  curl_setopt($curl, $key, $var);