WP Statistics - Version 10.0.5

Version Description

  • Release Date: February 5, 2016
  • Fixed: Date range selector display after entering a custom date range.
  • Fixed: Date ranges that ended in the past displaying the wrong visit/visitors data.
Download this release

Release Info

Developer GregRoss
Plugin Icon 128x128 WP Statistics
Version 10.0.5
Comparing to
See all releases

Code changes from version 10.0.4 to 10.0.5

includes/functions/functions.php CHANGED
@@ -25,7 +25,7 @@
25
 
26
  // Fetch the results from the database.
27
  $result = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}statistics_visit WHERE `last_counter` = '{$WP_Statistics->Current_Date('Y-m-d', $time)}'");
28
-
29
  // If we have a result, return it, otherwise force a 0 to be returned instead of the logical FALSE that would otherwise be the case.
30
  if( $result) {
31
  return $result->visit;
@@ -965,13 +965,26 @@
965
 
966
  $rcount = count( $range );
967
 
968
- $rangestart = $WP_Statistics->Current_Date('m/d/Y', '-' . $current);
969
- $rangeend = $WP_Statistics->Current_Date('m/d/Y');
970
-
971
  $bold = true;
972
- if( array_key_exists( 'rangestart', $_GET ) ) { $rangestart = $_GET['rangestart']; }
973
- if( array_key_exists( 'rangeend', $_GET ) ) { $rangeend = $_GET['rangeend']; }
974
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
975
  echo '<form method="get"><ul class="subsubsub">' . "\r\n";
976
 
977
  for( $i = 0; $i < $rcount; $i ++ ) {
@@ -1003,9 +1016,8 @@
1003
  }
1004
  else {
1005
  echo ' ' . __('Range', 'wp_statistics' ) . ': ';
1006
- $rangeend = $WP_Statistics->Current_Date('m/d/Y');
1007
- $rangestart = $WP_Statistics->Current_Date('m/d/Y','-'.$current);
1008
  }
 
1009
  echo '<input type="text" size="10" name="rangestart" id="datestartpicker" value="' . $rangestart. '" placeholder="' . __('MM/DD/YYYY', 'wp_statistics') .'"> '.__('to', 'wp_statistics').' <input type="text" size="10" name="rangeend" id="dateendpicker" value="' . $rangeend . '" placeholder="' . __('MM/DD/YYYY', 'wp_statistics') .'"> <input type="submit" value="'.__('Go', 'wp_statistics').'" class="button-primary">' . "\r\n";
1010
 
1011
  echo '</ul><form>' . "\r\n";
25
 
26
  // Fetch the results from the database.
27
  $result = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}statistics_visit WHERE `last_counter` = '{$WP_Statistics->Current_Date('Y-m-d', $time)}'");
28
+
29
  // If we have a result, return it, otherwise force a 0 to be returned instead of the logical FALSE that would otherwise be the case.
