Version Description
- Query improvements reported by @purityboy83 (Thanks purityboy83 for reporting this type of issues)
Download this release
Release Info
Developer | osamaesh |
Plugin | Visitors Traffic Real Time Statistics |
Version | 3.11 |
Comparing to | |
See all releases |
Code changes from version 3.10 to 3.11
- Visitors-Traffic-Real-Time-Statistics.php +1 -1
- functions.php +61 -10
- readme.txt +6 -1
Visitors-Traffic-Real-Time-Statistics.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Visitor Traffic Real Time Statistics
|
|
4 |
Description: Hits counter that shows analytical numbers of your WordPress site visitors and hits.
|
5 |
Author: wp-buy
|
6 |
Author URI: https://www.wp-buy.com/
|
7 |
-
Version: 3.
|
8 |
Text Domain: visitors-traffic-real-time-statistics
|
9 |
Domain Path: /languages
|
10 |
*/
|
4 |
Description: Hits counter that shows analytical numbers of your WordPress site visitors and hits.
|
5 |
Author: wp-buy
|
6 |
Author URI: https://www.wp-buy.com/
|
7 |
+
Version: 3.11
|
8 |
Text Domain: visitors-traffic-real-time-statistics
|
9 |
Domain Path: /languages
|
10 |
*/
|
functions.php
CHANGED
@@ -726,6 +726,28 @@ function ahcfree_check_table_column_exists($table_name, $column_name) {
|
|
726 |
return false;
|
727 |
}
|
728 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
729 |
//--------------------------------------------
|
730 |
/**
|
731 |
* Check if Table exist or not
|
@@ -739,8 +761,10 @@ function ahcfree_check_table_exists($table_name) {
|
|
739 |
$table_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s", DB_NAME, $table_name));
|
740 |
|
741 |
if (!empty($table_data)) {
|
|
|
742 |
return true;
|
743 |
}
|
|
|
744 |
return false;
|
745 |
}
|
746 |
|
@@ -780,6 +804,11 @@ function ahcfree_update_tables() {
|
|
780 |
if ( ahcfree_check_table_exists('ahc_recent_visitors') === true && ahcfree_check_table_column_exists('ahc_recent_visitors', 'ahc_region') === false ) {
|
781 |
$sqlQueries[] = "alter table `ahc_recent_visitors` add COLUMN `ahc_region` varchar(230) NULL";
|
782 |
}
|
|
|
|
|
|
|
|
|
|
|
783 |
|
784 |
foreach ($sqlQueries as $sql) {
|
785 |
if ($wpdb->query($sql) === false) {
|
@@ -1244,8 +1273,6 @@ function ahcfree_get_visitors_visits_in_period($period = 'total') {
|
|
1244 |
|
1245 |
$sql .= " AND DATE(CONVERT_TZ(vst_date, '" . AHCFREE_SERVER_CURRENT_TIMEZONE . "', '" . $custom_timezone_offset . "')) = '". ahcfree_localtime('Y-m-d') ."'";
|
1246 |
|
1247 |
-
|
1248 |
-
//$sql .= " AND DATE(vst_date) = DATE(NOW())";
|
1249 |
$results = $wpdb->get_results($sql, OBJECT);
|
1250 |
break;
|
1251 |
|
@@ -1258,23 +1285,47 @@ function ahcfree_get_visitors_visits_in_period($period = 'total') {
|
|
1258 |
case 'week': // last 7 days
|
1259 |
$limits = ahcfree_get_week_limits($date->format('Y-m-d'));
|
1260 |
|
1261 |
-
|
1262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1263 |
|
1264 |
break;
|
1265 |
|
1266 |
case 'month':
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1270 |
|
1271 |
|
1272 |
break;
|
1273 |
|
1274 |
case 'year':
|
1275 |
-
|
1276 |
-
|
1277 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1278 |
break;
|
1279 |
|
1280 |
default:
|
726 |
return false;
|
727 |
}
|
728 |
|
729 |
+
//--------------------------------------------
|
730 |
+
/**
|
731 |
+
* Check if index exist or not
|
732 |
+
*
|
733 |
+
* @uses wpdb::query()
|
734 |
+
*
|
735 |
+
* @return boolean
|
736 |
+
*/
|
737 |
+
function ahcfree_check_column_index_exists($table_name, $column_name) {
|
738 |
+
global $wpdb;
|
739 |
+
|
740 |
+
$column = $wpdb->get_row("show index from ".$table_name." where column_name='".$column_name."' ");
|
741 |
+
|
742 |
+
if (!empty($column)) {
|
743 |
+
|
744 |
+
return true;
|
745 |
+
}
|
746 |
+
|
747 |
+
return false;
|
748 |
+
}
|
749 |
+
|
750 |
+
|
751 |
//--------------------------------------------
|
752 |
/**
|
753 |
* Check if Table exist or not
|
761 |
$table_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s", DB_NAME, $table_name));
|
762 |
|
763 |
if (!empty($table_data)) {
|
764 |
+
|
765 |
return true;
|
766 |
}
|
767 |
+
|
768 |
return false;
|
769 |
}
|
770 |
|
804 |
if ( ahcfree_check_table_exists('ahc_recent_visitors') === true && ahcfree_check_table_column_exists('ahc_recent_visitors', 'ahc_region') === false ) {
|
805 |
$sqlQueries[] = "alter table `ahc_recent_visitors` add COLUMN `ahc_region` varchar(230) NULL";
|
806 |
}
|
807 |
+
|
808 |
+
if ( !ahcfree_check_column_index_exists('ahc_visitors', 'vst_date')) {
|
809 |
+
|
810 |
+
$sqlQueries[] = "alter table ahc_visitors add index idx_vst_date(vst_date)";
|
811 |
+
}
|
812 |
|
813 |
foreach ($sqlQueries as $sql) {
|
814 |
if ($wpdb->query($sql) === false) {
|
1273 |
|
1274 |
$sql .= " AND DATE(CONVERT_TZ(vst_date, '" . AHCFREE_SERVER_CURRENT_TIMEZONE . "', '" . $custom_timezone_offset . "')) = '". ahcfree_localtime('Y-m-d') ."'";
|
1275 |
|
|
|
|
|
1276 |
$results = $wpdb->get_results($sql, OBJECT);
|
1277 |
break;
|
1278 |
|
1285 |
case 'week': // last 7 days
|
1286 |
$limits = ahcfree_get_week_limits($date->format('Y-m-d'));
|
1287 |
|
1288 |
+
$custom_timezone_offset = str_ireplace('+','-',$custom_timezone_offset);
|
1289 |
+
|
1290 |
+
$sql .= " AND vst_date >= DATE_FORMAT(CONVERT_TZ('".$limits[0]." 23:59:59','" . AHCFREE_SERVER_CURRENT_TIMEZONE . "', '".$custom_timezone_offset."'),'%Y-%m-%d %H:%i') - INTERVAL 1 DAY
|
1291 |
+
and vst_date < DATE_FORMAT(CONVERT_TZ('".$limits[1]." 00:00:00','" . AHCFREE_SERVER_CURRENT_TIMEZONE . "', '".$custom_timezone_offset."'),'%Y-%m-%d %H:%i') + INTERVAL 1 DAY";
|
1292 |
+
|
1293 |
+
|
1294 |
+
|
1295 |
+
$results = $wpdb->get_results($sql);
|
1296 |
|
1297 |
break;
|
1298 |
|
1299 |
case 'month':
|
1300 |
+
|
1301 |
+
$custom_timezone_offset = str_ireplace('+','-',$custom_timezone_offset);
|
1302 |
+
|
1303 |
+
$sql .= " AND vst_date >= DATE_FORMAT(CONVERT_TZ('".$date->modify('-30 day')->format('Y-m-d')." 23:59:59','" . AHCFREE_SERVER_CURRENT_TIMEZONE . "', '".$custom_timezone_offset."'),'%Y-%m-%d %H:%i') - INTERVAL 1 DAY
|
1304 |
+
and vst_date < DATE_FORMAT(CONVERT_TZ('".$current_date->format('Y-m-d')." 00:00:00','" . AHCFREE_SERVER_CURRENT_TIMEZONE . "', '".$custom_timezone_offset."'),'%Y-%m-%d %H:%i') + INTERVAL 1 DAY";
|
1305 |
+
|
1306 |
+
|
1307 |
+
|
1308 |
+
$results = $wpdb->get_results($sql);
|
1309 |
+
|
1310 |
+
|
1311 |
|
1312 |
|
1313 |
break;
|
1314 |
|
1315 |
case 'year':
|
1316 |
+
|
1317 |
+
|
1318 |
+
$custom_timezone_offset = str_ireplace('+','-',$custom_timezone_offset);
|
1319 |
+
|
1320 |
+
$sql .= " AND vst_date >= DATE_FORMAT(CONVERT_TZ('".$date->modify('-365 day')->format('Y-m-d')." 23:59:59','" . AHCFREE_SERVER_CURRENT_TIMEZONE . "', '".$custom_timezone_offset."'),'%Y-%m-%d %H:%i') - INTERVAL 1 DAY
|
1321 |
+
and vst_date < DATE_FORMAT(CONVERT_TZ('".$current_date->format('Y-m-d')." 00:00:00','" . AHCFREE_SERVER_CURRENT_TIMEZONE . "', '".$custom_timezone_offset."'),'%Y-%m-%d %H:%i') + INTERVAL 1 DAY";
|
1322 |
+
|
1323 |
+
|
1324 |
+
|
1325 |
+
$results = $wpdb->get_results($sql);
|
1326 |
+
|
1327 |
+
|
1328 |
+
|
1329 |
break;
|
1330 |
|
1331 |
default:
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: wp-buy, osamaesh
|
|
3 |
Tags: visitor, traffic, statistics, analytics, stats, online, Visit, WordPress analytics ,visitors online, count visitor, google analytics, analytics, GeoIP, Geo locations, analytics dashboard, visits, chart, browser, blog, today, yesterday, week, month, wp Statistics, year, post, page, sidebar, summary, feedburner, hits, pagerank, google, histats, alexa, live visit, counter, diagram, graph
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.8
|
6 |
-
Stable tag: 3.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -150,6 +150,11 @@ This plugin supports IPv6; however, PHP must be compiled with IPv6 support enabl
|
|
150 |
|
151 |
== Changelog ==
|
152 |
|
|
|
|
|
|
|
|
|
|
|
153 |
= 3.10 =
|
154 |
1. Bug fixes - NOTICE message
|
155 |
|
3 |
Tags: visitor, traffic, statistics, analytics, stats, online, Visit, WordPress analytics ,visitors online, count visitor, google analytics, analytics, GeoIP, Geo locations, analytics dashboard, visits, chart, browser, blog, today, yesterday, week, month, wp Statistics, year, post, page, sidebar, summary, feedburner, hits, pagerank, google, histats, alexa, live visit, counter, diagram, graph
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.8
|
6 |
+
Stable tag: 3.11
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
150 |
|
151 |
== Changelog ==
|
152 |
|
153 |
+
= 3.11 =
|
154 |
+
1. Query improvements reported by @purityboy83 (Thanks purityboy83 for reporting this type of issues)
|
155 |
+
|
156 |
+
|
157 |
+
|
158 |
= 3.10 =
|
159 |
1. Bug fixes - NOTICE message
|
160 |
|