Google Analytics Dashboard for WP (GADWP) - Version 4.9.4

Version Description

Download this release

Release Info

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

Code changes from version 4.9.3.2 to 4.9.4

admin/ajax-actions.php CHANGED
@@ -19,7 +19,7 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
19
 
20
  public function __construct() {
21
  $this->gadwp = GADWP();
22
-
23
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( ( 1 == $this->gadwp->config->options['backend_item_reports'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) {
24
  // Items action
25
  add_action( 'wp_ajax_gadwp_backend_item_reports', array( $this, 'ajax_item_reports' ) );
@@ -55,7 +55,7 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
55
  if ( ob_get_length() ) {
56
  ob_clean();
57
  }
58
-
59
  if ( ! ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( ( 1 == $this->gadwp->config->options['backend_item_reports'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) ) {
60
  wp_die( - 31 );
61
  }
@@ -75,39 +75,39 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
75
  } else {
76
  $this->gadwp->gapi_controller->timeshift = (int) current_time( 'timestamp' ) - time();
77
  }
78
-
79
  if ( $filter_id ) {
80
  $uri_parts = explode( '/', get_permalink( $filter_id ), 4 );
81
-
82
  if ( isset( $uri_parts[3] ) ) {
83
  $uri = '/' . $uri_parts[3];
84
  } else {
85
  wp_die( - 25 );
86
  }
87
-
88
  // allow URL correction before sending an API request
89
- $filter = apply_filters( 'gadwp_backenditem_uri', $uri );
90
-
91
  $lastchar = substr( $filter, - 1 );
92
-
93
  if ( isset( $profile_info[6] ) && $profile_info[6] && $lastchar == '/' ) {
94
  $filter = $filter . $profile_info[6];
95
  }
96
-
97
  // Encode URL
98
  $filter = rawurlencode( rawurldecode( $filter ) );
99
  } else {
100
  $filter = false;
101
  }
102
-
103
  $queries = explode( ',', $query );
104
-
105
  $results = array();
106
-
107
  foreach ( $queries as $value ) {
108
  $results[] = $this->gadwp->gapi_controller->get( $projectId, $value, $from, $to, $filter );
109
  }
110
-
111
  wp_send_json( $results );
112
  }
113
 
@@ -120,13 +120,13 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
120
  if ( ! isset( $_POST['gadwp_security_dismiss_notices'] ) || ! wp_verify_nonce( $_POST['gadwp_security_dismiss_notices'], 'gadwp_dismiss_notices' ) ) {
121
  wp_die( - 30 );
122
  }
123
-
124
  if ( ! current_user_can( 'manage_options' ) ) {
125
  wp_die( - 31 );
126
  }
127
-
128
  delete_option( 'gadwp_got_updated' );
129
-
130
  wp_die();
131
  }
132
  }
19
 
20
  public function __construct() {
21
  $this->gadwp = GADWP();
22
+
23
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( ( 1 == $this->gadwp->config->options['backend_item_reports'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) {
24
  // Items action
25
  add_action( 'wp_ajax_gadwp_backend_item_reports', array( $this, 'ajax_item_reports' ) );
55
  if ( ob_get_length() ) {
56
  ob_clean();
57
  }
58
+
59
  if ( ! ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( ( 1 == $this->gadwp->config->options['backend_item_reports'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) ) {
60
  wp_die( - 31 );
61
  }
75
  } else {
76
  $this->gadwp->gapi_controller->timeshift = (int) current_time( 'timestamp' ) - time();
77
  }
78
+
79
  if ( $filter_id ) {
80
  $uri_parts = explode( '/', get_permalink( $filter_id ), 4 );
81
+
82
  if ( isset( $uri_parts[3] ) ) {
83
  $uri = '/' . $uri_parts[3];
84
  } else {
85
  wp_die( - 25 );
86
  }
87
+
88
  // allow URL correction before sending an API request
89
+ $filter = apply_filters( 'gadwp_backenditem_uri', $uri, $filter_id );
90
+
91
  $lastchar = substr( $filter, - 1 );
92
+
93
  if ( isset( $profile_info[6] ) && $profile_info[6] && $lastchar == '/' ) {
94
  $filter = $filter . $profile_info[6];
95
  }
96
+
97
  // Encode URL
98
  $filter = rawurlencode( rawurldecode( $filter ) );
99
  } else {
100
  $filter = false;
101
  }
102
+
103
  $queries = explode( ',', $query );
104
+
105
  $results = array();
106
+
107
  foreach ( $queries as $value ) {
108
  $results[] = $this->gadwp->gapi_controller->get( $projectId, $value, $from, $to, $filter );
109
  }
110
+
111
  wp_send_json( $results );
112
  }
113
 
120
  if ( ! isset( $_POST['gadwp_security_dismiss_notices'] ) || ! wp_verify_nonce( $_POST['gadwp_security_dismiss_notices'], 'gadwp_dismiss_notices' ) ) {
121
  wp_die( - 30 );
122
  }
123
+
124
  if ( ! current_user_can( 'manage_options' ) ) {
125
  wp_die( - 31 );
126
  }
127
+
128
  delete_option( 'gadwp_got_updated' );
129
+
130
  wp_die();
131
  }
132
  }
admin/settings.php CHANGED
@@ -273,6 +273,21 @@ final class GADWP_Settings {
273
  <input type="text" style="text-align: center;" name="options[ga_target_geomap]" value="<?php echo esc_attr($options['ga_target_geomap']); ?>" size="3">
274
  </td>
275
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  <tr>
277
  <td colspan="2"><hr></td>
278
  </tr>
@@ -446,6 +461,14 @@ final class GADWP_Settings {
446
  <option value="<?php echo $i;?>" <?php selected( $options['ga_pubyear_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
447
  <?php }?>
448
  </select></td>
 
 
 
 
 
 
 
 
449
  </tr>
450
  <tr>
451
  <td class="gadwp-settings-title"><label for="ga_category_dimindex"><?php _e("Categories:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
@@ -972,7 +995,7 @@ final class GADWP_Settings {
972
  $options = self::update_options( 'network' );
973
  $message = "<div class='updated'><p>" . __( "Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
974
  if ( is_multisite() ) { // Cleanup errors on the entire network
975
- foreach ( wp_get_sites( array( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
976
  switch_to_blog( $blog['blog_id'] );
977
  GADWP_Tools::delete_cache( 'gapi_errors' );
978
  restore_current_blog();
@@ -1162,7 +1185,7 @@ final class GADWP_Settings {
1162
  if ( isset( $options['ga_dash_tableid_network'] ) ) {
1163
  $options['ga_dash_tableid_network'] = json_decode( json_encode( $options['ga_dash_tableid_network'] ), false );
1164
  }
1165
- foreach ( wp_get_sites( array( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
1166
  ?>
1167
  <tr>
1168
  <td class="gadwp-settings-title-s"><label for="ga_dash_tableid_network"><?php echo '<strong>'.$blog['domain'].$blog['path'].'</strong>: ';?></label></td>
@@ -1171,7 +1194,8 @@ final class GADWP_Settings {
1171
  if ( ! empty( $options['ga_dash_profile_list'] ) ) {
1172
  foreach ( $options['ga_dash_profile_list'] as $items ) {
1173
  if ( $items[3] ) {
1174
- 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'] : '', false );
 
1175
  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>';
1176
  }
1177
  }
273
  <input type="text" style="text-align: center;" name="options[ga_target_geomap]" value="<?php echo esc_attr($options['ga_target_geomap']); ?>" size="3">
274
  </td>
275
  </tr>
276
+ <tr>
277
+ <td colspan="2" class="gadwp-settings-title">
278
+ <?php echo __("Maps API Key:", 'google-analytics-dashboard-for-wp'); ?>
279
+ <input type="text" style="text-align: center;" name="options[maps_api_key]" value="<?php echo esc_attr($options['maps_api_key']); ?>" size="50">
280
+ </td>
281
+ </tr>
282
+ <tr>
283
+ <td colspan="2"><hr><?php echo "<h2>" . __( "404 Errors Report", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
284
+ </tr>
285
+ <tr>
286
+ <td colspan="2" class="gadwp-settings-title">
287
+ <?php echo __("404 Page Title contains:", 'google-analytics-dashboard-for-wp'); ?>
288
+ <input type="text" style="text-align: center;" name="options[pagetitle_404]" value="<?php echo esc_attr($options['pagetitle_404']); ?>" size="20">
289
+ </td>
290
+ </tr>
291
  <tr>
292
  <td colspan="2"><hr></td>
293
  </tr>
461
  <option value="<?php echo $i;?>" <?php selected( $options['ga_pubyear_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
462
  <?php }?>
463
  </select></td>
464
+ </tr>
465
+ <tr>
466
+ <td class="gadwp-settings-title"><label for="ga_pubyearmonth_dimindex"><?php _e("Publication Month:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
467
+ <td><select id="ga_pubyearmonth_dimindex" name="options[ga_pubyearmonth_dimindex]">
468
+ <?php for ($i=0;$i<21;$i++){?>
469
+ <option value="<?php echo $i;?>" <?php selected( $options['ga_pubyearmonth_dimindex'], $i ); ?>><?php echo $i==0?'Disabled':'dimension '.$i; ?></option>
470
+ <?php }?>
471
+ </select></td>
472
  </tr>
473
  <tr>
474
  <td class="gadwp-settings-title"><label for="ga_category_dimindex"><?php _e("Categories:", 'google-analytics-dashboard-for-wp' ); ?></label></td>
995
  $options = self::update_options( 'network' );
996
  $message = "<div class='updated'><p>" . __( "Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
997
  if ( is_multisite() ) { // Cleanup errors on the entire network
998
+ foreach ( GADWP_Tools::get_sites( array( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
999
  switch_to_blog( $blog['blog_id'] );
1000
  GADWP_Tools::delete_cache( 'gapi_errors' );
1001
  restore_current_blog();
1185
  if ( isset( $options['ga_dash_tableid_network'] ) ) {
1186
  $options['ga_dash_tableid_network'] = json_decode( json_encode( $options['ga_dash_tableid_network'] ), false );
1187
  }
1188
+ foreach ( GADWP_Tools::get_sites( array( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
1189
  ?>
1190
  <tr>
1191
  <td class="gadwp-settings-title-s"><label for="ga_dash_tableid_network"><?php echo '<strong>'.$blog['domain'].$blog['path'].'</strong>: ';?></label></td>
1194
  if ( ! empty( $options['ga_dash_profile_list'] ) ) {
1195
  foreach ( $options['ga_dash_profile_list'] as $items ) {
1196
  if ( $items[3] ) {
1197
+ $temp_id = $blog['blog_id'];
1198
+ echo '<option value="' . esc_attr( $items[1] ) . '" ' . selected( $items[1], isset( $options['ga_dash_tableid_network']->$temp_id ) ? $options['ga_dash_tableid_network']->$temp_id : '', false );
1199
  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>';
1200
  }
1201
  }
admin/setup.php CHANGED
@@ -76,10 +76,6 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
76
  $new_hook = $hook;
77
  }
78
 
79
- $lang = get_bloginfo( 'language' );
80
- $lang = explode( '-', $lang );
81
- $lang = $lang[0];
82
-
83
  /*
84
  * GADWP main stylesheet
85
  */
@@ -146,11 +142,11 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
146
 
147
  wp_register_script( 'jquery-ui-tooltip-html', GADWP_URL . 'common/realtime/jquery.ui.tooltip.html.js' );
148
 
149
- wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22language%22%3A%22' . $lang . '%22%2C%22packages%22%3A%5B%22corechart%22%2C%20%22table%22%2C%20%22orgchart%22%2C%20%22geochart%22%5D%7D%5D%7D%27', array(), null );
150
 
151
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
152
 
153
- wp_enqueue_script( 'gadwp-backend-dashboard-reports', GADWP_URL . 'common/js/reports.js', array( 'jquery', 'googlejsapi', 'gadwp-nprogress', 'jquery-ui-tooltip', 'jquery-ui-core', 'jquery-ui-position', 'jquery-ui-tooltip-html' ), GADWP_CURRENT_VERSION, true );
154
 
155
  /* @formatter:off */
156
  wp_localize_script( 'gadwp-backend-dashboard-reports', 'gadwpItemData', array(
@@ -179,6 +175,7 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
179
  'searches' => __( "Searches", 'google-analytics-dashboard-for-wp' ),
180
  'trafficdetails' => __( "Traffic", 'google-analytics-dashboard-for-wp' ),
181
  'technologydetails' => __( "Technology", 'google-analytics-dashboard-for-wp' ),
 
182
  ),
183
  'i18n' => array(
184
  __( "A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp' ), //0
@@ -211,6 +208,7 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
211
  'rtLimitPages' => $this->gadwp->config->options['ga_realtime_pages'],
212
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
213
  'region' => $region,
 
214
  'language' => get_bloginfo( 'language' ),
215
  'viewList' => $views,
216
  'scope' => 'admin-widgets',
@@ -244,11 +242,11 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
244
 
245
  wp_enqueue_style( "wp-jquery-ui-dialog" );
246
 
247
- wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22language%22%3A%22' . $lang . '%22%2C%22packages%22%3A%5B%22corechart%22%2C%20%22table%22%2C%20%22orgchart%22%2C%20%22geochart%22%5D%7D%5D%7D%27', array(), null );
248
 
249
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
250
 
251
- wp_enqueue_script( 'gadwp-backend-item-reports', GADWP_URL . 'common/js/reports.js', array( 'gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog' ), GADWP_CURRENT_VERSION, true );
252
 
253
  /* @formatter:off */
254
  wp_localize_script( 'gadwp-backend-item-reports', 'gadwpItemData', array(
@@ -265,7 +263,7 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
265
  '1095daysAgo' => sprintf( _n( "%s Year", "%s Years", 3, 'google-analytics-dashboard-for-wp' ), __('Three', 'google-analytics-dashboard-for-wp') ),
266
  ),
267
  'reportList' => array(
268
- 'uniquePageviews' => __( "Unique Views", 'google-analytics-dashboard-for-wp' ),
269
  'users' => __( "Users", 'google-analytics-dashboard-for-wp' ),
270
  'organicSearches' => __( "Organic", 'google-analytics-dashboard-for-wp' ),
271
  'pageviews' => __( "Page Views", 'google-analytics-dashboard-for-wp' ),
@@ -282,7 +280,7 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
282
  __( "Visitor Type", 'google-analytics-dashboard-for-wp' ),
283
  __( "Social Networks", 'google-analytics-dashboard-for-wp' ),
284
  __( "Search Engines", 'google-analytics-dashboard-for-wp' ),
285
- __( "Unique Views", 'google-analytics-dashboard-for-wp' ),
286
  __( "Users", 'google-analytics-dashboard-for-wp' ),
287
  __( "Page Views", 'google-analytics-dashboard-for-wp' ),
288
  __( "Bounce Rate", 'google-analytics-dashboard-for-wp' ),
@@ -300,6 +298,7 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
300
  ),
301
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
302
  'region' => $region,
 
303
  'language' => get_bloginfo( 'language' ),
304
  'viewList' => false,
305
  'scope' => 'admin-item',
76
  $new_hook = $hook;
77
  }
78
 
 
 
 
 
79
  /*
80
  * GADWP main stylesheet
81
  */
142
 
143
  wp_register_script( 'jquery-ui-tooltip-html', GADWP_URL . 'common/realtime/jquery.ui.tooltip.html.js' );
144
 
145
+ wp_register_script( 'googlecharts', 'https://www.gstatic.com/charts/loader.js', array(), null );
146
 
147
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
148
 
149
+ wp_enqueue_script( 'gadwp-backend-dashboard-reports', GADWP_URL . 'common/js/reports.js', array( 'jquery', 'googlecharts', 'gadwp-nprogress', 'jquery-ui-tooltip', 'jquery-ui-core', 'jquery-ui-position', 'jquery-ui-tooltip-html' ), GADWP_CURRENT_VERSION, true );
150
 
151
  /* @formatter:off */
152
  wp_localize_script( 'gadwp-backend-dashboard-reports', 'gadwpItemData', array(
175
  'searches' => __( "Searches", 'google-analytics-dashboard-for-wp' ),
176
  'trafficdetails' => __( "Traffic", 'google-analytics-dashboard-for-wp' ),
177
  'technologydetails' => __( "Technology", 'google-analytics-dashboard-for-wp' ),
178
+ '404errors' => __( "404 Errors", 'google-analytics-dashboard-for-wp' ),
179
  ),
180
  'i18n' => array(
181
  __( "A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp' ), //0
208
  'rtLimitPages' => $this->gadwp->config->options['ga_realtime_pages'],
209
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
210
  'region' => $region,
211
+ 'mapsApiKey' => $this->gadwp->config->options['maps_api_key'],
212
  'language' => get_bloginfo( 'language' ),
213
  'viewList' => $views,
214
  'scope' => 'admin-widgets',
242
 
243
  wp_enqueue_style( "wp-jquery-ui-dialog" );
244
 
245
+ wp_register_script( 'googlecharts', 'https://www.gstatic.com/charts/loader.js', array(), null );
246
 
247
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
248
 
249
+ wp_enqueue_script( 'gadwp-backend-item-reports', GADWP_URL . 'common/js/reports.js', array( 'gadwp-nprogress', 'googlecharts', 'jquery', 'jquery-ui-dialog' ), GADWP_CURRENT_VERSION, true );
250
 
251
  /* @formatter:off */
252
  wp_localize_script( 'gadwp-backend-item-reports', 'gadwpItemData', array(
263
  '1095daysAgo' => sprintf( _n( "%s Year", "%s Years", 3, 'google-analytics-dashboard-for-wp' ), __('Three', 'google-analytics-dashboard-for-wp') ),
264
  ),
265
  'reportList' => array(
266
+ 'sessions' => __( "Sessions", 'google-analytics-dashboard-for-wp' ),
267
  'users' => __( "Users", 'google-analytics-dashboard-for-wp' ),
268
  'organicSearches' => __( "Organic", 'google-analytics-dashboard-for-wp' ),
269
  'pageviews' => __( "Page Views", 'google-analytics-dashboard-for-wp' ),
280
  __( "Visitor Type", 'google-analytics-dashboard-for-wp' ),
281
  __( "Social Networks", 'google-analytics-dashboard-for-wp' ),
282
  __( "Search Engines", 'google-analytics-dashboard-for-wp' ),
283
+ __( "Sessions", 'google-analytics-dashboard-for-wp' ),
284
  __( "Users", 'google-analytics-dashboard-for-wp' ),
285
  __( "Page Views", 'google-analytics-dashboard-for-wp' ),
286
  __( "Bounce Rate", 'google-analytics-dashboard-for-wp' ),
298
  ),
299
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
300
  'region' => $region,
301
+ 'mapsApiKey' => $this->gadwp->config->options['maps_api_key'],
302
  'language' => get_bloginfo( 'language' ),
303
  'viewList' => false,
304
  'scope' => 'admin-item',
common/js/reports.js CHANGED
@@ -8,6 +8,9 @@
8
 
9
  "use strict";
10
 
 
 
 
11
  // Get the numeric ID
12
  gadwpItemData.getID = function ( item ) {
13
  if ( gadwpItemData.scope == 'admin-item' ) {
@@ -117,11 +120,7 @@ jQuery.fn.extend( {
117
  }
118
 
119
  if ( !tools.getCookie( 'default_metric' ) || !tools.getCookie( 'default_dimension' ) ) {
120
- if ( gadwpItemData.scope == 'admin-widgets' ) {
121
- defaultMetric = 'sessions';
122
- } else {
123
- defaultMetric = 'uniquePageviews';
124
- }
125
  defaultDimension = '30daysAgo';
126
  } else {
127
  defaultMetric = tools.getCookie( 'default_metric' );
@@ -175,7 +174,9 @@ jQuery.fn.extend( {
175
  }
176
 
177
  reports = {
 
178
  orgChartTableChartData : '',
 
179
  orgChartPieChartsData : '',
180
  geoChartTableChartData : '',
181
  areaChartBottomStatsData : '',
@@ -325,6 +326,26 @@ jQuery.fn.extend( {
325
  NProgress.done();
326
  },
327
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  drawTableChart : function ( data ) {
329
  var chartData, options, chart;
330
 
@@ -883,7 +904,19 @@ jQuery.fn.extend( {
883
  jQuery.post( gadwpItemData.ajaxurl, postData, function ( response ) {
884
  reports.orgChartTableChart( response );
885
  } );
 
 
 
 
 
 
 
886
 
 
 
 
 
 
887
  } else if ( query == 'trafficdetails' || query == 'technologydetails' ) {
888
 
889
  tpl = '<div id="gadwp-orgchartpiecharts' + slug + '">';
@@ -972,6 +1005,9 @@ jQuery.fn.extend( {
972
  if ( jQuery( '#gadwp-orgcharttablechart' + slug ).length > 0 && jQuery.isArray( reports.orgChartTableChartData ) ) {
973
  reports.orgChartTableChart( reports.orgChartTableChartData );
974
  }
 
 
 
975
  },
976
 
977
  init : function () {
@@ -997,7 +1033,11 @@ jQuery.fn.extend( {
997
  reports.render( jQuery( '#gadwp-sel-view' + slug ).val(), jQuery( '#gadwp-sel-period' + slug ).val(), jQuery( '#gadwp-sel-report' + slug ).val() );
998
 
999
  jQuery( window ).resize( function () {
1000
- reports.refresh();
 
 
 
 
1001
  } );
1002
  }
1003
  }
@@ -1043,7 +1083,7 @@ jQuery.fn.extend( {
1043
  }
1044
  } );
1045
 
1046
- jQuery( document ).ready( function () {
1047
  if ( gadwpItemData.scope == 'admin-widgets' ) {
1048
  jQuery( '#gadwp-window-1' ).gadwpItemReport( 1 );
1049
  } else {
@@ -1064,4 +1104,4 @@ jQuery( document ).ready( function () {
1064
  jQuery( document ).on( "dialogopen", ".ui-dialog", function ( event, ui ) {
1065
  gadwpItemData.responsiveDialog();
1066
  } );
1067
- } );
8
 
9
  "use strict";
10
 
11
+ google.charts.load('current', {mapsApiKey: gadwpItemData.mapsApiKey, 'packages':['corechart', 'table', 'orgchart', 'geochart']});
12
+ google.charts.setOnLoadCallback( GADWPReportLoad );
13
+
14
  // Get the numeric ID
15
  gadwpItemData.getID = function ( item ) {
16
  if ( gadwpItemData.scope == 'admin-item' ) {
120
  }
121
 
122
  if ( !tools.getCookie( 'default_metric' ) || !tools.getCookie( 'default_dimension' ) ) {
123
+ defaultMetric = 'sessions';
 
 
 
 
124
  defaultDimension = '30daysAgo';
125
  } else {
126
  defaultMetric = tools.getCookie( 'default_metric' );
174
  }
175
 
176
  reports = {
177
+ oldViewPort: 0,
178
  orgChartTableChartData : '',
179
+ tableChartData : '',
180
  orgChartPieChartsData : '',
181
  geoChartTableChartData : '',
182
  areaChartBottomStatsData : '',
326
  NProgress.done();
327
  },
328
 
329
+ tableChart : function ( response ) {
330
+ reports.tableChartData = response
331
+ if ( jQuery.isArray( response ) ) {
332
+ if ( !jQuery.isNumeric( response[ 0 ] ) ) {
333
+ if ( jQuery.isArray( response[ 0 ] ) ) {
334
+ jQuery( '#gadwp-reports' + slug ).show();
335
+ reports.drawTableChart( response[ 0 ] );
336
+ } else {
337
+ reports.throwDebug( response[ 0 ] );
338
+ }
339
+ } else {
340
+ jQuery( '#gadwp-reports' + slug ).show();
341
+ reports.throwError( '#gadwp-tablechart' + slug, response[ 0 ], "125px" );
342
+ }
343
+ } else {
344
+ reports.throwDebug( response );
345
+ }
346
+ NProgress.done();
347
+ },
348
+
349
  drawTableChart : function ( data ) {
350
  var chartData, options, chart;
351
 
904
  jQuery.post( gadwpItemData.ajaxurl, postData, function ( response ) {
905
  reports.orgChartTableChart( response );
906
  } );
907
+ } else if ( query == '404errors' ) {
908
+ tpl = '<div id="gadwp-404tablechart' + slug + '">';
909
+ tpl += '<div id="gadwp-tablechart' + slug + '"></div>';
910
+ tpl += '</div>';
911
+
912
+ jQuery( '#gadwp-reports' + slug ).html( tpl );
913
+ jQuery( '#gadwp-reports' + slug ).hide();
914
 
915
+ postData.query = query;
916
+
917
+ jQuery.post( gadwpItemData.ajaxurl, postData, function ( response ) {
918
+ reports.tableChart( response );
919
+ } );
920
  } else if ( query == 'trafficdetails' || query == 'technologydetails' ) {
921
 
922
  tpl = '<div id="gadwp-orgchartpiecharts' + slug + '">';
1005
  if ( jQuery( '#gadwp-orgcharttablechart' + slug ).length > 0 && jQuery.isArray( reports.orgChartTableChartData ) ) {
1006
  reports.orgChartTableChart( reports.orgChartTableChartData );
1007
  }
1008
+ if ( jQuery( '#gadwp-404tablechart' + slug ).length > 0 && jQuery.isArray( reports.tableChartData ) ) {
1009
+ reports.tableChart( reports.tableChartData );
1010
+ }
1011
  },
1012
 
1013
  init : function () {
1033
  reports.render( jQuery( '#gadwp-sel-view' + slug ).val(), jQuery( '#gadwp-sel-period' + slug ).val(), jQuery( '#gadwp-sel-report' + slug ).val() );
1034
 
1035
  jQuery( window ).resize( function () {
1036
+ var diff = jQuery(window).width() - reports.oldViewPort;
1037
+ if ( ( diff < -5 ) || ( diff > 5 ) ) {
1038
+ reports.oldViewPort = jQuery(window).width();
1039
+ reports.refresh(); //refresh only on over 5px viewport width changes
1040
+ }
1041
  } );
1042
  }
1043
  }
1083
  }
1084
  } );
1085
 
1086
+ function GADWPReportLoad () {
1087
  if ( gadwpItemData.scope == 'admin-widgets' ) {
1088
  jQuery( '#gadwp-window-1' ).gadwpItemReport( 1 );
1089
  } else {
1104
  jQuery( document ).on( "dialogopen", ".ui-dialog", function ( event, ui ) {
1105
  gadwpItemData.responsiveDialog();
1106
  } );
1107
+ }
config.php CHANGED
@@ -104,6 +104,9 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
104
  if ( isset( $options['ga_pubyear_dimindex'] ) ) {
105
  $options['ga_pubyear_dimindex'] = (int) $options['ga_pubyear_dimindex'];
106
  }
 
 
 
107
  if ( isset( $options['ga_aff_tracking'] ) ) {
108
  $options['ga_aff_tracking'] = (int) $options['ga_aff_tracking'];
109
  }
@@ -113,6 +116,12 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
113
  if ( isset( $options['ga_cookiename'] ) ) { // v4.9
114
  $options['ga_cookiename'] = sanitize_text_field( $options['ga_cookiename'] );
115
  }
 
 
 
 
 
 
116
  if ( isset( $options['ga_cookieexpires'] ) && $options['ga_cookieexpires'] ) { // v4.9
117
  $options['ga_cookieexpires'] = (int) $options['ga_cookieexpires'];
118
  }
@@ -214,7 +223,7 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
214
  GADWP_Tools::clear_cache();
215
  GADWP_Tools::delete_cache( 'last_error' );
216
  if ( is_multisite() ) { // Cleanup errors and cookies on the entire network
217
- foreach ( wp_get_sites( array( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
218
  switch_to_blog( $blog['blog_id'] );
219
  GADWP_Tools::delete_cache( 'gapi_errors' );
220
  restore_current_blog();
@@ -307,6 +316,10 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
307
  $this->options['ga_pubyear_dimindex'] = 0;
308
  $flag = true;
309
  }
 
 
 
 
310
  if ( ! isset( $this->options['ga_event_affiliates'] ) ) {
311
  $this->options['ga_event_affiliates'] = '/out/';
312
  $flag = true;
@@ -349,6 +362,14 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
349
  $this->options['api_backoff'] = 0;
350
  $flag = true;
351
  }
 
 
 
 
 
 
 
 
352
  if ( isset( $this->options['ga_tracking_code'] ) ) {
353
  unset( $this->options['ga_tracking_code'] );
354
  $flag = true;
104
  if ( isset( $options['ga_pubyear_dimindex'] ) ) {
105
  $options['ga_pubyear_dimindex'] = (int) $options['ga_pubyear_dimindex'];
106
  }
107
+ if ( isset( $options['ga_pubyearmonth_dimindex'] ) ) {
108
+ $options['ga_pubyearmonth_dimindex'] = (int) $options['ga_pubyearmonth_dimindex'];
109
+ }
110
  if ( isset( $options['ga_aff_tracking'] ) ) {
111
  $options['ga_aff_tracking'] = (int) $options['ga_aff_tracking'];
112
  }
116
  if ( isset( $options['ga_cookiename'] ) ) { // v4.9
117
  $options['ga_cookiename'] = sanitize_text_field( $options['ga_cookiename'] );
118
  }
119
+ if ( isset( $options['pagetitle_404'] ) ) { // v4.9.4
120
+ $options['pagetitle_404'] = sanitize_text_field( $options['pagetitle_404'] );
121
+ }
122
+ if ( isset( $options['maps_api_key'] ) ) { // v4.9.4
123
+ $options['maps_api_key'] = sanitize_text_field( $options['maps_api_key'] );
124
+ }
125
  if ( isset( $options['ga_cookieexpires'] ) && $options['ga_cookieexpires'] ) { // v4.9
126
  $options['ga_cookieexpires'] = (int) $options['ga_cookieexpires'];
127
  }
223
  GADWP_Tools::clear_cache();
224
  GADWP_Tools::delete_cache( 'last_error' );
225
  if ( is_multisite() ) { // Cleanup errors and cookies on the entire network
226
+ foreach ( GADWP_Tools::get_sites( array( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
227
  switch_to_blog( $blog['blog_id'] );
228
  GADWP_Tools::delete_cache( 'gapi_errors' );
229
  restore_current_blog();
316
  $this->options['ga_pubyear_dimindex'] = 0;
317
  $flag = true;
318
  }
319
+ if ( ! isset( $this->options['ga_pubyearmonth_dimindex'] ) ) {
320
+ $this->options['ga_pubyearmonth_dimindex'] = 0;
321
+ $flag = true;
322
+ }
323
  if ( ! isset( $this->options['ga_event_affiliates'] ) ) {
324
  $this->options['ga_event_affiliates'] = '/out/';
325
  $flag = true;
362
  $this->options['api_backoff'] = 0;
363
  $flag = true;
364
  }
365
+ if ( ! isset( $this->options['pagetitle_404'] ) ) { // v4.9.4
366
+ $this->options['pagetitle_404'] = 'Page Not Found';
367
+ $flag = true;
368
+ }
369
+ if ( ! isset( $this->options['maps_api_key'] ) ) { // v4.9.4
370
+ $this->options['maps_api_key'] = '';
371
+ $flag = true;
372
+ }
373
  if ( isset( $this->options['ga_tracking_code'] ) ) {
374
  unset( $this->options['ga_tracking_code'] );
375
  $flag = true;
front/setup.php CHANGED
@@ -53,11 +53,11 @@ if ( ! class_exists( 'GADWP_Frontend_Setup' ) ) {
53
 
54
  wp_enqueue_style( "wp-jquery-ui-dialog" );
55
 
56
- wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22language%22%3A%22' . $lang . '%22%2C%22packages%22%3A%5B%22corechart%22%2C%20%22table%22%2C%20%22orgchart%22%2C%20%22geochart%22%5D%7D%5D%7D%27', array(), null );
57
 
58
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
59
 
60
- wp_enqueue_script( 'gadwp-frontend-item-reports', GADWP_URL . 'common/js/reports.js', array( 'gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog' ), GADWP_CURRENT_VERSION, true );
61
 
62
  /* @formatter:off */
63
  wp_localize_script( 'gadwp-frontend-item-reports', 'gadwpItemData', array(
@@ -74,7 +74,7 @@ if ( ! class_exists( 'GADWP_Frontend_Setup' ) ) {
74
  '1095daysAgo' => sprintf( _n( "%s Year", "%s Years", 3, 'google-analytics-dashboard-for-wp' ), __('Three', 'google-analytics-dashboard-for-wp') ),
75
  ),
76
  'reportList' => array(
77
- 'uniquePageviews' => __( "Unique Views", 'google-analytics-dashboard-for-wp' ),
78
  'users' => __( "Users", 'google-analytics-dashboard-for-wp' ),
79
  'organicSearches' => __( "Organic", 'google-analytics-dashboard-for-wp' ),
80
  'pageviews' => __( "Page Views", 'google-analytics-dashboard-for-wp' ),
@@ -91,7 +91,7 @@ if ( ! class_exists( 'GADWP_Frontend_Setup' ) ) {
91
  __( "Visitor Type", 'google-analytics-dashboard-for-wp' ),
92
  __( "Search Engines", 'google-analytics-dashboard-for-wp' ),
93
  __( "Social Networks", 'google-analytics-dashboard-for-wp' ),
94
- __( "Unique Views", 'google-analytics-dashboard-for-wp' ),
95
  __( "Users", 'google-analytics-dashboard-for-wp' ),
96
  __( "Page Views", 'google-analytics-dashboard-for-wp' ),
97
  __( "Bounce Rate", 'google-analytics-dashboard-for-wp' ),
@@ -109,6 +109,7 @@ if ( ! class_exists( 'GADWP_Frontend_Setup' ) ) {
109
  ),
110
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
111
  'region' => $region,
 
112
  'language' => get_bloginfo( 'language' ),
113
  'filter' => $_SERVER["REQUEST_URI"],
114
  'viewList' => false,
53
 
54
  wp_enqueue_style( "wp-jquery-ui-dialog" );
55
 
56
+ wp_register_script( 'googlecharts', 'https://www.gstatic.com/charts/loader.js', array(), null );
57
 
58
  wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
59
 
60
+ wp_enqueue_script( 'gadwp-frontend-item-reports', GADWP_URL . 'common/js/reports.js', array( 'gadwp-nprogress', 'googlecharts', 'jquery', 'jquery-ui-dialog' ), GADWP_CURRENT_VERSION, true );
61
 
62
  /* @formatter:off */
63
  wp_localize_script( 'gadwp-frontend-item-reports', 'gadwpItemData', array(
74
  '1095daysAgo' => sprintf( _n( "%s Year", "%s Years", 3, 'google-analytics-dashboard-for-wp' ), __('Three', 'google-analytics-dashboard-for-wp') ),
75
  ),
76
  'reportList' => array(
77
+ 'sessions' => __( "Sessions", 'google-analytics-dashboard-for-wp' ),
78
  'users' => __( "Users", 'google-analytics-dashboard-for-wp' ),
79
  'organicSearches' => __( "Organic", 'google-analytics-dashboard-for-wp' ),
80
  'pageviews' => __( "Page Views", 'google-analytics-dashboard-for-wp' ),
91
  __( "Visitor Type", 'google-analytics-dashboard-for-wp' ),
92
  __( "Search Engines", 'google-analytics-dashboard-for-wp' ),
93
  __( "Social Networks", 'google-analytics-dashboard-for-wp' ),
94
+ __( "Sessions", 'google-analytics-dashboard-for-wp' ),
95
  __( "Users", 'google-analytics-dashboard-for-wp' ),
96
  __( "Page Views", 'google-analytics-dashboard-for-wp' ),
97
  __( "Bounce Rate", 'google-analytics-dashboard-for-wp' ),
109
  ),
110
  'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
111
  'region' => $region,
112
+ 'mapsApiKey' => $this->gadwp->config->options['maps_api_key'],
113
  'language' => get_bloginfo( 'language' ),
114
  'filter' => $_SERVER["REQUEST_URI"],
115
  'viewList' => false,
front/tracking.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  /**
3
- * Author: Alin Marcu
4
  * Author URI: https://deconf.com
5
- * Copyright 2013 Alin Marcu
6
  * License: GPLv2 or later
7
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  */
@@ -19,13 +19,16 @@ if ( ! class_exists( 'GADWP_Tracking' ) ) {
19
 
20
  public function __construct() {
21
  $this->gadwp = GADWP();
22
-
23
  add_action( 'wp_head', array( $this, 'tracking_code' ), 99 );
24
  add_action( 'wp_enqueue_scripts', array( $this, 'load_scripts' ) );
25
  }
26
 
27
  public function load_scripts() {
28
- if ( $this->gadwp->config->options['ga_event_tracking'] && ! wp_script_is( 'jquery' ) ) {
 
 
 
29
  wp_enqueue_script( 'jquery' );
30
  }
31
  }
1
  <?php
2
  /**
3
+ * Author: Alin Marcu
4
  * Author URI: https://deconf.com
5
+ * Copyright 2013 Alin Marcu
6
  * License: GPLv2 or later
7
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  */
19
 
20
  public function __construct() {
21
  $this->gadwp = GADWP();
22
+
23
  add_action( 'wp_head', array( $this, 'tracking_code' ), 99 );
24
  add_action( 'wp_enqueue_scripts', array( $this, 'load_scripts' ) );
25
  }
26
 
27
  public function load_scripts() {
28
+ if ( $this->gadwp->config->options['ga_event_tracking'] ) {
29
+ if ( wp_script_is( 'jquery' ) ) {
30
+ wp_dequeue_script( 'jquery' );
31
+ }
32
  wp_enqueue_script( 'jquery' );
33
  }
34
  }
front/tracking/code-universal.php CHANGED
@@ -17,7 +17,7 @@ $profile = GADWP_Tools::get_selected_profile( $this->gadwp->config->options['ga_
17
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
18
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
19
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
20
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
21
  <?php
22
  $create_options = '{';
23
  if ( $this->gadwp->config->options['ga_speed_samplerate'] != 1 ) {
@@ -81,6 +81,13 @@ if ( $this->gadwp->config->options['ga_pubyear_dimindex'] && is_single() ) {
81
  ?>
82
  ga('set', 'dimension<?php echo (int)$this->gadwp->config->options ['ga_pubyear_dimindex']; ?>', '<?php echo (int)$date; ?>');
83
  <?php
 
 
 
 
 
 
 
84
  }
85
  if ( $this->gadwp->config->options['ga_category_dimindex'] && is_category() ) {
86
  ?>
17
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
18
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
19
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
20
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
21
  <?php
22
  $create_options = '{';
23
  if ( $this->gadwp->config->options['ga_speed_samplerate'] != 1 ) {
81
  ?>
82
  ga('set', 'dimension<?php echo (int)$this->gadwp->config->options ['ga_pubyear_dimindex']; ?>', '<?php echo (int)$date; ?>');
83
  <?php
84
+ }
85
+ if ( $this->gadwp->config->options['ga_pubyearmonth_dimindex'] && is_single() ) {
86
+ global $post;
87
+ $date = get_the_date( 'Y-m', $post->ID );
88
+ ?>
89
+ ga('set', 'dimension<?php echo (int)$this->gadwp->config->options ['ga_pubyearmonth_dimindex']; ?>', '<?php echo $date; ?>');
90
+ <?php
91
  }
92
  if ( $this->gadwp->config->options['ga_category_dimindex'] && is_category() ) {
93
  ?>
front/widgets.php CHANGED
@@ -17,7 +17,7 @@ final class GADWP_Frontend_Widget extends WP_Widget {
17
 
18
  public function __construct() {
19
  $this->gadwp = GADWP();
20
-
21
  parent::__construct( 'gadwp-frontwidget-report', __( 'Google Analytics Dashboard', 'google-analytics-dashboard-for-wp' ), array( 'description' => __( "Will display your google analytics stats in a widget", 'google-analytics-dashboard-for-wp' ) ) );
22
  // Frontend Styles
23
  if ( is_active_widget( false, false, $this->id_base, true ) ) {
@@ -29,10 +29,10 @@ final class GADWP_Frontend_Widget extends WP_Widget {
29
  $lang = get_bloginfo( 'language' );
30
  $lang = explode( '-', $lang );
31
  $lang = $lang[0];
32
-
33
  wp_enqueue_style( 'gadwp-front-widget', GADWP_URL . 'front/css/widgets.css', null, GADWP_CURRENT_VERSION );
34
  wp_enqueue_script( 'gadwp-front-widget', GADWP_URL . 'front/js/widgets.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
35
- wp_enqueue_script( 'googlejsapi', 'https://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22language%22%3A%22' . $lang . '%22%2C%22packages%22%3A%5B%22corechart%22%2C%20%22table%22%2C%20%22orgchart%22%2C%20%22geochart%22%5D%7D%5D%7D%27', array(), null );
36
  }
37
 
38
  public function widget( $args, $instance ) {
@@ -43,7 +43,7 @@ final class GADWP_Frontend_Widget extends WP_Widget {
43
  if ( ! empty( $widget_title ) ) {
44
  echo $args['before_title'] . $widget_title . $args['after_title'];
45
  }
46
-
47
  if ( isset( $this->gadwp->config->options['ga_dash_style'] ) ) {
48
  $css = "colors:['" . $this->gadwp->config->options['ga_dash_style'] . "','" . GADWP_Tools::colourVariator( $this->gadwp->config->options['ga_dash_style'], - 20 ) . "'],";
49
  $color = $this->gadwp->config->options['ga_dash_style'];
@@ -90,7 +90,9 @@ final class GADWP_Frontend_Widget extends WP_Widget {
90
  }
91
  ?>
92
  <script type="text/javascript">
93
- jQuery( function () {
 
 
94
  jQuery.post("<?php echo admin_url( 'admin-ajax.php' ); ?>", {action: "ajax_frontwidget_report", gadwp_number: "<?php echo $this->number; ?>", gadwp_optionname: "<?php echo $this->option_name; ?>" }, function(response){
95
  if (!jQuery.isNumeric(response) && jQuery.isArray(response)){
96
  if (jQuery("#gadwp-widgetchart")[0]){
@@ -105,7 +107,7 @@ final class GADWP_Frontend_Widget extends WP_Widget {
105
  jQuery("#gadwp-widgetchart").html("<?php __( "This report is unavailable", 'google-analytics-dashboard-for-wp' ); ?> ("+response+")");
106
  }
107
  });
108
- });
109
  function gadwp_drawFrontWidgetChart(response) {
110
  var data = google.visualization.arrayToDataTable(response);
111
  var options = {
17
 
18
  public function __construct() {
19
  $this->gadwp = GADWP();
20
+
21
  parent::__construct( 'gadwp-frontwidget-report', __( 'Google Analytics Dashboard', 'google-analytics-dashboard-for-wp' ), array( 'description' => __( "Will display your google analytics stats in a widget", 'google-analytics-dashboard-for-wp' ) ) );
22
  // Frontend Styles
23
  if ( is_active_widget( false, false, $this->id_base, true ) ) {
29
  $lang = get_bloginfo( 'language' );
30
  $lang = explode( '-', $lang );
31
  $lang = $lang[0];
32
+
33
  wp_enqueue_style( 'gadwp-front-widget', GADWP_URL . 'front/css/widgets.css', null, GADWP_CURRENT_VERSION );
34
  wp_enqueue_script( 'gadwp-front-widget', GADWP_URL . 'front/js/widgets.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
35
+ wp_enqueue_script( 'googlecharts', 'https://www.gstatic.com/charts/loader.js', array(), null );
36
  }
37
 
38
  public function widget( $args, $instance ) {
43
  if ( ! empty( $widget_title ) ) {
44
  echo $args['before_title'] . $widget_title . $args['after_title'];
45
  }
46
+
47
  if ( isset( $this->gadwp->config->options['ga_dash_style'] ) ) {
48
  $css = "colors:['" . $this->gadwp->config->options['ga_dash_style'] . "','" . GADWP_Tools::colourVariator( $this->gadwp->config->options['ga_dash_style'], - 20 ) . "'],";
49
  $color = $this->gadwp->config->options['ga_dash_style'];
90
  }
91
  ?>
92
  <script type="text/javascript">
93
+ google.charts.load('current', {mapsApiKey: '<?php echo $this->gadwp->config->options['maps_api_key']; ?>', 'packages':['corechart']});
94
+ google.charts.setOnLoadCallback( GADWPWidgetLoad );
95
+ function GADWPWidgetLoad (){
96
  jQuery.post("<?php echo admin_url( 'admin-ajax.php' ); ?>", {action: "ajax_frontwidget_report", gadwp_number: "<?php echo $this->number; ?>", gadwp_optionname: "<?php echo $this->option_name; ?>" }, function(response){
97
  if (!jQuery.isNumeric(response) && jQuery.isArray(response)){
98
  if (jQuery("#gadwp-widgetchart")[0]){
107
  jQuery("#gadwp-widgetchart").html("<?php __( "This report is unavailable", 'google-analytics-dashboard-for-wp' ); ?> ("+response+")");
108
  }
109
  });
110
+ }
111
  function gadwp_drawFrontWidgetChart(response) {
112
  var data = google.visualization.arrayToDataTable(response);
113
  var options = {
gadwp.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://deconf.com
5
  * Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6
  * Author: Alin Marcu
7
- * Version: 4.9.3.2
8
  * Author URI: https://deconf.com
9
  * Text Domain: google-analytics-dashboard-for-wp
10
  * Domain Path: /languages
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) )
16
 
17
  // Plugin Version
18
  if ( ! defined( 'GADWP_CURRENT_VERSION' ) ) {
19
- define( 'GADWP_CURRENT_VERSION', '4.9.3.2' );
20
  }
21
 
22
  if ( ! class_exists( 'GADWP_Manager' ) ) {
4
  * Plugin URI: https://deconf.com
5
  * Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6
  * Author: Alin Marcu
7
+ * Version: 4.9.4
8
  * Author URI: https://deconf.com
9
  * Text Domain: google-analytics-dashboard-for-wp
10
  * Domain Path: /languages
16
 
17
  // Plugin Version
18
  if ( ! defined( 'GADWP_CURRENT_VERSION' ) ) {
19
+ define( 'GADWP_CURRENT_VERSION', '4.9.4' );
20
  }
21
 
22
  if ( ! class_exists( 'GADWP_Manager' ) ) {
install/install.php CHANGED
@@ -52,6 +52,7 @@ class GADWP_Install {
52
  $options['ga_tag_dimindex'] = 0;
53
  $options['ga_user_dimindex'] = 0;
54
  $options['ga_pubyear_dimindex'] = 0;
 
55
  $options['ga_aff_tracking'] = 0;
56
  $options['ga_event_affiliates'] = '/out/';
57
  $options['automatic_updates_minorversion'] = 1;
@@ -62,6 +63,9 @@ class GADWP_Install {
62
  $options['ga_cookiedomain'] = '';
63
  $options['ga_cookiename'] = '';
64
  $options['ga_cookieexpires'] = '';
 
 
 
65
  } else {
66
  $options = array();
67
  $options['ga_dash_clientid'] = get_option( 'ga_dash_clientid' );
@@ -102,6 +106,7 @@ class GADWP_Install {
102
  $options['ga_tag_dimindex'] = 0;
103
  $options['ga_user_dimindex'] = 0;
104
  $options['ga_pubyear_dimindex'] = 0;
 
105
  $options['ga_event_affiliates'] = '/out/';
106
  $options['ga_aff_tracking'] = 0;
107
  $options['automatic_updates_minorversion'] = 1;
@@ -112,6 +117,8 @@ class GADWP_Install {
112
  $options['ga_cookiedomain'] = '';
113
  $options['ga_cookiename'] = '';
114
  $options['ga_cookieexpires'] = '';
 
 
115
 
116
  delete_option( 'ga_dash_clientid' );
117
  delete_option( 'ga_dash_clientsecret' );
52
  $options['ga_tag_dimindex'] = 0;
53
  $options['ga_user_dimindex'] = 0;
54
  $options['ga_pubyear_dimindex'] = 0;
55
+ $options['ga_pubyearmonth_dimindex'] = 0;
56
  $options['ga_aff_tracking'] = 0;
57
  $options['ga_event_affiliates'] = '/out/';
58
  $options['automatic_updates_minorversion'] = 1;
63
  $options['ga_cookiedomain'] = '';
64
  $options['ga_cookiename'] = '';
65
  $options['ga_cookieexpires'] = '';
66
+ $option['pagetitle_404'] = 'Page Not Found';
67
+ $option['maps_api_key'] = '';
68
+
69
  } else {
70
  $options = array();
71
  $options['ga_dash_clientid'] = get_option( 'ga_dash_clientid' );
106
  $options['ga_tag_dimindex'] = 0;
107
  $options['ga_user_dimindex'] = 0;
108
  $options['ga_pubyear_dimindex'] = 0;
109
+ $options['ga_pubyearmonth_dimindex'] = 0;
110
  $options['ga_event_affiliates'] = '/out/';
111
  $options['ga_aff_tracking'] = 0;
112
  $options['automatic_updates_minorversion'] = 1;
117
  $options['ga_cookiedomain'] = '';
118
  $options['ga_cookiename'] = '';
119
  $options['ga_cookieexpires'] = '';
120
+ $option['pagetitle_404'] = 'Page Not Found';
121
+ $option['maps_api_key'] = '';
122
 
123
  delete_option( 'ga_dash_clientid' );
124
  delete_option( 'ga_dash_clientsecret' );
install/uninstall.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Author: Alin Marcu
4
  * Author URI: https://deconf.com
5
- * Copyright 2013 Alin Marcu
6
  * License: GPLv2 or later
7
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  */
@@ -16,7 +16,7 @@ class GADWP_Uninstall {
16
  public static function uninstall() {
17
  global $wpdb;
18
  if ( is_multisite() ) { // Cleanup Network install
19
- foreach ( wp_get_sites( array( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
20
  switch_to_blog( $blog['blog_id'] );
21
  $sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_%%'" );
22
  delete_option( 'gadash_options' );
2
  /**
3
  * Author: Alin Marcu
4
  * Author URI: https://deconf.com
5
+ * Copyright 2013 Alin Marcu
6
  * License: GPLv2 or later
7
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  */
16
  public static function uninstall() {
17
  global $wpdb;
18
  if ( is_multisite() ) { // Cleanup Network install
19
+ foreach ( GADWP_Tools::get_sites( array( 'limit' => apply_filters( 'gadwp_sites_limit', 100 ) ) ) as $blog ) {
20
  switch_to_blog( $blog['blog_id'] );
21
  $sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_%%'" );
22
  delete_option( 'gadash_options' );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: deconf
3
  Donate link: https://deconf.com/donate/
4
  Tags: google,analytics,google analytics,dashboard,analytics dashboard,google analytics dashboard,google analytics plugin,google analytics widget,tracking,universal google analytics,realtime,multisite,gadwp
5
  Requires at least: 3.5
6
- Tested up to: 4.6.1
7
- Stable tag: 4.9.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -30,7 +30,7 @@ Google Analytics reports, in real-time, in your dashboard screen:
30
  The Google Analytics reports you need, on your dashboard, in your All Posts and All Pages screens, and on site's frontend:
31
 
32
  - Sessions, organic searches, page views, bounce rate analytics reports
33
- - Locations, pages, referrers, keywords analytics reports
34
  - Traffic channels, social networks, traffic mediums, search engines analytics reports
35
  - Device categories, browsers, operating systems, screen resolutions, mobile brands analytics reports
36
  - User access control over analytics reports
@@ -64,6 +64,7 @@ With Google Analytics Dashboard for WP you can use custom dimensions to track:
64
 
65
  - Authors
66
  - Publication year
 
67
  - Categories
68
  - Tags
69
  - User engagement
@@ -136,69 +137,17 @@ Google Analytics Dashboard for WP it's released under the GPLv2, you can use it
136
 
137
  == Changelog ==
138
 
139
- = 4.9.3.2 =
140
  * Enhancements:
141
- * WP 4.6.1 compatibility
142
-
143
- = 4.9.3.1 =
144
- * Bug Fixes:
145
- * fixing a bug where &nbsp was displayed instead of a blank space on localized sites
146
-
147
- = 4.9.3 =
148
- * Enhancements:
149
- * implement more specific error codes
150
- * files cleanup
151
- * move reports.js and other scripts to footer
152
- * on-screen errors instead of using console
153
  * New Features:
154
- * custom dimensions support for Tags
155
-
156
- = 4.9.2 =
157
- * Enhancements:
158
- * improved loading speed for charts
159
- * add autoloading for Charts Library to allow dequeue on conflicts
160
- * removed API Key option, since is not needed anymore
161
- * display session values in Pie Chart slices
162
- * improved data accuracy for Pie Charts
163
-
164
  * Bug Fixes:
165
- * multiple fixes for frontend widget
166
- * page title missing in Realtime report
167
-
168
- * New Features:
169
- * brand new Technology Reports with details about Device Categories, Browsers, Operating Systems, Screen Resolutions and Device Brands
170
-
171
- = 4.9.1.2 =
172
- - Bug Fix: multiple CSS fixes for frontend widget
173
- - Bug Fix: clean-up output for View selection list
174
- - Bug Fix: try to fix Google Charts conflicts with other plugins
175
- - Bug Fix: prevent PHP warnings during authorization and while revoking tokens
176
-
177
- = 4.9.1.1 =
178
- - Bug Fix: focusFlag preventing Real-Time reports from refreshing properly
179
- - Bug Fix: date format is not properly localized in daily/monthly reports
180
- - Bug Fix: reports loading issues on WordPress 4.4
181
-
182
- = 4.9.1 =
183
- - Bug Fix: clear_cache method is generating PHP warnings on certain conditions
184
- - Bug Fix: make sure Google charts libraries are loaded before rendering
185
-
186
- = 4.9.0.1 =
187
- - Bug Fix: Pages report missing from admin dashboard widget
188
- - Bug Fix: Invalid response with a -31 error when using a certain combination of backend settings
189
-
190
- = 4.9 =
191
- - Bug Fix: add an unique class to jQuery UI Tooltips to avoid conflicts
192
- - Bug Fix: multiple CSS improvements
193
- - Bug Fix: invalid localized date formats
194
- - Bug Fix: switching between multisite modes doesn't propagate the new network status on all sites
195
- - Bug Fix: Location Settings ignored in posts/pages reports
196
- - Enhancement: unset cookies while revoking the authorization or clearing the cache
197
- - Enhancement: no more page re-loads on admin dashboard widget when switching between reports
198
- - Enhancement: unified reporting system with real-time capabilities
199
- - Enhancement: new tracking options enabling you to customize cookieName, cookieDomain, cookieExpires; props by [Martins Sipenko](https://github.com/martinssipenko)
200
- - Enhancement: display update notices only to admins and only on dashboard
201
- - Enhancement: force language packs updates for all available languages on a Network
202
- - Enhancement: added View switch capabilities
203
 
204
  The full changelog is [available here](https://deconf.com/changelog-google-analytics-dashboard-for-wp/).
3
  Donate link: https://deconf.com/donate/
4
  Tags: google,analytics,google analytics,dashboard,analytics dashboard,google analytics dashboard,google analytics plugin,google analytics widget,tracking,universal google analytics,realtime,multisite,gadwp
5
  Requires at least: 3.5
6
+ Tested up to: 4.7
7
+ Stable tag: 4.9.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
30
  The Google Analytics reports you need, on your dashboard, in your All Posts and All Pages screens, and on site's frontend:
31
 
32
  - Sessions, organic searches, page views, bounce rate analytics reports
33
+ - Locations, pages, referrers, keywords, 404 errors analytics reports
34
  - Traffic channels, social networks, traffic mediums, search engines analytics reports
35
  - Device categories, browsers, operating systems, screen resolutions, mobile brands analytics reports
36
  - User access control over analytics reports
64
 
65
  - Authors
66
  - Publication year
67
+ - Publication month
68
  - Categories
69
  - Tags
70
  - User engagement
137
 
138
  == Changelog ==
139
 
140
+ = 4.9.4 =
141
  * Enhancements:
142
+ * always load analytics.js over SSL
143
+ * gadwp_backenditem_uri filter passes post ID as an additional variable
144
+ * option to use a Google Maps API key for the Locations report
 
 
 
 
 
 
 
 
 
145
  * New Features:
146
+ * a new year-month dimension is now available, to allow further segmentation of the most successful publication years, by month; props by [Antoine Girard](https://github.com/thetoine)
147
+ * a new 404 Errors report designed to analyze and easily identify the source of 404 errors
 
 
 
 
 
 
 
 
148
  * Bug Fixes:
149
+ * switch to get_sites() while maintaining compatibility with older WP installs
150
+ * fix for multisite installs, Properties/Views Settings list was not properly displayed on PHP7
151
+ * prevent autoloading of reports' cache entries; props by [Alex Bradaric](https://github.com/bradaric)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
  The full changelog is [available here](https://deconf.com/changelog-google-analytics-dashboard-for-wp/).
tools/gapi.php CHANGED
@@ -336,9 +336,6 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
336
  case 'organicSearches' :
337
  $title = __( "Organic Searches", 'google-analytics-dashboard-for-wp' );
338
  break;
339
- case 'uniquePageviews' :
340
- $title = __( "Unique Page Views", 'google-analytics-dashboard-for-wp' );
341
- break;
342
  default :
343
  $title = __( "Sessions", 'google-analytics-dashboard-for-wp' );
344
  }
@@ -407,7 +404,7 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
407
  $options = array( 'dimensions' => null, 'quotaUser' => $this->managequota . 'p' . $projectId );
408
  if ( $filter ) {
409
  $options['filters'] = 'ga:pagePath==' . $filter;
410
- $metrics = 'ga:uniquePageviews,ga:users,ga:pageviews,ga:BounceRate,ga:organicSearches,ga:pageviewsPerSession';
411
  } else {
412
  $metrics = 'ga:sessions,ga:users,ga:pageviews,ga:BounceRate,ga:organicSearches,ga:pageviewsPerSession';
413
  }
@@ -450,9 +447,9 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
450
  * @return array|int
451
  */
452
  private function get_contentpages( $projectId, $from, $to, $filter = '' ) {
453
- $metrics = 'ga:pageviews';
454
  $dimensions = 'ga:pageTitle';
455
- $options = array( 'dimensions' => $dimensions, 'sort' => '-ga:pageviews', 'quotaUser' => $this->managequota . 'p' . $projectId );
456
  if ( $filter ) {
457
  $options['filters'] = 'ga:pagePath==' . $filter;
458
  }
@@ -461,13 +458,43 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
461
  if ( is_numeric( $data ) ) {
462
  return $data;
463
  }
464
- $gadwp_data = array( array( __( "Pages", 'google-analytics-dashboard-for-wp' ), __( "Views", 'google-analytics-dashboard-for-wp' ) ) );
465
  foreach ( $data->getRows() as $row ) {
466
  $gadwp_data[] = array( esc_html( $row[0] ), (int) $row[1] );
467
  }
468
  return $gadwp_data;
469
  }
470
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
  /**
472
  * Analytics data for Org Charts & Table Charts (referrers)
473
  *
@@ -798,7 +825,7 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
798
  if ( empty( $projectId ) || ! is_numeric( $projectId ) ) {
799
  wp_die( - 26 );
800
  }
801
- if ( in_array( $query, array( 'sessions', 'users', 'organicSearches', 'visitBounceRate', 'pageviews', 'uniquePageviews' ) ) ) {
802
  return $this->get_areachart_data( $projectId, $from, $to, $query, $filter );
803
  }
804
  if ( $query == 'bottomstats' ) {
@@ -813,6 +840,10 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
813
  if ( $query == 'contentpages' ) {
814
  return $this->get_contentpages( $projectId, $from, $to, $filter );
815
  }
 
 
 
 
816
  if ( $query == 'searches' ) {
817
  return $this->get_searches( $projectId, $from, $to, $filter );
818
  }
336
  case 'organicSearches' :
337
  $title = __( "Organic Searches", 'google-analytics-dashboard-for-wp' );
338
  break;
 
 
 
339
  default :
340
  $title = __( "Sessions", 'google-analytics-dashboard-for-wp' );
341
  }
404
  $options = array( 'dimensions' => null, 'quotaUser' => $this->managequota . 'p' . $projectId );
405
  if ( $filter ) {
406
  $options['filters'] = 'ga:pagePath==' . $filter;
407
+ $metrics = 'ga:sessions,ga:users,ga:pageviews,ga:BounceRate,ga:organicSearches,ga:pageviewsPerSession';
408
  } else {
409
  $metrics = 'ga:sessions,ga:users,ga:pageviews,ga:BounceRate,ga:organicSearches,ga:pageviewsPerSession';
410
  }
447
  * @return array|int
448
  */
449
  private function get_contentpages( $projectId, $from, $to, $filter = '' ) {
450
+ $metrics = 'ga:sessions';
451
  $dimensions = 'ga:pageTitle';
452
+ $options = array( 'dimensions' => $dimensions, 'sort' => '-ga:sessions', 'quotaUser' => $this->managequota . 'p' . $projectId );
453
  if ( $filter ) {
454
  $options['filters'] = 'ga:pagePath==' . $filter;
455
  }
458
  if ( is_numeric( $data ) ) {
459
  return $data;
460
  }
461
+ $gadwp_data = array( array( __( "Pages", 'google-analytics-dashboard-for-wp' ), __( "Sessions", 'google-analytics-dashboard-for-wp' ) ) );
462
  foreach ( $data->getRows() as $row ) {
463
  $gadwp_data[] = array( esc_html( $row[0] ), (int) $row[1] );
464
  }
465
  return $gadwp_data;
466
  }
467
 
468
+ /**
469
+ * Analytics data for 404 Errors
470
+ *
471
+ * @param
472
+ * $projectId
473
+ * @param
474
+ * $from
475
+ * @param
476
+ * $to
477
+ * @return array|int
478
+ */
479
+ private function get_404errors( $projectId, $from, $to, $filter = "Page Not Found" ) {
480
+ $metrics = 'ga:sessions';
481
+ $dimensions = 'ga:pagePath,ga:fullReferrer';
482
+ $options = array( 'dimensions' => $dimensions, 'sort' => '-ga:sessions', 'quotaUser' => $this->managequota . 'p' . $projectId );
483
+ $options['filters'] = 'ga:pageTitle=@' . $filter;
484
+ $serial = 'qr4_' . $this->get_serial( $projectId . $from . $filter );
485
+ $data = $this->handle_corereports( $projectId, $from, $to, $metrics, $options, $serial );
486
+ if ( is_numeric( $data ) ) {
487
+ return $data;
488
+ }
489
+ $gadwp_data = array( array( __( "404 Errors", 'google-analytics-dashboard-for-wp' ), __( "Sessions", 'google-analytics-dashboard-for-wp' ) ) );
490
+ foreach ( $data->getRows() as $row ) {
491
+ $path = esc_html( $row[0] );
492
+ $source = esc_html( $row[1] );
493
+ $gadwp_data[] = array( "<strong>" . __( "URI:", 'google-analytics-dashboard-for-wp' ) . "</strong> " . $path . "<br><strong>" . __( "Source:", 'google-analytics-dashboard-for-wp' ) . "</strong> " . $source, (int) $row[2] );
494
+ }
495
+ return $gadwp_data;
496
+ }
497
+
498
  /**
499
  * Analytics data for Org Charts & Table Charts (referrers)
500
  *
825
  if ( empty( $projectId ) || ! is_numeric( $projectId ) ) {
826
  wp_die( - 26 );
827
  }
828
+ if ( in_array( $query, array( 'sessions', 'users', 'organicSearches', 'visitBounceRate', 'pageviews') ) ) {
829
  return $this->get_areachart_data( $projectId, $from, $to, $query, $filter );
830
  }
831
  if ( $query == 'bottomstats' ) {
840
  if ( $query == 'contentpages' ) {
841
  return $this->get_contentpages( $projectId, $from, $to, $filter );
842
  }
843
+ if ( $query == '404errors' ) {
844
+ $filter = $this->gadwp->config->options['pagetitle_404'];
845
+ return $this->get_404errors( $projectId, $from, $to, $filter );
846
+ }
847
  if ( $query == 'searches' ) {
848
  return $this->get_searches( $projectId, $from, $to, $filter );
849
  }
tools/nprogress/nprogress.css DELETED
@@ -1,67 +0,0 @@
1
- #nprogress {
2
- pointer-events: none;
3
- }
4
-
5
- #nprogress .bar {
6
- background: #29d;
7
- position: fixed;
8
- z-index: 1031;
9
- top: 0;
10
- left: 0;
11
- width: 100%;
12
- height: 2px;
13
- }
14
-
15
- /* Fancy blur effect */
16
- #nprogress .peg {
17
- display: block;
18
- position: absolute;
19
- right: 0px;
20
- width: 100px;
21
- height: 100%;
22
- box-shadow: 0 0 10px #29d, 0 0 5px #29d;
23
- opacity: 1.0;
24
- -webkit-transform: rotate(3deg) translate(0px, -4px);
25
- -ms-transform: rotate(3deg) translate(0px, -4px);
26
- transform: rotate(3deg) translate(0px, -4px);
27
- }
28
-
29
- /* Remove these to get rid of the spinner */
30
- #nprogress .spinner {
31
- display: block;
32
- position: fixed;
33
- z-index: 1031;
34
- top: 15px;
35
- right: 15px;
36
- }
37
-
38
- #nprogress .spinner-icon {
39
- width: 18px;
40
- height: 18px;
41
- box-sizing: border-box;
42
- border: solid 2px transparent;
43
- border-top-color: #29d;
44
- border-left-color: #29d;
45
- border-radius: 50%;
46
- -webkit-animation: nprogress-spinner 400ms linear infinite;
47
- animation: nprogress-spinner 400ms linear infinite;
48
- }
49
-
50
- .nprogress-custom-parent {
51
- overflow: hidden;
52
- position: relative;
53
- }
54
-
55
- .nprogress-custom-parent #nprogress .spinner, .nprogress-custom-parent #nprogress .bar
56
- {
57
- position: absolute;
58
- }
59
-
60
- @-webkit-keyframes nprogress-spinner {
61
- 0% { -webkit-transform: rotate(0deg); }
62
- 100% { -webkit-transform: rotate(360deg); }
63
- }
64
- @keyframes nprogress-spinner {
65
- 0% { transform: rotate(0deg); }
66
- 100% { transform: rotate(360deg); }
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/nprogress/nprogress.js DELETED
@@ -1,476 +0,0 @@
1
- /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
2
- * @license MIT */
3
-
4
- ;(function(root, factory) {
5
-
6
- if (typeof define === 'function' && define.amd) {
7
- define(factory);
8
- } else if (typeof exports === 'object') {
9
- module.exports = factory();
10
- } else {
11
- root.NProgress = factory();
12
- }
13
-
14
- })(this, function() {
15
- var NProgress = {};
16
-
17
- NProgress.version = '0.1.6';
18
-
19
- var Settings = NProgress.settings = {
20
- minimum: 0.08,
21
- easing: 'ease',
22
- positionUsing: '',
23
- speed: 200,
24
- trickle: true,
25
- trickleRate: 0.02,
26
- trickleSpeed: 800,
27
- showSpinner: true,
28
- barSelector: '[role="bar"]',
29
- spinnerSelector: '[role="spinner"]',
30
- parent: 'body',
31
- template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
32
- };
33
-
34
- /**
35
- * Updates configuration.
36
- *
37
- * NProgress.configure({
38
- * minimum: 0.1
39
- * });
40
- */
41
- NProgress.configure = function(options) {
42
- var key, value;
43
- for (key in options) {
44
- value = options[key];
45
- if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
46
- }
47
-
48
- return this;
49
- };
50
-
51
- /**
52
- * Last number.
53
- */
54
-
55
- NProgress.status = null;
56
-
57
- /**
58
- * Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
59
- *
60
- * NProgress.set(0.4);
61
- * NProgress.set(1.0);
62
- */
63
-
64
- NProgress.set = function(n) {
65
- var started = NProgress.isStarted();
66
-
67
- n = clamp(n, Settings.minimum, 1);
68
- NProgress.status = (n === 1 ? null : n);
69
-
70
- var progress = NProgress.render(!started),
71
- bar = progress.querySelector(Settings.barSelector),
72
- speed = Settings.speed,
73
- ease = Settings.easing;
74
-
75
- progress.offsetWidth; /* Repaint */
76
-
77
- queue(function(next) {
78
- // Set positionUsing if it hasn't already been set
79
- if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
80
-
81
- // Add transition
82
- css(bar, barPositionCSS(n, speed, ease));
83
-
84
- if (n === 1) {
85
- // Fade out
86
- css(progress, {
87
- transition: 'none',
88
- opacity: 1
89
- });
90
- progress.offsetWidth; /* Repaint */
91
-
92
- setTimeout(function() {
93
- css(progress, {
94
- transition: 'all ' + speed + 'ms linear',
95
- opacity: 0
96
- });
97
- setTimeout(function() {
98
- NProgress.remove();
99
- next();
100
- }, speed);
101
- }, speed);
102
- } else {
103
- setTimeout(next, speed);
104
- }
105
- });
106
-
107
- return this;
108
- };
109
-
110
- NProgress.isStarted = function() {
111
- return typeof NProgress.status === 'number';
112
- };
113
-
114
- /**
115
- * Shows the progress bar.
116
- * This is the same as setting the status to 0%, except that it doesn't go backwards.
117
- *
118
- * NProgress.start();
119
- *
120
- */
121
- NProgress.start = function() {
122
- if (!NProgress.status) NProgress.set(0);
123
-
124
- var work = function() {
125
- setTimeout(function() {
126
- if (!NProgress.status) return;
127
- NProgress.trickle();
128
- work();
129
- }, Settings.trickleSpeed);
130
- };
131
-
132
- if (Settings.trickle) work();
133
-
134
- return this;
135
- };
136
-
137
- /**
138
- * Hides the progress bar.
139
- * This is the *sort of* the same as setting the status to 100%, with the
140
- * difference being `done()` makes some placebo effect of some realistic motion.
141
- *
142
- * NProgress.done();
143
- *
144
- * If `true` is passed, it will show the progress bar even if its hidden.
145
- *
146
- * NProgress.done(true);
147
- */
148
-
149
- NProgress.done = function(force) {
150
- if (!force && !NProgress.status) return this;
151
-
152
- return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
153
- };
154
-
155
- /**
156
- * Increments by a random amount.
157
- */
158
-
159
- NProgress.inc = function(amount) {
160
- var n = NProgress.status;
161
-
162
- if (!n) {
163
- return NProgress.start();
164
- } else {
165
- if (typeof amount !== 'number') {
166
- amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
167
- }
168
-
169
- n = clamp(n + amount, 0, 0.994);
170
- return NProgress.set(n);
171
- }
172
- };
173
-
174
- NProgress.trickle = function() {
175
- return NProgress.inc(Math.random() * Settings.trickleRate);
176
- };
177
-
178
- /**
179
- * Waits for all supplied jQuery promises and
180
- * increases the progress as the promises resolve.
181
- *
182
- * @param $promise jQUery Promise
183
- */
184
- (function() {
185
- var initial = 0, current = 0;
186
-
187
- NProgress.promise = function($promise) {
188
- if (!$promise || $promise.state() == "resolved") {
189
- return this;
190
- }
191
-
192
- if (current == 0) {
193
- NProgress.start();
194
- }
195
-
196
- initial++;
197
- current++;
198
-
199
- $promise.always(function() {
200
- current--;
201
- if (current == 0) {
202
- initial = 0;
203
- NProgress.done();
204
- } else {
205
- NProgress.set((initial - current) / initial);
206
- }
207
- });
208
-
209
- return this;
210
- };
211
-
212
- })();
213
-
214
- /**
215
- * (Internal) renders the progress bar markup based on the `template`
216
- * setting.
217
- */
218
-
219
- NProgress.render = function(fromStart) {
220
- if (NProgress.isRendered()) return document.getElementById('nprogress');
221
-
222
- addClass(document.documentElement, 'nprogress-busy');
223
-
224
- var progress = document.createElement('div');
225
- progress.id = 'nprogress';
226
- progress.innerHTML = Settings.template;
227
-
228
- var bar = progress.querySelector(Settings.barSelector),
229
- perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
230
- parent = document.querySelector(Settings.parent),
231
- spinner;
232
-
233
- css(bar, {
234
- transition: 'all 0 linear',
235
- transform: 'translate3d(' + perc + '%,0,0)'
236
- });
237
-
238
- if (!Settings.showSpinner) {
239
- spinner = progress.querySelector(Settings.spinnerSelector);
240
- spinner && removeElement(spinner);
241
- }
242
-
243
- if (parent != document.body) {
244
- addClass(parent, 'nprogress-custom-parent');
245
- }
246
-
247
- parent.appendChild(progress);
248
- return progress;
249
- };
250
-
251
- /**
252
- * Removes the element. Opposite of render().
253
- */
254
-
255
- NProgress.remove = function() {
256
- removeClass(document.documentElement, 'nprogress-busy');
257
- removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent')
258
- var progress = document.getElementById('nprogress');
259
- progress && removeElement(progress);
260
- };
261
-
262
- /**
263
- * Checks if the progress bar is rendered.
264
- */
265
-
266
- NProgress.isRendered = function() {
267
- return !!document.getElementById('nprogress');
268
- };
269
-
270
- /**
271
- * Determine which positioning CSS rule to use.
272
- */
273
-
274
- NProgress.getPositioningCSS = function() {
275
- // Sniff on document.body.style
276
- var bodyStyle = document.body.style;
277
-
278
- // Sniff prefixes
279
- var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
280
- ('MozTransform' in bodyStyle) ? 'Moz' :
281
- ('msTransform' in bodyStyle) ? 'ms' :
282
- ('OTransform' in bodyStyle) ? 'O' : '';
283
-
284
- if (vendorPrefix + 'Perspective' in bodyStyle) {
285
- // Modern browsers with 3D support, e.g. Webkit, IE10
286
- return 'translate3d';
287
- } else if (vendorPrefix + 'Transform' in bodyStyle) {
288
- // Browsers without 3D support, e.g. IE9
289
- return 'translate';
290
- } else {
291
- // Browsers without translate() support, e.g. IE7-8
292
- return 'margin';
293
- }
294
- };
295
-
296
- /**
297
- * Helpers
298
- */
299
-
300
- function clamp(n, min, max) {
301
- if (n < min) return min;
302
- if (n > max) return max;
303
- return n;
304
- }
305
-
306
- /**
307
- * (Internal) converts a percentage (`0..1`) to a bar translateX
308
- * percentage (`-100%..0%`).
309
- */
310
-
311
- function toBarPerc(n) {
312
- return (-1 + n) * 100;
313
- }
314
-
315
-
316
- /**
317
- * (Internal) returns the correct CSS for changing the bar's
318
- * position given an n percentage, and speed and ease from Settings
319
- */
320
-
321
- function barPositionCSS(n, speed, ease) {
322
- var barCSS;
323
-
324
- if (Settings.positionUsing === 'translate3d') {
325
- barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
326
- } else if (Settings.positionUsing === 'translate') {
327
- barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
328
- } else {
329
- barCSS = { 'margin-left': toBarPerc(n)+'%' };
330
- }
331
-
332
- barCSS.transition = 'all '+speed+'ms '+ease;
333
-
334
- return barCSS;
335
- }
336
-
337
- /**
338
- * (Internal) Queues a function to be executed.
339
- */
340
-
341
- var queue = (function() {
342
- var pending = [];
343
-
344
- function next() {
345
- var fn = pending.shift();
346
- if (fn) {
347
- fn(next);
348
- }
349
- }
350
-
351
- return function(fn) {
352
- pending.push(fn);
353
- if (pending.length == 1) next();
354
- };
355
- })();
356
-
357
- /**
358
- * (Internal) Applies css properties to an element, similar to the jQuery
359
- * css method.
360
- *
361
- * While this helper does assist with vendor prefixed property names, it
362
- * does not perform any manipulation of values prior to setting styles.
363
- */
364
-
365
- var css = (function() {
366
- var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
367
- cssProps = {};
368
-
369
- function camelCase(string) {
370
- return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
371
- return letter.toUpperCase();
372
- });
373
- }
374
-
375
- function getVendorProp(name) {
376
- var style = document.body.style;
377
- if (name in style) return name;
378
-
379
- var i = cssPrefixes.length,
380
- capName = name.charAt(0).toUpperCase() + name.slice(1),
381
- vendorName;
382
- while (i--) {
383
- vendorName = cssPrefixes[i] + capName;
384
- if (vendorName in style) return vendorName;
385
- }
386
-
387
- return name;
388
- }
389
-
390
- function getStyleProp(name) {
391
- name = camelCase(name);
392
- return cssProps[name] || (cssProps[name] = getVendorProp(name));
393
- }
394
-
395
- function applyCss(element, prop, value) {
396
- prop = getStyleProp(prop);
397
- element.style[prop] = value;
398
- }
399
-
400
- return function(element, properties) {
401
- var args = arguments,
402
- prop,
403
- value;
404
-
405
- if (args.length == 2) {
406
- for (prop in properties) {
407
- value = properties[prop];
408
- if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
409
- }
410
- } else {
411
- applyCss(element, args[1], args[2]);
412
- }
413
- }
414
- })();
415
-
416
- /**
417
- * (Internal) Determines if an element or space separated list of class names contains a class name.
418
- */
419
-
420
- function hasClass(element, name) {
421
- var list = typeof element == 'string' ? element : classList(element);
422
- return list.indexOf(' ' + name + ' ') >= 0;
423
- }
424
-
425
- /**
426
- * (Internal) Adds a class to an element.
427
- */
428
-
429
- function addClass(element, name) {
430
- var oldList = classList(element),
431
- newList = oldList + name;
432
-
433
- if (hasClass(oldList, name)) return;
434
-
435
- // Trim the opening space.
436
- element.className = newList.substring(1);
437
- }
438
-
439
- /**
440
- * (Internal) Removes a class from an element.
441
- */
442
-
443
- function removeClass(element, name) {
444
- var oldList = classList(element),
445
- newList;
446
-
447
- if (!hasClass(element, name)) return;
448
-
449
- // Replace the class name.
450
- newList = oldList.replace(' ' + name + ' ', ' ');
451
-
452
- // Trim the opening and closing spaces.
453
- element.className = newList.substring(1, newList.length - 1);
454
- }
455
-
456
- /**
457
- * (Internal) Gets a space separated list of the class names on the element.
458
- * The list is wrapped with a single space on each end to facilitate finding
459
- * matches within the list.
460
- */
461
-
462
- function classList(element) {
463
- return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
464
- }
465
-
466
- /**
467
- * (Internal) Removes an element from the DOM.
468
- */
469
-
470
- function removeElement(element) {
471
- element && element.parentNode && element.parentNode.removeChild(element);
472
- }
473
-
474
- return NProgress;
475
- });
476
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/tools.php CHANGED
@@ -121,7 +121,7 @@ if ( ! class_exists( 'GADWP_Tools' ) ) {
121
 
122
  public static function set_cache( $name, $value, $expiration = 0 ) {
123
  $option = array( 'value' => $value, 'expires' => time() + (int) $expiration );
124
- update_option( 'gadwp_cache_' . $name, $option );
125
  }
126
 
127
  public static function delete_cache( $name ) {
@@ -171,5 +171,17 @@ if ( ! class_exists( 'GADWP_Tools' ) ) {
171
  global $wpdb;
172
  $sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_qr%%'" );
173
  }
 
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
  }
121
 
122
  public static function set_cache( $name, $value, $expiration = 0 ) {
123
  $option = array( 'value' => $value, 'expires' => time() + (int) $expiration );
124
+ update_option( 'gadwp_cache_' . $name, $option, 'no' );
125
  }
126
 
127
  public static function delete_cache( $name ) {
171
  global $wpdb;
172
  $sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_qr%%'" );
173
  }
174
+
175
+ public static function get_sites( $args ){ // Use wp_get_sites() if WP version is lower than 4.6.0
176
+ global $wp_version;
177
+ if ( version_compare( $wp_version, '4.6.0', '<' ) ) {
178
+ return wp_get_sites( $args );
179
+ } else {
180
+ foreach ( get_sites( $args ) as $blog ) {
181
+ $blogs[] = (array)$blog; //Convert WP_Site object to array
182
+ }
183
+ return $blogs;
184
+ }
185
+ }
186
  }
187
  }