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