Google Analytics Dashboard for WP (GADWP) - Version 4.8.1.3

Version Description

  • Bug Fix: truncate long translation strings in google analytics reports
  • Bug Fix: rename query args to something more unique to avoid conflicts with other plugins
  • Bug Fix: Italian translation small fix
  • Bug Fix: add text domain and domain path in plugin's header; switch to default text domain
  • Bug Fix: avoid empty item reports while the URI ends with a slash and a Default Page is set in View settings (requires re-authorization)
  • Enhancement: throw an error in the General Settings screen (even if it's not a blocker) to acknowledge the user
  • Enhancement: item reports improvements, more suggestive error messages in item reports, hide unnecessary item reports divs on critical errors
  • Enhancement: Spanish translation updated
  • Enhancement: Greek translation, props by Kostas Asargiotakis
  • Enhancement: i18n improvements, props by Ivan Ridao Freitas
  • Enhancement: all Google Analytics API requests need to pass additional validity checks and must be sent through get() method
  • Enhancement: unset default dimension and default metric cookies after a plugin update
Download this release

Release Info

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

Code changes from version 4.8.1.2 to 4.8.1.3

Files changed (47) hide show
  1. admin/ajax-actions.php +6 -0
  2. admin/css/gadwp.css +3 -0
  3. admin/css/item-reports.css +4 -0
  4. admin/item-reports.php +1 -1
  5. admin/settings.php +207 -188
  6. admin/setup.php +51 -47
  7. admin/widgets.php +98 -98
  8. config.php +325 -342
  9. front/ajax-actions.php +14 -8
  10. front/css/item-reports.css +7 -1
  11. front/item-reports.php +1 -1
  12. front/js/item-reports.js +0 -1
  13. front/setup.php +37 -34
  14. front/widgets.php +21 -21
  15. gadwp.php +8 -6
  16. install/install.php +2 -0
  17. languages/{ga-dash-ar.po → google-analytics-dashboard-for-wp-ar.po} +151 -157
  18. languages/{ga-dash-cs_CZ.mo → google-analytics-dashboard-for-wp-cs_CZ.mo} +0 -0
  19. languages/{ga-dash-cs_CZ.po → google-analytics-dashboard-for-wp-cs_CZ.po} +142 -142
  20. languages/{ga-dash-de_DE.mo → google-analytics-dashboard-for-wp-de_DE.mo} +0 -0
  21. languages/{ga-dash-de_DE.po → google-analytics-dashboard-for-wp-de_DE.po} +155 -158
  22. languages/google-analytics-dashboard-for-wp-el_GR.mo +0 -0
  23. languages/google-analytics-dashboard-for-wp-el_GR.po +882 -0
  24. languages/google-analytics-dashboard-for-wp-es_ES.mo +0 -0
  25. languages/{ga-dash-es_ES.po → google-analytics-dashboard-for-wp-es_ES.po} +332 -336
  26. languages/{ga-dash-fr_FR.mo → google-analytics-dashboard-for-wp-fr_FR.mo} +0 -0
  27. languages/{ga-dash-fr_FR.po → google-analytics-dashboard-for-wp-fr_FR.po} +142 -142
  28. languages/{ga-dash-hu_HU.mo → google-analytics-dashboard-for-wp-hu_HU.mo} +0 -0
  29. languages/{ga-dash-hu_HU.po → google-analytics-dashboard-for-wp-hu_HU.po} +154 -157
  30. languages/{ga-dash-it_IT.mo → google-analytics-dashboard-for-wp-it_IT.mo} +0 -0
  31. languages/{ga-dash-it_IT.po → google-analytics-dashboard-for-wp-it_IT.po} +1269 -1275
  32. languages/{ga-dash-ja.mo → google-analytics-dashboard-for-wp-ja.mo} +0 -0
  33. languages/{ga-dash-ja.po → google-analytics-dashboard-for-wp-ja.po} +154 -157
  34. languages/{ga-dash-nl_NL.mo → google-analytics-dashboard-for-wp-nl_NL.mo} +0 -0
  35. languages/{ga-dash-nl_NL.po → google-analytics-dashboard-for-wp-nl_NL.po} +154 -157
  36. languages/{ga-dash-pl_PL.po → google-analytics-dashboard-for-wp-pl_PL.po} +151 -157
  37. languages/{ga-dash-pt_BR.mo → google-analytics-dashboard-for-wp-pt_BR.mo} +0 -0
  38. languages/{ga-dash-pt_BR.po → google-analytics-dashboard-for-wp-pt_BR.po} +154 -157
  39. languages/{ga-dash-ro_RO.mo → google-analytics-dashboard-for-wp-ro_RO.mo} +0 -0
  40. languages/{ga-dash-ro_RO.po → google-analytics-dashboard-for-wp-ro_RO.po} +154 -157
  41. languages/{ga-dash-ru_RU.mo → google-analytics-dashboard-for-wp-ru_RU.mo} +0 -0
  42. languages/{ga-dash-ru_RU.po → google-analytics-dashboard-for-wp-ru_RU.po} +142 -142
  43. languages/{ga-dash.pot → google-analytics-dashboard-for-wp.pot} +120 -119
  44. readme.txt +16 -2
  45. tools/gapi.php +66 -45
  46. {admin → tools}/js/item-reports.js +84 -22
  47. tools/tools.php +5 -0
admin/ajax-actions.php CHANGED
@@ -78,6 +78,12 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
78
  // allow URL correction before sending an API request
79
  $filter = apply_filters( 'gadwp_backenditem_uri', $uri );
80
 
 
 
 
 
 
 
81
  // Encode URL
82
  $filter = rawurlencode( rawurldecode( $filter ) );
83
 
78
  // allow URL correction before sending an API request
79
  $filter = apply_filters( 'gadwp_backenditem_uri', $uri );
80
 
81
+ $lastchar = substr( $filter, - 1 );
82
+
83
+ if ( isset( $profile_info[6] ) && $profile_info[6] && $lastchar == '/' ) {
84
+ $filter = $filter . $profile_info[6];
85
+ }
86
+
87
  // Encode URL
88
  $filter = rawurlencode( rawurldecode( $filter ) );
89
 
admin/css/gadwp.css CHANGED
@@ -376,6 +376,9 @@ td.roles {
376
  color: #777;
377
  padding: 0px 5px 0px 5px;
378
  margin: 0px 0px 0px 0px;
 
 
 
379
  }
380
 
381
  .gadash-wrapper .inside .small-box p {
376
  color: #777;
377
  padding: 0px 5px 0px 5px;
378
  margin: 0px 0px 0px 0px;
379
+ text-overflow: ellipsis;
380
+ overflow: hidden;
381
+ white-space: nowrap;
382
  }
383
 
384
  .gadash-wrapper .inside .small-box p {
admin/css/item-reports.css CHANGED
@@ -51,10 +51,14 @@
51
  }
52
 
53
  .gadwp-wrapper .inside .small-box h3 {
 
54
  font-size: 1em;
55
  color: #777;
56
  padding: 0px 5px 0px 5px;
57
  margin: 0px 0px 0px 0px;
 
 
 
58
  }
59
 
60
  .gadwp-wrapper .inside .small-box p {
51
  }
52
 
53
  .gadwp-wrapper .inside .small-box h3 {
54
+ font-family: 'Open Sans', sans-serif;
55
  font-size: 1em;
56
  color: #777;
57
  padding: 0px 5px 0px 5px;
58
  margin: 0px 0px 0px 0px;
59
+ text-overflow: ellipsis;
60
+ overflow: hidden;
61
+ white-space: nowrap;
62
  }
63
 
64
  .gadwp-wrapper .inside .small-box p {
admin/item-reports.php CHANGED
@@ -58,7 +58,7 @@ if ( ! class_exists( 'GADWP_Backend_Item_Reports' ) ) {
58
 
59
  public function add_columns( $columns ) {
60
  return array_merge( $columns, array(
61
- 'gadwp_stats' => __( 'Analytics', 'ga-dash' ) ) );
62
  }
63
  }
64
  }
58
 
59
  public function add_columns( $columns ) {
60
  return array_merge( $columns, array(
61
+ 'gadwp_stats' => __( 'Analytics', 'google-analytics-dashboard-for-wp' ) ) );
62
  }
63
  }
64
  }
admin/settings.php CHANGED
@@ -86,18 +86,18 @@ final class GADWP_Settings {
86
  }
87
  $options = self::update_options( 'frontend' );
88
  if ( isset( $_POST['options']['ga_dash_hidden'] ) ) {
89
- $message = "<div class='updated'><p>" . __( "Settings saved.", 'ga-dash' ) . "</p></div>";
90
  if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
91
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
92
  }
93
  }
94
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
95
- $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'ga-dash' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'ga-dash' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'ga-dash' ) ) ) );
96
  }
97
  ?>
98
  <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
99
  <div class="wrap">
100
- <?php echo "<h2>" . __( "Google Analytics Frontend Settings", 'ga-dash' ) . "</h2>"; ?><hr>
101
  </div>
102
  <div id="poststuff">
103
  <div id="post-body" class="metabox-holder columns-2">
@@ -107,10 +107,10 @@ final class GADWP_Settings {
107
  <?php if (isset($message)) echo $message; ?>
108
  <table class="options">
109
  <tr>
110
- <td colspan="2"><?php echo "<h2>" . __( "Permissions", 'ga-dash' ) . "</h2>"; ?></td>
111
  </tr>
112
  <tr>
113
- <td class="roles title"><label for="ga_dash_access_front"><?php _e("Show stats to:", 'ga-dash' ); ?></label></td>
114
  <td class="roles">
115
  <?php
116
  if ( ! isset( $wp_roles ) ) {
@@ -151,14 +151,14 @@ final class GADWP_Settings {
151
  <div class="onoffswitch-switch"></div>
152
  </label>
153
  </div>
154
- <div class="switch-desc"><?php echo " ".__("enable web page reports on frontend", 'ga-dash' );?></div>
155
  </td>
156
  </tr>
157
  <tr>
158
  <td colspan="2"><hr></td>
159
  </tr>
160
  <tr>
161
- <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
162
  </tr>
163
  </table>
164
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
@@ -181,18 +181,18 @@ final class GADWP_Settings {
181
  }
182
  $options = self::update_options( 'backend' );
183
  if ( isset( $_POST['options']['ga_dash_hidden'] ) ) {
184
- $message = "<div class='updated'><p>" . __( "Settings saved.", 'ga-dash' ) . "</p></div>";
185
  if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
186
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
187
  }
188
  }
189
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
190
- $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'ga-dash' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'ga-dash' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'ga-dash' ) ) ) );
191
  }
192
  ?>
193
  <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
194
  <div class="wrap">
195
- <?php echo "<h2>" . __( "Google Analytics Backend Settings", 'ga-dash' ) . "</h2>"; ?><hr>
196
  </div>
197
  <div id="poststuff">
198
  <div id="post-body" class="metabox-holder columns-2">
@@ -202,10 +202,10 @@ final class GADWP_Settings {
202
  <?php if (isset($message)) echo $message; ?>
203
  <table class="options">
204
  <tr>
205
- <td colspan="2"><?php echo "<h2>" . __( "Permissions", 'ga-dash' ) . "</h2>"; ?></td>
206
  </tr>
207
  <tr>
208
- <td class="roles title"><label for="ga_dash_access_back"><?php _e("Show stats to:", 'ga-dash' ); ?></label></td>
209
  <td class="roles">
210
  <?php
211
  if ( ! isset( $wp_roles ) ) {
@@ -248,7 +248,7 @@ final class GADWP_Settings {
248
  <div class="onoffswitch-switch"></div>
249
  </label>
250
  </div>
251
- <div class="switch-desc"><?php _e ( "enable Switch View functionality", 'ga-dash' );?></div>
252
  </td>
253
  </tr>
254
  <tr>
@@ -259,7 +259,7 @@ final class GADWP_Settings {
259
  <div class="onoffswitch-switch"></div>
260
  </label>
261
  </div>
262
- <div class="switch-desc"><?php _e ( "enable reports on Posts List and Pages List", 'ga-dash' );?></div>
263
  </td>
264
  </tr>
265
  <tr>
@@ -270,23 +270,23 @@ final class GADWP_Settings {
270
  <div class="onoffswitch-switch"></div>
271
  </label>
272
  </div>
273
- <div class="switch-desc"><?php _e ( "enable the main Dashboard Widget", 'ga-dash' );?></div>
274
  </td>
275
  </tr>
276
  <tr>
277
- <td colspan="2"><hr><?php echo "<h2>" . __( "Real-Time Settings", 'ga-dash' ) . "</h2>"; ?></td>
278
  </tr>
279
  <tr>
280
- <td colspan="2" class="title"> <?php _e("Maximum number of pages to display on real-time tab:", 'ga-dash'); ?>
281
  <input type="number" name="options[ga_realtime_pages]" id="ga_realtime_pages" value="<?php echo (int)$options['ga_realtime_pages']; ?>" size="3">
282
  </td>
283
  </tr>
284
  <tr>
285
- <td colspan="2"><hr><?php echo "<h2>" . __( "Location Settings", 'ga-dash' ) . "</h2>"; ?></td>
286
  </tr>
287
  <tr>
288
  <td colspan="2" class="title">
289
- <?php echo __("Target Geo Map to country:", 'ga-dash'); ?>
290
  <input type="text" style="text-align: center;" name="options[ga_target_geomap]" value="<?php echo esc_attr($options['ga_target_geomap']); ?>" size="3">
291
  </td>
292
  </tr>
@@ -294,7 +294,7 @@ final class GADWP_Settings {
294
  <td colspan="2"><hr></td>
295
  </tr>
296
  <tr>
297
- <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
298
  </tr>
299
  </table>
300
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
@@ -315,21 +315,21 @@ final class GADWP_Settings {
315
  }
316
  $options = self::update_options( 'tracking' );
317
  if ( isset( $_POST['options']['ga_dash_hidden'] ) ) {
318
- $message = "<div class='updated'><p>" . __( "Settings saved.", 'ga-dash' ) . "</p></div>";
319
  if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
320
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
321
  }
322
  }
323
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
324
- $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'ga-dash' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'ga-dash' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'ga-dash' ) ) ) );
325
  }
326
  if ( ! $options['ga_dash_tracking'] ) {
327
- $message = "<div class='error'><p>" . __( "The tracking component is disabled. You should set <strong>Tracking Options</strong> to <strong>Enabled</strong>", 'ga-dash' ) . ".</p></div>";
328
  }
329
  ?>
330
  <form name="ga_dash_form" method="post" action="<?php esc_url($_SERVER['REQUEST_URI']); ?>">
331
  <div class="wrap">
332
- <?php echo "<h2>" . __( "Google Analytics Tracking Code", 'ga-dash' ) . "</h2>"; ?>
333
  </div>
334
  <div id="poststuff">
335
  <div id="post-body" class="metabox-holder columns-2">