30
  if( $result) {
31
  return $result->visit;
965
 
966
  $rcount = count( $range );
967
 
 
 
 
968
  $bold = true;
 
 
969
 
970
+ // Check to see if there's a range in the URL, if so set it, otherwise use the default.
971
+ if( array_key_exists( 'rangestart', $_GET ) ) { $rangestart = $_GET['rangestart']; } else { $rangestart = $WP_Statistics->Current_Date('m/d/Y', '-' . $current); }
972
+ if( array_key_exists( 'rangeend', $_GET ) ) { $rangeend = $_GET['rangeend']; } else { $rangeend = $WP_Statistics->Current_Date('m/d/Y'); }
973
+
974
+ // Now get the number of days in the range.
975
+ $rangestart_utime = $WP_Statistics->strtotimetz( $rangestart );
976
+ $rangeend_utime = $WP_Statistics->strtotimetz( $rangeend );
977
+ $daysToDisplay = (int)( ( $rangeend_utime - $rangestart_utime ) / 24 / 60 / 60 );
978
+
979
+ // If the rangeend isn't today AND not one of the standard range values, then it's a custom selected value and we need to flag it as such.
980
+ if( $rangeend != $WP_Statistics->Current_Date('m/d/Y') && ! in_array( $current, $range ) ) {
981
+ $current = -1;
982
+ } else {
983
+ // If on the other hand we are a standard range, let's reset the custom range selector to match it.
984
+ $rangestart = $WP_Statistics->Current_Date('m/d/Y', '-' . $current);
985
+ $rangeend = $WP_Statistics->Current_Date('m/d/Y');
986
+ }
987
+
988
  echo '<form method="get"><ul class="subsubsub">' . "\r\n";
989
 
990
  for( $i = 0; $i < $rcount; $i ++ ) {
1016
  }
1017
  else {
1018
  echo ' ' . __('Range', 'wp_statistics' ) . ': ';
 
 
1019
  }
1020
+
1021
  echo '<input type="text" size="10" name="rangestart" id="datestartpicker" value="' . $rangestart. '" placeholder="' . __('MM/DD/YYYY', 'wp_statistics') .'"> '.__('to', 'wp_statistics').' <input type="text" size="10" name="rangeend" id="dateendpicker" value="' . $rangeend . '" placeholder="' . __('MM/DD/YYYY', 'wp_statistics') .'"> <input type="submit" value="'.__('Go', 'wp_statistics').'" class="button-primary">' . "\r\n";
1022
 
1023
  echo '</ul><form>' . "\r\n";
includes/log/hit-statistics.php CHANGED
@@ -32,27 +32,28 @@
32
  <?php
33
  $visit_total = 0;
34
  $visitor_total = 0;
 
35
 
36
  echo "var visit_data_line = [";
37
 
38
- for( $i=$daysToDisplay; $i>=0; $i--) {
39
- $stat = wp_statistics_visit('-'.$i, true);
 
40
  $visit_total += $stat;
41
 
42
- echo "['" . $WP_Statistics->Real_Current_Date('Y-m-d', '-'.$i, $rangeend_utime) . "'," . $stat . "], ";
43
-
44
  }
45
 
46
  echo "];\n";
47
 
48
  echo "var visitor_data_line = [";
49
 
50
- for( $i=$daysToDisplay; $i>=0; $i--) {
51
- $stat = wp_statistics_visitor('-'.$i, true);
 
52
  $visitor_total += $stat;
53
 
54
- echo "['" . $WP_Statistics->Real_Current_Date('Y-m-d', '-'.$i, $rangeend_utime) . "'," . $stat . "], ";
55
-
56
  }
57
 
58
  echo "];\n";
32
  <?php
33
  $visit_total = 0;
34
  $visitor_total = 0;
35
+ $daysInThePast = ( time() - $rangeend_utime ) / 86400;
36
 
37
  echo "var visit_data_line = [";
38
 
39
+ for( $i = $daysToDisplay; $i >= 0; $i-- ) {
40
+ $working_date = $WP_Statistics->Real_Current_Date( 'Y-m-d', '-' . $i, $rangeend_utime );
41
+ $stat = wp_statistics_visit( '-' . (int)( $i + $daysInThePast ), true );
42
  $visit_total += $stat;
43
 
44
+ echo "['" . $working_date . "'," . $stat . "], ";
 
45
  }
46
 
47
  echo "];\n";
48
 
49
  echo "var visitor_data_line = [";
50
 
51
+ for( $i = $daysToDisplay; $i >= 0; $i-- ) {
52
+ $working_date = $WP_Statistics->Real_Current_Date( 'Y-m-d', '-' . $i, $rangeend_utime );
53
+ $stat = wp_statistics_visitor( '-' . (int)( $i + $daysInThePast ), true );
54
  $visitor_total += $stat;
55
 
56
+ echo "['" . $working_date . "'," . $stat . "], ";
 
57
  }
58
 
59
  echo "];\n";
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mostafa.s1990, GregRoss
3
  Donate link: http://wp-statistics.com/donate/
4
  Tags: statistics, stats, visit, visitors, chart, browser, blog, today, yesterday, week, month, year, total, post, page, sidebar, summary, feedburner, hits, pagerank, google, alexa, live visit
5
  Requires at least: 3.0
6
- Tested up to: 4.4
7
- Stable tag: 10.0.4
8
  License: GPL3
9
 
10
  Complete statistics for your WordPress site.
@@ -238,6 +238,11 @@ If you still have issues open a new thread on the support forum and we'll try an
238
  The overview page has been completely rewritten! If you had set custom values for what widgets to display and in what order on your overview page you will have to re-select them using the "Screen Options" tab on the overview page and by dragging and dropping the widgets in to place.
239
 
240
  == Changelog ==
 
 
 
 
 
241
  = 10.0.4 =
242
  * Release Date: January 21, 2016
243
  * Fixed: Recent Visitors widget in the dashboard did not work.
3
  Donate link: http://wp-statistics.com/donate/
4
  Tags: statistics, stats, visit, visitors, chart, browser, blog, today, yesterday, week, month, year, total, post, page, sidebar, summary, feedburner, hits, pagerank, google, alexa, live visit
5
  Requires at least: 3.0
6
+ Tested up to: 4.4.2
7
+ Stable tag: 10.0.5
8
  License: GPL3
9
 
10
  Complete statistics for your WordPress site.
238
  The overview page has been completely rewritten! If you had set custom values for what widgets to display and in what order on your overview page you will have to re-select them using the "Screen Options" tab on the overview page and by dragging and dropping the widgets in to place.
239
 
240
  == Changelog ==
241
+ = 10.0.5 =
242
+ * Release Date: February 5, 2016
243
+ * Fixed: Date range selector display after entering a custom date range.
244
+ * Fixed: Date ranges that ended in the past displaying the wrong visit/visitors data.
245
+
246
  = 10.0.4 =
247
  * Release Date: January 21, 2016
248
  * Fixed: Recent Visitors widget in the dashboard did not work.
wp-statistics.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Statistics
4
  Plugin URI: http://wp-statistics.com/
5
  Description: Complete statistics for your WordPress site.
6
- Version: 10.0.4
7
  Author: Mostafa Soufi & Greg Ross
8
  Author URI: http://wp-statistics.com/
9
  Text Domain: wp_statistics
@@ -12,7 +12,7 @@ License: GPL2
12
  */
13
 
14
  // These defines are used later for various reasons.
15
- define('WP_STATISTICS_VERSION', '10.0.4');
16
  define('WP_STATISTICS_MANUAL', 'manual/WP Statistics Admin Manual.');
17
  define('WP_STATISTICS_REQUIRED_PHP_VERSION', '5.3.0');
18
  define('WP_STATISTICS_REQUIRED_GEOIP_PHP_VERSION', WP_STATISTICS_REQUIRED_PHP_VERSION);
3
  Plugin Name: WP Statistics
4
  Plugin URI: http://wp-statistics.com/
5
  Description: Complete statistics for your WordPress site.
6
+ Version: 10.0.5
7
  Author: Mostafa Soufi & Greg Ross
8
  Author URI: http://wp-statistics.com/
9
  Text Domain: wp_statistics
12
  */
13
 
14
  // These defines are used later for various reasons.
15
+ define('WP_STATISTICS_VERSION', '10.0.5');
16
  define('WP_STATISTICS_MANUAL', 'manual/WP Statistics Admin Manual.');
17
  define('WP_STATISTICS_REQUIRED_PHP_VERSION', '5.3.0');
18
  define('WP_STATISTICS_REQUIRED_GEOIP_PHP_VERSION', WP_STATISTICS_REQUIRED_PHP_VERSION);