@@ -338,11 +338,11 @@ final class GADWP_Settings {
338
  <div class="inside">
339
  <?php
340
  $tabs = array(
341
- 'basic' => __( "Basic Settings", 'ga-dash' ),
342
- 'events' => __( "Events Tracking", 'ga-dash' ),
343
- 'custom' => __( "Custom Definitions", 'ga-dash' ),
344
- 'exclude' => __( "Exclude Tracking", 'ga-dash' ),
345
- 'advanced' => __( "Advanced Settings", 'ga-dash' ) );
346
  self::navigation_tabs( $tabs );
347
  if ( isset( $message ) )
348
  echo $message;
@@ -350,13 +350,13 @@ final class GADWP_Settings {
350
  <div id="gadwp-basic">
351
  <table class="options">
352
  <tr>
353
- <td colspan="2"><?php echo "<h2>" . __( "Tracking Settings", 'ga-dash' ) . "</h2>"; ?></td>
354
  </tr>
355
  <tr>
356
- <td class="title"><label for="ga_dash_tracking"><?php _e("Tracking Options:", 'ga-dash' ); ?></label></td>
357
  <td><select id="ga_dash_tracking" name="options[ga_dash_tracking]" onchange="this.form.submit()">
358
- <option value="0" <?php selected( $options['ga_dash_tracking'], 0 ); ?>><?php _e("Disabled", 'ga-dash');?></option>
359
- <option value="1" <?php selected( $options['ga_dash_tracking'], 1 ); ?>><?php _e("Enabled", 'ga-dash');?></option>
360
  </select></td>
361
  </tr>
362
  <?php if ($options['ga_dash_tracking']) {?>
@@ -364,18 +364,18 @@ final class GADWP_Settings {
364
  <td class="title"></td>
365
  <td>
366
  <?php $profile_info = GADWP_Tools::get_selected_profile($gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail']); ?>
367
- <?php 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>';?>
368
  </td>
369
  </tr>
370
  <?php }?>
371
  <tr>
372
- <td colspan="2"><hr><?php echo "<h2>" . __( "Basic Tracking", 'ga-dash' ) . "</h2>"; ?></td>
373
  </tr>
374
  <tr>
375
- <td class="title"><label for="ga_dash_tracking_type"><?php _e("Tracking Type:", 'ga-dash' ); ?></label></td>
376
  <td><select id="ga_dash_tracking_type" name="options[ga_dash_tracking_type]">
377
- <option value="classic" <?php selected( $options['ga_dash_tracking_type'], 'classic' ); ?>><?php _e("Classic Analytics", 'ga-dash');?></option>
378
- <option value="universal" <?php selected( $options['ga_dash_tracking_type'], 'universal' ); ?>><?php _e("Universal Analytics", 'ga-dash');?></option>
379
  </select></td>
380
  </tr>
381
  <tr>
@@ -386,7 +386,7 @@ final class GADWP_Settings {
386
  <div class="onoffswitch-switch"></div>
387
  </label>
388
  </div>
389
- <div class="switch-desc"><?php echo " ".__("anonymize IPs while tracking", 'ga-dash' );?></div>
390
  </td>
391
  </tr>
392
  <tr>
@@ -397,7 +397,7 @@ final class GADWP_Settings {
397
  <div class="onoffswitch-switch"></div>
398
  </label>
399
  </div>
400
- <div class="switch-desc"><?php echo " ".__("enable remarketing, demographics and interests reports", 'ga-dash' );?></div>
401
  </td>
402
  </tr>
403
  </table>
@@ -405,7 +405,7 @@ final class GADWP_Settings {
405
  <div id="gadwp-events">
406
  <table class="options">
407
  <tr>
408
- <td colspan="2"><?php echo "<h2>" . __( "Events Tracking", 'ga-dash' ) . "</h2>"; ?></td>
409
  </tr>
410
  <tr>
411
  <td colspan="2" class="title">
@@ -415,11 +415,11 @@ final class GADWP_Settings {
415
  <div class="onoffswitch-switch"></div>
416
  </label>
417
  </div>
418
- <div class="switch-desc"><?php echo " ".__("track downloads, mailto and outbound links", 'ga-dash' ); ?></div>
419
  </td>
420
  </tr>
421
  <tr>
422
- <td class="title"><label for="ga_event_downloads"><?php _e("Downloads Regex:", 'ga-dash'); ?></label></td>
423
  <td><input type="text" id="ga_event_downloads" name="options[ga_event_downloads]" value="<?php echo esc_attr($options['ga_event_downloads']); ?>" size="50"></td>
424
  </tr>
425
  <tr>
@@ -430,11 +430,11 @@ final class GADWP_Settings {
430
  <div class="onoffswitch-switch"></div>
431
  </label>
432
  </div>
433
- <div class="switch-desc"><?php echo " ".__("track affiliate links matching this regex", 'ga-dash' ); ?></div>
434
  </td>
435
  </tr>
436
  <tr>
437
- <td class="title"><label for="ga_event_affiliates"><?php _e("Affiliates Regex:", 'ga-dash'); ?></label></td>
438
  <td><input type="text" id="ga_event_affiliates" name="options[ga_event_affiliates]" value="<?php echo esc_attr($options['ga_event_affiliates']); ?>" size="50"></td>
439
  </tr>
440
  <tr>
@@ -445,7 +445,7 @@ final class GADWP_Settings {
445
  <div class="onoffswitch-switch"></div>
446
  </label>
447
  </div>
448
- <div class="switch-desc"><?php echo " ".__("track fragment identifiers, hashmarks (#) in URI links", 'ga-dash' ); ?></div>
449
  </td>
450
  </tr>
451
  </table>
@@ -453,10 +453,10 @@ final class GADWP_Settings {
453
  <div id="gadwp-custom">
454
  <table class="options">
455
  <tr>
456
- <td colspan="2"><?php echo "<h2>" . __( "Custom Definitions", 'ga-dash' ) . "</h2>"; ?></td>
457
  </tr>
458
  <tr>
459
- <td class="title"><label for="ga_author_dimindex"><?php _e("Authors:", 'ga-dash' ); ?></label></td>
460
  <td><select id="ga_author_dimindex" name="options[ga_author_dimindex]">
461
  <?php for ($i=0;$i<21;$i++){?>
462
  <option value="<?php echo $i;?>" <?php selected( $options['ga_author_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
@@ -464,7 +464,7 @@ final class GADWP_Settings {
464
  </select></td>
465
  </tr>
466
  <tr>
467
- <td class="title"><label for="ga_pubyear_dimindex"><?php _e("Publication Year:", 'ga-dash' ); ?></label></td>
468
  <td><select id="ga_pubyear_dimindex" name="options[ga_pubyear_dimindex]">
469
  <?php for ($i=0;$i<21;$i++){?>
470
  <option value="<?php echo $i;?>" <?php selected( $options['ga_pubyear_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
@@ -472,7 +472,7 @@ final class GADWP_Settings {
472
  </select></td>
473
  </tr>
474
  <tr>
475
- <td class="title"><label for="ga_category_dimindex"><?php _e("Categories:", 'ga-dash' ); ?></label></td>
476
  <td><select id="ga_category_dimindex" name="options[ga_category_dimindex]">
477
  <?php for ($i=0;$i<21;$i++){?>
478
  <option value="<?php echo $i;?>" <?php selected( $options['ga_category_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
@@ -480,7 +480,7 @@ final class GADWP_Settings {
480
  </select></td>
481
  </tr>
482
  <tr>
483
- <td class="title"><label for="ga_user_dimindex"><?php _e("User Type:", 'ga-dash' ); ?></label></td>
484
  <td><select id="ga_user_dimindex" name="options[ga_user_dimindex]">
485
  <?php for ($i=0;$i<21;$i++){?>
486
  <option value="<?php echo $i;?>" <?php selected( $options['ga_user_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
@@ -492,10 +492,10 @@ final class GADWP_Settings {
492
  <div id="gadwp-advanced">
493
  <table class="options">
494
  <tr>
495
- <td colspan="2"><?php echo "<h2>" . __( "Advanced Tracking", 'ga-dash' ) . "</h2>"; ?></td>
496
  </tr>
497
  <tr>
498
- <td class="title"><label for="ga_speed_samplerate"><?php _e("Page Speed SR:", 'ga-dash'); ?></label></td>
499
  <td><input type="number" id="ga_speed_samplerate" name="options[ga_speed_samplerate]" value="<?php echo (int)($options['ga_speed_samplerate']); ?>" max="100" min="1"> %</td>
500
  </tr>
501
  <tr>
@@ -506,7 +506,7 @@ final class GADWP_Settings {
506
  <div class="onoffswitch-switch"></div>
507
  </label>
508
  </div>
509
- <div class="switch-desc"><?php echo " ".__("exclude events from bounce-rate calculation", 'ga-dash' );?></div>
510
  </td>
511
  </tr>
512
  <tr>
@@ -517,7 +517,7 @@ final class GADWP_Settings {
517
  <div class="onoffswitch-switch"></div>
518
  </label>
519
  </div>
520
- <div class="switch-desc"><?php echo " ".__("enable enhanced link attribution", 'ga-dash' );?></div>
521
  </td>
522
  </tr>
523
  <tr>
@@ -528,7 +528,7 @@ final class GADWP_Settings {
528
  <div class="onoffswitch-switch"></div>
529
  </label>
530
  </div>
531
- <div class="switch-desc"><?php echo " ".__("enable AdSense account linking", 'ga-dash' );?></div>
532
  </td>
533
  </tr>
534
  <tr>
@@ -539,11 +539,11 @@ final class GADWP_Settings {
539
  <div class="onoffswitch-switch"></div>
540
  </label>
541
  </div>
542
- <div class="switch-desc"><?php echo " ".__("enable cross domain tracking", 'ga-dash' ); ?></div>
543
  </td>
544
  </tr>
545
  <tr>
546
- <td class="title"><label for="ga_crossdomain_list"><?php _e("Cross Domains:", 'ga-dash'); ?></label></td>
547
  <td><input type="text" id="ga_crossdomain_list" name="options[ga_crossdomain_list]" value="<?php echo esc_attr($options['ga_crossdomain_list']); ?>" size="50"></td>
548
  </tr>
549
  </table>
@@ -551,10 +551,10 @@ final class GADWP_Settings {
551
  <div id="gadwp-exclude">
552
  <table class="options">
553
  <tr>
554
- <td colspan="2"><?php echo "<h2>" . __( "Exclude Tracking", 'ga-dash' ) . "</h2>"; ?></td>
555
  </tr>
556
  <tr>
557
- <td class="roles title"><label for="ga_track_exclude"><?php _e("Exclude tracking for:", 'ga-dash' ); ?></label></td>
558
  <td class="roles">
559
  <?php
560
  if ( ! isset( $wp_roles ) ) {
@@ -595,7 +595,7 @@ final class GADWP_Settings {
595
  <td colspan="2"><hr></td>
596
  </tr>
597
  <tr>
598
- <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
599
  </tr>
600
  </table>
601
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
@@ -638,11 +638,11 @@ final class GADWP_Settings {
638
 
639
  $options = self::update_options( 'frontend' );
640
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
641
- $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'ga-dash' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'ga-dash' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'ga-dash' ) ) ) );
642
  }
643
  ?>
644
  <div class="wrap">
645
- <?php echo "<h2>" . __( "Google Analytics Errors & Debugging", 'ga-dash' ) . "</h2>"; ?>
646
  </div>
647
  <div id="poststuff">
648
  <div id="post-body" class="metabox-holder columns-2">
@@ -652,34 +652,34 @@ final class GADWP_Settings {
652
  <?php if (isset($message)) echo $message; ?>
653
  <?php
654
  $tabs = array(
655
- 'errors' => __( "Errors & Details", 'ga-dash' ),
656
- 'config' => __( "Plugin Settings", 'ga-dash' ) );
657
  self::navigation_tabs( $tabs );
658
  ?>
659
  <div id="gadwp-errors">
660
  <table class="options">
661
  <tr>
662
  <td>
663
- <?php echo "<h2>" . __( "Last Error detected", 'ga-dash' ) . "</h2>"; ?>
664
  </td>
665
  </tr>
666
  <tr>
667
  <td>
668
  <?php
669
- $errors = esc_html( print_r( get_transient( 'ga_dash_lasterror' ), true ) ) ? esc_html( print_r( get_transient( 'ga_dash_lasterror' ), true ) ) : __( "None", 'ga-dash' );
670
  echo '<pre class="log_data">Last Error: ';
671
  echo $errors;
672
  ?></pre>
673
  </td>
674
  </tr>
675
  <tr>
676
- <td colspan="2"><hr><?php echo "<h2>" . __( "Error Details", 'ga-dash' ) . "</h2>"; ?></td>
677
  </tr>
678
  <tr>
679
  <td>
680
  <?php
681
  echo '<pre class="log_data">Error Details: ';
682
- $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' );
683
  echo $error_details;
684
  ?></pre><br />
685
  <hr>
@@ -693,7 +693,7 @@ final class GADWP_Settings {
693
  <div id="gadwp-config">
694
  <table class="options">
695
  <tr>
696
- <td><?php echo "<h2>" . __( "Plugin Configuration", 'ga-dash' ) . "</h2>"; ?></td>
697
  </tr>
698
  <tr>
699
  <td><pre class="log_data"><?php echo esc_html(print_r($anonim, true));?></pre><br />
@@ -714,7 +714,7 @@ final class GADWP_Settings {
714
  return;
715
  }
716
  $options = self::update_options( 'general' );
717
- printf( '<div id="gapi-warning" class="updated"><p>%1$s <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=general_screen&utm_campaign=gadwp">%2$s</a></p></div>', __( 'Loading the required libraries. If this results in a blank screen or a fatal error, try this solution:', "ga-dash" ), __( 'Library conflicts between WordPress plugins', "ga-dash" ) );
718
  if ( null === $gadwp->gapi_controller ) {
719
  $gadwp->gapi_controller = new GADWP_GAPI_Controller();
720
  }
@@ -729,9 +729,26 @@ final class GADWP_Settings {
729
  $gadwp->config->options['automatic_updates_minorversion'] = 1;
730
  $gadwp->config->set_plugin_options();
731
  $options = self::update_options( 'general' );
732
- $message = "<div class='updated'><p>" . __( "Plugin authorization succeeded.", 'ga-dash' ) . "</p></div>";
733
  delete_transient( 'ga_dash_gapi_errors' );
734
  delete_transient( 'ga_dash_lasterror' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
735
  } catch ( Google_IO_Exception $e ) {
736
  set_transient( 'ga_dash_lasterror', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $e ), $gadwp->gapi_controller->error_timeout );
737
  return false;
@@ -744,73 +761,56 @@ final class GADWP_Settings {
744
  $gadwp->gapi_controller->reset_token( false );
745
  }
746
  } else {
747
- $message = "<div class='error'><p>" . __( "The access code is <strong>NOT</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X). Try again, and use the red link to get your access code", 'ga-dash' ) . ".</p></div>";
748
- }
749
- }
750
- if ( $gadwp->config->options['ga_dash_token'] && $gadwp->gapi_controller->client->getAccessToken() ) {
751
- if ( ! empty( $gadwp->config->options['ga_dash_profile_list'] ) ) {
752
- $profiles = $gadwp->config->options['ga_dash_profile_list'];
753
- } else {
754
- $profiles = $gadwp->gapi_controller->refresh_profiles();
755
- }
756
- if ( $profiles ) {
757
- $gadwp->config->options['ga_dash_profile_list'] = $profiles;
758
- if ( ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
759
- $profile = GADWP_Tools::guess_default_domain( $profiles );
760
- $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
761
- $gadwp->config->options['ga_dash_tableid'] = $profile;
762
- }
763
- $gadwp->config->set_plugin_options();
764
- $options = self::update_options( 'general' );
765
  }
766
  }
767
  if ( isset( $_POST['Clear'] ) ) {
768
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
769
  GADWP_Tools::clear_cache();
770
- $message = "<div class='updated'><p>" . __( "Cleared Cache.", 'ga-dash' ) . "</p></div>";
771
  } else {
772
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
773
  }
774
  }
775
  if ( isset( $_POST['Reset'] ) ) {
776
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
777
  $gadwp->gapi_controller->reset_token( true );
778
  GADWP_Tools::clear_cache();
779
- $message = "<div class='updated'><p>" . __( "Token Reseted and Revoked.", 'ga-dash' ) . "</p></div>";
780
  $options = self::update_options( 'Reset' );
781
  } else {
782
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
783
  }
784
  }
785
  if ( isset( $_POST['Reset_Err'] ) ) {
786
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
787
  delete_transient( 'ga_dash_lasterror' );
788
  delete_transient( 'ga_dash_gapi_errors' );
789
- $message = "<div class='updated'><p>" . __( "All errors reseted.", 'ga-dash' ) . "</p></div>";
790
  } else {
791
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
792
  }
793
  }
794
  if ( isset( $_POST['options']['ga_dash_hidden'] ) && ! isset( $_POST['Clear'] ) && ! isset( $_POST['Reset'] ) && ! isset( $_POST['Reset_Err'] ) ) {
795
- $message = "<div class='updated'><p>" . __( "Settings saved.", 'ga-dash' ) . "</p></div>";
796
  if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
797
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
798
  }
799
  }
800
  if ( isset( $_POST['Hide'] ) ) {
801
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
802
- $message = "<div class='updated'><p>" . __( "All other domains/properties were removed.", 'ga-dash' ) . "</p></div>";
803
  $lock_profile = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
804
  $gadwp->config->options['ga_dash_profile_list'] = array(
805
  $lock_profile );
806
  $options = self::update_options( 'general' );
807
  } else {
808
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
809
  }
810
  }
811
  ?>
812
  <div class="wrap">
813
- <?php echo "<h2>" . __( "Google Analytics Settings", 'ga-dash' ) . "</h2>"; ?>
814
  <hr>
815
  </div>
816
  <div id="poststuff">
@@ -819,16 +819,17 @@ final class GADWP_Settings {
819
  <div class="settings-wrapper">
820
  <div class="inside">
821
  <?php
822
- if ( $gadwp->gapi_controller->gapi_errors_handler() ) {
823
- $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'ga-dash' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'ga-dash' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'ga-dash' ) ) ) );
824
  }
825
  if ( isset( $_POST['Authorize'] ) ) {
826
  GADWP_Tools::clear_cache();
827
  $gadwp->gapi_controller->token_request();
828
- echo "<div class='updated'><p>" . __( "Use the red link (see below) to generate and get your access code!", 'ga-dash' ) . "</p></div>";
829
  } else {
830
- if ( isset( $message ) )
831
  echo $message;
 
832
  ?>
833
  <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
834
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
@@ -836,30 +837,30 @@ final class GADWP_Settings {
836
  <table class="options">
837
  <tr>
838
  <td colspan="2">
839
- <?php echo "<h2>" . __( "Plugin Authorization", 'ga-dash' ) . "</h2>";?>
840
  </td>
841
  </tr>
842
  <tr>
843
  <td colspan="2" class="info">
844
- <?php printf(__('You should watch the %1$s and read this %2$s before proceeding to authorization. This plugin requires a properly configured Google Analytics account!', 'ga-dash'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video", 'ga-dash')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("tutorial", 'ga-dash')));?>
845
  </td>
846
  </tr>
847
  <?php if (! $options['ga_dash_token'] || $options['ga_dash_userapi']) {?>
848
  <tr>
849
- <td colspan="2" class="info"><input name="options[ga_dash_userapi]" type="checkbox" id="ga_dash_userapi" value="1" <?php checked( $options['ga_dash_userapi'], 1 ); ?> onchange="this.form.submit()" <?php echo ($options['ga_dash_network'])?'disabled="disabled"':''; ?> /><?php echo " ".__("use your own API Project credentials", 'ga-dash' );?>
850
  </td>
851
  </tr>
852
  <?php } if ($options['ga_dash_userapi']) { ?>
853
  <tr>
854
- <td class="title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'ga-dash'); ?></label></td>
855
  <td><input type="text" name="options[ga_dash_apikey]" value="<?php echo esc_attr($options['ga_dash_apikey']); ?>" size="40" required="required"></td>
856
  </tr>
857
  <tr>
858
- <td class="title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'ga-dash'); ?></label></td>
859
  <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?>" size="40" required="required"></td>
860
  </tr>
861
  <tr>
862
- <td class="title"><label for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'ga-dash'); ?></label></td>
863
  <td><input type="text" name="options[ga_dash_clientsecret]" value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>" size="40" required="required"> <input type="hidden" name="options[ga_dash_hidden]" value="Y">
864
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
865
  </td>
@@ -869,33 +870,33 @@ final class GADWP_Settings {
869
  if ( $options['ga_dash_token'] ) {
870
  ?>
871
  <tr>
872
- <td colspan="2"><input type="submit" name="Reset" class="button button-secondary" value="<?php _e( "Clear Authorization", 'ga-dash' ); ?>" <?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /> <input type="submit" name="Reset_Err" class="button button-secondary" value="<?php _e( "Reset Errors", 'ga-dash' ); ?>" /></td>
873
  </tr>
874
  <tr>
875
  <td colspan="2"><hr></td>
876
  </tr>
877
  <tr>
878
- <td colspan="2"><?php echo "<h2>" . __( "General Settings", 'ga-dash' ) . "</h2>"; ?></td>
879
  </tr>
880
  <tr>
881
- <td class="title"><label for="ga_dash_tableid_jail"><?php _e("Select View:", 'ga-dash' ); ?></label></td>
882
  <td><select id="ga_dash_tableid_jail" <?php disabled(empty($options['ga_dash_profile_list']) || 1 == count($options['ga_dash_profile_list']), true); ?> name="options[ga_dash_tableid_jail]">
883
  <?php
884
  if ( ! empty( $options['ga_dash_profile_list'] ) ) {
885
  foreach ( $options['ga_dash_profile_list'] as $items ) {
886
  if ( $items[3] ) {
887
  echo '<option value="' . esc_attr( $items[1] ) . '" ' . selected( $items[1], $options['ga_dash_tableid_jail'] );
888
- echo ' title="' . __( "View Name:", 'ga-dash' ) . ' ' . esc_attr( $items[0] ) . '">' . esc_html( GADWP_Tools::strip_protocol( $items[3] ) ) . ' &#8658; ' . esc_attr( $items[0] ) . '</option>';
889
  }
890
  }
891
  } else {
892
- echo '<option value="">' . __( "Property not found", 'ga-dash' ) . '</option>';
893
  }
894
  ?>
895
  </select>
896
  <?php
897
  if ( count( $options['ga_dash_profile_list'] ) > 1 ) {
898
- ?>&nbsp;<input type="submit" name="Hide" class="button button-secondary" value="<?php _e( "Lock Selection", 'ga-dash' ); ?>" /><?php
899
  }
900
  ?>
901
  </td>
@@ -907,14 +908,14 @@ final class GADWP_Settings {
907
  <td class="title"></td>
908
  <td><?php
909
  $profile_info = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
910
- 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>';
911
  ?></td>
912
  </tr>
913
  <?php
914
  }
915
  ?>
916
  <tr>
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" name="options[ga_dash_style]" value="<?php echo esc_attr($options['ga_dash_style']); ?>" size="10"></td>
919
  </tr>
920
  <tr>
@@ -922,7 +923,7 @@ final class GADWP_Settings {
922
  </tr>
923
  <?php if ( !is_multisite()) {?>
924
  <tr>
925
- <td colspan="2"><?php echo "<h2>" . __( "Automatic Updates", 'ga-dash' ) . "</h2>"; ?></td>
926
  </tr>
927
  <tr>
928
  <td colspan="2" class="title">
@@ -932,7 +933,7 @@ final class GADWP_Settings {
932
  <div class="onoffswitch-switch"></div>
933
  </label>
934
  </div>
935
- <div class="switch-desc"><?php echo " ".__( "automatic updates for minor versions (security and maintenance releases only)", 'ga-dash' );?></div>
936
  </td>
937
  </tr>
938
  <tr>
@@ -940,14 +941,14 @@ final class GADWP_Settings {
940
  </tr>
941
  <?php }?>
942
  <tr>
943
- <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
944
  </tr>
945
  <?php } else {?>
946
  <tr>
947
  <td colspan="2"><hr></td>
948
  </tr>
949
  <tr>
950
- <td colspan="2"><input type="submit" name="Authorize" class="button button-secondary" id="authorize" value="<?php _e( "Authorize Plugin", 'ga-dash' ); ?>" <?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /></td>
951
  </tr>
952
  <tr>
953
  <td colspan="2"><hr></td>
@@ -977,7 +978,7 @@ final class GADWP_Settings {
977
  /*
978
  * Include GAPI
979
  */
980
- 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/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=general_screen&utm_campaign=gadwp">Library conflicts between WordPress plugins</a></p></div>';
981
 
982
  if ( null === $gadwp->gapi_controller ) {
983
  $gadwp->gapi_controller = new GADWP_GAPI_Controller();
@@ -994,7 +995,7 @@ final class GADWP_Settings {
994
  $gadwp->config->options['automatic_updates_minorversion'] = 1;
995
  $gadwp->config->set_plugin_options( true );
996
  $options = self::update_options( 'network' );
997
- $message = "<div class='updated'><p>" . __( "Plugin authorization succeeded.", 'ga-dash' ) . "</p></div>";
998
  if ( is_multisite() ) { // Cleanup errors on the entire network
999
  foreach ( wp_get_sites( array(
1000
  'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
@@ -1005,6 +1006,23 @@ final class GADWP_Settings {
1005
  } else {
1006
  delete_transient( 'ga_dash_gapi_errors' );
1007
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1008
  } catch ( Google_IO_Exception $e ) {
1009
  set_transient( 'ga_dash_lasterror', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $e ), $gadwp->gapi_controller->error_timeout );
1010
  return false;
@@ -1017,73 +1035,73 @@ final class GADWP_Settings {
1017
  $gadwp->gapi_controller->reset_token( false );
1018
  }
1019
  } else {
1020
- $message = "<div class='error'><p>" . __( "The access code is <strong>NOT</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X). Try again, and use the red link to get your access code", 'ga-dash' ) . ".</p></div>";
1021
  }
1022
  }
1023
  if ( isset( $_POST['Refresh'] ) ) {
1024
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1025
  $gadwp->config->options['ga_dash_profile_list'] = array();
1026
- $message = "<div class='updated'><p>" . __( "Properties refreshed.", 'ga-dash' ) . "</p></div>";
1027
  $options = self::update_options( 'network' );
1028
- } else {
1029
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
1030
- }
1031
- }
1032
- if ( $gadwp->config->options['ga_dash_token'] && $gadwp->gapi_controller->client->getAccessToken() ) {
1033
- if ( ! empty( $gadwp->config->options['ga_dash_profile_list'] ) ) {
1034
- $profiles = $gadwp->config->options['ga_dash_profile_list'];
1035
- } else {
1036
- $profiles = $gadwp->gapi_controller->refresh_profiles();
1037
- }
1038
- if ( $profiles ) {
1039
- $gadwp->config->options['ga_dash_profile_list'] = $profiles;
1040
- if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
1041
- $profile = GADWP_Tools::guess_default_domain( $profiles );
1042
- $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
1043
- $gadwp->config->options['ga_dash_tableid'] = $profile;
1044
  }
1045
- $gadwp->config->set_plugin_options( true );
1046
- $options = self::update_options( 'network' );
1047
  }
1048
  }
1049
  if ( isset( $_POST['Clear'] ) ) {
1050
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1051
  GADWP_Tools::clear_cache();
1052
- $message = "<div class='updated'><p>" . __( "Cleared Cache.", 'ga-dash' ) . "</p></div>";
1053
  } else {
1054
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
1055
  }
1056
  }
1057
  if ( isset( $_POST['Reset'] ) ) {
1058
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1059
  $gadwp->gapi_controller->reset_token( true );
1060
  GADWP_Tools::clear_cache();
1061
- $message = "<div class='updated'><p>" . __( "Token Reseted and Revoked.", 'ga-dash' ) . "</p></div>";
1062
  $options = self::update_options( 'Reset' );
1063
  } else {
1064
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
1065
  }
1066
  }
1067
  if ( isset( $_POST['options']['ga_dash_hidden'] ) && ! isset( $_POST['Clear'] ) && ! isset( $_POST['Reset'] ) && ! isset( $_POST['Refresh'] ) ) {
1068
- $message = "<div class='updated'><p>" . __( "Settings saved.", 'ga-dash' ) . "</p></div>";
1069
  if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
1070
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
1071
  }
1072
  }
1073
  if ( isset( $_POST['Hide'] ) ) {
1074
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1075
- $message = "<div class='updated'><p>" . __( "All other domains/properties were removed.", 'ga-dash' ) . "</p></div>";
1076
  $lock_profile = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
1077
  $gadwp->config->options['ga_dash_profile_list'] = array(
1078
  $lock_profile );
1079
  $options = self::update_options( 'network' );
1080
  } else {
1081
- $message = "<div class='error'><p>" . __( "Cheating Huh?", 'ga-dash' ) . "</p></div>";
1082
  }
1083
  }
1084
  ?>
1085
  <div class="wrap">
1086
- <?php echo "<h2>" . __( "Google Analytics Settings", 'ga-dash' ) . "</h2>"; ?><hr>
1087
  </div>
1088
  <div id="poststuff">
1089
  <div id="post-body" class="metabox-holder columns-2">
@@ -1091,23 +1109,24 @@ final class GADWP_Settings {
1091
  <div class="settings-wrapper">
1092
  <div class="inside">
1093
  <?php
1094
- if ( $gadwp->gapi_controller->gapi_errors_handler() ) {
1095
- $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'ga-dash' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'ga-dash' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'ga-dash' ) ) ) );
1096
  }
1097
  if ( isset( $_POST['Authorize'] ) ) {
1098
  GADWP_Tools::clear_cache();
1099
  $gadwp->gapi_controller->token_request();
1100
- echo "<div class='updated'><p>" . __( "Use the red link (see below) to generate and get your access code!", 'ga-dash' ) . "</p></div>";
1101
  } else {
1102
- if ( isset( $message ) )
1103
  echo $message;
 
1104
  ?>
1105
  <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
1106
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
1107
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
1108
  <table class="options">
1109
  <tr>
1110
- <td colspan="2"><?php echo "<h2>" . __( "Network Setup", 'ga-dash' ) . "</h2>"; ?></td>
1111
  </tr>
1112
  <tr>
1113
  <td colspan="2" class="title">
@@ -1117,7 +1136,7 @@ final class GADWP_Settings {
1117
  <div class="onoffswitch-switch"></div>
1118
  </label>
1119
  </div>
1120
- <div class="switch-desc"><?php echo " ".__("use a single Google Analytics account for the entire network", 'ga-dash' );?></div>
1121
  </td>
1122
  </tr>
1123
  <?php if ($options['ga_dash_network']){ //Network Mode check?>
@@ -1125,18 +1144,18 @@ final class GADWP_Settings {
1125
  <td colspan="2"><hr></td>
1126
  </tr>
1127
  <tr>
1128
- <td colspan="2"><?php echo "<h2>" . __( "Plugin Authorization", 'ga-dash' ) . "</h2>"; ?></td>
1129
  </tr>
1130
  <tr>
1131
  <td colspan="2" class="info">
1132
- <?php printf(__('You should watch the %1$s and read this %2$s before proceeding to authorization. This plugin requires a properly configured Google Analytics account!', 'ga-dash'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video", 'ga-dash')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("tutorial", 'ga-dash')));?>
1133
  </td>
1134
  </tr>
1135
  <?php
1136
  if ( ! $options['ga_dash_token'] || $options['ga_dash_userapi'] ) {
1137
  ?>
1138
  <tr>
1139
- <td colspan="2" class="info"><input name="options[ga_dash_userapi]" type="checkbox" id="ga_dash_userapi" value="1" <?php checked( $options['ga_dash_userapi'], 1 ); ?> onchange="this.form.submit()" /><?php echo " ".__("use your own API Project credentials", 'ga-dash' );?>
1140
  </td>
1141
  </tr>
1142
  <?php
@@ -1144,15 +1163,15 @@ final class GADWP_Settings {
1144
  if ( $options['ga_dash_userapi'] ) {
1145
  ?>
1146
  <tr>
1147
- <td class="title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'ga-dash'); ?></label></td>
1148
  <td><input type="text" name="options[ga_dash_apikey]" value="<?php echo esc_attr($options['ga_dash_apikey']); ?>" size="40" required="required"></td>
1149
  </tr>
1150
  <tr>
1151
- <td class="title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'ga-dash'); ?></label></td>
1152
  <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?>" size="40" required="required"></td>
1153
  </tr>
1154
  <tr>
1155
- <td class="title"><label for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'ga-dash'); ?></label></td>
1156
  <td><input type="text" name="options[ga_dash_clientsecret]" value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>" size="40" required="required"> <input type="hidden" name="options[ga_dash_hidden]" value="Y">
1157
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
1158
  </td>
@@ -1162,13 +1181,13 @@ final class GADWP_Settings {
1162
  if ( $options['ga_dash_token'] ) {
1163
  ?>
1164
  <tr>
1165
- <td colspan="2"><input type="submit" name="Reset" class="button button-secondary" value="<?php _e( "Clear Authorization", 'ga-dash' ); ?>" /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /> <input type="submit" name="Refresh" class="button button-secondary" value="<?php _e( "Refresh Properties", 'ga-dash' ); ?>" /></td>
1166
  </tr>
1167
  <tr>
1168
  <td colspan="2"><hr></td>
1169
  </tr>
1170
  <tr>
1171
- <td colspan="2"><?php echo "<h2>" . __( "Properties/Views Settings", 'ga-dash' ) . "</h2>"; ?></td>
1172
  </tr>
1173
  <?php
1174
  if ( isset( $options['ga_dash_tableid_network'] ) ) {
@@ -1185,11 +1204,11 @@ final class GADWP_Settings {
1185
  foreach ( $options['ga_dash_profile_list'] as $items ) {
1186
  if ( $items[3] ) {
1187
  echo '<option value="' . esc_attr( $items[1] ) . '" ' . selected( $items[1], isset( $options['ga_dash_tableid_network']->$blog['blog_id'] ) ? $options['ga_dash_tableid_network']->$blog['blog_id'] : '' );
1188
- echo ' title="' . __( "View Name:", 'ga-dash' ) . ' ' . esc_attr( $items[0] ) . '">' . esc_html( GADWP_Tools::strip_protocol( $items[3] ) ) . ' &#8658; ' . esc_attr( $items[0] ) . '</option>';
1189
  }
1190
  }
1191
  } else {
1192
- echo '<option value="">' . __( "Property not found", 'ga-dash' ) . '</option>';
1193
  }
1194
  ?>
1195
  </select> <br /></td>
@@ -1198,7 +1217,7 @@ final class GADWP_Settings {
1198
  }
1199
  ?>
1200
  <tr>
1201
- <td colspan="2"><?php echo "<h2>" . __( "Automatic Updates", 'ga-dash' ) . "</h2>"; ?></td>
1202
  </tr>
1203
  <tr>
1204
  <td colspan="2" class="title">
@@ -1208,11 +1227,11 @@ final class GADWP_Settings {
1208
  <div class="onoffswitch-switch"></div>
1209
  </label>
1210
  </div>
1211
- <div class="switch-desc"><?php echo " ".__( "automatic updates for minor versions (security and maintenance releases only)", 'ga-dash' );?></div>
1212
  </td>
1213
  </tr>
1214
  <tr>
1215
- <td colspan="2"><hr><?php echo "<h2>" . __( "Exclude Tracking", 'ga-dash' ) . "</h2>"; ?></td>
1216
  </tr>
1217
  <tr>
1218
  <td colspan="2" class="title">
@@ -1222,14 +1241,14 @@ final class GADWP_Settings {
1222
  <div class="onoffswitch-switch"></div>
1223
  </label>
1224
  </div>
1225
- <div class="switch-desc"><?php echo " ".__("exclude Super Admin tracking for the entire network", 'ga-dash' );?></div>
1226
  </td>
1227
  </tr>
1228
  <tr>
1229
  <td colspan="2"><hr></td>
1230
  </tr>
1231
  <tr>
1232
- <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
1233
  </tr>
1234
  <?php
1235
  } else {
@@ -1238,7 +1257,7 @@ final class GADWP_Settings {
1238
  <td colspan="2"><hr></td>
1239
  </tr>
1240
  <tr>
1241
- <td colspan="2"><input type="submit" name="Authorize" class="button button-secondary" id="authorize" value="<?php _e( "Authorize Plugin", 'ga-dash' ); ?>" /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /></td>
1242
  </tr>
1243
  <?php } //Network Mode check?>
1244
  <tr>
@@ -1270,7 +1289,7 @@ final class GADWP_Settings {
1270
  <div class="meta-box-sortables">
1271
  <div class="postbox">
1272
  <h3>
1273
- <span><?php _e("Setup Tutorial & Demo",'ga-dash') ?></span>
1274
  </h3>
1275
  <div class="inside">
1276
  <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=video&utm_campaign=gadwp" target="_blank"><img src="<?php echo plugins_url( 'images/google-analytics-dashboard.png' , __FILE__ );?>" width="100%" alt="" /></a>
@@ -1278,7 +1297,7 @@ final class GADWP_Settings {
1278
  </div>
1279
  <div class="postbox">
1280
  <h3>
1281
- <span><?php _e("Follow & Review",'ga-dash')?></span>
1282
  </h3>
1283
  <div class="inside">
1284
  <div class="gadash-desc">
@@ -1304,47 +1323,47 @@ final class GADWP_Settings {
1304
  <a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info"><img src="<?php echo plugins_url( 'images/star.png' , __FILE__ ); ?>" /></a>
1305
  </div>
1306
  <div class="gadash-desc">
1307
- <?php printf(__('Your feedback and review are both important, %s!', 'ga-dash'), sprintf('<a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info">%s</a>', __('rate this plugin', 'ga-dash')));?>
1308
  </div>
1309
  </div>
1310
  </div>
1311
  <div class="postbox">
1312
  <h3>
1313
- <span><?php _e("Further Reading",'ga-dash')?></span>
1314
  </h3>
1315
  <div class="inside">
1316
  <div class="gadash-title">
1317
  <a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp"><img src="<?php echo plugins_url( 'images/ssl.png' , __FILE__ ); ?>" /></a>
1318
  </div>
1319
  <div class="gadash-desc">
1320
- <?php printf(__('%s by moving your website to HTTPS/SSL.', 'ga-dash'), sprintf('<a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp">%s</a>', __('Improve search rankings', 'ga-dash')));?>
1321
  </div>
1322
  <br />
1323
  <div class="gadash-title">
1324
  <a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp"><img src="<?php echo plugins_url( 'images/wp.png' , __FILE__ ); ?>" /></a>
1325
  </div>
1326
  <div class="gadash-desc">
1327
- <?php printf(__('Other %s written by the same author', 'ga-dash'), sprintf('<a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp">%s</a>', __('WordPress Plugins', 'ga-dash')));?>
1328
  </div>
1329
  </div>
1330
  </div>
1331
  <div class="postbox">
1332
  <h3>
1333
- <span><?php _e("Other Services",'ga-dash')?></span>
1334
  </h3>
1335
  <div class="inside">
1336
  <div class="gadash-title">
1337
  <a href="https://deconf.com/wordpress-cdn-speeds-up-your-site/"><img src="<?php echo plugins_url( 'images/mcdn.png' , __FILE__ ); ?>" /></a>
1338
  </div>
1339
  <div class="gadash-desc">
1340
- <?php printf(__('Speed up your website and plug into a whole %s', 'ga-dash'), sprintf('<a href="https://deconf.com/wordpress-cdn-speeds-up-your-site/?utm_source=gadwp_config&utm_medium=link&utm_content=maxcdn&utm_campaign=gadwp">%s</a>.', __('new level of site speed', 'ga-dash')));?>
1341
  </div>
1342
  <br />
1343
  <div class="gadash-title">
1344
  <a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp"><img src="<?php echo plugins_url( 'images/clicky.png' , __FILE__ ); ?>" /></a>
1345
  </div>
1346
  <div class="gadash-desc">
1347
- <?php printf(__('%s service with users tracking at IP level.', 'ga-dash'), sprintf('<a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp">%s</a>', __('Web Analytics', 'ga-dash')));?>
1348
  </div>
1349
  </div>
1350
  </div>
86
  }
87
  $options = self::update_options( 'frontend' );
88
  if ( isset( $_POST['options']['ga_dash_hidden'] ) ) {
89
+ $message = "<div class='updated'><p>" . __( "Settings saved.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
90
  if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
91
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
92
  }
93
  }
94
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
95
+ $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'google-analytics-dashboard-for-wp' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'google-analytics-dashboard-for-wp' ) ) ) );
96
  }
97
  ?>
98
  <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
99
  <div class="wrap">
100
+ <?php echo "<h2>" . __( "Google Analytics Frontend Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?><hr>
101
  </div>
102
  <div id="poststuff">
103
  <div id="post-body" class="metabox-holder columns-2">
107
  <?php if (isset($message)) echo $message; ?>
108
  <table class="options">
109
  <tr>
110
+ <td colspan="2"><?php echo "<h2>" . __( "Permissions", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
111
  </tr>
112
  <tr>
113
+ <td class="roles title"><label for="ga_dash_access_front"><?php _e("Show stats to:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
114
  <td class="roles">
115
  <?php
116
  if ( ! isset( $wp_roles ) ) {
151
  <div class="onoffswitch-switch"></div>
152
  </label>
153
  </div>
154
+ <div class="switch-desc"><?php echo " ".__("enable web page reports on frontend", 'google-analytics-dashboard-for-wp' );?></div>
155
  </td>
156
  </tr>
157
  <tr>
158
  <td colspan="2"><hr></td>
159
  </tr>
160
  <tr>
161
+ <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" /></td>
162
  </tr>
163
  </table>
164
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
181
  }
182
  $options = self::update_options( 'backend' );
183
  if ( isset( $_POST['options']['ga_dash_hidden'] ) ) {
184
+ $message = "<div class='updated'><p>" . __( "Settings saved.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
185
  if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
186
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
187
  }
188
  }
189
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
190
+ $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'google-analytics-dashboard-for-wp' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'google-analytics-dashboard-for-wp' ) ) ) );
191
  }
192
  ?>
193
  <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
194
  <div class="wrap">
195
+ <?php echo "<h2>" . __( "Google Analytics Backend Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?><hr>
196
  </div>
197
  <div id="poststuff">
198
  <div id="post-body" class="metabox-holder columns-2">
202
  <?php if (isset($message)) echo $message; ?>
203
  <table class="options">
204
  <tr>
205
+ <td colspan="2"><?php echo "<h2>" . __( "Permissions", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
206
  </tr>
207
  <tr>
208
+ <td class="roles title"><label for="ga_dash_access_back"><?php _e("Show stats to:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
209
  <td class="roles">
210
  <?php
211
  if ( ! isset( $wp_roles ) ) {
248
  <div class="onoffswitch-switch"></div>
249
  </label>
250
  </div>
251
+ <div class="switch-desc"><?php _e ( "enable Switch View functionality", 'google-analytics-dashboard-for-wp' );?></div>
252
  </td>
253
  </tr>
254
  <tr>
259
  <div class="onoffswitch-switch"></div>
260
  </label>
261
  </div>
262
+ <div class="switch-desc"><?php _e ( "enable reports on Posts List and Pages List", 'google-analytics-dashboard-for-wp' );?></div>
263
  </td>
264
  </tr>
265
  <tr>
270
  <div class="onoffswitch-switch"></div>
271
  </label>
272
  </div>
273
+ <div class="switch-desc"><?php _e ( "enable the main Dashboard Widget", 'google-analytics-dashboard-for-wp' );?></div>
274
  </td>
275
  </tr>
276
  <tr>
277
+ <td colspan="2"><hr><?php echo "<h2>" . __( "Real-Time Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
278
  </tr>
279
  <tr>
280
+ <td colspan="2" class="title"> <?php _e("Maximum number of pages to display on real-time tab:", 'google-analytics-dashboard-for-wp'); ?>
281
  <input type="number" name="options[ga_realtime_pages]" id="ga_realtime_pages" value="<?php echo (int)$options['ga_realtime_pages']; ?>" size="3">
282
  </td>
283
  </tr>
284
  <tr>
285
+ <td colspan="2"><hr><?php echo "<h2>" . __( "Location Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
286
  </tr>
287
  <tr>
288
  <td colspan="2" class="title">
289
+ <?php echo __("Target Geo Map to country:", 'google-analytics-dashboard-for-wp'); ?>
290
  <input type="text" style="text-align: center;" name="options[ga_target_geomap]" value="<?php echo esc_attr($options['ga_target_geomap']); ?>" size="3">
291
  </td>
292
  </tr>
294
  <td colspan="2"><hr></td>
295
  </tr>
296
  <tr>
297
+ <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" /></td>
298
  </tr>
299
  </table>
300
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
315
  }
316
  $options = self::update_options( 'tracking' );
317
  if ( isset( $_POST['options']['ga_dash_hidden'] ) ) {
318
+ $message = "<div class='updated'><p>" . __( "Settings saved.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
319
  if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
320
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
321
  }
322
  }
323
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
324
+ $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'google-analytics-dashboard-for-wp' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'google-analytics-dashboard-for-wp' ) ) ) );
325
  }
326
  if ( ! $options['ga_dash_tracking'] ) {
327
+ $message = "<div class='error'><p>" . __( "The tracking component is disabled. You should set <strong>Tracking Options</strong> to <strong>Enabled</strong>", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
328
  }
329
  ?>
330
  <form name="ga_dash_form" method="post" action="<?php esc_url($_SERVER['REQUEST_URI']); ?>">
331
  <div class="wrap">
332
+ <?php echo "<h2>" . __( "Google Analytics Tracking Code", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?>
333
  </div>
334
  <div id="poststuff">
335
  <div id="post-body" class="metabox-holder columns-2">
338
  <div class="inside">
339
  <?php
340
  $tabs = array(
341
+ 'basic' => __( "Basic Settings", 'google-analytics-dashboard-for-wp' ),
342
+ 'events' => __( "Events Tracking", 'google-analytics-dashboard-for-wp' ),
343
+ 'custom' => __( "Custom Definitions", 'google-analytics-dashboard-for-wp' ),
344
+ 'exclude' => __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ),
345
+ 'advanced' => __( "Advanced Settings", 'google-analytics-dashboard-for-wp' ) );
346
  self::navigation_tabs( $tabs );
347
  if ( isset( $message ) )
348
  echo $message;
350
  <div id="gadwp-basic">
351
  <table class="options">
352
  <tr>
353
+ <td colspan="2"><?php echo "<h2>" . __( "Tracking Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
354
  </tr>
355
  <tr>
356
+ <td class="title"><label for="ga_dash_tracking"><?php _e("Tracking Options:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
357
  <td><select id="ga_dash_tracking" name="options[ga_dash_tracking]" onchange="this.form.submit()">
358
+ <option value="0" <?php selected( $options['ga_dash_tracking'], 0 ); ?>><?php _e("Disabled", 'google-analytics-dashboard-for-wp');?></option>
359
+ <option value="1" <?php selected( $options['ga_dash_tracking'], 1 ); ?>><?php _e("Enabled", 'google-analytics-dashboard-for-wp');?></option>
360
  </select></td>
361
  </tr>
362
  <?php if ($options['ga_dash_tracking']) {?>
364
  <td class="title"></td>
365
  <td>
366
  <?php $profile_info = GADWP_Tools::get_selected_profile($gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail']); ?>
367
+ <?php echo '<pre>' . __("View Name:", 'google-analytics-dashboard-for-wp') . "\t" . esc_html($profile_info[0]) . "<br />" . __("Tracking ID:", 'google-analytics-dashboard-for-wp') . "\t" . esc_html($profile_info[2]) . "<br />" . __("Default URL:", 'google-analytics-dashboard-for-wp') . "\t" . esc_html($profile_info[3]) . "<br />" . __("Time Zone:", 'google-analytics-dashboard-for-wp') . "\t" . esc_html($profile_info[5]) . '</pre>';?>
368
  </td>
369
  </tr>
370
  <?php }?>
371
  <tr>
372
+ <td colspan="2"><hr><?php echo "<h2>" . __( "Basic Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
373
  </tr>
374
  <tr>
375
+ <td class="title"><label for="ga_dash_tracking_type"><?php _e("Tracking Type:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
376
  <td><select id="ga_dash_tracking_type" name="options[ga_dash_tracking_type]">
377
+ <option value="classic" <?php selected( $options['ga_dash_tracking_type'], 'classic' ); ?>><?php _e("Classic Analytics", 'google-analytics-dashboard-for-wp');?></option>
378
+ <option value="universal" <?php selected( $options['ga_dash_tracking_type'], 'universal' ); ?>><?php _e("Universal Analytics", 'google-analytics-dashboard-for-wp');?></option>
379
  </select></td>
380
  </tr>
381
  <tr>
386
  <div class="onoffswitch-switch"></div>
387
  </label>
388
  </div>
389
+ <div class="switch-desc"><?php echo " ".__("anonymize IPs while tracking", 'google-analytics-dashboard-for-wp' );?></div>
390
  </td>
391
  </tr>
392
  <tr>
397
  <div class="onoffswitch-switch"></div>
398
  </label>
399
  </div>
400
+ <div class="switch-desc"><?php echo " ".__("enable remarketing, demographics and interests reports", 'google-analytics-dashboard-for-wp' );?></div>
401
  </td>
402
  </tr>
403
  </table>
405
  <div id="gadwp-events">
406
  <table class="options">
407
  <tr>
408
+ <td colspan="2"><?php echo "<h2>" . __( "Events Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
409
  </tr>
410
  <tr>
411
  <td colspan="2" class="title">
415
  <div class="onoffswitch-switch"></div>
416
  </label>
417
  </div>
418
+ <div class="switch-desc"><?php echo " ".__("track downloads, mailto and outbound links", 'google-analytics-dashboard-for-wp' ); ?></div>
419
  </td>
420
  </tr>
421
  <tr>
422
+ <td class="title"><label for="ga_event_downloads"><?php _e("Downloads Regex:", 'google-analytics-dashboard-for-wp'); ?></label></td>
423
  <td><input type="text" id="ga_event_downloads" name="options[ga_event_downloads]" value="<?php echo esc_attr($options['ga_event_downloads']); ?>" size="50"></td>
424
  </tr>
425
  <tr>
430
  <div class="onoffswitch-switch"></div>
431
  </label>
432
  </div>
433
+ <div class="switch-desc"><?php echo " ".__("track affiliate links matching this regex", 'google-analytics-dashboard-for-wp' ); ?></div>
434
  </td>
435
  </tr>
436
  <tr>
437
+ <td class="title"><label for="ga_event_affiliates"><?php _e("Affiliates Regex:", 'google-analytics-dashboard-for-wp'); ?></label></td>
438
  <td><input type="text" id="ga_event_affiliates" name="options[ga_event_affiliates]" value="<?php echo esc_attr($options['ga_event_affiliates']); ?>" size="50"></td>
439
  </tr>
440
  <tr>
445
  <div class="onoffswitch-switch"></div>
446
  </label>
447
  </div>
448
+ <div class="switch-desc"><?php echo " ".__("track fragment identifiers, hashmarks (#) in URI links", 'google-analytics-dashboard-for-wp' ); ?></div>
449
  </td>
450
  </tr>
451
  </table>
453
  <div id="gadwp-custom">
454
  <table class="options">
455
  <tr>
456
+ <td colspan="2"><?php echo "<h2>" . __( "Custom Definitions", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
457
  </tr>
458
  <tr>
459
+ <td class="title"><label for="ga_author_dimindex"><?php _e("Authors:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
460
  <td><select id="ga_author_dimindex" name="options[ga_author_dimindex]">
461
  <?php for ($i=0;$i<21;$i++){?>
462
  <option value="<?php echo $i;?>" <?php selected( $options['ga_author_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
464
  </select></td>
465
  </tr>
466
  <tr>
467
+ <td class="title"><label for="ga_pubyear_dimindex"><?php _e("Publication Year:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
468
  <td><select id="ga_pubyear_dimindex" name="options[ga_pubyear_dimindex]">
469
  <?php for ($i=0;$i<21;$i++){?>
470
  <option value="<?php echo $i;?>" <?php selected( $options['ga_pubyear_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
472
  </select></td>
473
  </tr>
474
  <tr>
475
+ <td class="title"><label for="ga_category_dimindex"><?php _e("Categories:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
476
  <td><select id="ga_category_dimindex" name="options[ga_category_dimindex]">
477
  <?php for ($i=0;$i<21;$i++){?>
478
  <option value="<?php echo $i;?>" <?php selected( $options['ga_category_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
480
  </select></td>
481
  </tr>
482
  <tr>
483
+ <td class="title"><label for="ga_user_dimindex"><?php _e("User Type:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
484
  <td><select id="ga_user_dimindex" name="options[ga_user_dimindex]">
485
  <?php for ($i=0;$i<21;$i++){?>
486
  <option value="<?php echo $i;?>" <?php selected( $options['ga_user_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
492
  <div id="gadwp-advanced">
493
  <table class="options">
494
  <tr>
495
+ <td colspan="2"><?php echo "<h2>" . __( "Advanced Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
496
  </tr>
497
  <tr>
498
+ <td class="title"><label for="ga_speed_samplerate"><?php _e("Page Speed SR:", 'google-analytics-dashboard-for-wp'); ?></label></td>
499
  <td><input type="number" id="ga_speed_samplerate" name="options[ga_speed_samplerate]" value="<?php echo (int)($options['ga_speed_samplerate']); ?>" max="100" min="1"> %</td>
500
  </tr>
501
  <tr>
506
  <div class="onoffswitch-switch"></div>
507
  </label>
508
  </div>
509
+ <div class="switch-desc"><?php echo " ".__("exclude events from bounce-rate calculation", 'google-analytics-dashboard-for-wp' );?></div>
510
  </td>
511
  </tr>
512
  <tr>
517
  <div class="onoffswitch-switch"></div>
518
  </label>
519
  </div>
520
+ <div class="switch-desc"><?php echo " ".__("enable enhanced link attribution", 'google-analytics-dashboard-for-wp' );?></div>
521
  </td>
522
  </tr>
523
  <tr>
528
  <div class="onoffswitch-switch"></div>
529
  </label>
530
  </div>
531
+ <div class="switch-desc"><?php echo " ".__("enable AdSense account linking", 'google-analytics-dashboard-for-wp' );?></div>
532
  </td>
533
  </tr>
534
  <tr>
539
  <div class="onoffswitch-switch"></div>
540
  </label>
541
  </div>
542
+ <div class="switch-desc"><?php echo " ".__("enable cross domain tracking", 'google-analytics-dashboard-for-wp' ); ?></div>
543
  </td>
544
  </tr>
545
  <tr>
546
+ <td class="title"><label for="ga_crossdomain_list"><?php _e("Cross Domains:", 'google-analytics-dashboard-for-wp'); ?></label></td>
547
  <td><input type="text" id="ga_crossdomain_list" name="options[ga_crossdomain_list]" value="<?php echo esc_attr($options['ga_crossdomain_list']); ?>" size="50"></td>
548
  </tr>
549
  </table>
551
  <div id="gadwp-exclude">
552
  <table class="options">
553
  <tr>
554
+ <td colspan="2"><?php echo "<h2>" . __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
555
  </tr>
556
  <tr>
557
+ <td class="roles title"><label for="ga_track_exclude"><?php _e("Exclude tracking for:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
558
  <td class="roles">
559
  <?php
560
  if ( ! isset( $wp_roles ) ) {
595
  <td colspan="2"><hr></td>
596
  </tr>
597
  <tr>
598
+ <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" /></td>
599
  </tr>
600
  </table>
601
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
638
 
639
  $options = self::update_options( 'frontend' );
640
  if ( ! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token'] ) {
641
+ $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'google-analytics-dashboard-for-wp' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'google-analytics-dashboard-for-wp' ) ) ) );
642
  }
643
  ?>
644
  <div class="wrap">
645
+ <?php echo "<h2>" . __( "Google Analytics Errors & Debugging", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?>
646
  </div>
647
  <div id="poststuff">
648
  <div id="post-body" class="metabox-holder columns-2">
652
  <?php if (isset($message)) echo $message; ?>
653
  <?php
654
  $tabs = array(
655
+ 'errors' => __( "Errors & Details", 'google-analytics-dashboard-for-wp' ),
656
+ 'config' => __( "Plugin Settings", 'google-analytics-dashboard-for-wp' ) );
657
  self::navigation_tabs( $tabs );
658
  ?>
659
  <div id="gadwp-errors">
660
  <table class="options">
661
  <tr>
662
  <td>
663
+ <?php echo "<h2>" . __( "Last Error detected", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?>
664
  </td>
665
  </tr>
666
  <tr>
667
  <td>
668
  <?php
669
+ $errors = esc_html( print_r( get_transient( 'ga_dash_lasterror' ), true ) ) ? esc_html( print_r( get_transient( 'ga_dash_lasterror' ), true ) ) : __( "None", 'google-analytics-dashboard-for-wp' );
670
  echo '<pre class="log_data">Last Error: ';
671
  echo $errors;
672
  ?></pre>
673
  </td>
674
  </tr>
675
  <tr>
676
+ <td colspan="2"><hr><?php echo "<h2>" . __( "Error Details", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
677
  </tr>
678
  <tr>
679
  <td>
680
  <?php
681
  echo '<pre class="log_data">Error Details: ';
682
+ $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", 'google-analytics-dashboard-for-wp' );
683
  echo $error_details;
684
  ?></pre><br />
685
  <hr>
693
  <div id="gadwp-config">
694
  <table class="options">
695
  <tr>
696
+ <td><?php echo "<h2>" . __( "Plugin Configuration", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
697
  </tr>
698
  <tr>
699
  <td><pre class="log_data"><?php echo esc_html(print_r($anonim, true));?></pre><br />
714
  return;
715
  }
716
  $options = self::update_options( 'general' );
717
+ printf( '<div id="gapi-warning" class="updated"><p>%1$s <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=general_screen&utm_campaign=gadwp">%2$s</a></p></div>', __( 'Loading the required libraries. If this results in a blank screen or a fatal error, try this solution:', 'google-analytics-dashboard-for-wp' ), __( 'Library conflicts between WordPress plugins', 'google-analytics-dashboard-for-wp' ) );
718
  if ( null === $gadwp->gapi_controller ) {
719
  $gadwp->gapi_controller = new GADWP_GAPI_Controller();
720
  }
729
  $gadwp->config->options['automatic_updates_minorversion'] = 1;
730
  $gadwp->config->set_plugin_options();
731
  $options = self::update_options( 'general' );
732
+ $message = "<div class='updated'><p>" . __( "Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
733
  delete_transient( 'ga_dash_gapi_errors' );
734
  delete_transient( 'ga_dash_lasterror' );
735
+ if ( $gadwp->config->options['ga_dash_token'] && $gadwp->gapi_controller->client->getAccessToken() ) {
736
+ if ( ! empty( $gadwp->config->options['ga_dash_profile_list'] ) ) {
737
+ $profiles = $gadwp->config->options['ga_dash_profile_list'];
738
+ } else {
739
+ $profiles = $gadwp->gapi_controller->refresh_profiles();
740
+ }
741
+ if ( $profiles ) {
742
+ $gadwp->config->options['ga_dash_profile_list'] = $profiles;
743
+ if ( ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
744
+ $profile = GADWP_Tools::guess_default_domain( $profiles );
745
+ $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
746
+ $gadwp->config->options['ga_dash_tableid'] = $profile;
747
+ }
748
+ $gadwp->config->set_plugin_options();
749
+ $options = self::update_options( 'general' );
750
+ }
751
+ }
752
  } catch ( Google_IO_Exception $e ) {
753
  set_transient( 'ga_dash_lasterror', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $e ), $gadwp->gapi_controller->error_timeout );
754
  return false;
761
  $gadwp->gapi_controller->reset_token( false );
762
  }
763
  } else {
764
+ $message = "<div class='error'><p>" . __( "The access code is <strong>NOT</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X). Try again, and use the red link to get your access code", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
765
  }
766
  }
767
  if ( isset( $_POST['Clear'] ) ) {
768
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
769
  GADWP_Tools::clear_cache();
770
+ $message = "<div class='updated'><p>" . __( "Cleared Cache.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
771
  } else {
772
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
773
  }
774
  }
775
  if ( isset( $_POST['Reset'] ) ) {
776
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
777
  $gadwp->gapi_controller->reset_token( true );
778
  GADWP_Tools::clear_cache();
779
+ $message = "<div class='updated'><p>" . __( "Token Reseted and Revoked.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
780
  $options = self::update_options( 'Reset' );
781
  } else {
782
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
783
  }
784
  }
785
  if ( isset( $_POST['Reset_Err'] ) ) {
786
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
787
  delete_transient( 'ga_dash_lasterror' );
788
  delete_transient( 'ga_dash_gapi_errors' );
789
+ $message = "<div class='updated'><p>" . __( "All errors reseted.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
790
  } else {
791
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
792
  }
793
  }
794
  if ( isset( $_POST['options']['ga_dash_hidden'] ) && ! isset( $_POST['Clear'] ) && ! isset( $_POST['Reset'] ) && ! isset( $_POST['Reset_Err'] ) ) {
795
+ $message = "<div class='updated'><p>" . __( "Settings saved.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
796
  if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
797
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
798
  }
799
  }
800
  if ( isset( $_POST['Hide'] ) ) {
801
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
802
+ $message = "<div class='updated'><p>" . __( "All other domains/properties were removed.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
803
  $lock_profile = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
804
  $gadwp->config->options['ga_dash_profile_list'] = array(
805
  $lock_profile );
806
  $options = self::update_options( 'general' );
807
  } else {
808
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
809
  }
810
  }
811
  ?>
812
  <div class="wrap">
813
+ <?php echo "<h2>" . __( "Google Analytics Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?>
814
  <hr>
815
  </div>
816
  <div id="poststuff">
819
  <div class="settings-wrapper">
820
  <div class="inside">
821
  <?php
822
+ if ( $gadwp->gapi_controller->gapi_errors_handler() || get_transient('ga_dash_lasterror') ) {
823
+ $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'google-analytics-dashboard-for-wp' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'google-analytics-dashboard-for-wp' ) ) ) );
824
  }
825
  if ( isset( $_POST['Authorize'] ) ) {
826
  GADWP_Tools::clear_cache();
827
  $gadwp->gapi_controller->token_request();
828
+ echo "<div class='updated'><p>" . __( "Use the red link (see below) to generate and get your access code!", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
829
  } else {
830
+ if ( isset( $message ) ){
831
  echo $message;
832
+ }
833
  ?>
834
  <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
835
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
837
  <table class="options">
838
  <tr>
839
  <td colspan="2">
840
+ <?php echo "<h2>" . __( "Plugin Authorization", 'google-analytics-dashboard-for-wp' ) . "</h2>";?>
841
  </td>
842
  </tr>
843
  <tr>
844
  <td colspan="2" class="info">
845
+ <?php printf(__('You should watch the %1$s and read this %2$s before proceeding to authorization. This plugin requires a properly configured Google Analytics account!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video", 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("tutorial", 'google-analytics-dashboard-for-wp')));?>
846
  </td>
847
  </tr>
848
  <?php if (! $options['ga_dash_token'] || $options['ga_dash_userapi']) {?>
849
  <tr>
850
+ <td colspan="2" class="info"><input name="options[ga_dash_userapi]" type="checkbox" id="ga_dash_userapi" value="1" <?php checked( $options['ga_dash_userapi'], 1 ); ?> onchange="this.form.submit()" <?php echo ($options['ga_dash_network'])?'disabled="disabled"':''; ?> /><?php echo " ".__("use your own API Project credentials", 'google-analytics-dashboard-for-wp' );?>
851
  </td>
852
  </tr>
853
  <?php } if ($options['ga_dash_userapi']) { ?>
854
  <tr>
855
+ <td class="title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'google-analytics-dashboard-for-wp'); ?></label></td>
856
  <td><input type="text" name="options[ga_dash_apikey]" value="<?php echo esc_attr($options['ga_dash_apikey']); ?>" size="40" required="required"></td>
857
  </tr>
858
  <tr>
859
+ <td class="title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'google-analytics-dashboard-for-wp'); ?></label></td>
860
  <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?>" size="40" required="required"></td>
861
  </tr>
862
  <tr>
863
+ <td class="title"><label for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'google-analytics-dashboard-for-wp'); ?></label></td>
864
  <td><input type="text" name="options[ga_dash_clientsecret]" value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>" size="40" required="required"> <input type="hidden" name="options[ga_dash_hidden]" value="Y">
865
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
866
  </td>
870
  if ( $options['ga_dash_token'] ) {
871
  ?>
872
  <tr>
873
+ <td colspan="2"><input type="submit" name="Reset" class="button button-secondary" value="<?php _e( "Clear Authorization", 'google-analytics-dashboard-for-wp' ); ?>" <?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'google-analytics-dashboard-for-wp' ); ?>" /> <input type="submit" name="Reset_Err" class="button button-secondary" value="<?php _e( "Reset Errors", 'google-analytics-dashboard-for-wp' ); ?>" /></td>
874
  </tr>
875
  <tr>
876
  <td colspan="2"><hr></td>
877
  </tr>
878
  <tr>
879
+ <td colspan="2"><?php echo "<h2>" . __( "General Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
880
  </tr>
881
  <tr>
882
+ <td class="title"><label for="ga_dash_tableid_jail"><?php _e("Select View:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
883
  <td><select id="ga_dash_tableid_jail" <?php disabled(empty($options['ga_dash_profile_list']) || 1 == count($options['ga_dash_profile_list']), true); ?> name="options[ga_dash_tableid_jail]">
884
  <?php
885
  if ( ! empty( $options['ga_dash_profile_list'] ) ) {
886
  foreach ( $options['ga_dash_profile_list'] as $items ) {
887
  if ( $items[3] ) {
888
  echo '<option value="' . esc_attr( $items[1] ) . '" ' . selected( $items[1], $options['ga_dash_tableid_jail'] );
889
+ echo ' title="' . __( "View Name:", 'google-analytics-dashboard-for-wp' ) . ' ' . esc_attr( $items[0] ) . '">' . esc_html( GADWP_Tools::strip_protocol( $items[3] ) ) . ' &#8658; ' . esc_attr( $items[0] ) . '</option>';
890
  }
891
  }
892
  } else {
893
+ echo '<option value="">' . __( "Property not found", 'google-analytics-dashboard-for-wp' ) . '</option>';
894
  }
895
  ?>
896
  </select>
897
  <?php
898
  if ( count( $options['ga_dash_profile_list'] ) > 1 ) {
899
+ ?>&nbsp;<input type="submit" name="Hide" class="button button-secondary" value="<?php _e( "Lock Selection", 'google-analytics-dashboard-for-wp' ); ?>" /><?php
900
  }
901
  ?>
902
  </td>
908
  <td class="title"></td>
909
  <td><?php
910
  $profile_info = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
911
+ echo '<pre>' . __( "View Name:", 'google-analytics-dashboard-for-wp' ) . "\t" . esc_html( $profile_info[0] ) . "<br />" . __( "Tracking ID:", 'google-analytics-dashboard-for-wp' ) . "\t" . esc_html( $profile_info[2] ) . "<br />" . __( "Default URL:", 'google-analytics-dashboard-for-wp' ) . "\t" . esc_html( $profile_info[3] ) . "<br />" . __( "Time Zone:", 'google-analytics-dashboard-for-wp' ) . "\t" . esc_html( $profile_info[5] ) . '</pre>';
912
  ?></td>
913
  </tr>
914
  <?php
915
  }
916
  ?>
917
  <tr>
918
+ <td class="title"><label for="ga_dash_style"><?php _e("Theme Color:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
919
  <td><input type="text" id="ga_dash_style" class="ga_dash_style" name="options[ga_dash_style]" value="<?php echo esc_attr($options['ga_dash_style']); ?>" size="10"></td>
920
  </tr>
921
  <tr>
923
  </tr>
924
  <?php if ( !is_multisite()) {?>
925
  <tr>
926
+ <td colspan="2"><?php echo "<h2>" . __( "Automatic Updates", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
927
  </tr>
928
  <tr>
929
  <td colspan="2" class="title">
933
  <div class="onoffswitch-switch"></div>
934
  </label>
935
  </div>
936
+ <div class="switch-desc"><?php echo " ".__( "automatic updates for minor versions (security and maintenance releases only)", 'google-analytics-dashboard-for-wp' );?></div>
937
  </td>
938
  </tr>
939
  <tr>
941
  </tr>
942
  <?php }?>
943
  <tr>
944
+ <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" /></td>
945
  </tr>
946
  <?php } else {?>
947
  <tr>
948
  <td colspan="2"><hr></td>
949
  </tr>
950
  <tr>
951
+ <td colspan="2"><input type="submit" name="Authorize" class="button button-secondary" id="authorize" value="<?php _e( "Authorize Plugin", 'google-analytics-dashboard-for-wp' ); ?>" <?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'google-analytics-dashboard-for-wp' ); ?>" /></td>
952
  </tr>
953
  <tr>
954
  <td colspan="2"><hr></td>
978
  /*
979
  * Include GAPI
980
  */
981
+ echo '<div id="gapi-warning" class="updated"><p>' . __( 'Loading the required libraries. If this results in a blank screen or a fatal error, try this solution:', 'google-analytics-dashboard-for-wp' ) . ' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=general_screen&utm_campaign=gadwp">Library conflicts between WordPress plugins</a></p></div>';
982
 
983
  if ( null === $gadwp->gapi_controller ) {
984
  $gadwp->gapi_controller = new GADWP_GAPI_Controller();
995
  $gadwp->config->options['automatic_updates_minorversion'] = 1;
996
  $gadwp->config->set_plugin_options( true );
997
  $options = self::update_options( 'network' );
998
+ $message = "<div class='updated'><p>" . __( "Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
999
  if ( is_multisite() ) { // Cleanup errors on the entire network
1000
  foreach ( wp_get_sites( array(
1001
  'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
1006
  } else {
1007
  delete_transient( 'ga_dash_gapi_errors' );
1008
  }
1009
+ if ( $gadwp->config->options['ga_dash_token'] && $gadwp->gapi_controller->client->getAccessToken() ) {
1010
+ if ( ! empty( $gadwp->config->options['ga_dash_profile_list'] ) ) {
1011
+ $profiles = $gadwp->config->options['ga_dash_profile_list'];
1012
+ } else {
1013
+ $profiles = $gadwp->gapi_controller->refresh_profiles();
1014
+ }
1015
+ if ( $profiles ) {
1016
+ $gadwp->config->options['ga_dash_profile_list'] = $profiles;
1017
+ if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
1018
+ $profile = GADWP_Tools::guess_default_domain( $profiles );
1019
+ $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
1020
+ $gadwp->config->options['ga_dash_tableid'] = $profile;
1021
+ }
1022
+ $gadwp->config->set_plugin_options( true );
1023
+ $options = self::update_options( 'network' );
1024
+ }
1025
+ }
1026
  } catch ( Google_IO_Exception $e ) {
1027
  set_transient( 'ga_dash_lasterror', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $e ), $gadwp->gapi_controller->error_timeout );
1028
  return false;
1035
  $gadwp->gapi_controller->reset_token( false );
1036
  }
1037
  } else {
1038
+ $message = "<div class='error'><p>" . __( "The access code is <strong>NOT</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X). Try again, and use the red link to get your access code", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
1039
  }
1040
  }
1041
  if ( isset( $_POST['Refresh'] ) ) {
1042
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1043
  $gadwp->config->options['ga_dash_profile_list'] = array();
1044
+ $message = "<div class='updated'><p>" . __( "Properties refreshed.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1045
  $options = self::update_options( 'network' );
1046
+ if ( $gadwp->config->options['ga_dash_token'] && $gadwp->gapi_controller->client->getAccessToken() ) {
1047
+ if ( ! empty( $gadwp->config->options['ga_dash_profile_list'] ) ) {
1048
+ $profiles = $gadwp->config->options['ga_dash_profile_list'];
1049
+ } else {
1050
+ $profiles = $gadwp->gapi_controller->refresh_profiles();
1051
+ }
1052
+ if ( $profiles ) {
1053
+ $gadwp->config->options['ga_dash_profile_list'] = $profiles;
1054
+ if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
1055
+ $profile = GADWP_Tools::guess_default_domain( $profiles );
1056
+ $gadwp->config->options['ga_dash_tableid_jail'] = $profile;
1057
+ $gadwp->config->options['ga_dash_tableid'] = $profile;
1058
+ }
1059
+ $gadwp->config->set_plugin_options( true );
1060
+ $options = self::update_options( 'network' );
1061
+ }
1062
  }
1063
+ } else {
1064
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1065
  }
1066
  }
1067
  if ( isset( $_POST['Clear'] ) ) {
1068
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1069
  GADWP_Tools::clear_cache();
1070
+ $message = "<div class='updated'><p>" . __( "Cleared Cache.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1071
  } else {
1072
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1073
  }
1074
  }
1075
  if ( isset( $_POST['Reset'] ) ) {
1076
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1077
  $gadwp->gapi_controller->reset_token( true );
1078
  GADWP_Tools::clear_cache();
1079
+ $message = "<div class='updated'><p>" . __( "Token Reseted and Revoked.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1080
  $options = self::update_options( 'Reset' );
1081
  } else {
1082
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1083
  }
1084
  }
1085
  if ( isset( $_POST['options']['ga_dash_hidden'] ) && ! isset( $_POST['Clear'] ) && ! isset( $_POST['Reset'] ) && ! isset( $_POST['Refresh'] ) ) {
1086
+ $message = "<div class='updated'><p>" . __( "Settings saved.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1087
  if ( ! ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) ) {
1088
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1089
  }
1090
  }
1091
  if ( isset( $_POST['Hide'] ) ) {
1092
  if ( isset( $_POST['gadash_security'] ) && wp_verify_nonce( $_POST['gadash_security'], 'gadash_form' ) ) {
1093
+ $message = "<div class='updated'><p>" . __( "All other domains/properties were removed.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1094
  $lock_profile = GADWP_Tools::get_selected_profile( $gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail'] );
1095
  $gadwp->config->options['ga_dash_profile_list'] = array(
1096
  $lock_profile );
1097
  $options = self::update_options( 'network' );
1098
  } else {
1099
+ $message = "<div class='error'><p>" . __( "Cheating Huh?", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1100
  }
1101
  }
1102
  ?>
1103
  <div class="wrap">
1104
+ <?php echo "<h2>" . __( "Google Analytics Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?><hr>
1105
  </div>
1106
  <div id="poststuff">
1107
  <div id="post-body" class="metabox-holder columns-2">
1109
  <div class="settings-wrapper">
1110
  <div class="inside">
1111
  <?php
1112
+ if ( $gadwp->gapi_controller->gapi_errors_handler() || get_transient('ga_dash_lasterror')) {
1113
+ $message = sprintf( '<div class="error"><p>%s</p></div>', sprintf( __( 'Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_errors_debugging', false ), __( 'Errors & Debug', 'google-analytics-dashboard-for-wp' ) ), sprintf( '<a href="%1$s">%2$s</a>', menu_page_url( 'gadash_settings', false ), __( 'authorize the plugin', 'google-analytics-dashboard-for-wp' ) ) ) );
1114
  }
1115
  if ( isset( $_POST['Authorize'] ) ) {
1116
  GADWP_Tools::clear_cache();
1117
  $gadwp->gapi_controller->token_request();
1118
+ echo "<div class='updated'><p>" . __( "Use the red link (see below) to generate and get your access code!", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1119
  } else {
1120
+ if ( isset( $message ) ){
1121
  echo $message;
1122
+ }
1123
  ?>
1124
  <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
1125
  <input type="hidden" name="options[ga_dash_hidden]" value="Y">
1126
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
1127
  <table class="options">
1128
  <tr>
1129
+ <td colspan="2"><?php echo "<h2>" . __( "Network Setup", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1130
  </tr>
1131
  <tr>
1132
  <td colspan="2" class="title">
1136
  <div class="onoffswitch-switch"></div>
1137
  </label>
1138
  </div>
1139
+ <div class="switch-desc"><?php echo " ".__("use a single Google Analytics account for the entire network", 'google-analytics-dashboard-for-wp' );?></div>
1140
  </td>
1141
  </tr>
1142
  <?php if ($options['ga_dash_network']){ //Network Mode check?>
1144
  <td colspan="2"><hr></td>
1145
  </tr>
1146
  <tr>
1147
+ <td colspan="2"><?php echo "<h2>" . __( "Plugin Authorization", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1148
  </tr>
1149
  <tr>
1150
  <td colspan="2" class="info">
1151
+ <?php printf(__('You should watch the %1$s and read this %2$s before proceeding to authorization. This plugin requires a properly configured Google Analytics account!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video", 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("tutorial", 'google-analytics-dashboard-for-wp')));?>
1152
  </td>
1153
  </tr>
1154
  <?php
1155
  if ( ! $options['ga_dash_token'] || $options['ga_dash_userapi'] ) {
1156
  ?>
1157
  <tr>
1158
+ <td colspan="2" class="info"><input name="options[ga_dash_userapi]" type="checkbox" id="ga_dash_userapi" value="1" <?php checked( $options['ga_dash_userapi'], 1 ); ?> onchange="this.form.submit()" /><?php echo " ".__("use your own API Project credentials", 'google-analytics-dashboard-for-wp' );?>
1159
  </td>
1160
  </tr>
1161
  <?php
1163
  if ( $options['ga_dash_userapi'] ) {
1164
  ?>
1165
  <tr>
1166
+ <td class="title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'google-analytics-dashboard-for-wp'); ?></label></td>
1167
  <td><input type="text" name="options[ga_dash_apikey]" value="<?php echo esc_attr($options['ga_dash_apikey']); ?>" size="40" required="required"></td>
1168
  </tr>
1169
  <tr>
1170
+ <td class="title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'google-analytics-dashboard-for-wp'); ?></label></td>
1171
  <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?>" size="40" required="required"></td>
1172
  </tr>
1173
  <tr>
1174
+ <td class="title"><label for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'google-analytics-dashboard-for-wp'); ?></label></td>
1175
  <td><input type="text" name="options[ga_dash_clientsecret]" value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>" size="40" required="required"> <input type="hidden" name="options[ga_dash_hidden]" value="Y">
1176
  <?php wp_nonce_field('gadash_form','gadash_security'); ?>
1177
  </td>
1181
  if ( $options['ga_dash_token'] ) {
1182
  ?>
1183
  <tr>
1184
+ <td colspan="2"><input type="submit" name="Reset" class="button button-secondary" value="<?php _e( "Clear Authorization", 'google-analytics-dashboard-for-wp' ); ?>" /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'google-analytics-dashboard-for-wp' ); ?>" /> <input type="submit" name="Refresh" class="button button-secondary" value="<?php _e( "Refresh Properties", 'google-analytics-dashboard-for-wp' ); ?>" /></td>
1185
  </tr>
1186
  <tr>
1187
  <td colspan="2"><hr></td>
1188
  </tr>
1189
  <tr>
1190
+ <td colspan="2"><?php echo "<h2>" . __( "Properties/Views Settings", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1191
  </tr>
1192
  <?php
1193
  if ( isset( $options['ga_dash_tableid_network'] ) ) {
1204
  foreach ( $options['ga_dash_profile_list'] as $items ) {
1205
  if ( $items[3] ) {
1206
  echo '<option value="' . esc_attr( $items[1] ) . '" ' . selected( $items[1], isset( $options['ga_dash_tableid_network']->$blog['blog_id'] ) ? $options['ga_dash_tableid_network']->$blog['blog_id'] : '' );
1207
+ echo ' title="' . __( "View Name:", 'google-analytics-dashboard-for-wp' ) . ' ' . esc_attr( $items[0] ) . '">' . esc_html( GADWP_Tools::strip_protocol( $items[3] ) ) . ' &#8658; ' . esc_attr( $items[0] ) . '</option>';
1208
  }
1209
  }
1210
  } else {
1211
+ echo '<option value="">' . __( "Property not found", 'google-analytics-dashboard-for-wp' ) . '</option>';
1212
  }
1213
  ?>
1214
  </select> <br /></td>
1217
  }
1218
  ?>
1219
  <tr>
1220
+ <td colspan="2"><?php echo "<h2>" . __( "Automatic Updates", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1221
  </tr>
1222
  <tr>
1223
  <td colspan="2" class="title">
1227
  <div class="onoffswitch-switch"></div>
1228
  </label>
1229
  </div>
1230
+ <div class="switch-desc"><?php echo " ".__( "automatic updates for minor versions (security and maintenance releases only)", 'google-analytics-dashboard-for-wp' );?></div>
1231
  </td>
1232
  </tr>
1233
  <tr>
1234
+ <td colspan="2"><hr><?php echo "<h2>" . __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1235
  </tr>
1236
  <tr>
1237
  <td colspan="2" class="title">
1241
  <div class="onoffswitch-switch"></div>
1242
  </label>
1243
  </div>
1244
+ <div class="switch-desc"><?php echo " ".__("exclude Super Admin tracking for the entire network", 'google-analytics-dashboard-for-wp' );?></div>
1245
  </td>
1246
  </tr>
1247
  <tr>
1248
  <td colspan="2"><hr></td>
1249
  </tr>
1250
  <tr>
1251
+ <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" /></td>
1252
  </tr>
1253
  <?php
1254
  } else {
1257
  <td colspan="2"><hr></td>
1258
  </tr>
1259
  <tr>
1260
+ <td colspan="2"><input type="submit" name="Authorize" class="button button-secondary" id="authorize" value="<?php _e( "Authorize Plugin", 'google-analytics-dashboard-for-wp' ); ?>" /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e( "Clear Cache", 'google-analytics-dashboard-for-wp' ); ?>" /></td>
1261
  </tr>
1262
  <?php } //Network Mode check?>
1263
  <tr>
1289
  <div class="meta-box-sortables">
1290
  <div class="postbox">
1291
  <h3>
1292
+ <span><?php _e("Setup Tutorial & Demo",'google-analytics-dashboard-for-wp') ?></span>
1293
  </h3>
1294
  <div class="inside">
1295
  <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=video&utm_campaign=gadwp" target="_blank"><img src="<?php echo plugins_url( 'images/google-analytics-dashboard.png' , __FILE__ );?>" width="100%" alt="" /></a>
1297
  </div>
1298
  <div class="postbox">
1299
  <h3>
1300
+ <span><?php _e("Follow & Review",'google-analytics-dashboard-for-wp')?></span>
1301
  </h3>
1302
  <div class="inside">
1303
  <div class="gadash-desc">
1323
  <a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info"><img src="<?php echo plugins_url( 'images/star.png' , __FILE__ ); ?>" /></a>
1324
  </div>
1325
  <div class="gadash-desc">
1326
+ <?php printf(__('Your feedback and review are both important, %s!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info">%s</a>', __('rate this plugin', 'google-analytics-dashboard-for-wp')));?>
1327
  </div>
1328
  </div>
1329
  </div>
1330
  <div class="postbox">
1331
  <h3>
1332
+ <span><?php _e("Further Reading",'google-analytics-dashboard-for-wp')?></span>
1333
  </h3>
1334
  <div class="inside">
1335
  <div class="gadash-title">
1336
  <a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp"><img src="<?php echo plugins_url( 'images/ssl.png' , __FILE__ ); ?>" /></a>
1337
  </div>
1338
  <div class="gadash-desc">
1339
+ <?php printf(__('%s by moving your website to HTTPS/SSL.', 'google-analytics-dashboard-for-wp'), sprintf('<a href="https://deconf.com/move-website-https-ssl/?utm_source=gadwp_config&utm_medium=link&utm_content=ssl&utm_campaign=gadwp">%s</a>', __('Improve search rankings', 'google-analytics-dashboard-for-wp')));?>
1340
  </div>
1341
  <br />
1342
  <div class="gadash-title">
1343
  <a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp"><img src="<?php echo plugins_url( 'images/wp.png' , __FILE__ ); ?>" /></a>
1344
  </div>
1345
  <div class="gadash-desc">
1346
+ <?php printf(__('Other %s written by the same author', 'google-analytics-dashboard-for-wp'), sprintf('<a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp">%s</a>', __('WordPress Plugins', 'google-analytics-dashboard-for-wp')));?>
1347
  </div>
1348
  </div>
1349
  </div>
1350
  <div class="postbox">
1351
  <h3>
1352
+ <span><?php _e("Other Services",'google-analytics-dashboard-for-wp')?></span>
1353
  </h3>
1354
  <div class="inside">
1355
  <div class="gadash-title">
1356
  <a href="https://deconf.com/wordpress-cdn-speeds-up-your-site/"><img src="<?php echo plugins_url( 'images/mcdn.png' , __FILE__ ); ?>" /></a>
1357
  </div>
1358
  <div class="gadash-desc">
1359
+ <?php printf(__('Speed up your website and plug into a whole %s', 'google-analytics-dashboard-for-wp'), sprintf('<a href="https://deconf.com/wordpress-cdn-speeds-up-your-site/?utm_source=gadwp_config&utm_medium=link&utm_content=maxcdn&utm_campaign=gadwp">%s</a>.', __('new level of site speed', 'google-analytics-dashboard-for-wp')));?>
1360
  </div>
1361
  <br />
1362
  <div class="gadash-title">
1363
  <a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp"><img src="<?php echo plugins_url( 'images/clicky.png' , __FILE__ ); ?>" /></a>
1364
  </div>
1365
  <div class="gadash-desc">
1366
+ <?php printf(__('%s service with users tracking at IP level.', 'google-analytics-dashboard-for-wp'), sprintf('<a href="https://deconf.com/clicky-web-analytics-review/?utm_source=gadwp_config&utm_medium=link&utm_content=clicky&utm_campaign=gadwp">%s</a>', __('Web Analytics', 'google-analytics-dashboard-for-wp')));?>
1367
  </div>
1368
  </div>
1369
  </div>
admin/setup.php CHANGED
@@ -38,12 +38,12 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
38
  global $wp_version;
39
  if ( current_user_can( 'manage_options' ) ) {
40
  include ( GADWP_DIR . 'admin/settings.php' );
41
- add_menu_page( __( "Google Analytics", 'ga-dash' ), __( "Google Analytics", 'ga-dash' ), 'manage_options', 'gadash_settings', array( 'GADWP_Settings', 'general_settings' ), version_compare( $wp_version, '3.8.0', '>=' ) ? 'dashicons-chart-area' : GADWP_URL . 'admin/images/gadash-icon.png' );
42
- add_submenu_page( 'gadash_settings', __( "General Settings", 'ga-dash' ), __( "General Settings", 'ga-dash' ), 'manage_options', 'gadash_settings', array( 'GADWP_Settings', 'general_settings' ) );
43
- add_submenu_page( 'gadash_settings', __( "Backend Settings", 'ga-dash' ), __( "Backend Settings", 'ga-dash' ), 'manage_options', 'gadash_backend_settings', array( 'GADWP_Settings', 'backend_settings' ) );
44
- add_submenu_page( 'gadash_settings', __( "Frontend Settings", 'ga-dash' ), __( "Frontend Settings", 'ga-dash' ), 'manage_options', 'gadash_frontend_settings', array( 'GADWP_Settings', 'frontend_settings' ) );
45
- add_submenu_page( 'gadash_settings', __( "Tracking Code", 'ga-dash' ), __( "Tracking Code", 'ga-dash' ), 'manage_options', 'gadash_tracking_settings', array( 'GADWP_Settings', 'tracking_settings' ) );
46
- add_submenu_page( 'gadash_settings', __( "Errors & Debug", 'ga-dash' ), __( "Errors & Debug", 'ga-dash' ), 'manage_options', 'gadash_errors_debugging', array( 'GADWP_Settings', 'errors_debugging' ) );
47
  }
48
  }
49
 
@@ -54,9 +54,9 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
54
  global $wp_version;
55
  if ( current_user_can( 'manage_netwrok' ) ) {
56
  include ( GADWP_DIR . 'admin/settings.php' );
57
- add_menu_page( __( "Google Analytics", 'ga-dash' ), "Google Analytics", 'manage_netwrok', 'gadash_settings', array( 'GADWP_Settings', 'general_settings_network' ), version_compare( $wp_version, '3.8.0', '>=' ) ? 'dashicons-chart-area' : GADWP_URL . 'admin/images/gadash-icon.png' );
58
- add_submenu_page( 'gadash_settings', __( "General Settings", 'ga-dash' ), __( "General Settings", 'ga-dash' ), 'manage_netwrok', 'gadash_settings', array( 'GADWP_Settings', 'general_settings_network' ) );
59
- add_submenu_page( 'gadash_settings', __( "Errors & Debug", 'ga-dash' ), __( "Errors & Debug", 'ga-dash' ), 'manage_network', 'gadash_errors_debugging', array( 'GADWP_Settings', 'errors_debugging' ) );
60
  }
61
  }
62
 
@@ -149,52 +149,55 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
149
 
150
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'tools/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
151
 
152
- wp_enqueue_script( 'gadwp_backend_item_reports', plugins_url( 'js/item-reports.js', __FILE__ ), array( 'gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog' ), GADWP_CURRENT_VERSION );
153
 
154
  /* @formatter:off */
155
  wp_localize_script( 'gadwp_backend_item_reports', 'gadwp_item_data', array(
156
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
157
  'security' => wp_create_nonce( 'gadwp_backend_item_reports' ),
158
  'dateList' => array(
159
- 'today' => __( "Today", 'ga-dash' ),
160
- 'yesterday' => __( "Yesterday", 'ga-dash' ),
161
- '7daysAgo' => sprintf( __( "Last %d Days", 'ga-dash' ), 7 ),
162
- '14daysAgo' => sprintf( __( "Last %d Days", 'ga-dash' ), 14 ),
163
- '30daysAgo' => sprintf( __( "Last %d Days", 'ga-dash' ), 30 ),
164
- '90daysAgo' => sprintf( __( "Last %d Days", 'ga-dash' ), 90 ),
165
- '365daysAgo' => sprintf( _n( "%s Year", "%s Years", 1, 'ga-dash' ), __('One', 'ga-dash') ),
166
- '1095daysAgo' => sprintf( _n( "%s Year", "%s Years", 3, 'ga-dash' ), __('Three', 'ga-dash') ),
167
  ),
168
  'reportList' => array(
169
- 'uniquePageviews' => __( "Unique Views", 'ga-dash' ),
170
- 'users' => __( "Users", 'ga-dash' ),
171
- 'organicSearches' => __( "Organic", 'ga-dash' ),
172
- 'pageviews' => __( "Page Views", 'ga-dash' ),
173
- 'visitBounceRate' => __( "Bounce Rate", 'ga-dash' ),
174
- 'locations' => __( "Location", 'ga-dash' ),
175
- 'referrers' => __( "Referrers", 'ga-dash' ),
176
- 'searches' => __( "Searches", 'ga-dash' ),
177
- 'trafficdetails' => __( "Traffic Details", 'ga-dash' )
178
  ),
179
  'i18n' => array(
180
- __( "A JavaScript Error is blocking plugin resources!", 'ga-dash' ),
181
- __( "Traffic Mediums", 'ga-dash' ),
182
- __( "Visitor Type", 'ga-dash' ),
183
- __( "Social Networks", 'ga-dash' ),
184
- __( "Search Engines", 'ga-dash' ),
185
- __( "Unique Views", 'ga-dash' ),
186
- __( "Users", 'ga-dash' ),
187
- __( "Page Views", 'ga-dash' ),
188
- __( "Bounce Rate", 'ga-dash' ),
189
- __( "Organic Search", 'ga-dash' ),
190
- __( "Pages/Session", 'ga-dash' ),
191
- __( "Invalid response, more details in JavaScript Console (F12).", 'ga-dash' ),
192
- __( "Not enough data collected", 'ga-dash' ),
193
- __( "This report is unavailable", 'ga-dash' ),
194
- __( "report generated by", 'ga-dash' ),
 
195
  ),
196
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
197
  'region' => $region,
 
 
198
  )
199
  );
200
  /* @formatter:on */
@@ -222,7 +225,7 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
222
  * @return array
223
  */
224
  public function settings_link( $links ) {
225
- $settings_link = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=gadash_settings' ) ) . '">' . __( "Settings", 'ga-dash' ) . '</a>';
226
  array_unshift( $links, $settings_link );
227
  return $links;
228
  }
@@ -233,10 +236,11 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
233
  function admin_notice() {
234
  if ( get_option( 'gadwp_got_updated' ) ) :
235
  ?>
236
- <div id="gadwp-notice" class="notice is-dismissible">
237
- <p><?php echo sprintf( __('Google Analytics Dashboard for WP has been updated to version %s.', 'ga-dash' ), GADWP_CURRENT_VERSION).' '.sprintf( __('For details, check out %1$s and %2$s.', 'ga-dash' ), sprintf(' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_notice&utm_medium=link&utm_content=release_notice&utm_campaign=gadwp">%s</a> ', __('the documentation page', 'ga-dash') ), sprintf(' <a href="%1$s">%2$s</a>', esc_url( get_admin_url( null, 'admin.php?page=gadash_settings' ) ), __('the plugin&#39;s settings page', 'ga-dash') ) ); ?></p>
238
- </div>
239
- <?php
 
240
  endif;
241
  }
242
  }
38
  global $wp_version;
39
  if ( current_user_can( 'manage_options' ) ) {
40
  include ( GADWP_DIR . 'admin/settings.php' );
41
+ add_menu_page( __( "Google Analytics", 'google-analytics-dashboard-for-wp' ), __( "Google Analytics", 'google-analytics-dashboard-for-wp' ), 'manage_options', 'gadash_settings', array( 'GADWP_Settings', 'general_settings' ), version_compare( $wp_version, '3.8.0', '>=' ) ? 'dashicons-chart-area' : GADWP_URL . 'admin/images/gadash-icon.png' );
42
+ add_submenu_page( 'gadash_settings', __( "General Settings", 'google-analytics-dashboard-for-wp' ), __( "General Settings", 'google-analytics-dashboard-for-wp' ), 'manage_options', 'gadash_settings', array( 'GADWP_Settings', 'general_settings' ) );
43
+ add_submenu_page( 'gadash_settings', __( "Backend Settings", 'google-analytics-dashboard-for-wp' ), __( "Backend Settings", 'google-analytics-dashboard-for-wp' ), 'manage_options', 'gadash_backend_settings', array( 'GADWP_Settings', 'backend_settings' ) );
44
+ add_submenu_page( 'gadash_settings', __( "Frontend Settings", 'google-analytics-dashboard-for-wp' ), __( "Frontend Settings", 'google-analytics-dashboard-for-wp' ), 'manage_options', 'gadash_frontend_settings', array( 'GADWP_Settings', 'frontend_settings' ) );
45
+ add_submenu_page( 'gadash_settings', __( "Tracking Code", 'google-analytics-dashboard-for-wp' ), __( "Tracking Code", 'google-analytics-dashboard-for-wp' ), 'manage_options', 'gadash_tracking_settings', array( 'GADWP_Settings', 'tracking_settings' ) );
46
+ add_submenu_page( 'gadash_settings', __( "Errors & Debug", 'google-analytics-dashboard-for-wp' ), __( "Errors & Debug", 'google-analytics-dashboard-for-wp' ), 'manage_options', 'gadash_errors_debugging', array( 'GADWP_Settings', 'errors_debugging' ) );
47
  }
48
  }
49
 
54
  global $wp_version;
55
  if ( current_user_can( 'manage_netwrok' ) ) {
56
  include ( GADWP_DIR . 'admin/settings.php' );
57
+ add_menu_page( __( "Google Analytics", 'google-analytics-dashboard-for-wp' ), "Google Analytics", 'manage_netwrok', 'gadash_settings', array( 'GADWP_Settings', 'general_settings_network' ), version_compare( $wp_version, '3.8.0', '>=' ) ? 'dashicons-chart-area' : GADWP_URL . 'admin/images/gadash-icon.png' );
58
+ add_submenu_page( 'gadash_settings', __( "General Settings", 'google-analytics-dashboard-for-wp' ), __( "General Settings", 'google-analytics-dashboard-for-wp' ), 'manage_netwrok', 'gadash_settings', array( 'GADWP_Settings', 'general_settings_network' ) );
59
+ add_submenu_page( 'gadash_settings', __( "Errors & Debug", 'google-analytics-dashboard-for-wp' ), __( "Errors & Debug", 'google-analytics-dashboard-for-wp' ), 'manage_network', 'gadash_errors_debugging', array( 'GADWP_Settings', 'errors_debugging' ) );
60
  }
61
  }
62
 
149
 
150
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'tools/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
151
 
152
+ wp_enqueue_script( 'gadwp_backend_item_reports', GADWP_URL . 'tools/js/item-reports.js', array( 'gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog' ), GADWP_CURRENT_VERSION );
153
 
154
  /* @formatter:off */
155
  wp_localize_script( 'gadwp_backend_item_reports', 'gadwp_item_data', array(
156
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
157
  'security' => wp_create_nonce( 'gadwp_backend_item_reports' ),
158
  'dateList' => array(
159
+ 'today' => __( "Today", 'google-analytics-dashboard-for-wp' ),
160
+ 'yesterday' => __( "Yesterday", 'google-analytics-dashboard-for-wp' ),
161
+ '7daysAgo' => sprintf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 7 ),
162
+ '14daysAgo' => sprintf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 14 ),
163
+ '30daysAgo' => sprintf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 30 ),
164
+ '90daysAgo' => sprintf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 90 ),
165
+ '365daysAgo' => sprintf( _n( "%s Year", "%s Years", 1, 'google-analytics-dashboard-for-wp' ), __('One', 'google-analytics-dashboard-for-wp') ),
166
+ '1095daysAgo' => sprintf( _n( "%s Year", "%s Years", 3, 'google-analytics-dashboard-for-wp' ), __('Three', 'google-analytics-dashboard-for-wp') ),
167
  ),
168
  'reportList' => array(
169
+ 'uniquePageviews' => __( "Unique Views", 'google-analytics-dashboard-for-wp' ),
170
+ 'users' => __( "Users", 'google-analytics-dashboard-for-wp' ),
171
+ 'organicSearches' => __( "Organic", 'google-analytics-dashboard-for-wp' ),
172
+ 'pageviews' => __( "Page Views", 'google-analytics-dashboard-for-wp' ),
173
+ 'visitBounceRate' => __( "Bounce Rate", 'google-analytics-dashboard-for-wp' ),
174
+ 'locations' => __( "Location", 'google-analytics-dashboard-for-wp' ),
175
+ 'referrers' => __( "Referrers", 'google-analytics-dashboard-for-wp' ),
176
+ 'searches' => __( "Searches", 'google-analytics-dashboard-for-wp' ),
177
+ 'trafficdetails' => __( "Traffic Details", 'google-analytics-dashboard-for-wp' )
178
  ),
179
  'i18n' => array(
180
+ __( "A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp' ), //0
181
+ __( "Traffic Mediums", 'google-analytics-dashboard-for-wp' ),
182
+ __( "Visitor Type", 'google-analytics-dashboard-for-wp' ),
183
+ __( "Social Networks", 'google-analytics-dashboard-for-wp' ),
184
+ __( "Search Engines", 'google-analytics-dashboard-for-wp' ),
185
+ __( "Unique Views", 'google-analytics-dashboard-for-wp' ),
186
+ __( "Users", 'google-analytics-dashboard-for-wp' ),
187
+ __( "Page Views", 'google-analytics-dashboard-for-wp' ),
188
+ __( "Bounce Rate", 'google-analytics-dashboard-for-wp' ),
189
+ __( "Organic Search", 'google-analytics-dashboard-for-wp' ),
190
+ __( "Pages/Session", 'google-analytics-dashboard-for-wp' ),
191
+ __( "Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp' ),
192
+ __( "Not enough data collected", 'google-analytics-dashboard-for-wp' ),
193
+ __( "This report is unavailable", 'google-analytics-dashboard-for-wp' ),
194
+ __( "report generated by", 'google-analytics-dashboard-for-wp' ), //14
195
+ __( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . ' <a href="' . menu_page_url( 'gadash_settings', false ) . '">' . __( "authorize the plugin", 'google-analytics-dashboard-for-wp' ) . '</a>.',
196
  ),
197
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
198
  'region' => $region,
199
+ 'language' => get_bloginfo( 'language' ),
200
+ 'scope' => 'admin',
201
  )
202
  );
203
  /* @formatter:on */
225
  * @return array
226
  */
227
  public function settings_link( $links ) {
228
+ $settings_link = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=gadash_settings' ) ) . '">' . __( "Settings", 'google-analytics-dashboard-for-wp' ) . '</a>';
229
  array_unshift( $links, $settings_link );
230
  return $links;
231
  }
236
  function admin_notice() {
237
  if ( get_option( 'gadwp_got_updated' ) ) :
238
  ?>
239
+ <div id="gadwp-notice" class="notice is-dismissible">
240
+ <p><?php echo sprintf( __('Google Analytics Dashboard for WP has been updated to version %s.', 'google-analytics-dashboard-for-wp' ), GADWP_CURRENT_VERSION).' '.sprintf( __('For details, check out %1$s and %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf(' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_notice&utm_medium=link&utm_content=release_notice&utm_campaign=gadwp">%s</a> ', __('the documentation page', 'google-analytics-dashboard-for-wp') ), sprintf(' <a href="%1$s">%2$s</a>', esc_url( get_admin_url( null, 'admin.php?page=gadash_settings' ) ), __('the plugin&#39;s settings page', 'google-analytics-dashboard-for-wp') ) ); ?></p>
241
+ </div>
242
+
243
+ <?php
244
  endif;
245
  }
246
  }
admin/widgets.php CHANGED
@@ -24,18 +24,18 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
24
  }
25
 
26
  public function add_widget() {
27
- wp_add_dashboard_widget( 'gadash-widget', __( "Google Analytics Dashboard", 'ga-dash' ), array( $this, 'dashboard_widget' ), $control_callback = null );
28
  }
29
 
30
  public function dashboard_widget() {
31
  if ( empty( $this->gadwp->config->options['ga_dash_token'] ) ) {
32
- echo '<p>' . __( "This plugin needs an authorization:", 'ga-dash' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Authorize Plugin", 'ga-dash' ), 'secondary' ) . '</form>';
33
  return;
34
  }
35
 
36
  if ( current_user_can( 'manage_options' ) ) {
37
- if ( isset( $_REQUEST['ga_dash_profile_select'] ) ) {
38
- $this->gadwp->config->options['ga_dash_tableid'] = $_REQUEST['ga_dash_profile_select'];
39
  }
40
  $profiles = $this->gadwp->config->options['ga_dash_profile_list'];
41
  $profile_switch = '';
@@ -50,7 +50,7 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
50
  if ( $this->gadwp->config->options['switch_profile'] == 0 && $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
51
  $this->gadwp->config->options['ga_dash_tableid'] = $this->gadwp->config->options['ga_dash_tableid_jail'];
52
  }
53
- $profile_switch .= '<select id="ga_dash_profile_select" name="ga_dash_profile_select" onchange="this.form.submit()">';
54
  foreach ( $profiles as $profile ) {
55
  if ( ! $this->gadwp->config->options['ga_dash_tableid'] ) {
56
  $this->gadwp->config->options['ga_dash_tableid'] = $profile[1];
@@ -58,12 +58,12 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
58
  if ( isset( $profile[3] ) ) {
59
  $profile_switch .= '<option value="' . esc_attr( $profile[1] ) . '" ';
60
  $profile_switch .= selected( $profile[1], $this->gadwp->config->options['ga_dash_tableid'], false );
61
- $profile_switch .= ' title="' . __( "View Name:", 'ga-dash' ) . ' ' . esc_attr( $profile[0] ) . '">' . esc_attr( GADWP_Tools::strip_protocol( $profile[3] ) ) . '</option>';
62
  }
63
  }
64
  $profile_switch .= "</select>";
65
  } else {
66
- echo '<p>' . __( "Something went wrong while retrieving profiles list.", 'ga-dash' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "More details", 'ga-dash' ), 'secondary' ) . '</form>';
67
  return;
68
  }
69
  }
@@ -76,7 +76,7 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
76
  if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
77
  $projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
78
  } else {
79
- echo '<p>' . __( "An admin should asign a default Google Analytics Profile.", 'ga-dash' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Select Domain", 'ga-dash' ), 'secondary' ) . '</form>';
80
  return;
81
  }
82
  } else {
@@ -87,52 +87,52 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
87
  if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
88
  $projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
89
  } else {
90
- echo '<p>' . __( "An admin should asign a default Google Analytics Profile.", 'ga-dash' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Select Domain", 'ga-dash' ), 'secondary' ) . '</form>';
91
  return;
92
  }
93
  }
94
  if ( ! ( $projectId ) ) {
95
- echo '<p>' . __( "Something went wrong while retrieving property data. You need to create and properly configure a Google Analytics account:", 'ga-dash' ) . '</p> <form action="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" method="POST">' . get_submit_button( __( "Find out more!", 'ga-dash' ), 'secondary' ) . '</form>';
96
  return;
97
  }
98
- if ( isset( $_REQUEST['query'] ) ) {
99
- $query = $_REQUEST['query'];
100
  } else {
101
  $default_metric = GADWP_Tools::get_cookie( 'default_metric' );
102
  $query = $default_metric ? $default_metric : 'sessions';
103
  }
104
- if ( isset( $_REQUEST['period'] ) ) {
105
- $period = $_REQUEST['period'];
106
  } else {
107
  $default_dimension = GADWP_Tools::get_cookie( 'default_dimension' );
108
  $period = $default_dimension ? $default_dimension : '30daysAgo';
109
  }
110
 
111
  ?>
112
- <select id="ga_dash_period" name="period" onchange="this.form.submit()">
113
- <option value="realtime" <?php selected ( "realtime", $period, true ); ?>><?php _e("Real-Time",'ga-dash'); ?></option>
114
- <option value="today" <?php selected ( "today", $period, true ); ?>><?php _e("Today",'ga-dash'); ?></option>
115
- <option value="yesterday" <?php selected ( "yesterday", $period, true ); ?>><?php _e("Yesterday",'ga-dash'); ?></option>
116
- <option value="7daysAgo" <?php selected ( "7daysAgo", $period, true ); ?>><?php printf( __( "Last %d Days", 'ga-dash' ), 7 ); ?></option>
117
- <option value="14daysAgo" <?php selected ( "14daysAgo", $period, true ); ?>><?php printf( __( "Last %d Days", 'ga-dash' ), 14 ); ?></option>
118
- <option value="30daysAgo" <?php selected ( "30daysAgo", $period, true ); ?>><?php printf( __( "Last %d Days", 'ga-dash' ), 30 ); ?></option>
119
- <option value="90daysAgo" <?php selected ( "90daysAgo", $period, true ); ?>><?php printf( __( "Last %d Days", 'ga-dash' ), 90 ); ?></option>
120
- <option value="365daysAgo" <?php selected ( "365daysAgo", $period, true ); ?>><?php printf( _n( "%s Year", "%s Years", 1, 'ga-dash' ), __('One', 'ga-dash') ); ?></option>
121
- <option value="1095daysAgo" <?php selected ( "1095daysAgo", $period, true ); ?>><?php printf( _n( "%s Year", "%s Years", 3, 'ga-dash' ), __('Three', 'ga-dash') ); ?></option>
122
  </select>
123
 
124
  <?php if ($period != 'realtime') {?>
125
- <select id="ga_dash_query" name="query" onchange="this.form.submit()">
126
- <option value="sessions" <?php selected ( "sessions", $query, true ); ?>><?php _e("Sessions",'ga-dash'); ?></option>
127
- <option value="users" <?php selected ( "users", $query, true ); ?>><?php _e("Users",'ga-dash'); ?></option>
128
- <option value="organicSearches" <?php selected ( "organicSearches", $query, true ); ?>><?php _e("Organic",'ga-dash'); ?></option>
129
- <option value="pageviews" <?php selected ( "pageviews", $query, true ); ?>><?php _e("Page Views",'ga-dash'); ?></option>
130
- <option value="visitBounceRate" <?php selected ( "visitBounceRate", $query, true ); ?>><?php _e("Bounce Rate",'ga-dash'); ?></option>
131
- <option value="locations" <?php selected ( "locations", $query, true ); ?>><?php _e("Location",'ga-dash'); ?></option>
132
- <option value="contentpages" <?php selected ( "contentpages", $query, true ); ?>><?php _e("Pages",'ga-dash'); ?></option>
133
- <option value="referrers" <?php selected ( "referrers", $query, true ); ?>><?php _e("Referrers",'ga-dash'); ?></option>
134
- <option value="searches" <?php selected ( "searches", $query, true ); ?>><?php _e("Searches",'ga-dash'); ?></option>
135
- <option value="trafficdetails" <?php selected ( "trafficdetails", $query, true ); ?>><?php _e("Traffic Details",'ga-dash'); ?></option>
136
  </select>
137
  <?php }?>
138
  </form>
@@ -230,27 +230,27 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
230
  </div>
231
  <div class='gadash-tdo-right' id='gadash-tdo-right'>
232
  <div class="gadash-bigtext">
233
- <div class="gadash-bleft"><?php _e( "REFERRAL", 'ga-dash' );?></div>
234
  <div class="gadash-bright">0</div>
235
  </div>
236
  <div class="gadash-bigtext">
237
- <div class="gadash-bleft"><?php _e( "ORGANIC", 'ga-dash' );?></div>
238
  <div class="gadash-bright">0</div>
239
  </div>
240
  <div class="gadash-bigtext">
241
- <div class="gadash-bleft"><?php _e( "SOCIAL", 'ga-dash' );?></div>
242
  <div class="gadash-bright">0</div>
243
  </div>
244
  <div class="gadash-bigtext">
245
- <div class="gadash-bleft"><?php _e( "CAMPAIGN", 'ga-dash' );?></div>
246
  <div class="gadash-bright">0</div>
247
  </div>
248
  <div class="gadash-bigtext">
249
- <div class="gadash-bleft"><?php _e( "DIRECT", 'ga-dash' );?></div>
250
  <div class="gadash-bright">0</div>
251
  </div>
252
  <div class="gadash-bigtext">
253
- <div class="gadash-bleft"><?php _e( "NEW", 'ga-dash' );?></div>
254
  <div class="gadash-bright">0</div>
255
  </div>
256
  </div>
@@ -352,19 +352,19 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
352
  };
353
  };
354
  if (countrfr){
355
- tablerfr = "<table><tr><td><?php _e("REFERRALS", 'ga-dash');?> ("+countrfr+")</td></tr>"+tablerfr+"</table><br />";
356
  }
357
  if (countkwd){
358
- tablekwd = "<table><tr><td><?php _e("KEYWORDS", 'ga-dash');?> ("+countkwd+")</td></tr>"+tablekwd+"</table><br />";
359
  }
360
  if (countscl){
361
- tablescl = "<table><tr><td><?php _e("SOCIAL", 'ga-dash');?> ("+countscl+")</td></tr>"+tablescl+"</table><br />";
362
  }
363
  if (countcpg){
364
- tablecpg = "<table><tr><td><?php _e("CAMPAIGN", 'ga-dash');?> ("+countcpg+")</td></tr>"+tablecpg+"</table><br />";
365
  }
366
  if (countdrt){
367
- tabledrt = "<table><tr><td><?php _e("DIRECT", 'ga-dash');?> ("+countdrt+")</td></tr></table><br />";
368
  }
369
  return ("<p><center><strong>"+pagetitle+"</strong></center></p>"+tablerfr+tablekwd+tablescl+tablecpg+tabledrt);
370
  }
@@ -472,14 +472,14 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
472
  ucustomstats.sort( function(a,b){ return b.count - a.count } );
473
 
474
  var uvisittype = ["REFERRAL","ORGANIC","SOCIAL","CUSTOM"];
475
- document.getElementById("gadash-tdo-right").innerHTML = '<div class="gadash-bigtext"><a href="#" data-tooltip="'+gadash_generatetooltip(ureferralsstats)+'"><div class="gadash-bleft">'+'<?php _e("REFERRAL", 'ga-dash');?>'+'</a></div><div class="gadash-bright">'+countsessions(data,uvisittype[0])+'</div></div>';
476
- document.getElementById("gadash-tdo-right").innerHTML += '<div class="gadash-bigtext"><a href="#" data-tooltip="'+gadash_generatetooltip(ukeywordsstats)+'"><div class="gadash-bleft">'+'<?php _e("ORGANIC", 'ga-dash');?>'+'</a></div><div class="gadash-bright">'+countsessions(data,uvisittype[1])+'</div></div>';
477
- document.getElementById("gadash-tdo-right").innerHTML += '<div class="gadash-bigtext"><a href="#" data-tooltip="'+gadash_generatetooltip(usocialstats)+'"><div class="gadash-bleft">'+'<?php _e("SOCIAL", 'ga-dash');?>'+'</a></div><div class="gadash-bright">'+countsessions(data,uvisittype[2])+'</div></div>';
478
- document.getElementById("gadash-tdo-right").innerHTML += '<div class="gadash-bigtext"><a href="#" data-tooltip="'+gadash_generatetooltip(ucustomstats)+'"><div class="gadash-bleft">'+'<?php _e("CAMPAIGN", 'ga-dash');?>'+'</a></div><div class="gadash-bright">'+countsessions(data,uvisittype[3])+'</div></div>';
479
 
480
  var uvisitortype = ["DIRECT","NEW"];
481
- document.getElementById("gadash-tdo-right").innerHTML += '<div class="gadash-bigtext"><div class="gadash-bleft">'+'<?php _e("DIRECT", 'ga-dash');?>'+'</div><div class="gadash-bright">'+countsessions(data,uvisitortype[0])+'</div></div>';
482
- document.getElementById("gadash-tdo-right").innerHTML += '<div class="gadash-bigtext"><div class="gadash-bleft">'+'<?php _e("NEW", 'ga-dash');?>'+'</div><div class="gadash-bright">'+countsessions(data,uvisitortype[1])+'</div></div>';
483
 
484
  });
485
  };
@@ -499,7 +499,7 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
499
  NProgress.start();
500
  } catch(e) {
501
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
502
- jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'ga-dash'); ?>");
503
  }
504
 
505
  jQuery.post(ajaxurl, {action: "gadash_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo 'trafficchannels,' . $query; ?>",gadash_security_widget_reports: "<?php echo wp_create_nonce('gadash_get_widgetreports'); ?>"}, function(response){
@@ -511,12 +511,12 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
511
  google.setOnLoadCallback(ga_dash_drawtrafficchannels(gadash_trafficchannels));
512
  } else {
513
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
514
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
515
  console.log("\n********************* GADWP Log ********************* \n\n"+response[0]);
516
  }
517
  }else{
518
  jQuery("#gadash-trafficchannels").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
519
- jQuery("#gadash-trafficchannels").html("<?php _e("This report is unavailable", 'ga-dash'); ?> ("+response[0]+")");
520
  }
521
 
522
  if (!jQuery.isNumeric(response[1])){
@@ -525,17 +525,17 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
525
  google.setOnLoadCallback(ga_dash_drawprs(gadash_prs));
526
  } else {
527
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
528
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
529
  console.log("\n********************* GADWP Log ********************* \n\n"+response[1]);
530
  }
531
  }else{
532
  jQuery("#gadash-prs").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
533
- jQuery("#gadash-prs").html("<?php _e("This report is unavailable", 'ga-dash'); ?> ("+response[1]+")");
534
  }
535
 
536
  }else{
537
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
538
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
539
  console.log("\n********************* GADWP Log ********************* \n\n"+response);
540
  }
541
  NProgress.done();
@@ -584,7 +584,7 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
584
  NProgress.start();
585
  } catch(e) {
586
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
587
- jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'ga-dash'); ?>");
588
  }
589
 
590
  jQuery.post(ajaxurl, {action: "gadash_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "trafficchannels,medium,visitorType,source,socialNetwork",gadash_security_widget_reports: "<?php echo wp_create_nonce('gadash_get_widgetreports'); ?>"}, function(response){
@@ -596,12 +596,12 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
596
  google.setOnLoadCallback(ga_dash_drawtrafficchannels(gadash_trafficchannels));
597
  } else {
598
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
599
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
600
  console.log("\n********************* GADWP Log ********************* \n\n"+response[0]);
601
  }
602
  }else{
603
  jQuery("#gadash-trafficchannels").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
604
- jQuery("#gadash-trafficchannels").html("<?php _e("This report is unavailable", 'ga-dash'); ?> ("+response[0]+")");
605
  }
606
 
607
  if (!jQuery.isNumeric(response[1])){
@@ -610,12 +610,12 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
610
  google.setOnLoadCallback(ga_dash_drawtrafficmediums(gadash_trafficmediums));
611
  } else {
612
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
613
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
614
  console.log("\n********************* GADWP Log ********************* \n\n"+response[1]);
615
  }
616
  }else{
617
  jQuery("#gadash-trafficmediums").css({"background-color":"#F7F7F7","height":"auto","padding-top":"80px","padding-bottom":"80px","color":"#000","text-align":"center"});
618
- jQuery("#gadash-trafficmediums").html("<?php _e("This report is unavailable", 'ga-dash'); ?> ("+response[1]+")");
619
  }
620
 
621
  if (!jQuery.isNumeric(response[2])){
@@ -624,12 +624,12 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
624
  google.setOnLoadCallback(ga_dash_drawtraffictype(gadash_traffictype));
625
  } else {
626
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
627
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
628
  console.log("\n********************* GADWP Log ********************* \n\n"+response[2]);
629
  }
630
  }else{
631
  jQuery("#gadash-traffictype").css({"background-color":"#F7F7F7","height":"auto","padding-top":"80px","padding-bottom":"80px","color":"#000","text-align":"center"});
632
- jQuery("#gadash-traffictype").html("<?php _e("This report is unavailable", 'ga-dash'); ?> ("+response[2]+")");
633
  }
634
 
635
  if (!jQuery.isNumeric(response[3])){
@@ -638,12 +638,12 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
638
  google.setOnLoadCallback(ga_dash_drawtrafficorganic(gadash_trafficorganic));
639
  } else {
640
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
641
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
642
  console.log("\n********************* GADWP Log ********************* \n\n"+response[3]);
643
  }
644
  }else{
645
  jQuery("#gadash-trafficorganic").css({"background-color":"#F7F7F7","height":"auto","padding-top":"80px","padding-bottom":"80px","color":"#000","text-align":"center"});
646
- jQuery("#gadash-trafficorganic").html("<?php _e("This report is unavailable", 'ga-dash'); ?> ("+response[3]+")");
647
  }
648
 
649
  if (!jQuery.isNumeric(response[4])){
@@ -652,17 +652,17 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
652
  google.setOnLoadCallback(ga_dash_drawsocialnetworks(gadash_socialnetworks));
653
  } else {
654
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
655
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
656
  console.log("\n********************* GADWP Log ********************* \n\n"+response[4]);
657
  }
658
  }else{
659
  jQuery("#gadash-socialnetworks").css({"background-color":"#F7F7F7","height":"auto","padding-top":"80px","padding-bottom":"80px","color":"#000","text-align":"center"});
660
- jQuery("#gadash-socialnetworks").html("<?php _e("This report is unavailable", 'ga-dash'); ?> ("+response[4]+")");
661
  }
662
 
663
  }else{
664
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
665
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
666
  console.log("\n********************* GADWP Log ********************* \n\n"+response);
667
  }
668
  NProgress.done();
@@ -675,7 +675,7 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
675
  tooltipText: 'percentage',
676
  legend: 'none',
677
  chartArea: {width: '99%',height: '80%'},
678
- title: '<?php _e( "Traffic Mediums", 'ga-dash' ); ?>',
679
  colors:['<?php echo esc_html($this->gadwp->config->options ['ga_dash_style']); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 20 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 20 )); ?>']
680
  };
681
 
@@ -690,7 +690,7 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
690
  tooltipText: 'percentage',
691
  legend: 'none',
692
  chartArea: {width: '99%',height: '80%'},
693
- title: '<?php _e( "Visitor Type", 'ga-dash' ); ?>',
694
  colors:['<?php echo esc_html($this->gadwp->config->options ['ga_dash_style']); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 20 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 20 )); ?>']
695
  };
696
 
@@ -705,7 +705,7 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
705
  tooltipText: 'percentage',
706
  legend: 'none',
707
  chartArea: {width: '99%',height: '80%'},
708
- title: '<?php _e( "Social Networks", 'ga-dash' ); ?>',
709
  colors:['<?php echo esc_html($this->gadwp->config->options ['ga_dash_style']); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 20 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 20 )); ?>']
710
  };
711
 
@@ -720,7 +720,7 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
720
  tooltipText: 'percentage',
721
  legend: 'none',
722
  chartArea: {width: '99%',height: '80%'},
723
- title: '<?php _e( "Search Engines", 'ga-dash' ); ?>',
724
  colors:['<?php echo esc_html($this->gadwp->config->options ['ga_dash_style']); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 20 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 20 )); ?>']
725
  };
726
 
@@ -751,7 +751,7 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
751
  NProgress.start();
752
  } catch(e) {
753
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
754
- jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'ga-dash'); ?>");
755
  }
756
 
757
  jQuery.post(ajaxurl, {action: "gadash_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo $query; ?>",gadash_security_widget_reports: "<?php echo wp_create_nonce('gadash_get_widgetreports'); ?>"}, function(response){
@@ -764,19 +764,19 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
764
  google.setOnLoadCallback(ga_dash_drawlocations(gadash_locations));
765
  } else {
766
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
767
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
768
  console.log("\n********************* GADWP Log ********************* \n\n"+response[0]);
769
  }
770
  }else{
771
  jQuery("#gadash-map").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
772
- jQuery("#gadash-map").html("<?php _e("This report is unavailable", 'ga-dash'); ?> ("+response[0]+")");
773
  jQuery("#gadash-locations").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
774
- jQuery("#gadash-locations").html("<?php _e("This report is unavailable", 'ga-dash'); ?> ("+response[0]+")");
775
  }
776
 
777
  }else{
778
  jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
779
- jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'); ?>");
780
  console.log("\n********************* GADWP Log ********************* \n\n"+response);
781
  }
782
  NProgress.done();
@@ -820,34 +820,34 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
820
  <div id="gadash-bottomstats" class="gadash-wrapper">
821
  <div class="inside">
822
  <div class="small-box">
823
- <h3><?php _e( "Sessions", 'ga-dash' );?></h3>
824
  <p id="gdsessions">&nbsp;</p>
825
  </div>
826
  <div class="small-box">
827
- <h3><?php _e( "Users", 'ga-dash' );?></h3>
828
  <p id="gdusers">&nbsp;</p>
829
  </div>
830
  <div class="small-box">
831
- <h3><?php _e( "Page Views", 'ga-dash' );?></h3>
832
  <p id="gdpageviews">&nbsp;</p>
833
  </div>
834
  <div class="small-box">
835
- <h3><?php _e( "Bounce Rate", 'ga-dash' );?></h3>
836
  <p id="gdbouncerate">&nbsp;</p>
837
  </div>
838
  <div class="small-box">
839
- <h3><?php _e( "Organic Search", 'ga-dash' );?></h3>
840
  <p id="gdorganicsearch">&nbsp;</p>
841
  </div>
842
  <div class="small-box">
843
- <h3><?php _e( "Pages/Session", 'ga-dash' );?></h3>
844
  <p id="gdpagespervisit">&nbsp;</p>
845
  </div>
846
  </div>
847
  </div>
848
  <script type="text/javascript">
849
 
850
- google.load("visualization", "1", {packages:["corechart"]});
851
 
852
  try {
853
  NProgress.configure({ parent: "#gadash-progressbar" });
@@ -855,7 +855,7 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
855
  NProgress.start();
856